mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Introduce unit test for CheckoutPayPalAddressPreset PCP-28
This commit is contained in:
parent
ebb78afe8c
commit
781760a82c
2 changed files with 183 additions and 1 deletions
|
@ -72,7 +72,9 @@ class CheckoutPayPalAddressPreset
|
|||
];
|
||||
$payerMap = [
|
||||
'billing_email' => 'emailAddress',
|
||||
'billing_phone' => 'phone',
|
||||
];
|
||||
$payerPhoneMap = [
|
||||
'billing_phone' => 'nationalNumber',
|
||||
];
|
||||
|
||||
if(array_key_exists($fieldId, $addressMap) && $shipping) {
|
||||
|
@ -87,6 +89,10 @@ class CheckoutPayPalAddressPreset
|
|||
return $payer->{$payerMap[$fieldId]}() ?: null;
|
||||
}
|
||||
|
||||
if(array_key_exists($fieldId, $payerPhoneMap) && $payer && $payer->phone() && $payer->phone()->phone()) {
|
||||
return $payer->phone()->phone()->{$payerPhoneMap[$fieldId]}() ?: null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue