Skip to content

Las Palmas and Tenerife should be represented by Canary Islands in UPS #20222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ abstract class AbstractCarrierOnline extends AbstractCarrier

const GUAM_REGION_CODE = 'GU';

const SPAIN_COUNTRY_ID = 'ES';

const CANARY_ISLANDS_COUNTRY_ID = 'IC';

const SANTA_CRUZ_DE_TENERIFE_REGION_ID = 'Santa Cruz de Tenerife';

const LAS_PALMAS_REGION_ID = 'Las Palmas';

/**
* Array of quotes
*
Expand Down
9 changes: 9 additions & 0 deletions app/code/Magento/Ups/Model/Carrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,14 @@ public function setRequest(RateRequest $request)
$destCountry = self::GUAM_COUNTRY_ID;
}

// For UPS, Las Palmas and Santa Cruz de Tenerife will be represented by Canary Islands country
if ($destCountry === self::SPAIN_COUNTRY_ID &&
($request->getDestRegionCode() === self::LAS_PALMAS_REGION_ID
|| $request->getDestRegionCode() === self::SANTA_CRUZ_DE_TENERIFE_REGION_ID)
) {
$destCountry = self::CANARY_ISLANDS_COUNTRY_ID;
}

$country = $this->_countryFactory->create()->load($destCountry);
$rowRequest->setDestCountry($country->getData('iso2_code') ?: $destCountry);

Expand Down Expand Up @@ -1700,6 +1708,7 @@ public function getCustomizableContainerTypes()

/**
* Get delivery confirmation level based on origin/destination
*
* Return null if delivery confirmation is not acceptable
*
* @param string|null $countyDestination
Expand Down