Skip to main content

Promises

Commitments per shipment group (aggregate Promise).

📄️Make a provisional promise for one shipment group from a quoted offer

MakePromise. Consumes the offer (CONSUMED), creates the promise in PROVISIONAL with holdExpiresAt, and holds capacity on the witness PromiseBook (nodeId:pickupDepartureId), opening the book lazily on the first hold, in ONE transaction (documented exception to one aggregate per transaction, G22). A retry with the same Idempotency-Key and body replays the stored answer when it is final (a promise made, or a refusal the request cannot pass later); a refusal that capacity, a concurrent request or a fact not known yet can still change releases the key, so the retry under the same key runs again. Errors: not-found (404); offer-not-quotable, promise-capacity-exhausted, book-closed, concurrent-update (409); group-spans-nodes, invalid-promise-terms, nominal-basis-not-allowed-for-tier, validation-failed (422); idempotency-key-required (400); idempotency-key-reused (409).

📄️Confirm a provisional promise for a placed order (ConfirmPromise)

Called by customer-ordering inside checkout, before the order is placed (E7). PROVISIONAL becomes CONFIRMED and the book hold moves from provisional to confirmed, in one transaction; PromiseConfirmed goes to the analytics topic. Idempotent: confirming an already CONFIRMED promise with the same orderId and groupNo is a no-op returning 200. A hold past holdExpiresAt is refused with promise-hold-expired (409), and a RELEASED or otherwise closed promise with promise-closed (409): checkout then re-quotes and no order is placed.

📄️Cancel a confirmed promise on request (CancelPromise)

Called by customer-ordering to compensate a checkout whose later group failed to confirm: the promises already CONFIRMED are cancelled so their capacity is given back. No request body. A CONFIRMED or AT_RISK promise becomes CANCELLED (cancelReason CANCELLED_ON_REQUEST), the confirmed hold goes back to its PromiseBook and PromiseCancelled goes to the analytics topic, in one transaction. Idempotent: cancelling an already CANCELLED promise is a no-op returning 200 with the same view. A PROVISIONAL, KEPT, BROKEN or RELEASED promise is refused with illegal-transition (409); a provisional hold is never cancelled, it lapses by itself (ReleaseExpiredHolds).