You are here

protected function ExpressCheckout::getStatusMapping in Commerce PayPal 8

Returns a mapping of PayPal payment statuses to payment states.

Parameters

string $status: (optional) The PayPal payment status.

Return value

array|string An array containing the PayPal remote statuses as well as their corresponding states. if $status is specified, the corresponding state is returned.

2 calls to ExpressCheckout::getStatusMapping()
ExpressCheckout::onNotify in src/Plugin/Commerce/PaymentGateway/ExpressCheckout.php
Processes the notification request.
ExpressCheckout::onReturn in src/Plugin/Commerce/PaymentGateway/ExpressCheckout.php
Processes the "return" request.

File

src/Plugin/Commerce/PaymentGateway/ExpressCheckout.php, line 820

Class

ExpressCheckout
Provides the Paypal Express Checkout payment gateway.

Namespace

Drupal\commerce_paypal\Plugin\Commerce\PaymentGateway

Code

protected function getStatusMapping($status = NULL) {
  $mapping = [
    'Voided' => 'authorization_voided',
    'Pending' => 'authorization',
    'Processed' => 'completed',
    'Completed' => 'completed',
    'Refunded' => 'refunded',
    'Partially-Refunded' => 'partially_refunded',
    'Expired' => 'authorization_expired',
  ];

  // If a status was passed, return its corresponding payment state.
  if (isset($status) && isset($mapping[$status])) {
    return $mapping[$status];
  }
  return $mapping;
}