You are here

function commerce_stripe_pi_void_access in Commerce Stripe Payment Intent 7

Access callback for voiding transactions.

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_void_access'
commerce_stripe_pi_menu in ./commerce_stripe_pi.module
Implements hook_menu().

File

./commerce_stripe_pi.module, line 2187
Payment intent stripe payment integration.

Code

function commerce_stripe_pi_void_access($order, $transaction) {

  // Only auth_only transactions can be voided.
  if ($transaction->payment_method !== 'commerce_stripe_pi' || empty($transaction->remote_id) || strtoupper($transaction->remote_status) !== 'AUTH_ONLY') {
    return FALSE;
  }

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