Skip to content
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
11 changes: 5 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
instead of the v2 string name. Shipping Guide v2 prices by numeric code,
so sending `EXPRESS_NORDIC_0900` (and the other string names) returned an
empty product list — i.e. "no price". Products without a confirmed numeric
code fall back to the string value, unchanged. Note: Express Nordic 09:00
(`0335`) is being decommissioned by Bring on 2026-09-01 in favour of Bring
Courier & Express (`3620` + VAS `1171`).
code fall back to the string value, unchanged. The `EXPRESS_NORDIC_0900`
case maps to `4850` (Business Parcel Express / "Pakke til bedrift ekspress"),
the everyday express parcel — not Bring's separate "Express Nordic 09:00"
courier product (`0335`).

### Added
- `Product::shippingGuideCode(): ?string` — the numeric service code the
Shipping Guide v2 endpoints expect, string-typed so leading zeros survive
(`0335`). Distinct from `legacyNumericCode()`, which carries the historical
in-app codes (Express Nordic 09:00 is `4850` there, `0335` here).
Shipping Guide v2 endpoints expect, string-typed (leading-zero safe).

### Changed
- `TrackingApi::signature(string)` and `SignatureEndpoint::__construct`
Expand Down
20 changes: 11 additions & 9 deletions src/v4/Enum/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,29 @@ public function legacyNumericCode(): ?int
* parameter.
*
* Shipping Guide v2 identifies products by Bring's numeric service codes
* (e.g. "5800" Pickup Parcel, "5600" Home Delivery, "0335" Express Nordic
* 09:00). It does NOT price the v2 string names (EXPRESS_NORDIC_0900, …) —
* sending those returns an empty product list ("no price"). Codes are
* returned as strings so leading zeros survive ("0335" must not become 335).
* (e.g. "5800" Pickup Parcel, "5600" Home Delivery, "5000" Business Parcel,
* "4850" Business Parcel Express / "Pakke til bedrift ekspress"). It does
* NOT price the v2 string names (EXPRESS_NORDIC_0900, …) — sending those
* returns an empty product list ("no price"). Codes are returned as strings
* so any future leading-zero code survives intact.
*
* Returns null for products whose Shipping Guide code is not yet confirmed;
* callers should fall back to the enum string value for those so unknown
* products are no worse off than before.
*
* NOTE: Express Nordic 09:00 (0335) is being decommissioned by Bring on
* 2026-09-01. The successor is Bring Courier & Express (3620) with VAS 1171
* — that migration needs both a product and an additional-service change,
* so it is intentionally NOT silently mapped here.
* NOTE on the EXPRESS_NORDIC_0900 case: despite the enum name, this catalog
* uses it for Business Parcel Express (4850) — the everyday express parcel,
* confirmed against Bring's revised-services list (5000/5100/5300/5600/5800/
* 4850). It is NOT Bring's separate time-definite courier product "Express
* Nordic 09:00" (0335), which is being decommissioned 2026-09-01.
*/
public function shippingGuideCode(): ?string
{
return match ($this) {
self::PICKUP_PARCEL => '5800',
self::HOME_DELIVERY_PARCEL => '5600',
self::BUSINESS_PARCEL => '5000',
self::EXPRESS_NORDIC_0900 => '0335',
self::EXPRESS_NORDIC_0900 => '4850',
self::MAILBOX_PARCEL => '3584',
self::MAILBOX_PARCEL_TRACKED => '3570',
default => null,
Expand Down
9 changes: 5 additions & 4 deletions tests/v4/Endpoint/Shipping/PriceRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ public function testProductsSerialiseToBringNumericServiceCodes(): void
self::assertSame(['5000', '5800'], $q['product']);
}

public function testExpressNordicKeepsLeadingZeroAndUsesShippingGuideCode(): void
public function testExpressUsesNumericShippingGuideCode(): void
{
$q = $this->request(Product::EXPRESS_NORDIC_0900)->toQuery();

// 0335 (Shipping Guide v2), NOT the string name and NOT the legacy
// in-app code 4850 — and the leading zero must survive.
self::assertSame(['0335'], $q['product']);
// 4850 = Business Parcel Express ("Pakke til bedrift ekspress"), the
// express product this catalog uses — NOT the v2 string name, and NOT
// the unrelated "Express Nordic 09:00" courier code 0335.
self::assertSame(['4850'], $q['product']);
}

public function testUnmappedProductFallsBackToStringValue(): void
Expand Down