You are here

function commerce_braintree_transaction_status in Commerce Braintree 7.2

Same name and namespace in other branches
  1. 7.3 commerce_braintree.module \commerce_braintree_transaction_status()

Decides the appropriate commerce payment transaction status.

Parameters

$remote_status string: The status string returned from Braintree.

Return value

string The appropriate commerce_payment_transaction status property.

2 calls to commerce_braintree_transaction_status()
commerce_braintree_js_process_transaction in ./commerce_braintree.module
Save a commerce_payment_transaction object from the Braintree API response.
_commerce_braintree_default_process_transaction in ./commerce_braintree.module
Process the actual Braintree transaction.

File

./commerce_braintree.module, line 1168
Integrates Braintree Transparent Redirect with Drupal Commerce.

Code

function commerce_braintree_transaction_status($remote_status) {
  $status = COMMERCE_PAYMENT_STATUS_FAILURE;
  switch ($remote_status) {
    case 'authorized':
    case 'authorizing':
      $status = COMMERCE_PAYMENT_STATUS_PENDING;
      break;
    case 'submitted_for_settlement':
    case 'settled':
    case 'settling':
    case 'settlement_confirmed':
    case 'settlement_pending':
      $status = COMMERCE_PAYMENT_STATUS_SUCCESS;
      break;
  }
  return $status;
}