Add setting option to enable/disable name on card field

This commit is contained in:
Emili Castells Guasch 2024-05-01 15:33:23 +02:00
parent c76872d9d1
commit c80f58abcf
3 changed files with 20 additions and 3 deletions

View file

@ -152,6 +152,19 @@ return array(
'gateway' => array( 'dcc', 'axo' ),
'requirements' => array( 'axo' ),
),
'axo_name_on_card' => array(
'title' => __( 'Display "Name on Card" field', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'default' => 'yes',
'classes' => array( 'ppcp-field-indent' ),
'class' => array(),
'label' => __( 'Enable "Name on Card" field', 'woocommerce-paypal-payments' ),
'desc_tip' => true,
'description' => __( 'Enable to display the "Name on Card" field for new Fastlane buyers.', 'woocommerce-paypal-payments' ),
'screens' => array( State::STATE_ONBOARDED ),
'gateway' => array( 'dcc', 'axo' ),
'requirements' => array( 'axo' ),
),
'axo_style_heading' => array(
'heading' => __( 'Advanced Style Settings (optional)', 'woocommerce-paypal-payments' ),
'heading_html' => sprintf(

View file

@ -639,10 +639,13 @@ class AxoManager {
}
cardComponentData() {
let fields = {};
if(this.axoConfig.name_on_card === '1') {
fields.cardholderName = {};
}
return {
fields: {
cardholderName: {} // optionally pass this to show the card holder name
},
fields: fields,
styles: this.remove_keys_with_empty_string(this.axoConfig.style_options)
}
}

View file

@ -190,6 +190,7 @@ class AxoManager {
'focusBorderColor' => $this->settings->has( 'axo_style_input_focus_border_color' ) ? $this->settings->get( 'axo_style_input_focus_border_color' ) : '',
),
),
'name_on_card' => $this->settings->has( 'axo_name_on_card' ) ? $this->settings->get( 'axo_name_on_card' ) : '',
);
}