claimitem

package
v1.49.39 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package claimitem is a single claimed line of an order claim: it references one order line item (by ItemId — the order LineItem.Id(), i.e. its variant or product id), the Quantity being claimed, and the Reason it is claimed.

A claim's items are their own rows (parent Claim by ClaimId), mirroring the gift-card / redemption relationship: the Claim is the request, the items are the append-only facts of what is being claimed. The refund/replacement amount on accept is a projection over these rows against the order's line prices — never a mutable counter — so re-reading is always the source of truth.

Index

Constants

View Source
const (
	ReasonDamaged   = "damaged"
	ReasonWrongItem = "wrong_item"
	ReasonMissing   = "missing"
	ReasonOther     = "other"
)

Claim reasons — why a line is being claimed.

Variables

This section is empty.

Functions

func Query

func ValidReason

func ValidReason(r string) bool

ValidReason reports whether r is one of the recognized claim reasons.

Types

type ClaimItem

type ClaimItem struct {
	mixin.Model[ClaimItem]

	// ClaimId is the parent claim this item belongs to.
	ClaimId string `json:"claimId"`

	// ItemId references the order line by its LineItem.Id() (variant or product).
	ItemId string `json:"itemId"`

	// Quantity is the number of units being claimed on this line.
	Quantity int `json:"quantity"`

	// Reason is one of damaged|wrong_item|missing|other.
	Reason string `json:"reason"`
}

ClaimItem is one claimed order line. ItemId matches the order LineItem.Id() (variant id, else product id). Quantity is the number of units claimed and must be ≤ the quantity originally ordered on that line (enforced at accept).

func New

func New(db *datastore.Datastore) *ClaimItem

func (*ClaimItem) Load

func (i *ClaimItem) Load(ps []datastore.Property) error

func (*ClaimItem) Save

func (i *ClaimItem) Save() ([]datastore.Property, error)

Jump to

Keyboard shortcuts

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