ADR 0016: checkout to a pickup point
Status
Accepted (2026-11-13). Part of the network's pickup-points wave (RN-0010/RN-0011): node-topology's ADR 0017 declares the PICKUP_POINT node, delivery-promise's ADR 0027 quotes to it and shipping-and-tracking's ADR 0016 labels, deposits and collects at it. This repo builds against the WRITTEN contracts below, never against a sibling's code. Builds on ADR 0002 (the destination invariant), ADR 0003 (the tracking read model), ADR 0010 (REST) and ADR 0012 (the consolidation key).
Context
A shopper may check out to a pickup point instead of a ship-to address. The quote names the point (delivery-promise resolves it to its own postal prefix and its serving delivery station, and refuses an unknown, suspended or station-less point with DESTINATION_NOT_SERVED — exactly how checkout fails for a bad point; customer-ordering needs NO node-topology consumer of its own). The label is issued against the point: the PII exit that feeds it must answer a destination kind, not an address. Collection at the point is what the shopper sees next on the tracking view.
Decision
-
Checkout input.
CheckoutRequestgainspickupPointId. Validation becomes exactly-one-ofshipTo|shipToAddressId|pickupPointId(422validation-failed, the message names all three). A saved-address id and a point are refused together like any other pair. -
The aggregate.
NewOrdergainsPickupPointID stringas the alternative toShipTo(four places: the struct, thePlacevalidation, theSnapshot/Restorepair, and theCustomerOrderPlacedbuilder).Placerequires exactly one destination: a ship-to order validates the address as today; a pickup order requires a valid id and NO ship-to. The order'sdestinationPostalPrefixfor a pickup order is the confirmed promise's destination prefix — delivery-promise quotes the point under the point's own prefix (its ADR 0027), so the promise already carries it; every group's promise must name the same prefix, which becomes the order's.ErrPromiseDestinationMismatchadditionally compares the pickup point: a group whose promise names apickupPointId(an optional field of the promise answer this service decodes tolerantly; absent today) must name the order's point, and a ship-to order refuses a group whose promise names one. -
Persistence. Migration
0011_order_pickup_destination:customer_ordersgainspickup_point_id TEXT NULL,ship_tobecomes nullable, and a CHECK enforces exactly one destination (ship_to IS NULLexactly whenpickup_point_id IS NOT NULL). The same migration adds the tracking columns of point 6 (the slice's one allocated migration number). -
The PII exit.
GET /orders/{orderId}/ship-toanswers a pickup order with{"destinationKind": "PICKUP_POINT", "pickupPointId": "..."}and NO address fields (shipping-and-tracking's label branch consumes exactly these field names,destinationKind+pickupPointId; an absent kind is SHIP_TO, the shape of every order today). The restricted route stays the one exit of the destination and now carries no PII at all for these orders. -
The placed event.
CustomerOrderPlacedgains optionalpickupPointId(omitted for a ship-to order; the address never leaves, as ever). -
The consolidation key. For a pickup order the keyed hash runs over the shopper and
point:<pickupPointId>— the same secret, the same HMAC-SHA-256 shape and the same ADR 0012 semantics (same destination -> same key), in a SEPARATE key space: a pickup order and an address order NEVER merge (thepoint:prefix cannot be a normalised address, which never contains a lower-case word or a colon), and two pickup orders merge exactly when they share the shopper and the point. -
The tracking view. Consume
com.retailnetwork.logistics.shipping-and-tracking.journey.PackageReadyForCollection(datatrackingNumber,assignmentId,orderId,pickupPointId,readyForCollectionAt,holdUntil) andcom.retailnetwork.logistics.shipping-and-tracking.journey.PackageCollected(datatrackingNumber,assignmentId,orderId,pickupPointId,collectedAt, optionalproofCode), both onretailnetwork.shipping-and-tracking.eventsunder SHIPPING_CONSUMER_GROUP. They upserttracking_packages: the state becomesREADY_FOR_COLLECTIONthenCOLLECTED, and the new columnsready_for_collection_at,hold_until,collected_at,proof_codeandpickup_point_id(also fed by the pickupLabelIssued, which carries the point) record the collection facts. The tracking view showsdestinationKind,pickupPointIdand the optionalpickupPoint {readyForCollectionAt, holdUntil, collectedAt?}object — collection is what the shopper sees next. The events change no aggregate: the promise is judged at the deposit (delivery-promise) and the order keeps moving on the shipment events; an uncollected package returns through the existingPackageReturned.
Consequences
- Checkout of a bad point never reaches promise-making with that point: the
shopper holds no quotable offer, so
offer-not-quotablerequotes as today. - The destination CHECK makes the two destination kinds explicit in the store; every existing row keeps its ship-to (the migration only widens the null).
- No new consumer group, topic, env var or chart value: the two events ride the existing shipping-and-tracking consumer, the keyer is the existing secret.
- The feature is dormant until a pickup order exists; nothing changes for ship-to orders on any path.