function commerce_stripe_pi_capture_access in Commerce Stripe Payment Intent 7
Access callback for processing capture.
Parameters
object $order: The commerce order entity.
object $transaction: The commerce payment transaction entity.
Return value
bool Return TRUE if the user can update the transaction.
1 string reference to 'commerce_stripe_pi_capture_access'
- commerce_stripe_pi_menu in ./
commerce_stripe_pi.module - Implements hook_menu().
File
- ./
commerce_stripe_pi.module, line 2158 - Payment intent stripe payment integration.
Code
function commerce_stripe_pi_capture_access($order, $transaction) {
// Return FALSE if the transaction isn't for Commerce Stripe or isn't
// awaiting capture. This is detected by the AUTH_ONLY status.
if ($transaction->payment_method !== 'commerce_stripe_pi' || empty($transaction->remote_id) || strtoupper($transaction->remote_status) !== 'AUTH_ONLY') {
return FALSE;
}
// Return FALSE if it is more than 7 days past the original authorization.
// Stripe does not allow capture after this time.
if (time() - $transaction->created > 86400 * 7) {
return FALSE;
}
// Allow access if the user can update this transaction.
return commerce_payment_transaction_access('update', $transaction);
}