You are here

public function PayPalPaymentECPaymentMethodController::convertStatus in PayPal for Payment 7

Converts a PayPal status to a Payment status.

Parameters

array $nvp_response: A doExpressCheckout response.

Return value

string

1 call to PayPalPaymentECPaymentMethodController::convertStatus()
PayPalPaymentECPaymentMethodController::doExpressCheckoutPayment in paypal_payment_ec/includes/PayPalPaymentECPaymentMethodController.inc
Executes a checkout.

File

paypal_payment_ec/includes/PayPalPaymentECPaymentMethodController.inc, line 343

Class

PayPalPaymentECPaymentMethodController
A PayPal Express Checkout payment method.

Code

public function convertStatus(array $nvp_response) {
  if (isset($nvp_response['PAYMENTINFO_0_PAYMENTSTATUS'])) {
    $paypal_status = $nvp_response['PAYMENTINFO_0_PAYMENTSTATUS'];
    if ($paypal_status == 'Pending' && isset($nvp_response['PAYMENTINFO_0_PENDINGREASON'])) {
      $status_map = PayPalPaymentIPNController::pendingStatusMap();
      $pending_reason = $nvp_response['PAYMENTINFO_0_PENDINGREASON'];
      return isset($status_map[$pending_reason]) ? $status_map[$pending_reason] : PAYMENT_STATUS_PENDING;
    }
    else {
      $status_map = $this
        ->statusMap();
      return isset($status_map[$paypal_status]) ? $status_map[$paypal_status] : PAYMENT_STATUS_UNKNOWN;
    }
  }
  return PAYMENT_STATUS_UNKNOWN;
}