mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Ensure sending billing phone number if it exist in shipping address
This commit is contained in:
parent
e886b0027c
commit
404095423b
2 changed files with 17 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue