You are here

function commerce_braintree_get_payment_transaction in Commerce Braintree 7.2

Same name and namespace in other branches
  1. 7.3 commerce_braintree.module \commerce_braintree_get_payment_transaction()
  2. 7 commerce_braintree.module \commerce_braintree_get_payment_transaction()

Get transaction with a specific Braintree ID.

1 call to commerce_braintree_get_payment_transaction()
_commerce_braintree_default_process_transaction in ./commerce_braintree.module
Process the actual Braintree transaction.

File

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

Code

function commerce_braintree_get_payment_transaction($feedback_remote_id) {
  $query = new EntityFieldQuery();
  $result = $query
    ->entityCondition('entity_type', 'commerce_payment_transaction')
    ->propertyCondition('payment_method', 'braintree')
    ->propertyCondition('remote_id', $feedback_remote_id)
    ->execute();
  if (isset($result['commerce_payment_transaction']) && count($result['commerce_payment_transaction']) > 0) {
    $transaction = array_pop($result['commerce_payment_transaction']);
    return $transaction->transaction_id;
  }
  return FALSE;
}