You are here

function commerce_braintree_void_form in Commerce Braintree 7.3

Same name and namespace in other branches
  1. 7.2 includes/commerce_braintree.admin.inc \commerce_braintree_void_form()

Form callback: allows the user to void a transaction.

1 string reference to 'commerce_braintree_void_form'
commerce_braintree_menu in ./commerce_braintree.module
Implements hook_menu().

File

includes/commerce_braintree.admin.inc, line 106
Provides admin forms for commerce_braintree.

Code

function commerce_braintree_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;
  $amount = commerce_currency_format($transaction->amount, $transaction->currency_code);
  $form['markup'] = array(
    '#markup' => '<strong>' . t('Are you sure that you want to void this transaction?') . '</strong>' . '<br /><br />' . t('Voiding a transaction will prevent the customer from being charged @amount and void the transaction record.', array(
      '@amount' => $amount,
    )),
  );
  $form = confirm_form($form, t('Are you sure that you want to void this transaction?'), 'admin/commerce/orders/' . $order->order_id . '/payment', '', t('Void'), t('Cancel'), 'confirm');
  return $form;
}