fix(shipping-guide): send numeric product codes in price query#64
Conversation
Shipping Guide v2 (/shippingguide/v2/products[/price]) prices by Bring's numeric service code, not the v2 string name. PriceRequest::toQuery() emitted the enum string value (EXPRESS_NORDIC_0900, ...), so Bring returned an empty product list — surfaced in-app as 'no price'. Add Product::shippingGuideCode() returning the numeric code as a string (leading-zero safe, e.g. '0335' for Express Nordic 09:00) and serialise through it, falling back to the string value for products without a confirmed code. Kept distinct from legacyNumericCode() (the historical in-app codes, where Express Nordic is 4850) so input parsing on the caller side is unaffected. Note: Express Nordic 09:00 (0335) is decommissioned by Bring 2026-09-01; successor is Courier & Express (3620 + VAS 1171).
There was a problem hiding this comment.
Code Review
This pull request updates PriceRequest::toQuery() to serialize products using Bring's numeric service codes (via a new Product::shippingGuideCode() method) instead of v2 string names, falling back to the string value if no numeric code is confirmed. This ensures correct pricing behavior with Shipping Guide v2. A new test suite PriceRequestTest has been added to verify these changes. There are no review comments, so I have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
PHPStan (level 8, tests included) inferred the test helper's variadic $products as array<int|string, Product>, which doesn't satisfy the constructor's list<Product>. Wrap in array_values() to guarantee a list.
Problem
Shipping Guide v2 (
/shippingguide/v2/products[/price]) prices products by Bring's numeric service code, not the v2 string name.PriceRequest::toQuery()emitted the enum's string value (EXPRESS_NORDIC_0900, …), so Bring returned an empty product list — surfaced in the app as "no price" for Express Nordic 09:00.This is the inverse of the assumption baked into the earlier purchase-side fix (which resolved the calculator's
4850into the enum, only for the SDK to serialize it straight back to the string name).Change
Product::shippingGuideCode(): ?string— the numeric code Shipping Guide v2 expects, returned as a string so leading zeros survive ('0335';(int)'0335'would corrupt to335).PriceRequest::toQuery()serializes through it, falling back to the string value for products without a confirmed numeric code (no regression for unmapped products).legacyNumericCode(): the SPA sends4850for Express (BringCalculator.vue), so input parsing still needs4850while output to Bring needs0335. One shared map could not be correct for both directions.PriceRequestTestcovering numeric serialization, the0335leading-zero case, the string fallback, and the empty-products case.Verification
0335) is decommissioned by Bring on 2026-09-01; successor is Courier & Express (3620+ VAS1171) — a product and additional-service change, intentionally not auto-mapped here.bookingProductId()still maps Express Nordic 09:00 →4850(Booking API, a different endpoint, unverified). Worth checking separately if express is booked through this SDK.https://claude.ai/code/session_01TLPjgivGN5mopPrs4vcfBp
Generated by Claude Code