function uc_recurring_hosted_authorizenet_arb_update_form_submit in UC Recurring Payments and Subscriptions 6.2
Same name and namespace in other branches
- 7.2 modules/uc_recurring_hosted/uc_recurring_hosted.module \uc_recurring_hosted_authorizenet_arb_update_form_submit()
Implements update form submit for the authorizenet ARB gateway.
File
- modules/
uc_recurring_hosted/ uc_recurring_hosted.module, line 513 - Provides hosted gateway specific code for recurring payments, specifically Authorize.net ARB and Paypal WPS
Code
function uc_recurring_hosted_authorizenet_arb_update_form_submit(&$form, &$form_state) {
$fee = uc_recurring_fee_user_load($form_state['values']['rfid']);
$order = uc_order_load($fee->order_id);
$order->payment_details = $form_state['values']['cc_data'];
$subscription_id = end(array_keys($order->data['cc_txns']['references']));
if ($order->payment_details['cc_exp_month'] < 10) {
$order->payment_details['cc_exp_month'] = '0' . $order->payment_details['cc_exp_month'];
}
// Build the data array for the request.
$updates = array(
'payment' => array(
'creditCard' => array(
'cardNumber' => $order->payment_details['cc_number'],
'expirationDate' => $order->payment_details['cc_exp_year'] . '-' . $order->payment_details['cc_exp_month'],
),
),
);
if (uc_authorizenet_arb_update($subscription_id, $updates, $order->order_id)) {
drupal_set_message(t('Account updated.'));
$form_state['redirect'] = 'user/' . $form_state['values']['uid'];
}
else {
drupal_set_message(t('Account update failed.'), 'error');
}
}