gobl 0.22.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 +1 -0
- data/data/regimes/be.json +1 -0
- data/data/regimes/br.json +135 -0
- data/data/regimes/ca.json +1 -0
- data/data/regimes/ch.json +1 -0
- data/data/regimes/co.json +0 -221
- data/data/regimes/de.json +14 -1
- data/data/regimes/el.json +8 -1
- data/data/regimes/es.json +3 -2
- data/data/regimes/fr.json +1 -0
- data/data/regimes/gb.json +1 -0
- data/data/regimes/in.json +128 -0
- data/data/regimes/it.json +2 -14
- data/data/regimes/mx.json +1 -0
- data/data/regimes/nl.json +1 -0
- data/data/regimes/pl.json +8 -7
- data/data/regimes/pt.json +1573 -9
- data/lib/generated/gobl/bill/charge.rb +34 -19
- data/lib/generated/gobl/bill/correction_options.rb +6 -1
- 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 +39 -32
- 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 +8 -3
- 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 +20 -1
- 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 -9
- 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/org/address.rb +9 -4
- data/lib/generated/gobl/org/attachment.rb +62 -0
- data/lib/generated/gobl/org/document_ref.rb +20 -5
- data/lib/generated/gobl/org/identity.rb +6 -1
- data/lib/generated/gobl/org/inbox.rb +22 -14
- data/lib/generated/gobl/org/item.rb +2 -3
- data/lib/generated/gobl/{cbc → org}/note.rb +16 -5
- data/lib/generated/gobl/org/party.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 +3 -1
- data/lib/generated/gobl/pay/card.rb +5 -2
- data/lib/generated/gobl/pay/instructions.rb +5 -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 +19 -4
- data/lib/generated/gobl/tax/catalogue_def.rb +39 -0
- data/lib/generated/gobl/tax/category_def.rb +4 -4
- data/lib/generated/gobl/tax/correction_definition.rb +5 -0
- data/lib/generated/gobl/tax/identity.rb +5 -0
- data/lib/generated/gobl/tax/regime_def.rb +17 -22
- data/lib/generated/gobl/tax/scenario.rb +6 -6
- data/lib/generated/gobl/tax/scenario_note.rb +42 -0
- data/lib/generated/gobl/tax/tag_set.rb +2 -2
- data/lib/generated/gobl/tax/total.rb +6 -1
- data/lib/gobl/version.rb +1 -1
- metadata +24 -13
- data/lib/generated/gobl/bill/outlay.rb +0 -58
- data/lib/generated/gobl/cbc/value_definition.rb +0 -37
- data/lib/generated/gobl/tax/source.rb +0 -27
@@ -10,27 +10,47 @@ module GOBL
|
|
10
10
|
# Charge represents a surchange applied to the complete document independent from the individual lines.
|
11
11
|
class Charge < GOBL::Object
|
12
12
|
# The Schema ID of the GOBL Charge structure
|
13
|
-
SCHEMA_ID = 'https://gobl.org/draft-0/bill/
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/charge'
|
14
14
|
|
15
15
|
# @!attribute [r] uuid
|
16
16
|
# Universally Unique Identifier.
|
17
17
|
# @return [String]
|
18
18
|
property :uuid, String
|
19
19
|
|
20
|
-
# @!attribute [r] key
|
21
|
-
# Key for grouping or identifying charges for tax purposes.
|
22
|
-
# @return [GOBL::CBC::Key]
|
23
|
-
property :key, GOBL::CBC::Key
|
24
|
-
|
25
20
|
# @!attribute [r] i
|
26
21
|
# Line number inside the list of charges (calculated).
|
27
22
|
# @return [Integer]
|
28
23
|
property :i, Integer
|
29
24
|
|
30
|
-
#
|
31
|
-
|
25
|
+
# Enumeration of possible values for {#key} with their corresponding descriptions
|
26
|
+
KEY_ENUM = {
|
27
|
+
'stamp-duty' => 'Stamp Duty',
|
28
|
+
'outlay' => 'Outlay',
|
29
|
+
'tax' => 'Tax',
|
30
|
+
'customs' => 'Customs',
|
31
|
+
'delivery' => 'Delivery',
|
32
|
+
'packing' => 'Packing',
|
33
|
+
'handling' => 'Handling',
|
34
|
+
'insurance' => 'Insurance',
|
35
|
+
'storage' => 'Storage',
|
36
|
+
'admin' => 'Administration',
|
37
|
+
'cleaning' => 'Cleaning'
|
38
|
+
}.freeze
|
39
|
+
|
40
|
+
# @!attribute [r] key
|
41
|
+
# Key for grouping or identifying charges for tax purposes. A suggested list of keys is provided, but these may be extended by the issuer.
|
42
|
+
# @return [GOBL::CBC::Key]
|
43
|
+
property :key, GOBL::CBC::Key
|
44
|
+
|
45
|
+
# @!attribute [r] code
|
46
|
+
# Code to used to refer to the this charge by the issuer
|
47
|
+
# @return [GOBL::CBC::Code]
|
48
|
+
property :code, GOBL::CBC::Code
|
49
|
+
|
50
|
+
# @!attribute [r] reason
|
51
|
+
# Text description as to why the charge was applied
|
32
52
|
# @return [String]
|
33
|
-
property :
|
53
|
+
property :reason, String
|
34
54
|
|
35
55
|
# @!attribute [r] base
|
36
56
|
# Base represents the value used as a base for percent calculations instead of the invoice's sum of lines.
|
@@ -38,7 +58,7 @@ module GOBL
|
|
38
58
|
property :base, GOBL::Num::Amount
|
39
59
|
|
40
60
|
# @!attribute [r] percent
|
41
|
-
# Percentage to apply to the
|
61
|
+
# Percentage to apply to the sum of all lines
|
42
62
|
# @return [GOBL::Num::Percentage]
|
43
63
|
property :percent, GOBL::Num::Percentage
|
44
64
|
|
@@ -52,15 +72,10 @@ module GOBL
|
|
52
72
|
# @return [GOBL::Tax::Set]
|
53
73
|
property :taxes, GOBL::Tax::Set
|
54
74
|
|
55
|
-
# @!attribute [r]
|
56
|
-
#
|
57
|
-
# @return [
|
58
|
-
property :
|
59
|
-
|
60
|
-
# @!attribute [r] reason
|
61
|
-
# Text description as to why the charge was applied
|
62
|
-
# @return [String]
|
63
|
-
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
|
64
79
|
|
65
80
|
# @!attribute [r] meta
|
66
81
|
# Additional semi-structured information.
|
@@ -39,9 +39,14 @@ module GOBL
|
|
39
39
|
property :reason, String
|
40
40
|
|
41
41
|
# @!attribute [r] ext
|
42
|
-
# Extensions for region specific requirements.
|
42
|
+
# Extensions for region specific requirements that may be added in the preceding or at the document level, according to the local rules.
|
43
43
|
# @return [GOBL::Tax::Extensions]
|
44
44
|
property :ext, GOBL::Tax::Extensions
|
45
|
+
|
46
|
+
# @!attribute [r] copy_tax
|
47
|
+
# CopyTax when true will copy the tax totals from the previous document to the preceding document data.
|
48
|
+
# @return [Boolean]
|
49
|
+
property :copy_tax, Boolean
|
45
50
|
end
|
46
51
|
end
|
47
52
|
end
|
@@ -7,35 +7,203 @@
|
|
7
7
|
|
8
8
|
module GOBL
|
9
9
|
module Bill
|
10
|
-
# Delivery
|
10
|
+
# Delivery document used to describe the delivery of goods or potentially also services.
|
11
11
|
class Delivery < GOBL::Object
|
12
12
|
# The Schema ID of the GOBL Delivery structure
|
13
|
-
SCHEMA_ID = 'https://gobl.org/draft-0/bill/
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/delivery'
|
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
|
+
'advice' => 'A delivery or despatch advice document send by the supplier to indicate how
|
61
|
+
an order is to be delivered.',
|
62
|
+
'note' => 'A delivery note is a document accompanying a shipment of goods that lists the
|
63
|
+
items included in the shipment.',
|
64
|
+
'waybill' => 'A waybill is a document issued by a carrier giving details and instructions
|
65
|
+
relating to the shipment of a consignment of goods.',
|
66
|
+
'receipt' => 'A delivery receipt is a document that is signed by the person who receives
|
67
|
+
goods to confirm that they have been received.'
|
68
|
+
}.freeze
|
69
|
+
|
70
|
+
# @!attribute [r] type
|
71
|
+
# Type of delivery document.
|
72
|
+
# @return [GOBL::CBC::Key]
|
73
|
+
property :type, GOBL::CBC::Key
|
74
|
+
validates_presence_of :type
|
75
|
+
validates_inclusion_of :type, in: TYPE_ENUM.keys
|
76
|
+
|
77
|
+
# @!attribute [r] series
|
78
|
+
# Series is used to identify groups of deliveries 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.
|
79
|
+
# @return [GOBL::CBC::Code]
|
80
|
+
property :series, GOBL::CBC::Code
|
81
|
+
|
82
|
+
# @!attribute [r] code
|
83
|
+
# Code is a sequential identifier that uniquely identifies the delivery. The code can be left empty initially, but is **required** to **sign** the document.
|
84
|
+
# @return [GOBL::CBC::Code]
|
85
|
+
property :code, GOBL::CBC::Code
|
86
|
+
|
87
|
+
# @!attribute [r] issue_date
|
88
|
+
# When the delivery document is to be issued.
|
89
|
+
# @return [GOBL::Cal::Date]
|
90
|
+
property :issue_date, GOBL::Cal::Date
|
91
|
+
|
92
|
+
# @!attribute [r] issue_time
|
93
|
+
# IssueTime is an optional field that may be useful to indicate the time of day when the delivery 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.
|
94
|
+
# @return [GOBL::Cal::Time]
|
95
|
+
property :issue_time, GOBL::Cal::Time
|
96
|
+
|
97
|
+
# @!attribute [r] value_date
|
98
|
+
# When the taxes of this delivery become accountable, if none set, the issue date is used.
|
99
|
+
# @return [GOBL::Cal::Date]
|
100
|
+
property :value_date, GOBL::Cal::Date
|
101
|
+
|
102
|
+
# @!attribute [r] currency
|
103
|
+
# Currency for all delivery totals.
|
104
|
+
# @return [GOBL::Currency::Code]
|
105
|
+
property :currency, GOBL::Currency::Code
|
106
|
+
|
107
|
+
# @!attribute [r] exchange_rates
|
108
|
+
# Exchange rates to be used when converting the invoices monetary values into other currencies.
|
109
|
+
# @return [Array<GOBL::Currency::ExchangeRate>]
|
110
|
+
property :exchange_rates, [GOBL::Currency::ExchangeRate]
|
111
|
+
|
112
|
+
# @!attribute [r] ordering
|
113
|
+
# Ordering details for the delivery, including links to other documents.
|
114
|
+
# @return [GOBL::Bill::Ordering]
|
115
|
+
property :ordering, GOBL::Bill::Ordering
|
116
|
+
|
117
|
+
# @!attribute [r] preceding
|
118
|
+
# Key information regarding previous delivery documents that this one will either extend or replace.
|
119
|
+
# @return [Array<GOBL::Org::DocumentRef>]
|
120
|
+
property :preceding, [GOBL::Org::DocumentRef]
|
121
|
+
|
122
|
+
# @!attribute [r] tracking
|
123
|
+
# Tracking is used to define specific codes or IDs that may be used to identify and track delivery.
|
124
|
+
# @return [Tracking]
|
125
|
+
property :tracking, Tracking
|
126
|
+
|
127
|
+
# @!attribute [r] despatch_date
|
128
|
+
# DespatchDate is the date when the goods are expected to be despatched.
|
129
|
+
# @return [GOBL::Cal::Date]
|
130
|
+
property :despatch_date, GOBL::Cal::Date
|
131
|
+
|
132
|
+
# @!attribute [r] receive_date
|
133
|
+
# ReceiveDate is the date when the goods are expected to be received.
|
134
|
+
# @return [GOBL::Cal::Date]
|
135
|
+
property :receive_date, GOBL::Cal::Date
|
136
|
+
|
137
|
+
# @!attribute [r] tax
|
138
|
+
# Special tax configuration for calculating totals.
|
139
|
+
# @return [GOBL::Bill::Tax]
|
140
|
+
property :tax, GOBL::Bill::Tax
|
141
|
+
|
142
|
+
# @!attribute [r] supplier
|
143
|
+
# The entity supplying the goods or services and usually responsible for paying taxes.
|
144
|
+
# @return [GOBL::Org::Party]
|
145
|
+
property :supplier, GOBL::Org::Party
|
146
|
+
validates_presence_of :supplier
|
147
|
+
|
148
|
+
# @!attribute [r] customer
|
149
|
+
# Legal entity receiving the goods or services, may be nil in certain circumstances such as simplified invoices.
|
150
|
+
# @return [GOBL::Org::Party]
|
151
|
+
property :customer, GOBL::Org::Party
|
152
|
+
|
153
|
+
# @!attribute [r] despatcher
|
154
|
+
# The party who will despatch the goods defined in the invoice.
|
155
|
+
# @return [GOBL::Org::Party]
|
156
|
+
property :despatcher, GOBL::Org::Party
|
14
157
|
|
15
158
|
# @!attribute [r] receiver
|
16
|
-
# The party who will receive delivery of the goods defined in the invoice
|
159
|
+
# The party who will receive delivery of the goods defined in the invoice.
|
17
160
|
# @return [GOBL::Org::Party]
|
18
161
|
property :receiver, GOBL::Org::Party
|
19
162
|
|
20
|
-
# @!attribute [r]
|
21
|
-
#
|
22
|
-
# @return [
|
23
|
-
property :
|
163
|
+
# @!attribute [r] courier
|
164
|
+
# The courier responsible for delivering the goods.
|
165
|
+
# @return [GOBL::Org::Party]
|
166
|
+
property :courier, GOBL::Org::Party
|
24
167
|
|
25
|
-
# @!attribute [r]
|
26
|
-
#
|
27
|
-
# @return [GOBL::
|
28
|
-
property :
|
168
|
+
# @!attribute [r] lines
|
169
|
+
# List of lines representing each of the items to be ordered.
|
170
|
+
# @return [Array<GOBL::Bill::Line>]
|
171
|
+
property :lines, [GOBL::Bill::Line]
|
172
|
+
|
173
|
+
# @!attribute [r] discounts
|
174
|
+
# Discounts or allowances applied to order totals
|
175
|
+
# @return [Array<GOBL::Bill::Discount>]
|
176
|
+
property :discounts, [GOBL::Bill::Discount]
|
29
177
|
|
30
|
-
# @!attribute [r]
|
31
|
-
#
|
32
|
-
# @return [GOBL::
|
33
|
-
property :
|
178
|
+
# @!attribute [r] charges
|
179
|
+
# Charges or surcharges applied to order totals
|
180
|
+
# @return [Array<GOBL::Bill::Charge>]
|
181
|
+
property :charges, [GOBL::Bill::Charge]
|
182
|
+
|
183
|
+
# @!attribute [r] totals
|
184
|
+
# Summary of all the order totals, including taxes (calculated).
|
185
|
+
# @return [GOBL::Bill::Totals]
|
186
|
+
property :totals, GOBL::Bill::Totals
|
187
|
+
|
188
|
+
# @!attribute [r] notes
|
189
|
+
# Unstructured information that is relevant to the delivery, such as correction or additional legal details.
|
190
|
+
# @return [Array<GOBL::Org::Note>]
|
191
|
+
property :notes, [GOBL::Org::Note]
|
192
|
+
|
193
|
+
# @!attribute [r] complements
|
194
|
+
# Additional complementary objects that add relevant information to the delivery.
|
195
|
+
# @return [Array<GOBL::Schema::Object>]
|
196
|
+
property :complements, [GOBL::Schema::Object]
|
34
197
|
|
35
198
|
# @!attribute [r] meta
|
36
|
-
# Additional
|
199
|
+
# Additional semi-structured data that doesn't fit into the body of the delivery.
|
37
200
|
# @return [GOBL::CBC::Meta]
|
38
201
|
property :meta, GOBL::CBC::Meta
|
202
|
+
|
203
|
+
# @!attribute [r] attachments
|
204
|
+
# 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.
|
205
|
+
# @return [Array<GOBL::Org::Attachment>]
|
206
|
+
property :attachments, [GOBL::Org::Attachment]
|
39
207
|
end
|
40
208
|
end
|
41
209
|
end
|
@@ -0,0 +1,41 @@
|
|
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
|
+
# DeliveryDetails covers the details of the destination for the products described in the invoice body.
|
11
|
+
class DeliveryDetails < GOBL::Object
|
12
|
+
# The Schema ID of the GOBL DeliveryDetails structure
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/delivery-details'
|
14
|
+
|
15
|
+
# @!attribute [r] receiver
|
16
|
+
# The party who will receive delivery of the goods defined in the invoice and is not responsible for taxes.
|
17
|
+
# @return [GOBL::Org::Party]
|
18
|
+
property :receiver, GOBL::Org::Party
|
19
|
+
|
20
|
+
# @!attribute [r] identities
|
21
|
+
# Identities is used to define specific codes or IDs that may be used to identify the delivery.
|
22
|
+
# @return [Array<GOBL::Org::Identity>]
|
23
|
+
property :identities, [GOBL::Org::Identity]
|
24
|
+
|
25
|
+
# @!attribute [r] date
|
26
|
+
# When the goods should be expected.
|
27
|
+
# @return [GOBL::Cal::Date]
|
28
|
+
property :date, GOBL::Cal::Date
|
29
|
+
|
30
|
+
# @!attribute [r] period
|
31
|
+
# Period of time in which to expect delivery if a specific date is not available.
|
32
|
+
# @return [GOBL::Cal::Period]
|
33
|
+
property :period, GOBL::Cal::Period
|
34
|
+
|
35
|
+
# @!attribute [r] meta
|
36
|
+
# Additional custom data.
|
37
|
+
# @return [GOBL::CBC::Meta]
|
38
|
+
property :meta, GOBL::CBC::Meta
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -10,7 +10,7 @@ module GOBL
|
|
10
10
|
# Discount represents an allowance applied to the complete document independent from the individual lines.
|
11
11
|
class Discount < GOBL::Object
|
12
12
|
# The Schema ID of the GOBL Discount structure
|
13
|
-
SCHEMA_ID = 'https://gobl.org/draft-0/bill/
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/discount'
|
14
14
|
|
15
15
|
# @!attribute [r] uuid
|
16
16
|
# Universally Unique Identifier.
|
@@ -22,10 +22,38 @@ module GOBL
|
|
22
22
|
# @return [Integer]
|
23
23
|
property :i, Integer
|
24
24
|
|
25
|
-
#
|
26
|
-
|
25
|
+
# Enumeration of possible values for {#key} with their corresponding descriptions
|
26
|
+
KEY_ENUM = {
|
27
|
+
'early-completion' => 'Bonus for works ahead of schedule',
|
28
|
+
'military' => 'Military Discount',
|
29
|
+
'work-accident' => 'Work Accident Discount',
|
30
|
+
'special-agreement' => 'Special Agreement Discount',
|
31
|
+
'production-error' => 'Production Error Discount',
|
32
|
+
'new-outlet' => 'New Outlet Discount',
|
33
|
+
'sample' => 'Sample Discount',
|
34
|
+
'end-of-range' => 'End of Range Discount',
|
35
|
+
'incoterm' => 'Incoterm Discount',
|
36
|
+
'pos-threshold' => 'Point of Sale Threshold Discount',
|
37
|
+
'special-rebate' => 'Special Rebate',
|
38
|
+
'temporary' => 'Temporary',
|
39
|
+
'standard' => 'Standard',
|
40
|
+
'yearly-turnover' => 'Yearly Turnover'
|
41
|
+
}.freeze
|
42
|
+
|
43
|
+
# @!attribute [r] key
|
44
|
+
# Key for identifying the type of discount being applied.
|
45
|
+
# @return [GOBL::CBC::Key]
|
46
|
+
property :key, GOBL::CBC::Key
|
47
|
+
|
48
|
+
# @!attribute [r] code
|
49
|
+
# Code to used to refer to the this discount by the issuer
|
50
|
+
# @return [GOBL::CBC::Code]
|
51
|
+
property :code, GOBL::CBC::Code
|
52
|
+
|
53
|
+
# @!attribute [r] reason
|
54
|
+
# Text description as to why the discount was applied
|
27
55
|
# @return [String]
|
28
|
-
property :
|
56
|
+
property :reason, String
|
29
57
|
|
30
58
|
# @!attribute [r] base
|
31
59
|
# Base represents the value used as a base for percent calculations instead of the invoice's sum of lines.
|
@@ -47,15 +75,10 @@ module GOBL
|
|
47
75
|
# @return [GOBL::Tax::Set]
|
48
76
|
property :taxes, GOBL::Tax::Set
|
49
77
|
|
50
|
-
# @!attribute [r]
|
51
|
-
#
|
52
|
-
# @return [
|
53
|
-
property :
|
54
|
-
|
55
|
-
# @!attribute [r] reason
|
56
|
-
# Text description as to why the discount was applied
|
57
|
-
# @return [String]
|
58
|
-
property :reason, String
|
78
|
+
# @!attribute [r] ext
|
79
|
+
# Extension codes that apply to the discount
|
80
|
+
# @return [GOBL::Tax::Extensions]
|
81
|
+
property :ext, GOBL::Tax::Extensions
|
59
82
|
|
60
83
|
# @!attribute [r] meta
|
61
84
|
# Additional semi-structured information.
|
@@ -14,8 +14,10 @@ module GOBL
|
|
14
14
|
|
15
15
|
# Enumeration of possible values for {#$regime} with their corresponding descriptions
|
16
16
|
$REGIME_ENUM = {
|
17
|
+
'AE' => 'United Arab Emirates',
|
17
18
|
'AT' => 'Austria',
|
18
19
|
'BE' => 'Belgium',
|
20
|
+
'BR' => 'Brazil',
|
19
21
|
'CA' => 'Canada',
|
20
22
|
'CH' => 'Switzerland',
|
21
23
|
'CO' => 'Colombia',
|
@@ -24,6 +26,7 @@ module GOBL
|
|
24
26
|
'ES' => 'Spain',
|
25
27
|
'FR' => 'France',
|
26
28
|
'GB' => 'United Kingdom',
|
29
|
+
'IN' => 'India',
|
27
30
|
'IT' => 'Italy',
|
28
31
|
'MX' => 'Mexico',
|
29
32
|
'NL' => 'The Netherlands',
|
@@ -68,27 +71,31 @@ module GOBL
|
|
68
71
|
}.freeze
|
69
72
|
|
70
73
|
# @!attribute [r] type
|
71
|
-
# Type of invoice document
|
74
|
+
# Type of invoice document. May be restricted by local tax regime requirements.
|
72
75
|
# @return [GOBL::CBC::Key]
|
73
76
|
property :type, GOBL::CBC::Key
|
74
77
|
validates_inclusion_of :type, in: TYPE_ENUM.keys, allow_blank: true
|
75
78
|
|
76
79
|
# @!attribute [r] series
|
77
|
-
#
|
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.
|
78
81
|
# @return [GOBL::CBC::Code]
|
79
82
|
property :series, GOBL::CBC::Code
|
80
83
|
|
81
84
|
# @!attribute [r] code
|
82
|
-
#
|
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.
|
83
86
|
# @return [GOBL::CBC::Code]
|
84
87
|
property :code, GOBL::CBC::Code
|
85
|
-
validates_presence_of :code
|
86
88
|
|
87
89
|
# @!attribute [r] issue_date
|
88
|
-
#
|
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.
|
89
91
|
# @return [GOBL::Cal::Date]
|
90
92
|
property :issue_date, GOBL::Cal::Date
|
91
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
|
+
|
92
99
|
# @!attribute [r] op_date
|
93
100
|
# Date when the operation defined by the invoice became effective.
|
94
101
|
# @return [GOBL::Cal::Date]
|
@@ -100,7 +107,7 @@ module GOBL
|
|
100
107
|
property :value_date, GOBL::Cal::Date
|
101
108
|
|
102
109
|
# @!attribute [r] currency
|
103
|
-
# Currency for all invoice totals.
|
110
|
+
# Currency for all invoice amounts and totals, unless explicitly stated otherwise.
|
104
111
|
# @return [GOBL::Currency::Code]
|
105
112
|
property :currency, GOBL::Currency::Code
|
106
113
|
|
@@ -110,17 +117,17 @@ module GOBL
|
|
110
117
|
property :exchange_rates, [GOBL::Currency::ExchangeRate]
|
111
118
|
|
112
119
|
# @!attribute [r] preceding
|
113
|
-
#
|
120
|
+
# Document references for previous invoices that this document replaces or extends.
|
114
121
|
# @return [Array<GOBL::Org::DocumentRef>]
|
115
122
|
property :preceding, [GOBL::Org::DocumentRef]
|
116
123
|
|
117
124
|
# @!attribute [r] tax
|
118
|
-
# Special tax configuration
|
119
|
-
# @return [Tax]
|
120
|
-
property :tax, Tax
|
125
|
+
# Special billing tax configuration options.
|
126
|
+
# @return [GOBL::Bill::Tax]
|
127
|
+
property :tax, GOBL::Bill::Tax
|
121
128
|
|
122
129
|
# @!attribute [r] supplier
|
123
|
-
# The
|
130
|
+
# The entity supplying the goods or services and usually responsible for paying taxes.
|
124
131
|
# @return [GOBL::Org::Party]
|
125
132
|
property :supplier, GOBL::Org::Party
|
126
133
|
validates_presence_of :supplier
|
@@ -132,48 +139,43 @@ module GOBL
|
|
132
139
|
|
133
140
|
# @!attribute [r] lines
|
134
141
|
# List of invoice lines representing each of the items sold to the customer.
|
135
|
-
# @return [Array<Line>]
|
136
|
-
property :lines, [Line]
|
142
|
+
# @return [Array<GOBL::Bill::Line>]
|
143
|
+
property :lines, [GOBL::Bill::Line]
|
137
144
|
|
138
145
|
# @!attribute [r] discounts
|
139
146
|
# Discounts or allowances applied to the complete invoice
|
140
|
-
# @return [Array<Discount>]
|
141
|
-
property :discounts, [Discount]
|
147
|
+
# @return [Array<GOBL::Bill::Discount>]
|
148
|
+
property :discounts, [GOBL::Bill::Discount]
|
142
149
|
|
143
150
|
# @!attribute [r] charges
|
144
151
|
# Charges or surcharges applied to the complete invoice
|
145
|
-
# @return [Array<Charge>]
|
146
|
-
property :charges, [Charge]
|
147
|
-
|
148
|
-
# @!attribute [r] outlays
|
149
|
-
# Expenses paid for by the supplier but invoiced directly to the customer.
|
150
|
-
# @return [Array<Outlay>]
|
151
|
-
property :outlays, [Outlay]
|
152
|
+
# @return [Array<GOBL::Bill::Charge>]
|
153
|
+
property :charges, [GOBL::Bill::Charge]
|
152
154
|
|
153
155
|
# @!attribute [r] ordering
|
154
156
|
# Ordering details including document references and buyer or seller parties.
|
155
|
-
# @return [Ordering]
|
156
|
-
property :ordering, Ordering
|
157
|
+
# @return [GOBL::Bill::Ordering]
|
158
|
+
property :ordering, GOBL::Bill::Ordering
|
157
159
|
|
158
160
|
# @!attribute [r] payment
|
159
161
|
# Information on when, how, and to whom the invoice should be paid.
|
160
|
-
# @return [
|
161
|
-
property :payment,
|
162
|
+
# @return [GOBL::Bill::PaymentDetails]
|
163
|
+
property :payment, GOBL::Bill::PaymentDetails
|
162
164
|
|
163
165
|
# @!attribute [r] delivery
|
164
166
|
# Specific details on delivery of the goods referenced in the invoice.
|
165
|
-
# @return [
|
166
|
-
property :delivery,
|
167
|
+
# @return [GOBL::Bill::DeliveryDetails]
|
168
|
+
property :delivery, GOBL::Bill::DeliveryDetails
|
167
169
|
|
168
170
|
# @!attribute [r] totals
|
169
171
|
# Summary of all the invoice totals, including taxes (calculated).
|
170
|
-
# @return [Totals]
|
171
|
-
property :totals, Totals
|
172
|
+
# @return [GOBL::Bill::Totals]
|
173
|
+
property :totals, GOBL::Bill::Totals
|
172
174
|
|
173
175
|
# @!attribute [r] notes
|
174
176
|
# Unstructured information that is relevant to the invoice, such as correction or additional legal details.
|
175
|
-
# @return [Array<GOBL::
|
176
|
-
property :notes, [GOBL::
|
177
|
+
# @return [Array<GOBL::Org::Note>]
|
178
|
+
property :notes, [GOBL::Org::Note]
|
177
179
|
|
178
180
|
# @!attribute [r] complements
|
179
181
|
# Additional complementary objects that add relevant information to the invoice.
|
@@ -184,6 +186,11 @@ module GOBL
|
|
184
186
|
# Additional semi-structured data that doesn't fit into the body of the invoice.
|
185
187
|
# @return [GOBL::CBC::Meta]
|
186
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]
|
187
194
|
end
|
188
195
|
end
|
189
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
|