Skip to content

Commit

Permalink
Merge pull request mollie#951 from GytisZum/PIPRES-449/mobile-phone-f…
Browse files Browse the repository at this point in the history
…ormat-fix

PIPRES-449: mobile phone fix then field is removed
  • Loading branch information
GytisZum authored Jul 9, 2024
2 parents 0cb9e13 + 9dd7463 commit 3a0c25c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Provider/PhoneNumberProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace Mollie\Provider;

use Address;
use AddressFormat;

if (!defined('_PS_VERSION_')) {
exit;
Expand Down Expand Up @@ -53,6 +54,12 @@ public function getFromAddress(Address $address)

private function getMobileOrPhone(Address $address)
{
return $address->phone_mobile ?: $address->phone;
$addressFormat = new AddressFormat((int) $address->id_country);

if (strpos($addressFormat->format, 'phone_mobile') !== false) {
return $address->phone_mobile ?: $address->phone;
}

return $address->phone;
}
}

0 comments on commit 3a0c25c

Please sign in to comment.