mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Fixes AXO module
This commit is contained in:
parent
c71c56973a
commit
995621ba21
8 changed files with 138 additions and 58 deletions
|
@ -6,7 +6,7 @@ class CardView {
|
|||
this.el = elements;
|
||||
this.manager = manager;
|
||||
|
||||
this.cardFormFields = new FormFieldGroup({
|
||||
this.group = new FormFieldGroup({
|
||||
baseSelector: '.ppcp-axo-payment-container',
|
||||
contentSelector: selector,
|
||||
template: (data) => {
|
||||
|
@ -76,19 +76,37 @@ class CardView {
|
|||
}
|
||||
|
||||
activate() {
|
||||
this.cardFormFields.activate();
|
||||
this.group.activate();
|
||||
}
|
||||
|
||||
deactivate() {
|
||||
this.cardFormFields.deactivate();
|
||||
this.group.deactivate();
|
||||
}
|
||||
|
||||
refresh() {
|
||||
this.cardFormFields.refresh();
|
||||
this.group.refresh();
|
||||
}
|
||||
|
||||
setData(data) {
|
||||
this.cardFormFields.setData(data);
|
||||
this.group.setData(data);
|
||||
}
|
||||
|
||||
copyDataToForm() {
|
||||
const name = this.group.dataValue('name');
|
||||
const { firstName, lastName } = this.splitName(name);
|
||||
|
||||
jQuery('#billing_first_name').val(firstName);
|
||||
jQuery('#billing_last_name').val(lastName);
|
||||
|
||||
return this.group.copyDataToForm();
|
||||
}
|
||||
|
||||
splitName(fullName) {
|
||||
let nameParts = fullName.trim().split(' ');
|
||||
let firstName = nameParts[0];
|
||||
let lastName = nameParts.length > 1 ? nameParts[nameParts.length - 1] : '';
|
||||
|
||||
return { firstName, lastName };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue