Documentation
¶
Overview ¶
Package exchange is the order-exchange domain (Medusa v2 core parity): an exchange pairs a return of inbound items on an order with outbound replacement items. The net money movement is DifferenceDueCents — positive when the customer owes the difference, negative when a refund is due.
Index ¶
Constants ¶
const ( StatusRequested = "requested" StatusConfirmed = "confirmed" StatusCanceled = "canceled" )
Exchange lifecycle states.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Exchange ¶
type Exchange struct {
mixin.Model[Exchange]
OrderId string `json:"orderId"`
// ReturnId links the return that carries the inbound items.
ReturnId string `json:"returnId,omitempty"`
// DifferenceDueCents > 0 means the customer owes; < 0 means a refund is due.
DifferenceDueCents currency.Cents `json:"differenceDueCents"`
CurrencyCode currency.Type `json:"currencyCode" orm:"default:usd"`
Status string `json:"status" orm:"default:requested"`
NoNotification bool `json:"noNotification"`
InboundItems []ExchangeItem `json:"inboundItems,omitempty" datastore:"-"`
InboundItems_ string `json:"-" datastore:",noindex"`
OutboundItems []ExchangeItem `json:"outboundItems,omitempty" datastore:"-"`
OutboundItems_ string `json:"-" datastore:",noindex"`
Metadata Map `json:"metadata,omitempty" datastore:"-"`
Metadata_ string `json:"-" datastore:",noindex"`
}
Exchange links a return of InboundItems on an order to OutboundItems shipped in their place. DifferenceDueCents is the net owed (>0) or refundable (<0) amount. An exchange is open until it is confirmed or canceled.
type ExchangeItem ¶
ExchangeItem is a single line of an exchange, referencing an order line item by ItemId with the quantity being returned (inbound) or shipped (outbound).