function commerce_paypal_wpp_capture_access in Commerce PayPal 7
Same name and namespace in other branches
- 7.2 modules/wpp/commerce_paypal_wpp.module \commerce_paypal_wpp_capture_access()
Determines access to the prior authorization capture form for PayPal WPP credit card transactions.
Parameters
$order: The order the transaction is on.
$transaction: The payment transaction object to be captured.
Return value
TRUE or FALSE indicating capture access.
1 string reference to 'commerce_paypal_wpp_capture_access'
- commerce_paypal_wpp_menu in modules/
wpp/ commerce_paypal_wpp.module - Implements hook_menu().
File
- modules/
wpp/ commerce_paypal_wpp.module, line 43 - Implements PayPal Website Payments Pro in Drupal Commerce checkout.
Code
function commerce_paypal_wpp_capture_access($order, $transaction) {
// Return FALSE if the transaction isn't for PayPal or isn't awaiting capture.
if ($transaction->payment_method != 'paypal_wpp' || $transaction->remote_status != 'Authorization') {
return FALSE;
}
// Return FALSE if it is more than 29 days past the original authorization.
if (REQUEST_TIME - $transaction->created > 86400 * 29) {
return FALSE;
}
// Allow access if the user can update payments on this transaction.
return commerce_payment_transaction_access('update', $transaction);
}