Introduce unit test for CheckoutPayPalAddressPreset PCP-28

This commit is contained in:
David Naber 2020-08-17 18:03:32 +02:00
parent ebb78afe8c
commit 781760a82c
2 changed files with 183 additions and 1 deletions

View file

@ -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;
}