You are here

function commerce_amex_void_form in Commerce American Express Payment Gateway (Amex) 7

Form callback: allows the user to capture a prior authorization.

1 string reference to 'commerce_amex_void_form'
commerce_amex_menu in ./commerce_amex.module
Implements hook_menu

File

includes/commerce_amex.admin.inc, line 96
Administrative forms for the Amex module.

Code

function commerce_amex_void_form($form, &$form_state, $order, $transaction) {
  $form_state['order'] = $order;
  $form_state['transaction'] = $transaction;

  // Load and store the payment method instance for this transaction.
  $payment_method = commerce_payment_method_instance_load($transaction->instance_id);
  $form_state['payment_method'] = $payment_method;
  $balance = commerce_payment_order_balance($order);
  $description = implode('<br />', array(
    t('Authorization: @amount', array(
      '@amount' => commerce_currency_format($transaction->amount, $transaction->currency_code),
    )),
    t('Order balance: @balance', array(
      '@balance' => commerce_currency_format($balance['amount'], $balance['currency_code']),
    )),
  ));
  $form = confirm_form($form, t('Do you want to VOID this transaction'), 'admin/commerce/orders/' . $order->order_id . '/payment', '', t('Void '), t('Cancel'), 'confirm');
  return $form;
}