Skip to content

Commit

Permalink
Merge pull request #200 from invopop/version-0.57.0
Browse files Browse the repository at this point in the history
Preparing release 0.57.0
  • Loading branch information
samlown authored Sep 18, 2023
2 parents c4d05c6 + 791bc50 commit f3930fb
Show file tree
Hide file tree
Showing 51 changed files with 182 additions and 109 deletions.
2 changes: 1 addition & 1 deletion bill/tax.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (t *Tax) ValidateWithContext(ctx context.Context) error {
return validation.ValidateStructWithContext(ctx, t,
validation.Field(&t.PricesInclude),
validation.Field(&t.Tags, validation.Each(r.InTags())),
validation.Field(&t.Calculator),
validation.Field(&t.Calculator, tax.InKeyDefs(tax.TotalCalculatorDefs)),
validation.Field(&t.Meta),
)
}
Expand Down
11 changes: 11 additions & 0 deletions bill/tax_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,15 @@ func TestTaxValidation(t *testing.T) {
err = tx.ValidateWithContext(ctx)
require.Error(t, err)
assert.Contains(t, err.Error(), "must be a valid value")

tx = &bill.Tax{
Calculator: "line",
}
err = tx.ValidateWithContext(ctx)
require.NoError(t, err)

tx.Calculator = "invalid"
err = tx.ValidateWithContext(ctx)
require.Error(t, err)
assert.Contains(t, err.Error(), "calculator: must be a valid value")
}
12 changes: 6 additions & 6 deletions build/schemas/bill/correction-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@
"title": "Reason",
"description": "Human readable reason for the corrective operation."
},
"correction_method": {
"method": {
"$ref": "https://gobl.org/draft-0/cbc/key",
"title": "Correction Method",
"title": "Method",
"description": "Correction method as defined by the tax regime."
},
"corrections": {
"changes": {
"items": {
"$ref": "https://gobl.org/draft-0/cbc/key"
},
"type": "array",
"title": "Corrections",
"description": "Correction keys that describe the specific changes according to the tax regime."
"title": "Changes",
"description": "Changes keys that describe the specific changes according to the tax regime."
}
},
"type": "object",
"description": "CorrectionOptions defines a structure used to pass configuration options to correct a previous invoice."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
40 changes: 31 additions & 9 deletions build/schemas/bill/invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -686,18 +686,18 @@
"title": "Stamps",
"description": "Seals of approval from other organisations that may need to be listed."
},
"corrections": {
"correction_method": {
"$ref": "https://gobl.org/draft-0/cbc/key",
"title": "Correction Method",
"description": "Tax regime specific key reflecting the method used to correct the preceding invoice."
},
"changes": {
"items": {
"$ref": "https://gobl.org/draft-0/cbc/key"
},
"type": "array",
"title": "Corrections",
"description": "Tax regime specific keys reflecting why the preceding invoice is being replaced."
},
"correction_method": {
"$ref": "https://gobl.org/draft-0/cbc/key",
"title": "Correction Method",
"description": "Tax regime specific keys reflecting the method used to correct the preceding invoice."
"title": "Changes",
"description": "Tax regime specific keys reflecting what has been changed from the previous invoice."
},
"period": {
"$ref": "https://gobl.org/draft-0/cal/period",
Expand Down Expand Up @@ -731,6 +731,23 @@
"title": "Tags",
"description": "Special tax tags that apply to this invoice according to local requirements."
},
"calculator": {
"$ref": "https://gobl.org/draft-0/cbc/key",
"oneOf": [
{
"const": "total",
"title": "Total",
"description": "Calculate the taxes based on the sum of all the line items (default)."
},
{
"const": "line",
"title": "Line",
"description": "Calculate the taxes based on each line item."
}
],
"title": "Calculator",
"description": "Calculator defines the rule to use when calculating the taxes.\nCurrently supported options: `line`, or `total` (default)."
},
"meta": {
"$ref": "https://gobl.org/draft-0/cbc/meta",
"title": "Meta",
Expand Down Expand Up @@ -782,6 +799,11 @@
"title": "Total with Tax",
"description": "Grand total after all taxes have been applied."
},
"rounding": {
"$ref": "https://gobl.org/draft-0/num/amount",
"title": "Rounding",
"description": "Rounding amount to apply to the invoice in case the total and payable\namounts don't quite match."
},
"outlays": {
"$ref": "https://gobl.org/draft-0/num/amount",
"title": "Outlay Totals",
Expand Down Expand Up @@ -813,5 +835,5 @@
"description": "Totals contains the summaries of all calculations for the invoice."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/cal/date-time.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"description": "Civil date time in simplified ISO format with no time zone\ninformation, for example: 2021-05-26T13:45:00"
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/cal/date.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"description": "Civil date in simplified ISO format, like 2021-05-26"
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/cal/period.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
"description": "Period represents two dates with a start and finish."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/cbc/code-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"description": "CodeMap is a map of keys to specific codes, useful to determine regime specific codes from their key counterparts."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/cbc/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"description": "Alphanumerical text identifier with upper-case letters, no whitespace, nor symbols."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/cbc/key.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"description": "Text identifier to be used instead of a code for a more verbose but readable identifier."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/cbc/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"description": "Meta defines a structure for data about the data being defined."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/cbc/note.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,5 @@
"description": "Note represents a free text of additional information that may be added to a document."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/currency/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -675,5 +675,5 @@
"description": "ISO Currency Code"
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/currency/exchange-rate.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
"description": "ExchangeRate contains data on the rate to be used when converting amounts from the document's base currency to whatever is defined."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/dsig/digest.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
"description": "Digest defines a structure to hold a digest value including the algorithm used to generate it."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/dsig/signature.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"description": "JSON Web Signature in compact form."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/envelope.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
"description": "Envelope wraps around a document adding headers and digital signatures."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/head/header.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@
"description": "Header defines the metadata of the body."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/head/stamp.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
"description": "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."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/i18n/string.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"description": "Map of 2-Letter language codes to their translations."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/l10n/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"description": "Code is used for short identifies like country or state codes."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/l10n/country-code.json
Original file line number Diff line number Diff line change
Expand Up @@ -1007,5 +1007,5 @@
"description": "Defines an ISO 3166-2 country code"
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/note/message.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
]
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/num/amount.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"description": "Quantity with optional decimal places that determine accuracy."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/num/percentage.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"description": "Similar to an Amount, but designed for percentages and includes % symbol in JSON output."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/org/address.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@
"description": "Address defines a globally acceptable set of attributes that describes a postal or fiscal address."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/org/coordinates.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@
"description": "Coordinates describes an exact geographical location in the world."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/org/email.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
"description": "Email describes the electronic mailing details."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/org/identity.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
"description": "Identity is used to define a code for a specific context."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/org/image.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@
"description": "Image describes a logo or photo that represents an entity."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/org/inbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
"description": "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."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/org/item.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@
"description": "Item is used to describe a single product or service."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/org/name.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@
"description": "Name represents what a human is called."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/org/party.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@
"description": "Party represents a person or business entity."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/org/person.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@
"description": "Person represents a human, and how to contact them electronically."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/org/registration.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@
"description": "Registration is used in countries that require additional information to be associated with a company usually related to a specific registration office."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/org/telephone.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
"description": "Telephone describes what is expected for a telephone number."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
2 changes: 1 addition & 1 deletion build/schemas/org/unit.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,5 @@
"description": "Unit describes how the quantity of the product should be interpreted."
}
},
"$comment": "Generated with GOBL v0.56.0"
"$comment": "Generated with GOBL v0.57.0"
}
Loading

0 comments on commit f3930fb

Please sign in to comment.