Documentation ¶
Overview ¶
Package org contains structures related to organization.
Index ¶
- Constants
- Variables
- func RequireIdentityKey(key ...cbc.Key) validation.Rule
- func RequireIdentityType(typ cbc.Code) validation.Rule
- type Address
- type Coordinates
- type DefUnit
- type DocumentRef
- type Email
- type Identity
- type Image
- type Inbox
- type Item
- type Name
- type Party
- type Person
- type Registration
- type Telephone
- type Unit
- type Website
Constants ¶
const ( IdentityKeySKU cbc.Key = "sku" // stock code unit ID IdentityKeyItem cbc.Key = "item" // item number IdentityKeyOrder cbc.Key = "order" // order number or code IdentityKeyAgreement cbc.Key = "agreement" // agreement number IdentityKeyContract cbc.Key = "contract" // contract number IdentityKeyPassport cbc.Key = "passport" // Passport number IdentityKeyNational cbc.Key = "national" // National ID card number IdentityKeyForeign cbc.Key = "foreign" // Foreigner ID card number IdentityKeyResident cbc.Key = "resident" // Resident ID card number IdentityKeyOther cbc.Key = "other" // Other ID card number )
Common identity keys that may be used to identify something, like an item, document, person, organisation, or company. Ideally, these will only be used when no other more structured properties are available inside GOBL. The keys suggested here are non-binding and can be used as a reference for other implementations.
const ( // UnitPatternUNECE is a regular expression for UN/ECE unit codes when a unit is not covered by GOBL. UnitPatternUNECE = `^[A-Z0-9]{2,3}$` // UnitUNECEMutuallyDefined is the UN/ECE code for mutually defined units. UnitUNECEMutuallyDefined cbc.Code = `ZZ` )
Variables ¶
var RegexpPatternW3W = "" /* 370-byte string literal not displayed */
RegexpPatternW3W is a regular expression that matches a what3words address.
var UnitDefinitions = []DefUnit{ {UnitMilligram, "Milligrams", "", "MGM"}, {UnitGram, "Metric grams", "", "GRM"}, {UnitKilogram, "Metric kilograms", "", "KGM"}, {UnitMetricTon, "Metric tons", "", "TNE"}, {UnitMillimetre, "Milimetres", "", "MMT"}, {UnitCentimetre, "Centimetres", "", "CMT"}, {UnitMetre, "Metres", "", "MTR"}, {UnitKilometre, "Kilometers", "", "KMT"}, {UnitInch, "Inches", "", "INH"}, {UnitFoot, "Feet", "", "FOT"}, {UnitSquareMetre, "Square metres", "", "MTK"}, {UnitCubicMetre, "Cubic metres", "", "MTQ"}, {UnitMillilitre, "Millilitres", "", "MLT"}, {UnitCentilitre, "Centilitres", "", "CLT"}, {UnitLitre, "Litres", "", "LTR"}, {UnitWatt, "Watts", "", "WTT"}, {UnitKilowatt, "Kilowatts", "", "KWT"}, {UnitKilowattHour, "Kilowatt Hours", "", "KWH"}, {UnitRate, "Rate", "A unit of quantity expressed as a rate for usage of a facility or service.", "A9"}, {UnitMonth, "Months", "Unit of time equal to 1/12 of a year of 365,25 days.", "MON"}, {UnitDay, "Days", "", "DAY"}, {UnitSecond, "Seconds", "", "SEC"}, {UnitHour, "Hours", "", "HUR"}, {UnitMinute, "Minutes", "", "MIN"}, {UnitPiece, "Pieces", "A unit of count defining the number of pieces (piece: a single item, article or exemplar).", "H87"}, {UnitItem, "Items", " A unit of count defining the number of items regarded as separate units.", "EA"}, {UnitPair, "Pairs", "A unit of count defining the number of pairs (pair: item described by two's).", "PR"}, {UnitDozen, "Dozens", "A unit of count defining the number of units in multiples of 12.", "DZN"}, {UnitAssortment, "Assortments", "A unit of count defining the number of assortments (assortment: a collection of items or components of a single product packaged together).", "AS"}, {UnitService, "Service Units", "A unit of count defining the number of service units (service unit: defined period / property / facility / utility of supply).", "E48"}, {UnitJob, "Jobs", "A unit of count defining the number of jobs.", "E51"}, {UnitActivity, "Activities", "A unit of count defining the number of activities (activity: a unit of work or action).", "ACT"}, {UnitTrip, "Trips", "A unit of count defining the number of trips (trip: a journey to a place and back again).", "E54"}, {UnitGroup, "Groups", "A unit of count defining the number of groups (group: set of items classified together).", "10"}, {UnitOutfit, "Outfits", "A unit of count defining the number of outfits (outfit: a complete set of equipment / materials / objects used for a specific purpose).", "11"}, {UnitKit, "Kits", "A unit of count defining the number of kits (kit: tub, barrel or pail).", "KT"}, {UnitBaseBox, "Base Boxes", "A unit of area of 112 sheets of tin mil products (tin plate, tin free steel or black plate) 14 by 20 inches, or 31,360 square inches.", "BB"}, {UnitBulkPack, "Bulk Packs", "A unit of count defining the number of items per bulk pack.", "AB"}, {UnitBag, "Bags", "", "XBG"}, {UnitBox, "Boxes", "", "XBX"}, {UnitBin, "Bins", "", "XBI"}, {UnitCan, "Cans", "", "XCA"}, {UnitTub, "Tubs", "", "XTB"}, {UnitCase, "Cases", "", "XCS"}, {UnitTray, "Trays", "", "XDS"}, {UnitPortion, "Portions", "", ""}, {UnitSet, "Sets", "A unit of count defining the number of sets (set: a number of objects grouped together).", "SET"}, {UnitRoll, "Rolls", "", "XRO"}, {UnitCarton, "Cartons", "", "XCT"}, {UnitCylinder, "Cylinders", "", "XCY"}, {UnitBarrel, "Barrels", "", "XBA"}, {UnitJerrican, "Jerricans", "Jerrican, cylindrical", "XJY"}, {UnitCarboy, "Carboys", "", "XCO"}, {UnitDemijohn, "Demijohn", "", "XDJ"}, {UnitBottle, "Bottles", "", "XBO"}, {UnitSixPack, "Six Packs", "", ""}, {UnitCanister, "Canisters", "", "XCI"}, {UnitPackage, "Packages", "Standard packaging unit.", "XPK"}, {UnitBunch, "Bunches", "", "XBH"}, {UnitTetraBrik, "Tetra-Briks", "", ""}, {UnitPallet, "Pallets", "", "XPX"}, {UnitReel, "Reels", "", "XRL"}, {UnitSack, "Sacks", "", "XSA"}, {UnitSheet, "Sheets", "", "XST"}, {UnitEnvelope, "Envelopes", "", "XEN"}, {UnitLot, "Lot", "", "XLT"}, {UnitUnit, "Unit", "A type of package composed of a single item or object, not otherwise specified as a unit of transport equipment.", "XUN"}, }
UnitDefinitions describes each of the unit constants. Order is important.
Functions ¶
func RequireIdentityKey ¶ added in v0.81.0
func RequireIdentityKey(key ...cbc.Key) validation.Rule
RequireIdentityKey provides a validation rule that will determine if at least one of the identities defined includes one with one of the defined keys.
func RequireIdentityType ¶ added in v0.81.0
func RequireIdentityType(typ cbc.Code) validation.Rule
RequireIdentityType provides a validation rule that will determine if at least one of the identities defined includes one with the defined type.
Types ¶
type Address ¶
type Address struct { uuid.Identify // Useful identifier, such as home, work, etc. Label string `json:"label,omitempty" jsonschema:"title=Label,example=Office"` // Box number or code for the post office box located at the address. PostOfficeBox string `json:"po_box,omitempty" jsonschema:"title=Post Office Box"` // House or building number in the street. Number string `json:"num,omitempty" jsonschema:"title=Number"` // Floor number within the building. Floor string `json:"floor,omitempty" jsonschema:"title=Floor"` // Block number within the building. Block string `json:"block,omitempty" jsonschema:"title=Block"` // Door number within the building. Door string `json:"door,omitempty" jsonschema:"title=Door"` // First line of street. Street string `json:"street,omitempty" jsonschema:"title=Street"` // Additional street address details. StreetExtra string `json:"street_extra,omitempty" jsonschema:"title=Extended Street"` // Name of a village, town, district, or city, typically inside a region. Locality string `json:"locality,omitempty" jsonschema:"title=Locality"` // Name of a city, province, county, or state, inside a country. Region string `json:"region,omitempty" jsonschema:"title=Region"` // State or province code for countries that require it. State cbc.Code `json:"state,omitempty" jsonschema:"title=State"` // Post or ZIP code. Code cbc.Code `json:"code,omitempty" jsonschema:"title=Code"` // ISO country code. Country l10n.ISOCountryCode `json:"country,omitempty" jsonschema:"title=Country"` // When the postal address is not sufficient, coordinates help locate the address more precisely. Coordinates *Coordinates `json:"coords,omitempty" jsonschema:"title=Coordinates"` // Any additional semi-structure details about the address. Meta cbc.Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Address defines a globally acceptable set of attributes that describes a postal or fiscal address. Attribute names loosely based on the xCard file format.
func (Address) JSONSchemaExtend ¶ added in v0.111.1
func (Address) JSONSchemaExtend(js *jsonschema.Schema)
JSONSchemaExtend adds extra details to the Address schema.
func (*Address) Normalize ¶ added in v0.205.0
func (a *Address) Normalize(normalizers tax.Normalizers)
Normalize will perform basic normalization of the address's data.
type Coordinates ¶
type Coordinates struct { // Decimal latitude coordinate. Latitude *float64 `json:"lat,omitempty" jsonschema:"title=Latitude"` // Decimal longitude coordinate. Longitude *float64 `json:"lon,omitempty" jsonschema:"title=Longitude"` // What 3 Words text coordinates. W3W string `json:"w3w,omitempty" jsonschema:"title=What 3 Words"` // Single string coordinate based on geohash standard. Geohash string `json:"geohash,omitempty" jsonschema:"title=Geohash"` }
Coordinates describes an exact geographical location in the world. We provide support for a set of different options beyond regular latitude and longitude.
func (*Coordinates) LatLon ¶ added in v0.51.2
func (c *Coordinates) LatLon() (float64, float64)
LatLon provides the Latitude and Longitude values as a pair, or 0, 0 if the coordinates are not set.
func (*Coordinates) Validate ¶ added in v0.51.2
func (c *Coordinates) Validate() error
Validate checks that coordinates look okay.
func (*Coordinates) ValidateWithContext ¶ added in v0.51.2
func (c *Coordinates) ValidateWithContext(ctx context.Context) error
ValidateWithContext checks that coordinates look okay in the given context.
type DefUnit ¶ added in v0.29.0
type DefUnit struct { // Key for the Unit Unit Unit `json:"unit" jsonschema:"title=Unit"` // Name of the Unit Name string `json:"name" jsonschema:"title=Name"` // Description of the unit Description string `json:"description" jsonschema:"title=Description"` // Standard UN/ECE code UNECE cbc.Code `json:"unece" jsonschema:"title=UN/ECE Unit Code"` }
DefUnit serves to define unit keys.
type DocumentRef ¶ added in v0.200.0
type DocumentRef struct { uuid.Identify // Type of the document referenced. Type cbc.Key `json:"type,omitempty" jsonschema:"title=Type"` // IssueDate reflects the date the document was issued. IssueDate *cal.Date `json:"issue_date,omitempty" jsonschema:"title=Issue Date"` // Series the referenced document belongs to. Series cbc.Code `json:"series,omitempty" jsonschema:"title=Series"` // Source document's code or other identifier. Code cbc.Code `json:"code" jsonschema:"title=Code"` // Line index numbers inside the document, if relevant. Lines []int `json:"lines,omitempty" jsonschema:"title=Lines"` // List of additional codes, IDs, or SKUs which can be used to identify the document or its contents, agreed upon by the supplier and customer. Identities []*Identity `json:"identities,omitempty" jsonschema:"title=Identities"` // Tax period in which the referred document had an effect required by some tax regimes and formats. Period *cal.Period `json:"period,omitempty" jsonschema:"title=Period"` // Human readable description on why this reference is here or needs to be used. Reason string `json:"reason,omitempty" jsonschema:"title=Reason"` // Additional details about the document. Description string `json:"description,omitempty" jsonschema:"title=Description"` // Seals of approval from other organisations that may need to be listed. Stamps []*head.Stamp `json:"stamps,omitempty" jsonschema:"title=Stamps"` // Link to the source document. URL string `json:"url,omitempty" jsonschema:"title=URL,format=uri"` // Extensions for additional codes that may be required. Ext tax.Extensions `json:"ext,omitempty" jsonschemaL:"title=Extensions"` // Meta contains additional information about the document. Meta cbc.Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
DocumentRef is used to describe an existing document or a specific part of it's contents.
func (*DocumentRef) Normalize ¶ added in v0.200.0
func (dr *DocumentRef) Normalize(normalizers tax.Normalizers)
Normalize attempts to clean and normalize the DocumentRef.
func (*DocumentRef) Validate ¶ added in v0.200.0
func (dr *DocumentRef) Validate() error
Validate ensures the Document looks correct.
func (*DocumentRef) ValidateWithContext ¶ added in v0.200.0
func (dr *DocumentRef) ValidateWithContext(ctx context.Context) error
ValidateWithContext ensures the Document looks correct within the provided context.
type Email ¶
type Email struct { uuid.Identify // Identifier for the email. Label string `json:"label,omitempty" jsonschema:"title=Label"` // Electronic mailing address. Address string `json:"addr" jsonschema:"title=Address"` // Additional fields. Meta cbc.Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Email describes the electronic mailing details.
type Identity ¶ added in v0.37.0
type Identity struct { uuid.Identify // Optional label useful for non-standard identities to give a bit more context. Label string `json:"label,omitempty" jsonschema:"title=Label"` // Country from which the identity was issued. Country l10n.ISOCountryCode `json:"country,omitempty" jsonschema:"title=Country"` // Uniquely classify this identity using a key instead of a code. Key cbc.Key `json:"key,omitempty" jsonschema:"title=Key"` // The type of Code being represented and usually specific for // a particular context, country, or tax regime, and cannot be used // alongside the key. Type cbc.Code `json:"type,omitempty" jsonschema:"title=Type"` // The actual value of the identity code. Code cbc.Code `json:"code" jsonschema:"title=Code"` // Description adds details about what the code could mean or imply Description string `json:"description,omitempty" jsonschema:"title=Description"` // Ext provides a way to add additional information to the identity. Ext tax.Extensions `json:"ext,omitempty" jsonschema:"title=Extensions"` }
Identity is used to define a code for a specific context.
func AddIdentity ¶ added in v0.54.0
AddIdentity makes it easier to add a new identity to a list and replace an existing value with a matching type.
func IdentityForKey ¶ added in v0.54.0
IdentityForKey helps return the identity with the first matching key.
func IdentityForType ¶ added in v0.55.0
IdentityForType helps return the identity with a matching type code.
func (*Identity) Normalize ¶ added in v0.204.0
func (i *Identity) Normalize(normalizers tax.Normalizers)
Normalize will try to clean the identity's data.
type Image ¶ added in v0.35.0
type Image struct { uuid.Identify // Label to help identify the image. Label string `json:"label,omitempty" jsonschema:"title=Label"` // URL of the image URL string `json:"url,omitempty" jsonschema:"title=URL"` // As an alternative to the URL and only when the source data is small, // like an SVG, the raw data may be provided using Base64 encoding. Data []byte `json:"data,omitempty" jsonschema:"title=Data"` // Format of the image. MIME string `json:"mime,omitempty" jsonschema:"title=MIME"` // Details of what the image represents. Description string `json:"description,omitempty" jsonschema:"title=Description"` // Alternative text if the image cannot be shown. Alt string `json:"alt,omitempty" jsonschema:"title=Alt"` // Height of the image in pixels. Height int32 `json:"height,omitempty" jsonschema:"title=Height"` // Width of the image in pixels. Width int32 `json:"width,omitempty" jsonschema:"title=Width"` // Digest can be used to ensure the image contained at the URL // is the same one as originally intended. Digest *dsig.Digest `json:"digest,omitempty" jsonschema:"title=Digest"` // Meta contains additional information about the image. Meta *cbc.Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Image describes a logo or photo that represents an entity. Most details except the URL are optional, but are potentially useful for validation if that's a requirement for the use case.
type Inbox ¶ added in v0.26.0
type Inbox struct { uuid.Identify // Label for the inbox. Label string `json:"label,omitempty" jsonschema:"title=Label"` // Type of inbox being defined. Key cbc.Key `json:"key,omitempty" jsonschema:"title=Key"` // Role assigned to this inbox that may be relevant for the consumer. Role cbc.Key `json:"role,omitempty" jsonschema:"title=Role"` // Code or ID that identifies the Inbox. Mutually exclusive with URL and Email. Code cbc.Code `json:"code,omitempty" jsonschema:"title=Code"` // URL of the inbox that includes the protocol, server, and path. May // be used instead of the Code to identify the inbox. Mutually exclusive with // Code and Email. URL string `json:"url,omitempty" jsonschema:"title=URL"` // Email address for the inbox. Mutually exclusive with Code and URL. Email string `json:"email,omitempty" jsonschema:"title=Email"` // Extension code map for any additional regime or addon specific codes that may be required. Ext tax.Extensions `json:"ext,omitempty" jsonschema:"title=Extensions"` }
Inbox is used to store data about a connection with a service that is responsible for potentially receiving copies of GOBL envelopes or other document formats defined locally.
func AddInbox ¶ added in v0.204.0
AddInbox makes it easier to add a new inbox to a list and replace an existing value with a matching key.
func (*Inbox) Normalize ¶ added in v0.204.0
func (i *Inbox) Normalize(normalizers tax.Normalizers)
Normalize will try to clean the inbox's data.
type Item ¶
type Item struct { uuid.Identify // Primary reference code that identifies this item. // Additional codes can be provided in the 'identities' property. Ref string `json:"ref,omitempty" jsonschema:"title=Ref"` // Special key used to classify the item sometimes required by some regimes. Key cbc.Key `json:"key,omitempty" jsonschema:"title=Key"` // Brief name of the item Name string `json:"name" jsonschema:"title=Name"` // List of additional codes, IDs, or SKUs which can be used to identify the item. They should be agreed upon between supplier and customer. Identities []*Identity `json:"identities,omitempty" jsonschema:"title=Identities"` // Detailed description of the item. Description string `json:"description,omitempty" jsonschema:"title=Description"` // Currency used for the item's price. Currency currency.Code `json:"currency,omitempty" jsonschema:"title=Currency"` // Base price of a single unit to be sold. Price num.Amount `json:"price" jsonschema:"title=Price"` // AltPrices defines a list of prices with their currencies that may be used // as an alternative to the item's base price. AltPrices []*currency.Amount `json:"alt_prices,omitempty" jsonschema:"title=Alternative Prices"` // Unit of measure. Unit Unit `json:"unit,omitempty" jsonschema:"title=Unit"` // Country code of where this item was from originally. Origin l10n.ISOCountryCode `json:"origin,omitempty" jsonschema:"title=Country of Origin"` // Extension code map for any additional regime specific codes that may be required. Ext tax.Extensions `json:"ext,omitempty" jsonschema:"title=Extensions"` // Additional meta information that may be useful Meta cbc.Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Item is used to describe a single product or service. Minimal usage implies just adding a name and price, more complete usage consists of adding descriptions, supplier IDs, SKUs, dimensions, etc.
A set of additional code, ID, or SKU can be included in the `identities` property. Each `Identity` can be defined with an optional type agreed upon between the supplier and customer. For general purpose use, the Item's `Ref` property is easier to use.
func (*Item) Normalize ¶ added in v0.200.0
func (i *Item) Normalize(normalizers tax.Normalizers)
Normalize performs any required normalizations on the Item.
type Name ¶
type Name struct { uuid.Identify // What the person would like to be called Alias string `json:"alias,omitempty" jsonschema:"title=Alias"` // Additional prefix to add to name, like Mrs. or Mr. Prefix string `json:"prefix,omitempty" jsonschema:"title=Prefix"` // Person's given or first name Given string `json:"given,omitempty" jsonschema:"title=Given"` // Middle names or initials Middle string `json:"middle,omitempty" jsonschema:"title=Middle"` // Second or Family name. Surname string `json:"surname,omitempty" jsonschema:"title=Surname"` // Additional second of family name. Surname2 string `json:"surname2,omitempty" jsonschema:"title=Second Surname"` // Titles to include after the name. Suffix string `json:"suffix,omitempty" jsonschema:"title=Suffix"` // Any additional useful data. Meta cbc.Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Name represents what a human is called. This is a complex subject, see this w3 article for some insights: https://www.w3.org/International/questions/qa-personal-names
type Party ¶
type Party struct { tax.Regime uuid.Identify // Label can be used to provide a custom label for the party in a given // context in a single language, for example "Supplier", "Host", or similar. Label string `json:"label,omitempty" jsonschema:"title=Label,example=Supplier"` // Legal name or representation of the organization. Name string `json:"name,omitempty" jsonschema:"title=Name"` // Alternate short name. Alias string `json:"alias,omitempty" jsonschema:"title=Alias"` // The entity's legal ID code used for tax purposes. They may have other numbers, but we're only interested in those valid for tax purposes. TaxID *tax.Identity `json:"tax_id,omitempty" jsonschema:"title=Tax Identity"` // Set of codes used to identify the party in other systems. Identities []*Identity `json:"identities,omitempty" jsonschema:"title=Identities"` // Details of physical people who represent the party. People []*Person `json:"people,omitempty" jsonschema:"title=People"` // Digital inboxes used for forwarding electronic versions of documents Inboxes []*Inbox `json:"inboxes,omitempty" jsonschema:"title=Inboxes"` // Regular post addresses for where information should be sent if needed. Addresses []*Address `json:"addresses,omitempty" jsonschema:"title=Postal Addresses"` // Electronic mail addresses Emails []*Email `json:"emails,omitempty" jsonschema:"title=Email Addresses"` // Public websites that provide further information about the party. Websites []*Website `json:"websites,omitempty" jsonschema:"title=Websites"` // Regular telephone numbers Telephones []*Telephone `json:"telephones,omitempty" jsonschema:"title=Telephone Numbers"` // Additional registration details about the company that may need to be included in a document. Registration *Registration `json:"registration,omitempty" jsonschema:"title=Registration"` // Images that can be used to identify the party visually. Logos []*Image `json:"logos,omitempty" jsonschema:"title=Logos"` // Extension code map for any additional regime specific codes that may be required. Ext tax.Extensions `json:"ext,omitempty" jsonschema:"title=Extensions"` // Any additional semi-structured information that does not fit into the rest of the party. Meta cbc.Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Party represents a person or business entity.
func (*Party) Calculate ¶ added in v0.29.1
Calculate will perform basic normalization of the party's data without using any tax regime or addon.
func (Party) JSONSchemaExtend ¶ added in v0.111.0
func (Party) JSONSchemaExtend(js *jsonschema.Schema)
JSONSchemaExtend adds extra details to the schema.
func (*Party) Normalize ¶ added in v0.200.0
func (p *Party) Normalize(normalizers tax.Normalizers)
Normalize will try to normalize the party's data.
type Person ¶
type Person struct { uuid.Identify // Label can be used to identify the person in a given context in a single // language, for example "Attn", "Contact", "Responsible", etc. Label string `json:"label,omitempty" jsonschema:"title=Label,example=Attn"` // Complete details on the name of the person Name *Name `json:"name" jsonschema:"title=Name"` // What they do within an organization Role string `json:"role,omitempty" jsonschema:"title=Role"` // Electronic mail addresses that belong to the person. Emails []*Email `json:"emails,omitempty" jsonschema:"title=Email Addresses"` // Regular phone or mobile numbers Telephones []*Telephone `json:"telephones,omitempty" jsonschema:"title=Telephone Numbers"` // Avatars provider links to images or photos or the person. Avatars []*Image `json:"avatars,omitempty" jsonschema:"title=Avatars"` // Data about the data. Meta cbc.Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Person represents a human, and how to contact them electronically.
type Registration ¶ added in v0.1.0
type Registration struct { uuid.Identify Label string `json:"label,omitempty" jsonschema:"title=Label,example=Registration"` Capital *num.Amount `json:"capital,omitempty" jsonschema:"title=Capital"` Currency currency.Code `json:"currency,omitempty" jsonschema:"title=Currency"` Office string `json:"office,omitempty" jsonschema:"title=Office"` Book string `json:"book,omitempty" jsonschema:"title=Book"` Volume string `json:"volume,omitempty" jsonschema:"title=Volume"` Sheet string `json:"sheet,omitempty" jsonschema:"title=Sheet"` Section string `json:"section,omitempty" jsonschema:"title=Section"` Page string `json:"page,omitempty" jsonschema:"title=Page"` Entry string `json:"entry,omitempty" jsonschema:"title=Entry"` Other string `json:"other,omitempty" jsonschema:"title=Other"` }
Registration is used in countries that require additional information to be associated with a company usually related to a specific registration office. The definition found here is based on the details required for spain. If your country requires additional fields, please let us know.
func (*Registration) Validate ¶ added in v0.51.2
func (r *Registration) Validate() error
Validate ensures the registration looks valid.
func (*Registration) ValidateWithContext ¶ added in v0.51.2
func (r *Registration) ValidateWithContext(ctx context.Context) error
ValidateWithContext ensures the registration looks valid inside the provided context.
type Telephone ¶
type Telephone struct { uuid.Identify // Identifier for this number. Label string `json:"label,omitempty" jsonschema:"title=Label"` // The number to be dialed in ITU E.164 international format. Number string `json:"num" jsonschema:"title=Number"` }
Telephone describes what is expected for a telephone number.
type Unit ¶ added in v0.20.0
type Unit string
Unit represents either a unit key defined by GOBL *or* a two to three letter code defined by the UN/ECE.
const ( UnitEmpty Unit = `` // No unit defined // Measurement units UnitMilligram Unit = `mg` UnitGram Unit = `g` UnitKilogram Unit = `kg` UnitMetricTon Unit = `t` UnitMillimetre Unit = `mm` UnitCentimetre Unit = `cm` UnitMetre Unit = `m` UnitKilometre Unit = `km` UnitInch Unit = `in` UnitFoot Unit = `ft` UnitSquareMetre Unit = `m2` UnitCubicMetre Unit = `m3` UnitMillilitre Unit = "ml" UnitCentilitre Unit = `cl` UnitLitre Unit = `l` UnitWatt Unit = `w` UnitKilowatt Unit = `kw` UnitKilowattHour Unit = `kwh` UnitMonth Unit = `mon` UnitDay Unit = `day` UnitSecond Unit = `s` UnitHour Unit = `h` UnitMinute Unit = `min` UnitRate Unit = `rate` UnitPiece Unit = `piece` UnitItem Unit = `item` UnitActivity Unit = `activity` UnitService Unit = `service` UnitGroup Unit = `group` UnitSet Unit = `set` UnitTrip Unit = `trip` UnitJob Unit = `job` UnitAssortment Unit = `assortment` UnitOutfit Unit = `outfit` UnitKit Unit = `kit` UnitBaseBox Unit = `basebox` UnitBulkPack Unit = `pk` // Presentation Unit Codes UnitBag Unit = `bag` UnitBox Unit = `box` UnitBin Unit = `bin` UnitCan Unit = `can` UnitTub Unit = `tub` UnitCase Unit = `case` UnitTray Unit = `tray` UnitPortion Unit = `portion` // non-standard (src: ES) UnitDozen Unit = `dozen` UnitPair Unit = `pair` UnitRoll Unit = `roll` UnitCarton Unit = `carton` UnitCylinder Unit = `cylinder` UnitBarrel Unit = `barrel` UnitJerrican Unit = `jerrican` UnitCarboy Unit = `carboy` UnitDemijohn Unit = `demijohn` UnitBottle Unit = `bottle` UnitSixPack Unit = `6pack` // non-standard (src: ES) UnitCanister Unit = `canister` UnitPackage Unit = `pkg` UnitBunch Unit = `bunch` UnitTetraBrik Unit = `tetrabrik` // non-standard (src: ES) UnitPallet Unit = `pallet` UnitReel Unit = `reel` UnitSack Unit = `sack` UnitSheet Unit = `sheet` UnitEnvelope Unit = `envelope` UnitUnit Unit = `unit` UnitLot Unit = `lot` )
Set of common units based on UN/ECE recommendation 20 and 21 extensions. Some local formats may define additional non-standard codes which may be added.
The UN/ECE defines a very large set of units which would be impractical to support here in GOBL, so the Unit type will also accept any UN/ECE unit code instead of one of the keys defined here.
func (Unit) JSONSchema ¶ added in v0.29.0
func (u Unit) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the struct for usage in Schema.
type Website ¶ added in v0.35.0
type Website struct { uuid.Identify // Label for the website to show alongside the URL. Label string `json:"label,omitempty" jsonschema:"title=Label"` // Title of the website to help distinguish between this and other links. Title string `json:"title,omitempty" jsonschema:"title=Title"` // URL for the website. URL string `json:"url" jsonschema:"title=URL,format=uri"` }
Website describes what is expected for a web address.