You are here

public static function PayPalPaymentIPNController::convertStatus in PayPal for Payment 7

Converts a PayPal status to a Payment status.

Parameters

array $ipn_variables:

Return value

string

2 calls to PayPalPaymentIPNController::convertStatus()
PayPalPaymentIPNController::process in paypal_payment_ipn/includes/PayPalPaymentIPNController.inc
Processes an IPN.
PayPalPaymentIPNControllerTest::testConvertStatus in paypal_payment_ipn/tests/PayPalPaymentIPNControllerTest.test
Tests convertStatus().

File

paypal_payment_ipn/includes/PayPalPaymentIPNController.inc, line 273

Class

PayPalPaymentIPNController
Provides IPN functionality.

Code

public static function convertStatus(array $ipn_variables) {
  if (isset($ipn_variables['payment_status'])) {
    $paypal_status = $ipn_variables['payment_status'];
    if ($paypal_status == 'Pending') {
      if (isset($ipn_variables['pending_reason'])) {
        $status_map = self::pendingStatusMap();
        $pending_reason = $ipn_variables['pending_reason'];
        return isset($status_map[$pending_reason]) ? $status_map[$pending_reason] : PAYMENT_STATUS_PENDING;
      }
      return PAYMENT_STATUS_PENDING;
    }
    else {
      $status_map = self::statusMap();
      return isset($status_map[$paypal_status]) ? $status_map[$paypal_status] : PAYMENT_STATUS_UNKNOWN;
    }
  }
  return PAYMENT_STATUS_UNKNOWN;
}