Documentation
¶
Overview ¶
Package claim wires the order-claim HTTP surface: CRUD on claims (with their claimed lines) plus the accept / reject decisions. A claim is a customer's report that delivered items were damaged / wrong / missing; the merchant accepts it — settling with a refund or a replacement order — or rejects it.
Every handler is tenant-scoped via the caller's organization namespace: the custom sub-routes pass the Namespace middleware explicitly and read/write the per-org store (datastore.NewNamespaced), the same isolation the rest of /v1 uses. Accept moves money, so it is admin-gated INSIDE the handler (the route middleware no-ops on the IAM path) and is idempotent: an already-accepted claim returns its prior outcome without refunding twice.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Accept ¶
Accept settles a pending claim. Money move ⇒ admin-gated inside the handler. Idempotent: an already-accepted claim returns its prior outcome without refunding or building a replacement again. The settled amount is computed from the claimed quantities × the order's line prices; claiming more units than were ordered is rejected (422) before any money moves.
func Create ¶
Create files a claim against an order and persists its claimed lines as claimitem rows. It validates the order exists (in the caller's org), the resolution type, and that every line names a valid reason and a positive quantity — but defers the "can't claim more than ordered" money check to accept, where it is enforced against the live order.
Types ¶
This section is empty.