quote

package
v1.49.58 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 7 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 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

View Source
const (
	AuthorCustomer = "customer"
	AuthorMerchant = "merchant"
)

Author types on a quote thread.

View Source
const (
	StatusPending          = "pending"
	StatusCustomerRejected = "customer_rejected"
	StatusMerchantRejected = "merchant_rejected"
	StatusAccepted         = "accepted"
)

Quote lifecycle states.

Variables

This section is empty.

Functions

func Query

func QueryMessages

func QueryMessages(db *datastore.Datastore) datastore.Query

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 New

func New(db *datastore.Datastore) *Quote

func (*Quote) IsActionable

func (q *Quote) IsActionable() bool

IsActionable reports whether the quote may still be accepted or rejected. Only pending quotes are actionable.

func (*Quote) Load

func (q *Quote) Load(ps []datastore.Property) (err error)

func (*Quote) Save

func (q *Quote) Save() ([]datastore.Property, error)

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

func (*QuoteMessage) Load

func (m *QuoteMessage) Load(ps []datastore.Property) error

func (*QuoteMessage) Save

func (m *QuoteMessage) Save() ([]datastore.Property, error)

Jump to

Keyboard shortcuts

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