You are here

function _commerce_amex_error_process in Commerce American Express Payment Gateway (Amex) 7

10 calls to _commerce_amex_error_process()
commerce_amex_3d_secure_callback in ./commerce_amex.module
Process callback response from merchant server
commerce_amex_3d_secure_check in ./commerce_amex.module
Check if the card is registered for 3D Secure and redirect if required
commerce_amex_capture_transaction in ./commerce_amex.module
Capture an autorised payment.
commerce_amex_cardonfile_charge in ./commerce_amex.module
Card on file callback: background charge payment
commerce_amex_cardonfile_save in ./commerce_amex.module
Request a token from Amex for a session and save the Card of File entity.

... See full list

File

./commerce_amex.module, line 1890
Implements American Express payment gateway for use in Drupal Commerce.

Code

function _commerce_amex_error_process($result, $transaction) {
  if (isset($result->error)) {
    $transaction->remote_status = $result->error->cause;
    switch ($transaction->remote_status) {
      case 'INVALID_REQUEST':
      case 'SERVER_BUSY':
        $transaction->message = $result->error->explanation;
        break;
      case 'REQUEST_REJECTED':
        $transaction->message = 'Request rejected: Code ' . $result->error->supportCode;
        break;
      case 'SERVER_FAILED':
        $transaction->message = 'Remote server error.';
        break;
    }
    commerce_payment_transaction_save($transaction);
  }
  return $transaction;
}