Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MethodKeyDefinitions = []MethodKeyDef{ {MethodKeyAny, "Any method available, no preference", "1"}, {MethodKeyCard, "Credit or debit card", "48"}, {MethodKeyCreditTransfer, "Send initiated bank or wire transfer", "30"}, {MethodKeyDebitTransfer, "Receive initiated bank or wire transfer", "31"}, {MethodKeyCash, "Cash", "10"}, {MethodKeyDirectDebit, "Direct debit", "49"}, {MethodKeyOnline, "Online or web payment", "68"}, }
MethodKeyDefinitions includes all the payment method keys that are accepted by GOBL.
var TermKeyDefinitions = []TermKeyDef{ {TermKeyNA, "Not yet defined", "16"}, {TermKeyEndOfMonth, "End of month", "2"}, {TermKeyDueDate, "Due on a specific date", "3"}, {TermKeyDeferred, "Deferred until after the due date", "4"}, {TermKeyProximo, "Month after the present", "9"}, {TermKeyInstant, "On receipt of invoice", "10"}, {TermKeyElective, "Chosen by the buyer", "11"}, {TermKeyPending, "Seller to advise buyer in separate transaction", "13"}, {TermKeyAdvance, "Payment made in advance", "32"}, {TermKeyDelivery, "Payment on Delivery", "52"}, }
TermKeyDefinitions includes all the currently accepted GOBL Payment Term definitions.
Functions ¶
This section is empty.
Types ¶
type Advance ¶ added in v0.2.0
type Advance struct { // Unique identifier for this advance. UUID *uuid.UUID `json:"uuid,omitempty" jsonschema:"title=UUID"` // When the advance was made. Date *cal.Date `json:"date,omitempty" jsonschema:"title=Date"` // ID or reference for the advance. Ref string `json:"ref,omitempty" jsonschema:"title=Reference"` // If this "advance" payment has come from a public grant or subsidy, set this to true. Grant bool `json:"grant,omitempty" jsonschema:"title=Grant"` // Details about the advance. Description string `json:"desc" jsonschema:"title=Description"` // How much as a percentage of the total with tax was paid Percent *num.Percentage `json:"percent,omitempty" jsonschema:"title=Percent"` // How much was paid. Amount num.Amount `json:"amount" jsonschema:"title=Amount"` // If different from the parent document's base currency. Currency currency.Code `json:"currency,omitempty" jsonschema:"title=Currency"` }
Advance represents a single payment that has been made already, such as a deposit on an intent to purchase, or as credit from a previous invoice which was later corrected or cancelled.
func (*Advance) CalculateFrom ¶ added in v0.30.3
CalculateFrom will update the amount using the rate of the provided total, if defined.
type Advances ¶ added in v0.13.0
type Advances []*Advance
Advances contains an array of advance objects.
type Card ¶ added in v0.2.0
type Card struct { // Last 4 digits of the card's Primary Account Number (PAN). Last4 string `json:"last4" jsonschema:"title=Last 4"` // Name of the person whom the card belongs to. Holder string `json:"holder" jsonschema:"title=Holder Name"` }
Card contains simplified card holder data as a reference for the customer.
type CreditTransfer ¶ added in v0.2.0
type CreditTransfer struct { // International Bank Account Number IBAN string `json:"iban,omitempty" jsonschema:"title=IBAN"` // Bank Identifier Code used for international transfers. BIC string `json:"bic,omitempty" jsonschema:"title=BIC"` // Account number, if IBAN not available. Number string `json:"number,omitempty" jsonschema:"title=Number"` // Name of the bank. Name string `json:"name,omitempty" jsonschema:"title=Name"` // Bank office branch address, not normally required. Branch *org.Address `json:"branch,omitempty" jsonschema:"title=Branch"` }
CreditTransfer contains fields that can be used for making payments via a bank transfer or wire.
type DirectDebit ¶ added in v0.2.0
type DirectDebit struct { // Unique identifier assigned by the payee for referencing the direct debit. Ref string `json:"ref,omitempty" jsonschema:"title=Mandate Reference"` // Unique banking reference that identifies the payee or seller assigned by the bank. Creditor string `json:"creditor,omitempty" jsonschema:"title=Creditor ID"` // Account identifier to be debited by the direct debit. Account string `json:"account,omitempty" jsonschema:"title=Account"` }
DirectDebit defines the data that will be used to make the direct debit.
type DueDate ¶ added in v0.2.0
type DueDate struct { Date *cal.Date `json:"date" jsonschema:"title=Date,description=When the payment is due."` Notes string `json:"notes,omitempty" jsonschema:"title=Notes,description=Other details to take into account for the due date."` Amount num.Amount `json:"amount" jsonschema:"title=Amount,description=How much needs to be paid by the date."` Percent *num.Percentage `json:"percent,omitempty" jsonschema:"title=Percent,description=Percentage of the total that should be paid by the date."` Currency currency.Code `json:"currency,omitempty" jsonschema:"title=Currency,description=If different from the parent document's base currency."` }
DueDate contains an amount that should be paid by the given date.
type Instructions ¶ added in v0.2.0
type Instructions struct { // How payment is expected or has been arranged to be collected Key MethodKey `json:"key" jsonschema:"title=Key"` // Optional text description of the payment method Detail string `json:"detail,omitempty" jsonschema:"title=Detail"` // Remittance information, a text value used to link the payment with the invoice. Ref string `json:"ref,omitempty" jsonschema:"title=Ref"` // Instructions for sending payment via a bank transfer. CreditTransfer []*CreditTransfer `json:"credit_transfer,omitempty" jsonschema:"title=Credit Transfer"` // Details of the payment that will be made via a credit or debit card. Card *Card `json:"card,omitempty" jsonschema:"title=Card"` // A group of terms that can be used by the customer or payer to consolidate direct debit payments. DirectDebit *DirectDebit `json:"direct_debit,omitempty" jsonschema:"title=Direct Debit"` // Array of online payment options Online []*Online `json:"online,omitempty" jsonschema:"title=Online"` // Any additional instructions that may be required to make the payment. Notes string `json:"notes,omitempty" jsonschema:"title=Notes"` // Non-structured additional data that may be useful. Meta cbc.Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Instructions holds a set of instructions that determine how the payment has or should be made. A single "code" exists in which the preferred payment method should be provided. All other details serve as a reference.
func (*Instructions) UNTDID4461 ¶ added in v0.28.0
func (i *Instructions) UNTDID4461() cbc.Code
UNTDID4461 provides the standard UNTDID 4461 code for the instruction's key.
func (*Instructions) Validate ¶ added in v0.28.0
func (i *Instructions) Validate() error
Validate ensures the fields provided in the instructions are valid.
type MethodKey ¶ added in v0.29.0
MethodKey represents a type of payment instruction
const ( MethodKeyAny MethodKey = "any" // Use any method available. MethodKeyCard MethodKey = "card" MethodKeyCreditTransfer MethodKey = "credit-transfer" MethodKeyDebitTransfer MethodKey = "debit-transfer" MethodKeyCash MethodKey = "cash" MethodKeyDirectDebit MethodKey = "direct-debit" // aka. Mandate MethodKeyOnline MethodKey = "online" // Website from which payment can be made )
Standard payment method codes. This is a heavily reduced list of practical codes which can be linked to UNTDID 4461 counterparts. If you require more payment method options, please send your pull requests.
func (MethodKey) JSONSchema ¶ added in v0.29.0
func (k MethodKey) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the struct for usage in Schema.
type MethodKeyDef ¶ added in v0.29.0
type MethodKeyDef struct { // Key being described Key MethodKey `json:"key" jsonschema:"title=Key"` // Details about the meaning of the key Description string `json:"description" jsonschema:"title=Description"` // UNTDID 4461 Equivalent Code UNTDID4461 cbc.Code `json:"untdid4461" jsonschema:"title=UNTDID 4461 Code"` }
MethodKeyDef is used to define each of the Method Keys that can be accepted by GOBL.
type Online ¶ added in v0.2.0
type Online struct { // Descriptive name given to the online provider. Name string `json:"name,omitempty" jsonschema:"title=Name"` // Full URL to be used for payment. Address string `json:"addr" jsonschema:"title=Address"` }
Online provides the details required to make a payment online using a website
type TermKey ¶ added in v0.29.0
TermKey defines the type of terms being handled
const ( // None defined TermKeyNA TermKey = "" // End of Month TermKeyEndOfMonth TermKey = "end-of-month" // Due on a specific date TermKeyDueDate TermKey = "due-date" // Deferred until after the due dates TermKeyDeferred TermKey = "deferred" // Month after the present TermKeyProximo TermKey = "proximo" // on receipt of invoice TermKeyInstant TermKey = "instant" // chosen by buyer TermKeyElective TermKey = "elective" // Seller to advise buyer in separate transaction TermKeyPending TermKey = "pending" // Payment made in advance TermKeyAdvance TermKey = "advance" // Payment on Delivery TermKeyDelivery TermKey = "delivery" )
Pre-defined Payment Terms based on UNTDID 4279
func (TermKey) JSONSchema ¶ added in v0.29.0
func (TermKey) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the struct for usage in Schema.
type TermKeyDef ¶ added in v0.29.0
type TermKeyDef struct { // The key being defined Key TermKey `json:"key" jsonschema:"Key"` // Human text for the key Description string `json:"description" jsonschema:"Description"` // The equivalent UNTDID 4279 Code UNTDID4279 cbc.Code `json:"untdid4279" jsonschema:"UNTDID 4279 Code"` }
TermKeyDef holds a definition of a single payment term key
type Terms ¶
type Terms struct { // Type of terms to be applied. Key TermKey `json:"key" jsonschema:"title=Key"` // Text detail of the chosen payment terms. Detail string `json:"detail,omitempty" jsonschema:"title=Detail"` // Set of dates for agreed payments. DueDates []*DueDate `json:"due_dates,omitempty" jsonschema:"title=Due Dates"` // Description of the conditions for payment. Notes string `json:"notes,omitempty" jsonschema:"title=Notes"` }
Terms defines when we expect the customer to pay, or have paid, for the contents of the document.
func (*Terms) CalculateDues ¶ added in v0.2.0
CalculateDues goes through each DueDate. If it has a percentage value set, it'll be used to calculate the amount.
func (*Terms) UNTDID4279 ¶ added in v0.28.0
UNTDID4279 returns the UNTDID 4270 code associated with the terms key.