fix(usps): declare usps_rate_indicator option and price_type connection config#1121
Open
zggit wants to merge 1 commit into
Open
fix(usps): declare usps_rate_indicator option and price_type connection config#1121zggit wants to merge 1 commit into
zggit wants to merge 1 commit into
Conversation
…on config
- usps_rate_indicator is read in the label request but was never declared
in ShippingOption, so shipping_options_initializer's items_filter
silently dropped it and labels always used the hardcoded DR indicator.
- price_type is read from connection_config in rate.py but was never
declared in ConnectionConfig, so config {"price_type": "CONTRACT"} was
silently dropped and rate requests always fell back to RETAIL.
- Default label rateIndicator changed DR -> SP (single piece). Contract
(NSA) pricing typically covers SP, and the DR default caused USPS to
answer 'Contract rate not found for request. Published rate returned.'
and bill published rates instead of the account's contract rates.
|
Someone is attempting to deploy a commit to the karrio Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
USPS contract (NSA) pricing is unreachable through the connector.
usps_rate_indicatoris consumed in the label request andprice_typeis consumed in the rate request, but neither is declared in its enum, so both are silently dropped by the options filter. Labels always ship with the hardcodedDRrate indicator, which makes USPS answer "Contract rate not found for request. Published rate returned." and bill published rates instead of the account's contract rates.Changes
providers/usps/units.pyusps_rate_indicatorinShippingOptionproviders/usps/utils.pyprice_typeinConnectionConfig(read byrate.py)providers/usps/shipment/create.pyrateIndicatorDR→SP(single piece)tests/usps/test_shipment.pyVerification
Verified against the live USPS API with an EPS account holding contract rates: quotes (
price_type: CONTRACTconnection config) and label postage both return the contract price. All 34 USPS connector tests pass.