Skip to content

Commit

Permalink
refs #49267 the alias list for PrestaShop iso country codes
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan202 committed Dec 18, 2024
1 parent 82dbadb commit b2be5cf
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions services/TrackingParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Configuration;
use Country;
use Exception;
use PaypalAddons\classes\Constants\CountryIsoAlias;
use PaypalAddons\classes\Constants\TrackingParameters as Map;
use PrestaShopLogger;
use Throwable;
Expand Down Expand Up @@ -64,19 +65,24 @@ public function getPaypalCarriersByCountry($isoCountry = null)
$carriers = [
[
'key' => Map::CARRIER_OTHER,
'name' => Map::CARRIER_OTHER,
'name' => Map::CARRIER_OTHER,
],
];
$isoAliasList = CountryIsoAlias::getAliasList();

if ($isoCountry === null) {
$isoCountry = $this->defaultCountry->iso_code;
if (empty($this->paypalCarriers[$isoCountry])) {
if (empty($isoAliasList[$isoCountry]) || empty($this->paypalCarriers[$isoAliasList[$isoCountry]])) {
return $carriers;
}

$isoCountry = $isoAliasList[$isoCountry];
}

if (empty($this->paypalCarriers[strtoupper($isoCountry)])) {
return $carriers;
}

return array_merge($carriers, $this->paypalCarriers[strtoupper($isoCountry)]);
return array_merge($carriers, $this->paypalCarriers[$isoCountry]);
}

public function getPaypalCarrierByPsCarrier($carrierRef)
Expand Down

0 comments on commit b2be5cf

Please sign in to comment.