org

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: Apache-2.0 Imports: 8 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	UUID          *uuid.UUID   `json:"uuid,omitempty" jsonschema:"title=UUID"`
	Label         string       `json:"label,omitempty" jsonschema:"title=Label,description=Useful identifier, such as home, work, etc."`
	PostOfficeBox string       `` /* 137-byte string literal not displayed */
	Number        string       `json:"num,omitempty" jsonschema:"title=Number,description=House or building number in the street."`
	Floor         string       `json:"floor,omitempty" jsonschema:"title=Floor,description=Floor number within the building."`
	Block         string       `json:"block,omitempty" jsonschema:"title=Block,description=Block number within the building."`
	Door          string       `json:"door,omitempty" jsonschema:"title=Door,description=Door number within the building."`
	Street        string       `json:"street,omitempty" jsonschema:"title=Street,description=Fist line of street."`
	StreetExtra   string       `json:"street_extra,omitempty" jsonschema:"title=Extended Street,description=Additional street address details."`
	Locality      string       `json:"locality" jsonschema:"title=Locality,description=The village, town, district, or city."`
	Region        string       `json:"region" jsonschema:"title=Region,description=Province, County, or State."`
	Code          string       `json:"code,omitempty" jsonschema:"title=Code,description=Post or ZIP code."`
	Country       l10n.Country `json:"country,omitempty" jsonschema:"title=Country,description=ISO country code."`
	Coordinates   *Coordinates `` /* 165-byte string literal not displayed */
	Meta          Meta         `json:"meta,omitempty" jsonschema:"title=Meta"`
}

Address defines a globally acceptable set of attributes that describes a postal or fiscal address. Attribute names loosly based on the xCard file format.

type Coordinates

type Coordinates struct {
	Latitude  float64 `json:"lat,omitempty" jsonschema:"title=Latitude,description=Decimal latitude coordinate."`
	Longitude float64 `json:"lon,omitempty" jsonschema:"title=Longitude,description=Decimal longitude coordinate."`
	W3W       string  `json:"w3w,omitempty" jsonschema:"title=What 3 Words,description=Text coordinates compose of three words."`
	Geohash   string  `json:"geohash,omitempty" jsonschema:"title=Geohash,description=Single string coordinate based on geohash standard."`
}

Coordinates describes an exact geographical location in the world. We provide support for a set of different options beyond regular latitude and longitude.

type Date

type Date struct {
	civil.Date
}

Date represents a simple date without time used most frequently with business documents.

func MakeDate

func MakeDate(year int, month time.Month, day int) Date

MakeDate provides a new date instance.

func NewDate

func NewDate(year int, month time.Month, day int) *Date

NewDate provides a pointer to a new date instance.

func (Date) JSONSchemaType

func (Date) JSONSchemaType() *jsonschema.Type

type Discount

type Discount struct {
	Rate   *num.Percentage `json:"rate,omitempty" jsonschema:"title=Rate"`
	Value  num.Amount      `json:"value" jsonschema:"title=Value,description=How much to deduct"`
	Reason string          `json:"reason,omitempty" jsonschema:"title=Reason,description=Description as to why this discount was applied."`
	Code   string          `json:"code,omitempty" jsonschema:"title=Code,description=Reason Code"`
}

Discount represents an amount and/or percentage that can be applied to a given price.

TODO: use the UNTDID 5189 code list for Discount Reason Code.

type Email

type Email struct {
	UUID    *uuid.UUID `json:"uuid,omitempty"`
	Label   string     `json:"label,omitempty" jsonschema:"title=Label,description=Identifier for the email."`
	Address string     `json:"addr" jsonschema:"title=Address,description=Electronic mailing address."`
	Meta    Meta       `json:"meta,omitempty" jsonschema:"title=Meta,description=Additional fields."`
}

Email describes the electronic mailing details.

func (*Email) Validate

func (e *Email) Validate() error

Validate ensures email address looks valid.

type Item

type Item struct {
	UUID        string       `json:"uuid,omitempty" jsonschema:"title=UUID,description=Unique identify of this item independent of the Supplier IDs"`
	Name        string       `json:"name"`
	Description string       `json:"desc,omitempty"`
	Currency    string       `` /* 132-byte string literal not displayed */
	Price       num.Amount   `json:"price" jsonschema:"title=Price,description=Price of item being sold."`
	Unit        string       `json:"unit,omitempty" jsonschema:"title=Unit,description=Code for unit of the item being sold"`
	SupplierIDs []*ItemID    `json:"supplier_ids,omitempty" jsonschema:"title=Supplier IDs"`
	Origin      l10n.Country `json:"origin,omitempty" jsonschema:"title=Country of Origin,description=Country code of where this item was from originally."`
	Meta        Meta         `json:"meta,omitempty" jsonschema:"title=Meta"`
}

