mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
adjust phone handling in payerData
This commit is contained in:
parent
1f297b3add
commit
0e93df755b
1 changed files with 13 additions and 8 deletions
|
@ -4,8 +4,14 @@ export const payerData = () => {
|
|||
return null;
|
||||
}
|
||||
|
||||
const phone = (typeof payer.phone !== 'undefined') ? payer.phone.phone_number.national_number : '';
|
||||
return {
|
||||
const phone = (document.querySelector('#billing_phone') || typeof payer.phone !== 'undefined') ?
|
||||
{
|
||||
phone_type:"HOME",
|
||||
phone_number:{
|
||||
national_number : (document.querySelector('#billing_phone')) ? document.querySelector('#billing_phone').value : payer.phone.phone_number.national_number
|
||||
}
|
||||
} : null;
|
||||
const payerData = {
|
||||
email_address:(document.querySelector('#billing_email')) ? document.querySelector('#billing_email').value : payer.email_address,
|
||||
name : {
|
||||
surname: (document.querySelector('#billing_last_name')) ? document.querySelector('#billing_last_name').value : payer.name.surname,
|
||||
|
@ -18,12 +24,11 @@ export const payerData = () => {
|
|||
admin_area_1 : (document.querySelector('#billing_city')) ? document.querySelector('#billing_city').value : payer.address.admin_area_1,
|
||||
admin_area_2 : (document.querySelector('#billing_state')) ? document.querySelector('#billing_state').value : payer.address.admin_area_2,
|
||||
postal_code : (document.querySelector('#billing_postcode')) ? document.querySelector('#billing_postcode').value : payer.address.postal_code
|
||||
},
|
||||
phone : {
|
||||
phone_type:"HOME",
|
||||
phone_number:{
|
||||
national_number : (document.querySelector('#billing_phone')) ? document.querySelector('#billing_phone').value : phone
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (phone) {
|
||||
payerData.phone = phone;
|
||||
}
|
||||
return payerData;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue