Documentation
¶
Index ¶
- func Query(db *datastore.Datastore) datastore.Query
- type CreditNote
- func (cn *CreditNote) Defaults()
- func (cn *CreditNote) Init(db *datastore.Datastore)
- func (cn CreditNote) Kind() string
- func (cn *CreditNote) Load(ps []datastore.Property) (err error)
- func (cn *CreditNote) MarkVoid() error
- func (cn *CreditNote) Save() (ps []datastore.Property, err error)
- func (cn *CreditNote) SetNumber(n int)
- func (cn *CreditNote) Validator() *val.Validator
- type CreditNoteLineItem
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreditNote ¶
type CreditNote struct {
mixin.Model
InvoiceId string `json:"invoiceId"`
CustomerId string `json:"customerId"`
Number string `json:"number"` // "CN-0001"
Amount int64 `json:"amount"` // total credit in cents
Currency currency.Type `json:"currency"`
Status Status `json:"status"`
// "duplicate" | "fraudulent" | "order_change" | "product_unsatisfactory"
Reason string `json:"reason,omitempty"`
LineItems []CreditNoteLineItem `json:"lineItems,omitempty" datastore:"-"`
LineItems_ string `json:"-" datastore:",noindex"`
// Credit that doesn't correspond to a specific line on the original invoice
OutOfBandAmount int64 `json:"outOfBandAmount,omitempty"`
// If applied to customer balance, the balance transaction ID
CreditBalanceTransaction string `json:"creditBalanceTransaction,omitempty"`
// If refunded to payment method
RefundId string `json:"refundId,omitempty"`
Memo string `json:"memo,omitempty"`
Metadata Map `json:"metadata,omitempty" datastore:"-"`
Metadata_ string `json:"-" datastore:",noindex"`
}
CreditNote represents a credit issued against an invoice. Credits can be applied to customer balance or refunded to the original payment method.
func New ¶
func New(db *datastore.Datastore) *CreditNote
func (*CreditNote) Defaults ¶
func (cn *CreditNote) Defaults()
func (*CreditNote) Init ¶
func (cn *CreditNote) Init(db *datastore.Datastore)
func (CreditNote) Kind ¶
func (cn CreditNote) Kind() string
func (*CreditNote) MarkVoid ¶
func (cn *CreditNote) MarkVoid() error
MarkVoid voids the credit note.
func (*CreditNote) SetNumber ¶
func (cn *CreditNote) SetNumber(n int)
SetNumber assigns the credit note number.
func (*CreditNote) Validator ¶
func (cn *CreditNote) Validator() *val.Validator
type CreditNoteLineItem ¶
type CreditNoteLineItem struct {
Description string `json:"description"`
Amount int64 `json:"amount"` // cents
Currency currency.Type `json:"currency"`
Quantity int64 `json:"quantity,omitempty"`
UnitPrice int64 `json:"unitPrice,omitempty"`
}
CreditNoteLineItem represents a line on a credit note.
Click to show internal directories.
Click to hide internal directories.