Skip to content

Commit

Permalink
PIPRES-449: mobile phone fix then field is removed
Browse files Browse the repository at this point in the history
  • Loading branch information
GytisZum committed Jul 8, 2024
1 parent 0cb9e13 commit d788296
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Provider/PhoneNumberProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
namespace Mollie\Provider;

use Address;
use AddressFormat;
use Country;

if (!defined('_PS_VERSION_')) {
exit;
Expand Down Expand Up @@ -53,6 +55,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 d788296

Please sign in to comment.