You are here

function commerce_payleap_capture_access in Commerce Payleap 7

1 string reference to 'commerce_payleap_capture_access'
commerce_payleap_menu in ./commerce_payleap.module
Implements hook_menu().

File

./commerce_payleap.module, line 62
Implements PayLeap payment services for use in Drupal Commerce.

Code

function commerce_payleap_capture_access($order, $transaction) {

  // Return FALSE if the transaction isn't for PayLeap or isn't awaiting capture.
  if ($transaction->payment_method != PAYLEAP_TXN_TYPE_DELAYED_CAPTURE || $transaction->remote_status == 'Fail' || $transaction->status != COMMERCE_PAYMENT_STATUS_PENDING) {
    return FALSE;
  }

  // TODO: Check if this is relevant to PayLeap.
  // Return FALSE if it is more than 30 days past the original authorization.
  if (time() - $transaction->created > 86400 * 30) {
    return FALSE;
  }

  // Allow access if the user can update payments on this transaction.
  return commerce_payment_transaction_access('update', $transaction);
}