claim

package
v1.49.44 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package claim is the order-claim domain (Medusa v2 core parity: order claims): a customer reports a problem with delivered items (damaged, wrong, missing) and the merchant resolves it with either a refund or a replacement order.

A Claim references an order and carries its claimed lines as claimitem rows (parent by ClaimId). It is pending until the merchant accepts (→ refund or replacement) or rejects it. Accept is idempotent: an already-accepted claim returns its prior outcome (RefundId / ReplacementOrderId) without moving money or creating a second refund. AmountCents is a projection computed at accept time from the claimed quantities × the order's line prices — never a mutable counter — so it is exact and re-derivable.

Index

Constants

View Source
const (
	StatusPending  = "pending"
	StatusAccepted = "accepted"
	StatusRejected = "rejected"
)

Claim lifecycle statuses.

View Source
const (
	ResolutionRefund  = "refund"
	ResolutionReplace = "replace"
)

Resolution types — how an accepted claim is settled.

Variables

This section is empty.

Functions

func Query

func ValidResolution

func ValidResolution(r string) bool

ValidResolution reports whether r is a recognized resolution type.

Types

type Claim

type Claim struct {
	mixin.Model[Claim]

	// OrderId is the order this claim is filed against.
	OrderId string `json:"orderId"`

	// Resolution is refund|replace. Default refund.
	Resolution string `json:"resolution" orm:"default:refund"`

	// Status is pending|accepted|rejected. Default pending.
	Status string `json:"status" orm:"default:pending"`

	// Reason is an optional free-text summary of the claim (per-line reasons
	// live on the claim items).
	Reason string `json:"reason,omitempty"`

	CurrencyCode currency.Type `json:"currencyCode" orm:"default:usd"`

	// AmountCents is the settled amount, computed at accept from the claimed
	// quantities × the order line prices. Zero until accepted.
	AmountCents currency.Cents `json:"amountCents"`

	// RefundId is set when an accepted claim was resolved with a refund.
	RefundId string `json:"refundId,omitempty"`

	// ReplacementOrderId is set when an accepted claim was resolved with a
	// replacement order.
	ReplacementOrderId string `json:"replacementOrderId,omitempty"`

	Metadata  Map    `json:"metadata,omitempty" datastore:"-"`
	Metadata_ string `json:"-" datastore:",noindex"`
}

Claim links a problem report to an order and resolves to a refund or a replacement order. Its claimed lines live as claimitem rows keyed by ClaimId.

func New

func New(db *datastore.Datastore) *Claim

func (*Claim) IsOpen

func (cl *Claim) IsOpen() bool

IsOpen reports whether the claim is still awaiting a decision.

func (*Claim) Load

func (cl *Claim) Load(ps []datastore.Property) (err error)

func (*Claim) Save

func (cl *Claim) Save() ([]datastore.Property, error)

Jump to

Keyboard shortcuts

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