You are here

function commerce_braintree_refund_access in Commerce Braintree 7.2

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

Access callback for refunding orders.

1 string reference to 'commerce_braintree_refund_access'
commerce_braintree_menu in ./commerce_braintree.module
Implements hook_menu().

File

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

Code

function commerce_braintree_refund_access($order, $transaction) {

  // Return FALSE if the transaction isn't for a Braintree method, doesn't have
  // a success status or has an amount of 0 or less.
  if (!in_array($transaction->payment_method, array(
    'braintree_tr',
    'braintree_dropin',
    'braintree_hostedfields',
  )) || $transaction->status != COMMERCE_PAYMENT_STATUS_SUCCESS || $transaction->amount <= 0) {
    return FALSE;
  }

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