You are here

function commerce_sermepa_get_payment_transaction in Commerce sermepa 7

Get transaction with a specific Sermepa Ds_AuthorisationCode.

Parameters

string $authorisation_code: The authorisation code received from Sermepa regarding the payment.

1 call to commerce_sermepa_get_payment_transaction()
commerce_sermepa_process_transaction in ./commerce_sermepa.module
Save the payment transaction for the order.

File

./commerce_sermepa.module, line 510
Provides a payment method for Drupal Commerce using Sermepa/Redsys gateway.

Code

function commerce_sermepa_get_payment_transaction($authorisation_code) {
  $query = new EntityFieldQuery();
  $result = $query
    ->entityCondition('entity_type', 'commerce_payment_transaction')
    ->propertyCondition('payment_method', 'commerce_sermepa')
    ->propertyCondition('remote_id', $authorisation_code)
    ->execute();
  if (!empty($result['commerce_payment_transaction']) && count($result['commerce_payment_transaction']) > 0) {
    $transaction = array_pop($result['commerce_payment_transaction']);
    return $transaction->transaction_id;
  }
  return FALSE;
}