Item is used to describe a single object or service. Minimal usage implies just adding a name and price, more complete usage consists of adding descriptions, supplier and client IDs, dimensions, etc.

All prices of items should be set as their "net" price, i.e. without tax.

The taxes themselves change according to the recipient, so they should be defined in their usage context.

type ItemID

type ItemID struct {
	Value string `json:"value"`
}

ItemID contains

type Meta

type Meta map[string]string

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.

type Name

type Name struct {
	UUID     *uuid.UUID `json:"uuid,omitempty" jsonschema:"title=UUID,description=Unique identity code"`
	Alias    string     `json:"alias,omitempty" jsonschema:"title=Alias,description=What the person would like to be called"`
	Prefix   string     `json:"prefix,omitempty" jsonschema:"title=Prefix"`
	Given    string     `json:"given" jsonschema:"title=Given,description=The person's given name"`
	Middle   string     `json:"middle,omitempty" jsonschema:"title=Middle,description=Middle names or initials"`
	Surname  string     `json:"surname" jsonschema:"title=Surname"`
	Surname2 string     `json:"surname2,omitempty" jsonschema:"title=Second Surname"`
	Suffix   string     `json:"suffix,omitempty" jsonschema:"title=Suffix"`
	Meta     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 {
	UUID       *uuid.UUID   `json:"uuid,omitempty" jsonschema:"title=UUID,description=Unique identity code."`
	TaxID      *TaxID       `` /* 205-byte string literal not displayed */
	Name       string       `json:"name" jsonschema:"title=Name,description=Legal name or representation of the organization."`
	Alias      string       `json:"alias,omitempty" jsonschema:"title=Alias,description=Alternate short name."`
	People     []*Person    `json:"people,omitempty" jsonschema:"title=People,description=Details of physical people who represent the party."`
	Addresses  []*Address   `` /* 145-byte string literal not displayed */
	Emails     []*Email     `json:"emails,omitempty" jsonschema:"title=Email Addresses"`
	Telephones []*Telephone `json:"telephones,omitempty" jsonschema:"title=Telephone Numbers"`
	Meta       Meta         `` /* 147-byte string literal not displayed */
}

Party represents a person or business entity.

func (*Party) Validate

func (p *Party) Validate() error

Validate is used to check the party's data meets minimum expectations.

type Period

type Period struct {
	Start *Date `json:"start"`
	End   *Date `json:"end"`
}

Period represents two dates with a start and finish.

type Person

type Person struct {
	UUID   *uuid.UUID `json:"uuid,omitempty" jsonschema:"title=UUID,description=Unique identity code"`
	Name   Name       `json:"name" jsonschema:"title=Name,description=Complete details on the name of the person"`
	Role   string     `json:"role,omitempty" jsonschema:"title=Role,description=What they do within an organization"`
	Emails []Email    `json:"emails,omitempty" jsonschema:"title=Email Addresses,description=Electronic mail addresses that belong to the person."`
	Meta   Meta       `json:"meta,omitempty" jsonschema:"title=Meta,description=Data about the data."`
}

Person represents a human, and how to contact them.

type TaxID

type TaxID struct {
	UUID    *uuid.UUID   `json:"uuid,omitempty" jsonschema:"title=UUID,description=Unique identity code"`
	Country l10n.Country `json:"country" jsonschema:"title=Country,description=ISO country code for Where the tax identity was issued."`
	Code    string       `json:"code" jsonschema:"title=Code,description=Identity code."`
	Meta    Meta         `json:"meta,omitempty" jsonschema:"title=Meta,description=Additional details."`
}

TaxID represents a party's tax identify number for a given country.

func (*TaxID) Validate

func (tid *TaxID) Validate() error

Validate checks to ensure the tax ID contains all the required fields. The check the value itself is in the expected format according to the country, you'll need to use the region packages directly. See the region `ValidateTaxID` method.

type Telephone

type Telephone struct {
	UUID   *uuid.UUID `json:"uuid,omitempty" jsonschema:"title=UUID"`
	Label  string     `json:"label,omitempty" jsonschema:"title=Label,description=Identifier for this number."`
	Number string     `json:"num" jsonschema:"title=Number,description=The number to be dialed in ITU E.164 international format."`
}

Telephone describes what is expected for a telephone number.

func (*Telephone) Validate

func (t *Telephone) Validate() error

Validate checks the telephone objects number to ensure it looks correct.

Jump to

Keyboard shortcuts

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