function uc_recurring_cybersource_update_form in UC Recurring Payments and Subscriptions 6.2
Same name and namespace in other branches
- 7.2 includes/uc_recurring.uc_cybersource.inc \uc_recurring_cybersource_update_form()
Create form for updating credit card details for recurring fee.
1 string reference to 'uc_recurring_cybersource_update_form'
- uc_recurring_uc_cybersource_recurring_info in includes/
uc_recurring.uc_cybersource.inc - Implements hook_recurring_info().
File
- includes/
uc_recurring.uc_cybersource.inc, line 90 - Uc recurring implementation for the CyberSource module.
Code
function uc_recurring_cybersource_update_form($form_state, $rfid) {
// Load fee.
$fee = uc_recurring_fee_user_load($rfid);
// Load corresponding order.
$order = uc_order_load($fee->order_id);
$form['rfid'] = array(
'#type' => 'value',
'#value' => $rfid,
);
$form['cc_data'] = array(
'#type' => 'fieldset',
'#title' => t('Credit card details'),
'#theme' => 'uc_payment_method_credit_form',
'#tree' => TRUE,
);
$form['cc_data'] = array_merge($form['cc_data'], uc_payment_method_credit_form($form_state, $order));
unset($form['cc_data']['cc_policy']);
// Make credit card info form items required
$form['cc_data']['cc_owner']['#required'] = TRUE;
$form['cc_data']['cc_number']['#required'] = TRUE;
$form['cc_data']['cc_exp_month']['#required'] = TRUE;
$form['cc_data']['cc_exp_year']['#required'] = TRUE;
$form['cc_data']['cc_cvv']['#required'] = TRUE;
// Add billing address form
if ($billing_items = uc_order_pane_bill_to('edit-form', $order)) {
$form = array_merge($form, $billing_items);
$form['bill_to']['#title'] = t('Billing address');
$form['bill_to']['#description'] = t('Credit card information must be provided to update billing address.');
$form['bill_to']['#collapsible'] = FALSE;
$form['bill_to']['#theme'] = 'uc_recurring_cybersource_billto_form';
// Make billing info form items required
$form['bill_to']['billing_first_name']['#required'] = TRUE;
$form['bill_to']['billing_last_name']['#required'] = TRUE;
$form['bill_to']['billing_street1']['#required'] = TRUE;
$form['bill_to']['billing_city']['#required'] = TRUE;
$form['bill_to']['billing_country']['#required'] = TRUE;
$form['bill_to']['billing_postal_code']['#required'] = TRUE;
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
'#suffix' => l(t('Cancel'), 'admin/store/orders/recurring/view/fee/' . $rfid),
);
return $form;
}