function commerce_braintree_settle_access in Commerce Braintree 7.2
Same name and namespace in other branches
- 7.3 commerce_braintree.module \commerce_braintree_settle_access()
Access callback for submitting transactions for settlement.
1 string reference to 'commerce_braintree_settle_access'
- commerce_braintree_menu in ./
commerce_braintree.module - Implements hook_menu().
File
- ./
commerce_braintree.module, line 90 - Integrates Braintree Transparent Redirect with Drupal Commerce.
Code
function commerce_braintree_settle_access($order, $transaction) {
// Make sure this is a valid and authorized Braintree payment transaction.
if (!in_array($transaction->payment_method, array(
'braintree_tr',
'braintree_dropin',
'braintree_hostedfields',
)) || empty($transaction->remote_id) || !in_array($transaction->remote_status, array(
'authorized',
))) {
return FALSE;
}
// Visa and MC expire in 10 days. All others expire in 30.
// Make sure this transaction is less than 30 days old.
if (time() - $transaction->created > 86400 * 30) {
return FALSE;
}
// Allow access if the user can update this transaction.
return commerce_payment_transaction_access('update', $transaction);
}