claim

package
v1.49.25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 14 Imported by: 0

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

func Accept(c *zip.Ctx) error

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

func Create(c *zip.Ctx) error

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.

func Items

func Items(c *zip.Ctx) error

Items returns the claimed lines for a claim.

func Reject

func Reject(c *zip.Ctx) error

Reject declines a pending claim. It does not move money.

func Route

func Route(router zip.Router, args ...zip.Handler)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL