Commercial destination should not be treated as residential #40307
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description (*)
The UPS REST rate request builder in
\Magento\Ups\Model\Carrieralways includes theResidentialAddressIndicatorfield in theShipTo.Addresssection, even when the destination type is commercial (49_residential = "02").According to UPS API behavior, the mere presence of the
ResidentialAddressIndicatortag (even with an empty value) makes the shipment be treated as residential, which results in “Demand Surcharge - Residential” being applied and higher rates being returned for commercial destinations.This pull request updates the REST request payload builder so that:
ResidentialAddressIndicatoris only included when49_residential === "01"(residential)."02"commercial) requests, theResidentialAddressIndicatorfield is not added to the payload at all.This aligns the REST implementation with the existing XML implementation, which already adds
ResidentialAddressIndicatorconditionally based on49_residential.Manual testing scenarios (*)
Scenario 1: Commercial destination should not be treated as residential
49_residential = "02").ShipTo.Address.ResidentialAddressIndicatoris present with an empty value.ShipTo.Addressdoes not contain theResidentialAddressIndicatorfield for49_residential = "02".Scenario 2: Residential destination still behaves as residential
49_residential = "01").ShipTo.Address.ResidentialAddressIndicatoris present in the UPS REST request.