You are here

function uc_authorizenet_arb_user_update_form_submit in Ubercart 6.2

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

File

payment/uc_authorizenet/uc_authorizenet.pages.inc, line 124
Includes page callbacks for Authorize.Net's Silent POST feature and user specific recurring fee operation pages.

Code

function uc_authorizenet_arb_user_update_form_submit($form, &$form_state) {
  $fee = uc_recurring_fee_load('user', $form_state['values']['rfid']);
  $updates = array(
    'payment' => array(
      'creditCard' => array(
        'cardNumber' => $form_state['values']['cc_data']['cc_number'],
        'expirationDate' => $form_state['values']['cc_data']['cc_exp_year'] . '-' . $form_state['values']['cc_data']['cc_exp_month'],
      ),
    ),
  );
  $result = uc_authorizenet_arb_update($fee['data'], $updates, $fee['order_id']);

  // If the update was successful...
  if ($result) {
    drupal_set_message(t('The payment details for that recurring fee have been updated.'));
  }
  else {
    drupal_set_message(t('An error has occurred while updating your payment details. Please try again and contact us if you are unable to perform the update.'), 'error');
  }
  $form_state['redirect'] = 'user/' . $form_state['values']['uid'];
}