Stage a destination transfer receipt (count an arrival)
POST/transfers/:transferLineId/receipt
A destination site counted received goods against a transfer line (ADR 0031). The transfer_line_id is looked up in the transfer_allocations ledger: a recognized ALLOCATED line answers 201 with a STAGED transfer receipt (expected_quantity from the ledger, received_quantity as counted, variance = received - expected, SIGNED: positive is over, negative is short) and publishes TransferReceiptStaged through the transactional outbox. NO usable stock moves at this step.
An UNRECOGNIZED scan — no ledger row for the line (this service never allocated it), a row that was REJECTED, a transfer_id mismatch, or a destination equal to the transfer's own origin site — is QUARANTINED: an inventory_exceptions row is written (kind UNKNOWN_TRANSFER or UNRECOGNIZED_TRANSFER), nothing that could raise usable stock is published, and the 422 problem body carries the exception's coordinates in its exception extension member so an operator can resolve it.
Idempotent on transfer_line_id at the database level: an identical replay answers 200 with the ORIGINAL receipt (replay: true) and republishes nothing; the same line id with a DIFFERENT payload is a 409 transfer-receipt-conflict (the original receipt is immutable).
Request
Responses
- 200
- 201
- 400
- 409
- 422
- 500
Idempotent replay: this exact scan was already staged; the ORIGINAL receipt is returned (replay: true) and nothing was republished.
Response Headers
Present, with the value true, ONLY when this response is a replay of the stored answer for the request's Idempotency-Key (the handler did not run again). The first execution of a key never carries it, and neither does a retry of a refusal that was not stored (ADR 0053: concurrent-modification and every refusal that depends on state that can change): that retry executes again.
The receipt was staged against a recognized ALLOCATED line. No usable stock moved — stow first raises it.
Response Headers
Present, with the value true, ONLY when this response is a replay of the stored answer for the request's Idempotency-Key (the handler did not run again). The first execution of a key never carries it, and neither does a retry of a refusal that was not stored (ADR 0053: concurrent-modification and every refusal that depends on state that can change): that retry executes again.
Malformed JSON body, transferId/sku/destinationSiteId missing or empty, receivedQuantity not positive, or the Idempotency-Key header is absent (ADR 0018).
This transfer_line_id already has a receipt staged with a DIFFERENT payload; the original receipt stands immutable. The same Idempotency-Key reused with a different method, path or body is also a 409 (idempotency-key-reused).
The scan could NOT be matched to a recognized ALLOCATED transfer line and was QUARANTINED as an inventory exception. No stock changed. The exception extension member carries the quarantine row's coordinates.
An unexpected internal error occurred.