You are here

function uc_authorizenet_arb_admin_cancel_form_submit in Ubercart 6.2

Same name and namespace in other branches
  1. 5 payment/uc_authorizenet/uc_authorizenet.module \uc_authorizenet_arb_admin_cancel_form_submit()

File

payment/uc_authorizenet/uc_authorizenet.admin.inc, line 77
Includes page callbacks for administrative recurring fee operation pages.

Code

function uc_authorizenet_arb_admin_cancel_form_submit($form, &$form_state) {
  $fee = uc_recurring_fee_load('user', $form_state['values']['rfid']);
  $result = uc_authorizenet_arb_cancel($fee['data'], $fee['order_id'], $fee);

  // If the cancellation was successful...
  if ($result) {
    drupal_set_message(t('Subscription cancelled through Authorize.Net.'));

    // Set the fee's recurring charges to 0.
    uc_recurring_fee_cancel($fee['rfid']);
  }
  else {
    drupal_set_message(t('Subscription cancellation failed. See order admin comments for more details.'), 'error');
  }
  $form_state['redirect'] = 'admin/store/orders/recurring';
}