You are here

function commerce_authnet_aim_void_access in Commerce Authorize.Net 7

Determines access to the void form for Authorize.Net AIM credit card transactions

Parameters

$order: The order the transaction is on.

$transaction: The payment transaction object to be voided.

Return value

TRUE or FALSE indicating void access.

1 string reference to 'commerce_authnet_aim_void_access'
commerce_authnet_menu in ./commerce_authnet.module
Implements hook_menu().

File

./commerce_authnet.module, line 138
Implements Authorize.Net payment services for use in Drupal Commerce.

Code

function commerce_authnet_aim_void_access($order, $transaction) {
  if (!in_array($transaction->payment_method, array(
    'authnet_aim',
    'authnet_acceptjs',
  )) || empty($transaction->remote_id) || !in_array(strtoupper($transaction->remote_status), array(
    'AUTH_ONLY',
    'PRIOR_AUTH_CAPTURE',
    'AUTH_CAPTURE',
  ))) {
    return FALSE;
  }

  // Return FALSE if it is more than 24 hours since the last update to the
  // transaction, as it will already have been settled.
  if (time() - $transaction->changed > 3600 * 24) {
    return FALSE;
  }

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