Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // KeyPattern describes what should keys look like KeyPattern = `^(?:[a-z]|[a-z0-9][a-z0-9-+]*[a-z0-9])$` // KeyValidationRegexp is used for key validation KeyValidationRegexp = regexp.MustCompile(KeyPattern) )
var NoteKeyDefinitions = []DefNoteKey{ { Key: NoteKeyGoods, Description: "Goods Description", UNTDID4451: "AAA", }, { Key: NoteKeyPayment, Description: "Terms of Payment", UNTDID4451: "PMT", }, { Key: NoteKeyLegal, Description: "Legal or regulatory information", UNTDID4451: "ABY", }, { Key: NoteKeyDangerousGoods, Description: "Dangerous goods additional information", UNTDID4451: "AAC", }, { Key: NoteKeyAck, Description: "Acknowledgement Description", UNTDID4451: "AAE", }, { Key: NoteKeyRate, Description: "Rate additional information", UNTDID4451: "AAF", }, { Key: NoteKeyReason, Description: "Reason", UNTDID4451: "ACD", }, { Key: NoteKeyDispute, Description: "Dispute", UNTDID4451: "ACE", }, { Key: NoteKeyCustomer, Description: "Customer remarks", UNTDID4451: "CUR", }, { Key: NoteKeyGlossary, Description: "Glossary", UNTDID4451: "ACZ", }, { Key: NoteKeyCustoms, Description: "Customs declaration information", UNTDID4451: "CUS", }, { Key: NoteKeyGeneral, Description: "General information", UNTDID4451: "AAI", }, { Key: NoteKeyHandling, Description: "Handling instructions", UNTDID4451: "HAN", }, { Key: NoteKeyPackaging, Description: "Packaging information", UNTDID4451: "PKG", }, { Key: NoteKeyLoading, Description: "Loading instructions", UNTDID4451: "LOI", }, { Key: NoteKeyPrice, Description: "Price conditions", UNTDID4451: "AAK", }, { Key: NoteKeyPriority, Description: "Priority information", UNTDID4451: "PRI", }, { Key: NoteKeyRegulatory, Description: "Regulatory information", UNTDID4451: "REG", }, { Key: NoteKeySafety, Description: "Safety instructions", UNTDID4451: "SAF", }, { Key: NoteKeyShipLine, Description: "Ship line", UNTDID4451: "SLR", }, { Key: NoteKeySupplier, Description: "Supplier remarks", UNTDID4451: "SUR", }, { Key: NoteKeyTransport, Description: "Transportation information", UNTDID4451: "TRA", }, { Key: NoteKeyDelivery, Description: "Delivery information", UNTDID4451: "DEL", }, { Key: NoteKeyQuarantine, Description: "Quarantine information", UNTDID4451: "QIN", }, { Key: NoteKeyTax, Description: "Tax declaration", UNTDID4451: "TXD", }, }
NoteKeyDefinitions provides a map of Note Keys to their definitions including a description and UNTDID code.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code string
Code represents a string used to uniquely identify the data we're looking at. We use "code" instead of "id", to reenforce the fact that codes should be more easily set and used by humans within definitions than IDs or UUIDs. Codes are standardised so that when validated they must contain between 2 and 6 inclusive upper-case letters or numbers.
const CodeEmpty Code = ""
CodeEmpty is used when no code is defined.
func (Code) JSONSchema ¶
func (Code) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the struct for usage in Schema.
type DefNoteKey ¶
type DefNoteKey struct { // Key to match against Key NoteKey `json:"key" jsonschema:"title=Key"` // Description of the Note Key Description string `json:"description" jsonschema:"title=Description"` // UNTDID 4451 code UNTDID4451 Code `json:"untdid4451" jsonschema:"title=UNTDID4451 Code"` }
DefNoteKey holds a note key definition
type Key ¶
type Key string
Key is used to define an ID or code that more closely represents a human name. The objective is to make it easier to define constants that can be re-used more easily.
const KeyEmpty Key = ""
KeyEmpty is used when no key is available.
func (Key) JSONSchema ¶
func (Key) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the struct for usage in Schema.
type Meta ¶
Meta defines a structure for data about the data being defined. Typically would be used for adding additional IDs or specifications not already defined or required by the base structure.
GOBL is focussed on ensuring the recipient has everything they need, as such, meta should only be used for data that may be used by intermediary conversion processes that should not be needed by the end-user.
We need to always use strings for values so that meta-data is easy to convert into other formats, such as protobuf which has strict type requirements.
type Note ¶
type Note struct { // Key specifying subject of the text Key NoteKey `json:"key,omitempty" jsonschema:"title=Key"` // Code used for additional data that may be required to identify the note. Code string `json:"code,omitempty" jsonschema:"title=Code"` // Source of this note, especially useful when auto-generated. Src string `json:"src,omitempty" jsonschema:"title=Source"` // The contents of the note Text string `json:"text" jsonschema:"title=Text"` }
Note represents a free text of additional information that may be added to a document.
func (*Note) UNTDID4451 ¶
UNTDID4451 provides the note's UNTDID 4451 equivalent value. If not available, returns CodeEmpty.
type NoteKey ¶
type NoteKey Key
NoteKey is used to describe the key used for identifying the type of note.
const ( // Goods Description NoteKeyGoods NoteKey = "goods" // Terms of Payment NoteKeyPayment NoteKey = "payment" // Legal or regulatory information NoteKeyLegal NoteKey = "legal" // Dangerous goods additional information NoteKeyDangerousGoods NoteKey = "dangerous-goods" // Acknowledgement Description NoteKeyAck NoteKey = "ack" // Rate additional information NoteKeyRate NoteKey = "rate" // Reason NoteKeyReason NoteKey = "reason" // Dispute NoteKeyDispute NoteKey = "dispute" // Customer remarks NoteKeyCustomer NoteKey = "customer" // Glossary NoteKeyGlossary NoteKey = "glossary" // Customs declaration information NoteKeyCustoms NoteKey = "customs" // General information NoteKeyGeneral NoteKey = "general" // Handling instructions NoteKeyHandling NoteKey = "handling" // Packaging information NoteKeyPackaging NoteKey = "packaging" // Loading instructions NoteKeyLoading NoteKey = "loading" // Price conditions NoteKeyPrice NoteKey = "price" // Priority information NoteKeyPriority NoteKey = "priority" // Regulatory information NoteKeyRegulatory NoteKey = "regulatory" // Safety Instructions NoteKeySafety NoteKey = "safety" // Ship Line NoteKeyShipLine NoteKey = "ship-line" // Supplier remarks NoteKeySupplier NoteKey = "supplier" // Transportation information NoteKeyTransport NoteKey = "transport" // Delivery Information NoteKeyDelivery NoteKey = "delivery" // Quarantine Information NoteKeyQuarantine NoteKey = "quarantine" // Tax declaration NoteKeyTax NoteKey = "tax" )
Predefined list of supported note keys based on the UNTDID 4451 list of text subject qualifiers. We've picked the ones which we think are most useful, but if you require an additional code, please send a pull request.
func (NoteKey) JSONSchema ¶
func (k NoteKey) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the struct for usage in Schema.
type Stamp ¶
type Stamp struct { // Identity of the agency used to create the stamp usually defined by each region. Provider Key `json:"prv" jsonschema:"title=Provider"` // The serialized stamp value generated for or by the external agency Value string `json:"val" jsonschema:"title=Value"` }
Stamp defines an official seal of approval from a third party like a governmental agency or intermediary and should thus be included in any official envelopes.