function uc_recurring_hosted_paypal_wpp_update_form in UC Recurring Payments and Subscriptions 7.2
Same name and namespace in other branches
- 6.2 modules/uc_recurring_hosted/uc_recurring_hosted.module \uc_recurring_hosted_paypal_wpp_update_form()
Form for updating the user credit card information
Parameters
unknown_type $form_state:
unknown_type $rfid:
Return value
unknown_type
1 string reference to 'uc_recurring_hosted_paypal_wpp_update_form'
- uc_recurring_hosted_recurring_info in modules/
uc_recurring_hosted/ uc_recurring_hosted.module - Implements hook_recurring_info().
File
- modules/
uc_recurring_hosted/ uc_recurring_hosted.module, line 1018 - Provides hosted gateway specific code for recurring payments, specifically Authorize.net ARB and Paypal WPS
Code
function uc_recurring_hosted_paypal_wpp_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'] += uc_payment_method_credit_form(array(), $order);
unset($form['cc_data']['cc_policy']);
$form['billing_data'] = array(
'#type' => 'fieldset',
'#title' => t('Billing Address Details'),
);
if (uc_address_field_enabled('first_name')) {
$form['billing_data']['billing_first_name'] = uc_textfield(uc_get_field_name('first_name'), $order->billing_first_name, uc_address_field_required('first_name'));
}
if (uc_address_field_enabled('last_name')) {
$form['billing_data']['billing_last_name'] = uc_textfield(uc_get_field_name('last_name'), $order->billing_last_name, uc_address_field_required('last_name'));
}
if (uc_address_field_enabled('company')) {
$form['billing_data']['billing_company'] = uc_textfield(uc_get_field_name('company'), $order->billing_company, uc_address_field_required('company'), NULL, 64);
}
if (uc_address_field_enabled('street1')) {
$form['billing_data']['billing_street1'] = uc_textfield(uc_get_field_name('street1'), $order->billing_street1, uc_address_field_required('street1'), NULL, 64);
}
if (uc_address_field_enabled('street2')) {
$form['billing_data']['billing_street2'] = uc_textfield(uc_get_field_name('street2'), $order->billing_street2, uc_address_field_required('street2'), NULL, 64);
}
if (uc_address_field_enabled('city')) {
$form['billing_data']['billing_city'] = uc_textfield(uc_get_field_name('city'), $order->billing_city, uc_address_field_required('city'));
}
if (uc_address_field_enabled('country')) {
$form['billing_data']['billing_country'] = uc_country_select(uc_get_field_name('country'), $order->billing_country, NULL, 'name', uc_address_field_required('country'));
}
if (uc_address_field_enabled('zone')) {
if (isset($_POST['panes']['billing']['billing_country'])) {
$country_id = intval($_POST['panes']['billing']['billing_country']);
}
else {
$country_id = $order->billing_country;
}
$form['billing_data']['billing_zone'] = uc_zone_select(uc_get_field_name('zone'), $order->billing_zone, NULL, $country_id, 'name', uc_address_field_required('zone'));
if (isset($_POST['panes']) && count($contents['billing_zone']['#options']) == 1) {
$form['billing_data']['billing_zone']['#required'] = FALSE;
}
}
if (uc_address_field_enabled('postal_code')) {
$form['billing_data']['billing_postal_code'] = uc_textfield(uc_get_field_name('postal_code'), $order->billing_postal_code, uc_address_field_required('postal_code'), NULL, 10, 10);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Update Account'),
'#suffix' => l(t('Cancel'), 'user/' . $order->uid . '/recurring-fees'),
);
return $form;
}