gobl 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/data/regimes/ae.json +173 -0
- data/data/regimes/at.json +56 -50
- data/data/regimes/be.json +56 -50
- data/data/regimes/br.json +135 -0
- data/data/regimes/ca.json +2 -1
- data/data/regimes/ch.json +56 -50
- data/data/regimes/co.json +34 -203
- data/data/regimes/de.json +74 -47
- data/data/regimes/el.json +211 -0
- data/data/regimes/es.json +69 -550
- data/data/regimes/fr.json +56 -50
- data/data/regimes/gb.json +60 -50
- data/data/regimes/in.json +128 -0
- data/data/regimes/it.json +48 -1311
- data/data/regimes/mx.json +39 -639
- data/data/regimes/nl.json +56 -50
- data/data/regimes/pl.json +101 -97
- data/data/regimes/pt.json +1459 -227
- data/data/regimes/us.json +55 -50
- data/lib/generated/gobl/bill/charge.rb +34 -19
- data/lib/generated/gobl/bill/correction_options.rb +8 -3
- data/lib/generated/gobl/bill/delivery.rb +184 -16
- data/lib/generated/gobl/bill/delivery_details.rb +41 -0
- data/lib/generated/gobl/bill/discount.rb +36 -13
- data/lib/generated/gobl/bill/invoice.rb +88 -41
- data/lib/generated/gobl/bill/line.rb +39 -4
- data/lib/generated/gobl/bill/line_charge.rb +56 -11
- data/lib/generated/gobl/bill/line_discount.rb +45 -12
- data/lib/generated/gobl/bill/order.rb +208 -0
- data/lib/generated/gobl/bill/ordering.rb +40 -35
- data/lib/generated/gobl/bill/payment.rb +155 -15
- data/lib/generated/gobl/bill/payment_details.rb +36 -0
- data/lib/generated/gobl/bill/payment_line.rb +77 -0
- data/lib/generated/gobl/bill/sub_line.rb +83 -0
- data/lib/generated/gobl/bill/tax.rb +19 -5
- data/lib/generated/gobl/bill/totals.rb +18 -18
- data/lib/generated/gobl/bill/tracking.rb +26 -0
- data/lib/generated/gobl/cal/date_time.rb +1 -1
- data/lib/generated/gobl/cal/time.rb +16 -0
- data/lib/generated/gobl/cbc/code.rb +2 -1
- data/lib/generated/gobl/cbc/{key_definition.rb → definition.rb} +18 -14
- data/lib/generated/gobl/cbc/source.rb +37 -0
- data/lib/generated/gobl/currency/code.rb +16 -16
- data/lib/generated/gobl/currency/exchange_rate.rb +10 -5
- data/lib/generated/gobl/head/header.rb +5 -5
- data/lib/generated/gobl/head/link.rb +43 -0
- data/lib/generated/gobl/l10n/{country_code.rb → iso_country_code.rb} +3 -3
- data/lib/generated/gobl/l10n/tax_country_code.rb +277 -0
- data/lib/generated/gobl/org/address.rb +11 -7
- data/lib/generated/gobl/org/attachment.rb +62 -0
- data/lib/generated/gobl/org/document_ref.rb +102 -0
- data/lib/generated/gobl/org/identity.rb +11 -1
- data/lib/generated/gobl/org/inbox.rb +22 -14
- data/lib/generated/gobl/org/item.rb +4 -5
- data/lib/generated/gobl/org/name.rb +0 -2
- data/lib/generated/gobl/{cbc → org}/note.rb +16 -5
- data/lib/generated/gobl/org/party.rb +9 -6
- data/lib/generated/gobl/org/person.rb +5 -0
- data/lib/generated/gobl/org/registration.rb +4 -0
- data/lib/generated/gobl/org/telephone.rb +1 -1
- data/lib/generated/gobl/org/unit.rb +2 -1
- data/lib/generated/gobl/pay/advance.rb +8 -1
- data/lib/generated/gobl/pay/card.rb +5 -2
- data/lib/generated/gobl/pay/instructions.rb +10 -3
- data/lib/generated/gobl/pay/terms.rb +7 -2
- data/lib/generated/gobl/regimes/mx/food_vouchers_line.rb +5 -0
- data/lib/generated/gobl/regimes/mx/fuel_account_line.rb +5 -0
- data/lib/generated/gobl/tax/addon_def.rb +76 -0
- data/lib/generated/gobl/tax/catalogue_def.rb +39 -0
- data/lib/generated/gobl/tax/{category.rb → category_def.rb} +14 -14
- data/lib/generated/gobl/tax/combo.rb +5 -0
- data/lib/generated/gobl/tax/correction_definition.rb +6 -1
- data/lib/generated/gobl/tax/correction_set.rb +13 -0
- data/lib/generated/gobl/tax/identity.rb +8 -3
- data/lib/generated/gobl/tax/{rate.rb → rate_def.rb} +11 -16
- data/lib/generated/gobl/tax/rate_total.rb +5 -0
- data/lib/generated/gobl/tax/{rate_value.rb → rate_value_def.rb} +4 -4
- data/lib/generated/gobl/tax/{regime.rb → regime_def.rb} +38 -33
- data/lib/generated/gobl/tax/scenario.rb +22 -12
- data/lib/generated/gobl/tax/scenario_note.rb +42 -0
- data/lib/generated/gobl/tax/scenario_set.rb +1 -1
- data/lib/generated/gobl/tax/tag_set.rb +28 -0
- data/lib/generated/gobl/tax/total.rb +6 -1
- data/lib/gobl/extensions/bill/invoice_helper.rb +6 -36
- data/lib/gobl/extensions/envelope_helper.rb +4 -0
- data/lib/gobl/version.rb +1 -1
- data/lib/gobl.rb +3 -2
- metadata +36 -21
- data/lib/generated/gobl/bill/document_reference.rb +0 -36
- data/lib/generated/gobl/bill/outlay.rb +0 -58
- data/lib/generated/gobl/bill/preceding.rb +0 -78
- data/lib/generated/gobl/cbc/code_definition.rb +0 -37
- data/lib/generated/gobl/tax/source.rb +0 -27
- data/lib/gobl/extensions/bill/scenario_summary.rb +0 -25
@@ -12,6 +12,44 @@ module GOBL
|
|
12
12
|
# The Schema ID of the GOBL Invoice structure
|
13
13
|
SCHEMA_ID = 'https://gobl.org/draft-0/bill/invoice'
|
14
14
|
|
15
|
+
# Enumeration of possible values for {#$regime} with their corresponding descriptions
|
16
|
+
$REGIME_ENUM = {
|
17
|
+
'AE' => 'United Arab Emirates',
|
18
|
+
'AT' => 'Austria',
|
19
|
+
'BE' => 'Belgium',
|
20
|
+
'BR' => 'Brazil',
|
21
|
+
'CA' => 'Canada',
|
22
|
+
'CH' => 'Switzerland',
|
23
|
+
'CO' => 'Colombia',
|
24
|
+
'DE' => 'Germany',
|
25
|
+
'EL' => 'Greece',
|
26
|
+
'ES' => 'Spain',
|
27
|
+
'FR' => 'France',
|
28
|
+
'GB' => 'United Kingdom',
|
29
|
+
'IN' => 'India',
|
30
|
+
'IT' => 'Italy',
|
31
|
+
'MX' => 'Mexico',
|
32
|
+
'NL' => 'The Netherlands',
|
33
|
+
'PL' => 'Poland',
|
34
|
+
'PT' => 'Portugal',
|
35
|
+
'US' => 'United States of America'
|
36
|
+
}.freeze
|
37
|
+
|
38
|
+
# @!attribute [r] $regime
|
39
|
+
# @return [GOBL::L10n::TaxCountryCode]
|
40
|
+
property :$regime, GOBL::L10n::TaxCountryCode
|
41
|
+
validates_inclusion_of :$regime, in: $REGIME_ENUM.keys, allow_blank: true
|
42
|
+
|
43
|
+
# @!attribute [r] $addons
|
44
|
+
# Addons defines a list of keys used to identify tax addons that apply special normalization, scenarios, and validation rules to a document.
|
45
|
+
# @return [Array<GOBL::CBC::Key>]
|
46
|
+
property :$addons, [GOBL::CBC::Key]
|
47
|
+
|
48
|
+
# @!attribute [r] $tags
|
49
|
+
# Tags are used to help identify specific tax scenarios or requirements that will apply changes to the contents of the invoice. Tags by design should always be optional, it should always be possible to build a valid invoice without any tags.
|
50
|
+
# @return [Array<GOBL::CBC::Key>]
|
51
|
+
property :$tags, [GOBL::CBC::Key]
|
52
|
+
|
15
53
|
# @!attribute [r] uuid
|
16
54
|
# Universally Unique Identifier.
|
17
55
|
# @return [String]
|
@@ -22,33 +60,42 @@ module GOBL
|
|
22
60
|
'standard' => 'A regular commercial invoice document between a supplier and customer.',
|
23
61
|
'proforma' => 'For a clients validation before sending a final invoice.',
|
24
62
|
'corrective' => 'Corrected invoice that completely *replaces* the preceding document.',
|
25
|
-
'credit-note' => 'Reflects a refund either partial or complete of the preceding document. A
|
63
|
+
'credit-note' => 'Reflects a refund either partial or complete of the preceding document. A
|
26
64
|
credit note effectively *extends* the previous document.',
|
27
|
-
'debit-note' => 'An additional set of charges to be added to the preceding document.'
|
65
|
+
'debit-note' => 'An additional set of charges to be added to the preceding document.',
|
66
|
+
'other' => 'Any other type of invoice that does not fit into the standard categories and implies
|
67
|
+
that any scenarios defined in tax regimes or addons will not be applied.
|
68
|
+
|
69
|
+
This is useful for being able to create invoices with custom types in extensions,
|
70
|
+
but is not recommend for general use.'
|
28
71
|
}.freeze
|
29
72
|
|
30
73
|
# @!attribute [r] type
|
31
|
-
# Type of invoice document
|
74
|
+
# Type of invoice document. May be restricted by local tax regime requirements.
|
32
75
|
# @return [GOBL::CBC::Key]
|
33
76
|
property :type, GOBL::CBC::Key
|
34
77
|
validates_inclusion_of :type, in: TYPE_ENUM.keys, allow_blank: true
|
35
78
|
|
36
79
|
# @!attribute [r] series
|
37
|
-
#
|
38
|
-
# @return [
|
39
|
-
property :series,
|
80
|
+
# Series is used to identify groups of invoices by date, business area, project, type of document, customer type, a combination of any or other company specific data. If the output format does not support the series as a separate field, it will be prepended to the code for presentation with a dash (`-`) for separation.
|
81
|
+
# @return [GOBL::CBC::Code]
|
82
|
+
property :series, GOBL::CBC::Code
|
40
83
|
|
41
84
|
# @!attribute [r] code
|
42
|
-
#
|
43
|
-
# @return [
|
44
|
-
property :code,
|
45
|
-
validates_presence_of :code
|
85
|
+
# Code is a sequential identifier that uniquely identifies the invoice. The code can be left empty initially, but is **required** to **sign** the invoice.
|
86
|
+
# @return [GOBL::CBC::Code]
|
87
|
+
property :code, GOBL::CBC::Code
|
46
88
|
|
47
89
|
# @!attribute [r] issue_date
|
48
|
-
#
|
90
|
+
# Issue date for when the invoice was created and issued. Todays date is used if none is set. There are often legal restrictions on how far back or in the future an invoice can be issued.
|
49
91
|
# @return [GOBL::Cal::Date]
|
50
92
|
property :issue_date, GOBL::Cal::Date
|
51
93
|
|
94
|
+
# @!attribute [r] issue_time
|
95
|
+
# IssueTime is an optional field that may be useful to indicate the time of day when the invoice was issued. Some regions and formats may require this field to be set. An empty string will be automatically updated to reflect the current time, otherwise the field can be left with a nil value.
|
96
|
+
# @return [GOBL::Cal::Time]
|
97
|
+
property :issue_time, GOBL::Cal::Time
|
98
|
+
|
52
99
|
# @!attribute [r] op_date
|
53
100
|
# Date when the operation defined by the invoice became effective.
|
54
101
|
# @return [GOBL::Cal::Date]
|
@@ -60,7 +107,7 @@ module GOBL
|
|
60
107
|
property :value_date, GOBL::Cal::Date
|
61
108
|
|
62
109
|
# @!attribute [r] currency
|
63
|
-
# Currency for all invoice totals.
|
110
|
+
# Currency for all invoice amounts and totals, unless explicitly stated otherwise.
|
64
111
|
# @return [GOBL::Currency::Code]
|
65
112
|
property :currency, GOBL::Currency::Code
|
66
113
|
|
@@ -70,70 +117,65 @@ module GOBL
|
|
70
117
|
property :exchange_rates, [GOBL::Currency::ExchangeRate]
|
71
118
|
|
72
119
|
# @!attribute [r] preceding
|
73
|
-
#
|
74
|
-
# @return [Array<
|
75
|
-
property :preceding, [
|
120
|
+
# Document references for previous invoices that this document replaces or extends.
|
121
|
+
# @return [Array<GOBL::Org::DocumentRef>]
|
122
|
+
property :preceding, [GOBL::Org::DocumentRef]
|
76
123
|
|
77
124
|
# @!attribute [r] tax
|
78
|
-
# Special tax configuration
|
79
|
-
# @return [Tax]
|
80
|
-
property :tax, Tax
|
125
|
+
# Special billing tax configuration options.
|
126
|
+
# @return [GOBL::Bill::Tax]
|
127
|
+
property :tax, GOBL::Bill::Tax
|
81
128
|
|
82
129
|
# @!attribute [r] supplier
|
83
|
-
# The
|
130
|
+
# The entity supplying the goods or services and usually responsible for paying taxes.
|
84
131
|
# @return [GOBL::Org::Party]
|
85
132
|
property :supplier, GOBL::Org::Party
|
86
133
|
validates_presence_of :supplier
|
87
134
|
|
88
135
|
# @!attribute [r] customer
|
89
|
-
# Legal entity receiving the goods or services, may be
|
136
|
+
# Legal entity receiving the goods or services, may be nil in certain circumstances such as simplified invoices.
|
90
137
|
# @return [GOBL::Org::Party]
|
91
138
|
property :customer, GOBL::Org::Party
|
92
139
|
|
93
140
|
# @!attribute [r] lines
|
94
141
|
# List of invoice lines representing each of the items sold to the customer.
|
95
|
-
# @return [Array<Line>]
|
96
|
-
property :lines, [Line]
|
142
|
+
# @return [Array<GOBL::Bill::Line>]
|
143
|
+
property :lines, [GOBL::Bill::Line]
|
97
144
|
|
98
145
|
# @!attribute [r] discounts
|
99
146
|
# Discounts or allowances applied to the complete invoice
|
100
|
-
# @return [Array<Discount>]
|
101
|
-
property :discounts, [Discount]
|
147
|
+
# @return [Array<GOBL::Bill::Discount>]
|
148
|
+
property :discounts, [GOBL::Bill::Discount]
|
102
149
|
|
103
150
|
# @!attribute [r] charges
|
104
151
|
# Charges or surcharges applied to the complete invoice
|
105
|
-
# @return [Array<Charge>]
|
106
|
-
property :charges, [Charge]
|
107
|
-
|
108
|
-
# @!attribute [r] outlays
|
109
|
-
# Expenses paid for by the supplier but invoiced directly to the customer.
|
110
|
-
# @return [Array<Outlay>]
|
111
|
-
property :outlays, [Outlay]
|
152
|
+
# @return [Array<GOBL::Bill::Charge>]
|
153
|
+
property :charges, [GOBL::Bill::Charge]
|
112
154
|
|
113
155
|
# @!attribute [r] ordering
|
114
156
|
# Ordering details including document references and buyer or seller parties.
|
115
|
-
# @return [Ordering]
|
116
|
-
property :ordering, Ordering
|
157
|
+
# @return [GOBL::Bill::Ordering]
|
158
|
+
property :ordering, GOBL::Bill::Ordering
|
117
159
|
|
118
160
|
# @!attribute [r] payment
|
119
161
|
# Information on when, how, and to whom the invoice should be paid.
|
120
|
-
# @return [
|
121
|
-
property :payment,
|
162
|
+
# @return [GOBL::Bill::PaymentDetails]
|
163
|
+
property :payment, GOBL::Bill::PaymentDetails
|
122
164
|
|
123
165
|
# @!attribute [r] delivery
|
124
166
|
# Specific details on delivery of the goods referenced in the invoice.
|
125
|
-
# @return [
|
126
|
-
property :delivery,
|
167
|
+
# @return [GOBL::Bill::DeliveryDetails]
|
168
|
+
property :delivery, GOBL::Bill::DeliveryDetails
|
127
169
|
|
128
170
|
# @!attribute [r] totals
|
129
171
|
# Summary of all the invoice totals, including taxes (calculated).
|
130
|
-
# @return [Totals]
|
131
|
-
property :totals, Totals
|
172
|
+
# @return [GOBL::Bill::Totals]
|
173
|
+
property :totals, GOBL::Bill::Totals
|
132
174
|
|
133
175
|
# @!attribute [r] notes
|
134
176
|
# Unstructured information that is relevant to the invoice, such as correction or additional legal details.
|
135
|
-
# @return [Array<GOBL::
|
136
|
-
property :notes, [GOBL::
|
177
|
+
# @return [Array<GOBL::Org::Note>]
|
178
|
+
property :notes, [GOBL::Org::Note]
|
137
179
|
|
138
180
|
# @!attribute [r] complements
|
139
181
|
# Additional complementary objects that add relevant information to the invoice.
|
@@ -144,6 +186,11 @@ module GOBL
|
|
144
186
|
# Additional semi-structured data that doesn't fit into the body of the invoice.
|
145
187
|
# @return [GOBL::CBC::Meta]
|
146
188
|
property :meta, GOBL::CBC::Meta
|
189
|
+
|
190
|
+
# @!attribute [r] attachments
|
191
|
+
# Attachments provide additional information or supporting documents that are not included in the main document. It is important that attachments are not used for alternative versions of the PDF, for that, see "links" inside the envelope headers.
|
192
|
+
# @return [Array<GOBL::Org::Attachment>]
|
193
|
+
property :attachments, [GOBL::Org::Attachment]
|
147
194
|
end
|
148
195
|
end
|
149
196
|
end
|
@@ -10,7 +10,7 @@ module GOBL
|
|
10
10
|
# Line is a single row in an invoice.
|
11
11
|
class Line < GOBL::Object
|
12
12
|
# The Schema ID of the GOBL Line structure
|
13
|
-
SCHEMA_ID = 'https://gobl.org/draft-0/bill/
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/line'
|
14
14
|
|
15
15
|
# @!attribute [r] uuid
|
16
16
|
# Universally Unique Identifier.
|
@@ -28,12 +28,37 @@ module GOBL
|
|
28
28
|
property :quantity, GOBL::Num::Amount
|
29
29
|
validates_presence_of :quantity
|
30
30
|
|
31
|
+
# @!attribute [r] identifier
|
32
|
+
# Single identifier provided by the supplier for an object on which the line item is based and is not considered a universal identity. Examples include a subscription number, telephone number, meter point, etc. Utilize the label property to provide a description of the identifier.
|
33
|
+
# @return [GOBL::Org::Identity]
|
34
|
+
property :identifier, GOBL::Org::Identity
|
35
|
+
|
36
|
+
# @!attribute [r] period
|
37
|
+
# A period of time relevant to when the service or item is delivered.
|
38
|
+
# @return [GOBL::Cal::Period]
|
39
|
+
property :period, GOBL::Cal::Period
|
40
|
+
|
41
|
+
# @!attribute [r] order
|
42
|
+
# Order reference for a specific line within a purchase order provided by the buyer.
|
43
|
+
# @return [GOBL::CBC::Code]
|
44
|
+
property :order, GOBL::CBC::Code
|
45
|
+
|
46
|
+
# @!attribute [r] cost
|
47
|
+
# Buyer accounting reference cost code to associate with the line.
|
48
|
+
# @return [GOBL::CBC::Code]
|
49
|
+
property :cost, GOBL::CBC::Code
|
50
|
+
|
31
51
|
# @!attribute [r] item
|
32
|
-
# Details about
|
52
|
+
# Details about the item, service or good, that is being sold
|
33
53
|
# @return [GOBL::Org::Item]
|
34
54
|
property :item, GOBL::Org::Item
|
35
55
|
validates_presence_of :item
|
36
56
|
|
57
|
+
# @!attribute [r] breakdown
|
58
|
+
# Breakdown of the line item for more detailed information. The sum of all lines will be used for the item price.
|
59
|
+
# @return [Array<SubLine>]
|
60
|
+
property :breakdown, [SubLine]
|
61
|
+
|
37
62
|
# @!attribute [r] sum
|
38
63
|
# Result of quantity multiplied by the item's price (calculated)
|
39
64
|
# @return [GOBL::Num::Amount]
|
@@ -59,10 +84,20 @@ module GOBL
|
|
59
84
|
# @return [GOBL::Num::Amount]
|
60
85
|
property :total, GOBL::Num::Amount
|
61
86
|
|
87
|
+
# @!attribute [r] substituted
|
88
|
+
# List of substituted lines. Useful for deliveries or corrective documents in order to indicate to the recipient which of the requested lines are being replaced. This is for purely informative purposes, and will not be used for calculations.
|
89
|
+
# @return [Array<SubLine>]
|
90
|
+
property :substituted, [SubLine]
|
91
|
+
|
62
92
|
# @!attribute [r] notes
|
63
93
|
# Set of specific notes for this line that may be required for clarification.
|
64
|
-
# @return [Array<GOBL::
|
65
|
-
property :notes, [GOBL::
|
94
|
+
# @return [Array<GOBL::Org::Note>]
|
95
|
+
property :notes, [GOBL::Org::Note]
|
96
|
+
|
97
|
+
# @!attribute [r] ext
|
98
|
+
# Extension codes that apply to the line
|
99
|
+
# @return [GOBL::Tax::Extensions]
|
100
|
+
property :ext, GOBL::Tax::Extensions
|
66
101
|
end
|
67
102
|
end
|
68
103
|
end
|
@@ -10,27 +10,72 @@ module GOBL
|
|
10
10
|
# LineCharge represents an amount added to the line, and will be applied before taxes.
|
11
11
|
class LineCharge < GOBL::Object
|
12
12
|
# The Schema ID of the GOBL LineCharge structure
|
13
|
-
SCHEMA_ID = 'https://gobl.org/draft-0/bill/
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/line#/$defs/LineCharge'
|
14
|
+
|
15
|
+
# Enumeration of possible values for {#key} with their corresponding descriptions
|
16
|
+
KEY_ENUM = {
|
17
|
+
'stamp-duty' => 'Stamp Duty',
|
18
|
+
'outlay' => 'Outlay',
|
19
|
+
'tax' => 'Tax',
|
20
|
+
'customs' => 'Customs',
|
21
|
+
'delivery' => 'Delivery',
|
22
|
+
'packing' => 'Packing',
|
23
|
+
'handling' => 'Handling',
|
24
|
+
'insurance' => 'Insurance',
|
25
|
+
'storage' => 'Storage',
|
26
|
+
'admin' => 'Administration',
|
27
|
+
'cleaning' => 'Cleaning'
|
28
|
+
}.freeze
|
29
|
+
|
30
|
+
# @!attribute [r] key
|
31
|
+
# Key for grouping or identifying charges for tax purposes. A suggested list of keys is provided, but these are for reference only and may be extended by the issuer.
|
32
|
+
# @return [GOBL::CBC::Key]
|
33
|
+
property :key, GOBL::CBC::Key
|
34
|
+
|
35
|
+
# @!attribute [r] code
|
36
|
+
# Reference or ID for this charge defined by the issuer
|
37
|
+
# @return [GOBL::CBC::Code]
|
38
|
+
property :code, GOBL::CBC::Code
|
39
|
+
|
40
|
+
# @!attribute [r] reason
|
41
|
+
# Text description as to why the charge was applied
|
42
|
+
# @return [String]
|
43
|
+
property :reason, String
|
44
|
+
|
45
|
+
# @!attribute [r] base
|
46
|
+
# Base for percent calculations instead of the line's sum
|
47
|
+
# @return [GOBL::Num::Amount]
|
48
|
+
property :base, GOBL::Num::Amount
|
14
49
|
|
15
50
|
# @!attribute [r] percent
|
16
|
-
# Percentage
|
51
|
+
# Percentage of base or parent line's sum
|
17
52
|
# @return [GOBL::Num::Percentage]
|
18
53
|
property :percent, GOBL::Num::Percentage
|
19
54
|
|
55
|
+
# @!attribute [r] quantity
|
56
|
+
# Quantity of units to apply the charge to when using the rate instead of the line's quantity.
|
57
|
+
# @return [GOBL::Num::Amount]
|
58
|
+
property :quantity, GOBL::Num::Amount
|
59
|
+
|
60
|
+
# @!attribute [r] unit
|
61
|
+
# Unit to associate with the quantity when using the rate.
|
62
|
+
# @return [GOBL::Org::Unit]
|
63
|
+
property :unit, GOBL::Org::Unit
|
64
|
+
|
65
|
+
# @!attribute [r] rate
|
66
|
+
# Rate defines a price per unit to use instead of the percentage.
|
67
|
+
# @return [GOBL::Num::Amount]
|
68
|
+
property :rate, GOBL::Num::Amount
|
69
|
+
|
20
70
|
# @!attribute [r] amount
|
21
71
|
# Fixed or resulting charge amount to apply (calculated if percent present).
|
22
72
|
# @return [GOBL::Num::Amount]
|
23
73
|
property :amount, GOBL::Num::Amount
|
24
74
|
|
25
|
-
# @!attribute [r]
|
26
|
-
#
|
27
|
-
# @return [
|
28
|
-
property :
|
29
|
-
|
30
|
-
# @!attribute [r] reason
|
31
|
-
# Text description as to why the charge was applied
|
32
|
-
# @return [String]
|
33
|
-
property :reason, String
|
75
|
+
# @!attribute [r] ext
|
76
|
+
# Extension codes that apply to the charge
|
77
|
+
# @return [GOBL::Tax::Extensions]
|
78
|
+
property :ext, GOBL::Tax::Extensions
|
34
79
|
end
|
35
80
|
end
|
36
81
|
end
|
@@ -10,27 +10,60 @@ module GOBL
|
|
10
10
|
# LineDiscount represents an amount deducted from the line, and will be applied before taxes.
|
11
11
|
class LineDiscount < GOBL::Object
|
12
12
|
# The Schema ID of the GOBL LineDiscount structure
|
13
|
-
SCHEMA_ID = 'https://gobl.org/draft-0/bill/
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/line#/$defs/LineDiscount'
|
14
14
|
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
# Enumeration of possible values for {#key} with their corresponding descriptions
|
16
|
+
KEY_ENUM = {
|
17
|
+
'early-completion' => 'Bonus for works ahead of schedule',
|
18
|
+
'military' => 'Military Discount',
|
19
|
+
'work-accident' => 'Work Accident Discount',
|
20
|
+
'special-agreement' => 'Special Agreement Discount',
|
21
|
+
'production-error' => 'Production Error Discount',
|
22
|
+
'new-outlet' => 'New Outlet Discount',
|
23
|
+
'sample' => 'Sample Discount',
|
24
|
+
'end-of-range' => 'End of Range Discount',
|
25
|
+
'incoterm' => 'Incoterm Discount',
|
26
|
+
'pos-threshold' => 'Point of Sale Threshold Discount',
|
27
|
+
'special-rebate' => 'Special Rebate',
|
28
|
+
'temporary' => 'Temporary',
|
29
|
+
'standard' => 'Standard',
|
30
|
+
'yearly-turnover' => 'Yearly Turnover'
|
31
|
+
}.freeze
|
19
32
|
|
20
|
-
# @!attribute [r]
|
21
|
-
#
|
22
|
-
# @return [GOBL::
|
23
|
-
property :
|
33
|
+
# @!attribute [r] key
|
34
|
+
# Key for identifying the type of discount being applied.
|
35
|
+
# @return [GOBL::CBC::Key]
|
36
|
+
property :key, GOBL::CBC::Key
|
24
37
|
|
25
38
|
# @!attribute [r] code
|
26
|
-
#
|
27
|
-
# @return [
|
28
|
-
property :code,
|
39
|
+
# Code or reference for this discount defined by the issuer
|
40
|
+
# @return [GOBL::CBC::Code]
|
41
|
+
property :code, GOBL::CBC::Code
|
29
42
|
|
30
43
|
# @!attribute [r] reason
|
31
44
|
# Text description as to why the discount was applied
|
32
45
|
# @return [String]
|
33
46
|
property :reason, String
|
47
|
+
|
48
|
+
# @!attribute [r] base
|
49
|
+
# Base for percent calculations instead of the line's sum.
|
50
|
+
# @return [GOBL::Num::Amount]
|
51
|
+
property :base, GOBL::Num::Amount
|
52
|
+
|
53
|
+
# @!attribute [r] percent
|
54
|
+
# Percentage to apply to the base or line sum to calculate the discount amount
|
55
|
+
# @return [GOBL::Num::Percentage]
|
56
|
+
property :percent, GOBL::Num::Percentage
|
57
|
+
|
58
|
+
# @!attribute [r] amount
|
59
|
+
# Fixed discount amount to apply (calculated if percent present)
|
60
|
+
# @return [GOBL::Num::Amount]
|
61
|
+
property :amount, GOBL::Num::Amount
|
62
|
+
|
63
|
+
# @!attribute [r] ext
|
64
|
+
# Extension codes that apply to the discount
|
65
|
+
# @return [GOBL::Tax::Extensions]
|
66
|
+
property :ext, GOBL::Tax::Extensions
|
34
67
|
end
|
35
68
|
end
|
36
69
|
end
|
@@ -0,0 +1,208 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
##
|
4
|
+
## DO NOT EDIT - This file was generated automatically.
|
5
|
+
##
|
6
|
+
##
|
7
|
+
|
8
|
+
module GOBL
|
9
|
+
module Bill
|
10
|
+
# Order documents are used for the initial part of a order-to-invoice process where the buyer requests goods or services from the seller.
|
11
|
+
class Order < GOBL::Object
|
12
|
+
# The Schema ID of the GOBL Order structure
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/order'
|
14
|
+
|
15
|
+
# Enumeration of possible values for {#$regime} with their corresponding descriptions
|
16
|
+
$REGIME_ENUM = {
|
17
|
+
'AE' => 'United Arab Emirates',
|
18
|
+
'AT' => 'Austria',
|
19
|
+
'BE' => 'Belgium',
|
20
|
+
'BR' => 'Brazil',
|
21
|
+
'CA' => 'Canada',
|
22
|
+
'CH' => 'Switzerland',
|
23
|
+
'CO' => 'Colombia',
|
24
|
+
'DE' => 'Germany',
|
25
|
+
'EL' => 'Greece',
|
26
|
+
'ES' => 'Spain',
|
27
|
+
'FR' => 'France',
|
28
|
+
'GB' => 'United Kingdom',
|
29
|
+
'IN' => 'India',
|
30
|
+
'IT' => 'Italy',
|
31
|
+
'MX' => 'Mexico',
|
32
|
+
'NL' => 'The Netherlands',
|
33
|
+
'PL' => 'Poland',
|
34
|
+
'PT' => 'Portugal',
|
35
|
+
'US' => 'United States of America'
|
36
|
+
}.freeze
|
37
|
+
|
38
|
+
# @!attribute [r] $regime
|
39
|
+
# @return [GOBL::L10n::TaxCountryCode]
|
40
|
+
property :$regime, GOBL::L10n::TaxCountryCode
|
41
|
+
validates_inclusion_of :$regime, in: $REGIME_ENUM.keys, allow_blank: true
|
42
|
+
|
43
|
+
# @!attribute [r] $addons
|
44
|
+
# Addons defines a list of keys used to identify tax addons that apply special normalization, scenarios, and validation rules to a document.
|
45
|
+
# @return [Array<GOBL::CBC::Key>]
|
46
|
+
property :$addons, [GOBL::CBC::Key]
|
47
|
+
|
48
|
+
# @!attribute [r] $tags
|
49
|
+
# Tags are used to help identify specific tax scenarios or requirements that will apply changes to the contents of the invoice. Tags by design should always be optional, it should always be possible to build a valid invoice without any tags.
|
50
|
+
# @return [Array<GOBL::CBC::Key>]
|
51
|
+
property :$tags, [GOBL::CBC::Key]
|
52
|
+
|
53
|
+
# @!attribute [r] uuid
|
54
|
+
# Universally Unique Identifier.
|
55
|
+
# @return [String]
|
56
|
+
property :uuid, String
|
57
|
+
|
58
|
+
# Enumeration of possible values for {#type} with their corresponding descriptions
|
59
|
+
TYPE_ENUM = {
|
60
|
+
'purchase' => 'A purchase order is a document that a buyer sends to a seller to request goods or services.',
|
61
|
+
'sale' => 'A sales order is a document that a seller sends to a buyer to confirm the sale of goods or services.',
|
62
|
+
'quote' => 'A quote is a document that a seller sends to a buyer to provide a price for goods or services.'
|
63
|
+
}.freeze
|
64
|
+
|
65
|
+
# @!attribute [r] type
|
66
|
+
# Type of the order.
|
67
|
+
# @return [GOBL::CBC::Key]
|
68
|
+
property :type, GOBL::CBC::Key
|
69
|
+
validates_inclusion_of :type, in: TYPE_ENUM.keys, allow_blank: true
|
70
|
+
|
71
|
+
# @!attribute [r] series
|
72
|
+
# Series is used to identify groups of orders by date, business area, project, type, customer, a combination of any, or other company specific data. If the output format does not support the series as a separate field, it will be prepended to the code for presentation with a dash (`-`) for separation.
|
73
|
+
# @return [GOBL::CBC::Code]
|
74
|
+
property :series, GOBL::CBC::Code
|
75
|
+
|
76
|
+
# @!attribute [r] code
|
77
|
+
# Code is a sequential identifier that uniquely identifies the order. The code can be left empty initially, but is **required** to **sign** the document.
|
78
|
+
# @return [GOBL::CBC::Code]
|
79
|
+
property :code, GOBL::CBC::Code
|
80
|
+
|
81
|
+
# @!attribute [r] issue_date
|
82
|
+
# When the invoice was created.
|
83
|
+
# @return [GOBL::Cal::Date]
|
84
|
+
property :issue_date, GOBL::Cal::Date
|
85
|
+
|
86
|
+
# @!attribute [r] issue_time
|
87
|
+
# IssueTime is an optional field that may be useful to indicate the time of day when the order was issued. Some regions and formats may require this field to be set. An empty string will be automatically updated to reflect the current time, otherwise the field can be left with a nil value.
|
88
|
+
# @return [GOBL::Cal::Time]
|
89
|
+
property :issue_time, GOBL::Cal::Time
|
90
|
+
|
91
|
+
# @!attribute [r] op_date
|
92
|
+
# Date when the operation defined by the invoice became effective.
|
93
|
+
# @return [GOBL::Cal::Date]
|
94
|
+
property :op_date, GOBL::Cal::Date
|
95
|
+
|
96
|
+
# @!attribute [r] value_date
|
97
|
+
# When the taxes of this invoice become accountable, if none set, the issue date is used.
|
98
|
+
# @return [GOBL::Cal::Date]
|
99
|
+
property :value_date, GOBL::Cal::Date
|
100
|
+
|
101
|
+
# @!attribute [r] currency
|
102
|
+
# Currency for all invoice totals.
|
103
|
+
# @return [GOBL::Currency::Code]
|
104
|
+
property :currency, GOBL::Currency::Code
|
105
|
+
|
106
|
+
# @!attribute [r] exchange_rates
|
107
|
+
# Exchange rates to be used when converting the invoices monetary values into other currencies.
|
108
|
+
# @return [Array<GOBL::Currency::ExchangeRate>]
|
109
|
+
property :exchange_rates, [GOBL::Currency::ExchangeRate]
|
110
|
+
|
111
|
+
# @!attribute [r] contracts
|
112
|
+
# The identification of contracts.
|
113
|
+
# @return [Array<GOBL::Org::DocumentRef>]
|
114
|
+
property :contracts, [GOBL::Org::DocumentRef]
|
115
|
+
|
116
|
+
# @!attribute [r] preceding
|
117
|
+
# Key information regarding previous order documents.
|
118
|
+
# @return [Array<GOBL::Org::DocumentRef>]
|
119
|
+
property :preceding, [GOBL::Org::DocumentRef]
|
120
|
+
|
121
|
+
# @!attribute [r] identities
|
122
|
+
# Additional codes, IDs, SKUs, or other regional or custom identifiers that may be used to identify the order.
|
123
|
+
# @return [Array<GOBL::Org::Identity>]
|
124
|
+
property :identities, [GOBL::Org::Identity]
|
125
|
+
|
126
|
+
# @!attribute [r] period
|
127
|
+
# Period of time in which the order is valid.
|
128
|
+
# @return [GOBL::Cal::Period]
|
129
|
+
property :period, GOBL::Cal::Period
|
130
|
+
|
131
|
+
# @!attribute [r] tax
|
132
|
+
# Special tax configuration for billing.
|
133
|
+
# @return [GOBL::Bill::Tax]
|
134
|
+
property :tax, GOBL::Bill::Tax
|
135
|
+
|
136
|
+
# @!attribute [r] supplier
|
137
|
+
# The entity supplying the goods or services and usually responsible for paying taxes.
|
138
|
+
# @return [GOBL::Org::Party]
|
139
|
+
property :supplier, GOBL::Org::Party
|
140
|
+
validates_presence_of :supplier
|
141
|
+
|
142
|
+
# @!attribute [r] customer
|
143
|
+
# Legal entity receiving the goods or services, may be nil in certain circumstances such as simplified invoices.
|
144
|
+
# @return [GOBL::Org::Party]
|
145
|
+
property :customer, GOBL::Org::Party
|
146
|
+
|
147
|
+
# @!attribute [r] buyer
|
148
|
+
# Party who is responsible for issuing payment, if not the same as the customer.
|
149
|
+
# @return [GOBL::Org::Party]
|
150
|
+
property :buyer, GOBL::Org::Party
|
151
|
+
|
152
|
+
# @!attribute [r] seller
|
153
|
+
# Seller is the party liable to pay taxes on the transaction if not the same as the supplier.
|
154
|
+
# @return [GOBL::Org::Party]
|
155
|
+
property :seller, GOBL::Org::Party
|
156
|
+
|
157
|
+
# @!attribute [r] lines
|
158
|
+
# List of lines representing each of the items to be ordered.
|
159
|
+
# @return [Array<GOBL::Bill::Line>]
|
160
|
+
property :lines, [GOBL::Bill::Line]
|
161
|
+
|
162
|
+
# @!attribute [r] discounts
|
163
|
+
# Discounts or allowances applied to order totals
|
164
|
+
# @return [Array<GOBL::Bill::Discount>]
|
165
|
+
property :discounts, [GOBL::Bill::Discount]
|
166
|
+
|
167
|
+
# @!attribute [r] charges
|
168
|
+
# Charges or surcharges applied to order totals
|
169
|
+
# @return [Array<GOBL::Bill::Charge>]
|
170
|
+
property :charges, [GOBL::Bill::Charge]
|
171
|
+
|
172
|
+
# @!attribute [r] payment
|
173
|
+
# Information on when, how, and to whom a final invoice would be paid.
|
174
|
+
# @return [GOBL::Bill::PaymentDetails]
|
175
|
+
property :payment, GOBL::Bill::PaymentDetails
|
176
|
+
|
177
|
+
# @!attribute [r] delivery
|
178
|
+
# Specific details on delivery of the goods to copy to the final invoice.
|
179
|
+
# @return [GOBL::Bill::DeliveryDetails]
|
180
|
+
property :delivery, GOBL::Bill::DeliveryDetails
|
181
|
+
|
182
|
+
# @!attribute [r] totals
|
183
|
+
# Summary of all the order totals, including taxes (calculated).
|
184
|
+
# @return [GOBL::Bill::Totals]
|
185
|
+
property :totals, GOBL::Bill::Totals
|
186
|
+
|
187
|
+
# @!attribute [r] notes
|
188
|
+
# Unstructured information that is relevant to the order, such as correction or additional legal details.
|
189
|
+
# @return [Array<GOBL::Org::Note>]
|
190
|
+
property :notes, [GOBL::Org::Note]
|
191
|
+
|
192
|
+
# @!attribute [r] complements
|
193
|
+
# Additional complementary objects that add relevant information to the order.
|
194
|
+
# @return [Array<GOBL::Schema::Object>]
|
195
|
+
property :complements, [GOBL::Schema::Object]
|
196
|
+
|
197
|
+
# @!attribute [r] meta
|
198
|
+
# Additional semi-structured data that doesn't fit into the body of the order.
|
199
|
+
# @return [GOBL::CBC::Meta]
|
200
|
+
property :meta, GOBL::CBC::Meta
|
201
|
+
|
202
|
+
# @!attribute [r] attachments
|
203
|
+
# Attachments provide additional information or supporting documents that are not included in the main document. It is important that attachments are not used for alternative versions of the PDF, for that, see "links" inside the envelope headers.
|
204
|
+
# @return [Array<GOBL::Org::Attachment>]
|
205
|
+
property :attachments, [GOBL::Org::Attachment]
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|