Close a receipt
POST/receipts/:receiptId/closures
Ends receiving, computes the discrepancies per line (Short, Over,
Damaged) and completes the ASN. Publishes ReceiptClosed. It no
longer completes the appointment nor raises DockAppointmentCompleted
(ADR 0019: the door release recorded by yard-management does, through
dock-scheduling). Closing a receipt that
is already Closed is 409 receipt-closed. A line nothing was received
for is Short.
With a receiving policy declared for the ASN's (owner, supplier)
(ADR 0026), the close judges every line's variance against it: inside
the tolerance band the variance is accepted and raises no finding;
between the band and its hard stop the close needs overrideReason
(409 tolerance-override-required without a valid one, 400
invalid-override-reason for a code outside the list) and the line
closes with an OverTolerance or UnderTolerance finding carrying
that code; at or beyond the hard stop the close is 409
tolerance-blocked and the receipt stays open. The body is optional:
without a policy it is ignored.
Request
Responses
- 200
- 400
- 404
- 409
- 412
- 500
The closed receipt with its final discrepancies.
Response Headers
Present, with the value true, only when this response is the replay of a stored answer for the same Idempotency-Key.
Strong entity tag of the resource: the quoted version, for example "3".
Malformed JSON or an unknown field (malformed-request), a bad query
parameter (invalid-query, invalid-limit, invalid-cursor,
unknown-query-parameter), a missing or malformed Idempotency-Key
(idempotency-key-required, idempotency-key-invalid), or a value that breaks a domain rule
(the invalid-*, *-requires-*, duplicate-* and
invalid-condition, invalid-carton*, invalid-scan*, invalid-counted-contents, invalid-cases,
invalid-gtin, invalid-sscc and invalid-owner-ref slugs), a reason code outside the list
(invalid-override-reason) or a tolerance band that breaks 0 <= tolerance < hardStop <= 1
(invalid-tolerance-band).
The resource in the path does not exist: asn-not-found,
appointment-not-found, receipt-not-found, carton-not-found or
receiving-policy-not-found (no policy declared for the exact owner and supplier).
The request conflicts with current state: asn-already-exists,
asn-in-progress, asn-terminal, asn-not-receivable,
appointment-cancelled, receipt-already-open, receipt-closed, sscc-prefix-not-configured and
sscc-serial-exhausted (receiver-assigned SSCCs, ADR 0024), tolerance-override-required
(a line sits between the declared band and its hard stop and no valid override reason was given) and
tolerance-blocked (a line is at or beyond the hard stop: no override passes, the receipt stays
open; ADR 0026), a write that lost a race
(concurrent-modification), or an Idempotency-Key already used with
a different request (idempotency-key-reused).
The If-Match value does not match the resource's current version; re-fetch and retry.
Unexpected server error.