Ensure sending billing phone number if it exist in shipping address

This commit is contained in:
Emili Castells Guasch 2024-05-06 14:03:44 +02:00
parent e886b0027c
commit 404095423b
2 changed files with 17 additions and 1 deletions

View file

@ -626,6 +626,8 @@ class AxoManager {
this.shippingView.toSubmitData(data);
this.cardView.toSubmitData(data);
this.ensureBillingPhoneNumber(data);
this.submit(this.data.card.id, data);
} else { // Gary flow
@ -771,6 +773,20 @@ class AxoManager {
return Array.isArray(obj) ? obj.filter(val => val) : obj;
}
ensureBillingPhoneNumber(data) {
if (data.billing_phone === '') {
let phone = '';
const cc = this.data?.shipping?.phoneNumber?.countryCode;
const number = this.data?.shipping?.phoneNumber?.nationalNumber;
if (cc) {
phone = `+${cc} `;
}
phone += number;
data.billing_phone = phone;
}
}
}
export default AxoManager;