Documentation
¶
Overview ¶
Package quote is the B2B request-for-quote domain: a company (models/company) negotiates the price of a draft order with the merchant. A quote threads messages (message.go) between customer and merchant until it is accepted or rejected by either side.
Index ¶
Constants ¶
const ( AuthorCustomer = "customer" AuthorMerchant = "merchant" )
Author types on a quote thread.
const ( StatusPending = "pending" StatusCustomerRejected = "customer_rejected" StatusMerchantRejected = "merchant_rejected" StatusAccepted = "accepted" )
Quote lifecycle states.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Quote ¶
type Quote struct {
mixin.Model[Quote]
CompanyId string `json:"companyId"`
CustomerId string `json:"customerId"`
// OrderId is the draft order this quote prices.
OrderId string `json:"orderId"`
Status string `json:"status" orm:"default:pending"`
TotalCents currency.Cents `json:"totalCents"`
CurrencyCode currency.Type `json:"currencyCode" orm:"default:usd"`
ValidUntil *time.Time `json:"validUntil,omitempty"`
Metadata Map `json:"metadata,omitempty" datastore:"-"`
Metadata_ string `json:"-" datastore:",noindex"`
}
Quote is a B2B RFQ against a draft order. TotalCents is the negotiated total the merchant is offering; the quote is actionable (acceptable/rejectable) only while pending.
func (*Quote) IsActionable ¶
IsActionable reports whether the quote may still be accepted or rejected. Only pending quotes are actionable.
type QuoteMessage ¶
type QuoteMessage struct {
mixin.Model[QuoteMessage]
QuoteId string `json:"quoteId"`
AuthorId string `json:"authorId"`
AuthorType string `json:"authorType"`
Text string `json:"text"`
// ItemId optionally references the order line this message is about.
ItemId string `json:"itemId,omitempty"`
}
QuoteMessage is a single message on a quote's negotiation thread. ItemId optionally scopes the message to a specific line of the underlying order.
func NewMessage ¶
func NewMessage(db *datastore.Datastore) *QuoteMessage