Skip to content
Snippets Groups Projects
Commit 41aeb297 authored by Joe 🤘 Shindelar's avatar Joe 🤘 Shindelar
Browse files

Fix for broken address requirement setting for Recurly JS checkout form. Adds...

Fix for broken address requirement setting for Recurly JS checkout form. Adds the missing VAT number setting that's present in older versions of the module but not this one.
parent 5deb09b1
No related branches found
No related tags found
No related merge requests found
......@@ -8,5 +8,7 @@ recurlyjs.settings:
type: string
recurlyjs_enable_coupons:
type: string
recurlyjs_hide_vat_number:
type: string
recurlyjs_accept_paypal:
type: string
......@@ -86,7 +86,7 @@ function _recurlyjs_form_recurly_settings_form_alter(&$form, FormStateInterface
'zip' => t('Zip code only'),
'none' => t('None'),
],
'#default_value' => \Drupal::config('recurlyjs.settings')->get('address_requirement') ?: 'full',
'#default_value' => \Drupal::config('recurlyjs.settings')->get('recurlyjs_address_requirement') ?: 'full',
'#description' => t('Choose the level of address information required. Collecting more address information reduces the probability of fraudulent accounts. This setting should match the address requirements as configured on @link in "Site Settings".',
[
'@link' => $recurly_account_link,
......@@ -107,6 +107,13 @@ function _recurlyjs_form_recurly_settings_form_alter(&$form, FormStateInterface
'#description' => t('Display the <em>Coupon Code</em> field on Recurly.js subscription forms.'),
];
$form['recurlyjs']['recurlyjs_hide_vat_number'] = [
'#title' => t('Hide VAT number input box from checkout page'),
'#type' => 'checkbox',
'#default_value' => \Drupal::config('recurlyjs.settings')->get('recurlyjs_hide_vat_number') ?: 0,
'#description' => t('VAT numbers are mostly used in the EU and not often in the US.'),
];
$form['recurlyjs']['recurlyjs_accept_paypal'] = [
'#title' => t('Enable PayPal'),
'#type' => 'checkbox',
......@@ -127,6 +134,7 @@ function recurlyjs_settings_form_submit(array &$form, FormStateInterface $form_s
->set('recurlyjs_address_requirement', $form_state->getValue('recurlyjs_address_requirement'))
->set('recurlyjs_enable_add_ons', $form_state->getValue('recurlyjs_enable_add_ons'))
->set('recurlyjs_enable_coupons', $form_state->getValue('recurlyjs_enable_coupons'))
->set('recurlyjs_hide_vat_number', $form_state->getValue('recurlyjs_hide_vat_number'))
->set('recurlyjs_accept_paypal', $form_state->getValue('recurlyjs_accept_paypal'))
->save();
}
......
......@@ -189,8 +189,8 @@ abstract class RecurlyJsFormBase extends FormBase {
'#suffix' => '</div>',
];
$address_requirement = \Drupal::state()->get('recurlyjs_address_requirement', 'full');
$hide_vat_number = \Drupal::state()->get('recurlyjs_hide_vat_number', 0);
$address_requirement = \Drupal::config('recurlyjs.settings')->get('recurlyjs_address_requirement') ?: 'full';
$hide_vat_number = \Drupal::config('recurlyjs.settings')->get('recurlyjs_hide_vat_number') ?: 0;
if (in_array($address_requirement, [
'zipstreet',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment