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
@@ -10,67 +10,72 @@ module GOBL
|
|
10
10
|
# Ordering provides additional information about the ordering process including references to other documents and alternative parties involved in the order-to-delivery process.
|
11
11
|
class Ordering < GOBL::Object
|
12
12
|
# The Schema ID of the GOBL Ordering structure
|
13
|
-
SCHEMA_ID = 'https://gobl.org/draft-0/bill/
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/ordering'
|
14
14
|
|
15
15
|
# @!attribute [r] code
|
16
16
|
# Identifier assigned by the customer or buyer for internal routing purposes.
|
17
|
-
# @return [
|
18
|
-
property :code,
|
17
|
+
# @return [GOBL::CBC::Code]
|
18
|
+
property :code, GOBL::CBC::Code
|
19
19
|
|
20
20
|
# @!attribute [r] identities
|
21
21
|
# Any additional Codes, IDs, SKUs, or other regional or custom identifiers that may be used to identify the order.
|
22
22
|
# @return [Array<GOBL::Org::Identity>]
|
23
23
|
property :identities, [GOBL::Org::Identity]
|
24
24
|
|
25
|
+
# @!attribute [r] cost
|
26
|
+
# Buyer accounting reference cost code associated with the document.
|
27
|
+
# @return [GOBL::CBC::Code]
|
28
|
+
property :cost, GOBL::CBC::Code
|
29
|
+
|
25
30
|
# @!attribute [r] period
|
26
31
|
# Period of time that the invoice document refers to often used in addition to the details provided in the individual line items.
|
27
32
|
# @return [GOBL::Cal::Period]
|
28
33
|
property :period, GOBL::Cal::Period
|
29
34
|
|
30
|
-
# @!attribute [r]
|
31
|
-
#
|
32
|
-
# @return [
|
33
|
-
property :
|
35
|
+
# @!attribute [r] buyer
|
36
|
+
# Party who is responsible for issuing payment, if not the same as the customer.
|
37
|
+
# @return [GOBL::Org::Party]
|
38
|
+
property :buyer, GOBL::Org::Party
|
39
|
+
|
40
|
+
# @!attribute [r] seller
|
41
|
+
# Seller is the party liable to pay taxes on the transaction if not the same as the supplier.
|
42
|
+
# @return [GOBL::Org::Party]
|
43
|
+
property :seller, GOBL::Org::Party
|
44
|
+
|
45
|
+
# @!attribute [r] projects
|
46
|
+
# Projects this invoice refers to.
|
47
|
+
# @return [Array<GOBL::Org::DocumentRef>]
|
48
|
+
property :projects, [GOBL::Org::DocumentRef]
|
34
49
|
|
35
|
-
# @!attribute [r]
|
36
|
-
# The identification of
|
37
|
-
# @return [
|
38
|
-
property :
|
50
|
+
# @!attribute [r] contracts
|
51
|
+
# The identification of contracts.
|
52
|
+
# @return [Array<GOBL::Org::DocumentRef>]
|
53
|
+
property :contracts, [GOBL::Org::DocumentRef]
|
39
54
|
|
40
|
-
# @!attribute [r]
|
41
|
-
# Purchase
|
42
|
-
# @return [
|
43
|
-
property :
|
55
|
+
# @!attribute [r] purchases
|
56
|
+
# Purchase orders issued by the customer or buyer.
|
57
|
+
# @return [Array<GOBL::Org::DocumentRef>]
|
58
|
+
property :purchases, [GOBL::Org::DocumentRef]
|
44
59
|
|
45
|
-
# @!attribute [r]
|
46
|
-
# Sales
|
47
|
-
# @return [
|
48
|
-
property :
|
60
|
+
# @!attribute [r] sales
|
61
|
+
# Sales orders issued by the supplier or seller.
|
62
|
+
# @return [Array<GOBL::Org::DocumentRef>]
|
63
|
+
property :sales, [GOBL::Org::DocumentRef]
|
49
64
|
|
50
65
|
# @!attribute [r] receiving
|
51
66
|
# Receiving Advice.
|
52
|
-
# @return [
|
53
|
-
property :receiving,
|
67
|
+
# @return [Array<GOBL::Org::DocumentRef>]
|
68
|
+
property :receiving, [GOBL::Org::DocumentRef]
|
54
69
|
|
55
70
|
# @!attribute [r] despatch
|
56
71
|
# Despatch advice.
|
57
|
-
# @return [
|
58
|
-
property :despatch,
|
72
|
+
# @return [Array<GOBL::Org::DocumentRef>]
|
73
|
+
property :despatch, [GOBL::Org::DocumentRef]
|
59
74
|
|
60
75
|
# @!attribute [r] tender
|
61
76
|
# Tender advice, the identification of the call for tender or lot the invoice relates to.
|
62
|
-
# @return [
|
63
|
-
property :tender,
|
64
|
-
|
65
|
-
# @!attribute [r] buyer
|
66
|
-
# Party who is responsible for making the purchase, but is not responsible for handling taxes.
|
67
|
-
# @return [GOBL::Org::Party]
|
68
|
-
property :buyer, GOBL::Org::Party
|
69
|
-
|
70
|
-
# @!attribute [r] seller
|
71
|
-
# Party who is selling the goods but is not responsible for taxes like the supplier.
|
72
|
-
# @return [GOBL::Org::Party]
|
73
|
-
property :seller, GOBL::Org::Party
|
77
|
+
# @return [Array<GOBL::Org::DocumentRef>]
|
78
|
+
property :tender, [GOBL::Org::DocumentRef]
|
74
79
|
end
|
75
80
|
end
|
76
81
|
end
|
@@ -7,30 +7,170 @@
|
|
7
7
|
|
8
8
|
module GOBL
|
9
9
|
module Bill
|
10
|
-
# Payment
|
10
|
+
# A Payment is used to link an invoice or invoices with a payment transaction.
|
11
11
|
class Payment < GOBL::Object
|
12
12
|
# The Schema ID of the GOBL Payment structure
|
13
|
-
SCHEMA_ID = 'https://gobl.org/draft-0/bill/
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/payment'
|
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
|
+
'request' => 'A payment request sent from the supplier to a customer indicating that they are
|
61
|
+
requesting a transfer of funds from the customer directly or a payer.
|
62
|
+
This is used to request payment for specific documents and invoices.',
|
63
|
+
'advice' => 'A remittance advice sent from the customer to the supplier reflecting that payment for
|
64
|
+
the referenced documents has been made.',
|
65
|
+
'receipt' => 'A payment receipt sent from the supplier to a customer indicating that they have
|
66
|
+
received a transfer of funds from the customer directly or a payer.
|
67
|
+
This is the default payment type and may be required by some tax
|
68
|
+
regimes in order to communicate the payment of specific documents and invoices.'
|
69
|
+
}.freeze
|
70
|
+
|
71
|
+
# @!attribute [r] type
|
72
|
+
# Type of payment document being issued.
|
73
|
+
# @return [GOBL::CBC::Key]
|
74
|
+
property :type, GOBL::CBC::Key
|
75
|
+
validates_inclusion_of :type, in: TYPE_ENUM.keys, allow_blank: true
|
76
|
+
|
77
|
+
# @!attribute [r] method
|
78
|
+
# Details on how the payment was made based on the original instructions.
|
79
|
+
# @return [GOBL::Pay::Instructions]
|
80
|
+
property :method, GOBL::Pay::Instructions
|
81
|
+
|
82
|
+
# @!attribute [r] series
|
83
|
+
# Series is used to identify groups of payments 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.
|
84
|
+
# @return [GOBL::CBC::Code]
|
85
|
+
property :series, GOBL::CBC::Code
|
86
|
+
|
87
|
+
# @!attribute [r] code
|
88
|
+
# Code is a sequential identifier that uniquely identifies the payment. The code can be left empty initially, but is **required** to **sign** the document.
|
89
|
+
# @return [GOBL::CBC::Code]
|
90
|
+
property :code, GOBL::CBC::Code
|
91
|
+
|
92
|
+
# @!attribute [r] issue_date
|
93
|
+
# When the payment was issued.
|
94
|
+
# @return [GOBL::Cal::Date]
|
95
|
+
property :issue_date, GOBL::Cal::Date
|
96
|
+
|
97
|
+
# @!attribute [r] issue_time
|
98
|
+
# IssueTime is an optional field that may be useful to indicate the time of day when the payment was issued.
|
99
|
+
# @return [GOBL::Cal::Time]
|
100
|
+
property :issue_time, GOBL::Cal::Time
|
101
|
+
|
102
|
+
# @!attribute [r] value_date
|
103
|
+
# When the taxes of this payment become accountable, if none set, the issue date is assumed.
|
104
|
+
# @return [GOBL::Cal::Date]
|
105
|
+
property :value_date, GOBL::Cal::Date
|
106
|
+
|
107
|
+
# @!attribute [r] currency
|
108
|
+
# Currency for all payment totals.
|
109
|
+
# @return [GOBL::Currency::Code]
|
110
|
+
property :currency, GOBL::Currency::Code
|
111
|
+
|
112
|
+
# @!attribute [r] exchange_rates
|
113
|
+
# Exchange rates to be used when converting the payment's monetary values into other currencies.
|
114
|
+
# @return [Array<GOBL::Currency::ExchangeRate>]
|
115
|
+
property :exchange_rates, [GOBL::Currency::ExchangeRate]
|
116
|
+
|
117
|
+
# @!attribute [r] ext
|
118
|
+
# Extensions for additional codes that may be required.
|
119
|
+
# @return [GOBL::Tax::Extensions]
|
120
|
+
property :ext, GOBL::Tax::Extensions
|
121
|
+
|
122
|
+
# @!attribute [r] preceding
|
123
|
+
# Key information regarding previous versions of this document.
|
124
|
+
# @return [Array<GOBL::Org::DocumentRef>]
|
125
|
+
property :preceding, [GOBL::Org::DocumentRef]
|
126
|
+
|
127
|
+
# @!attribute [r] supplier
|
128
|
+
# The taxable entity who is responsible for supplying goods or services.
|
129
|
+
# @return [GOBL::Org::Party]
|
130
|
+
property :supplier, GOBL::Org::Party
|
131
|
+
validates_presence_of :supplier
|
132
|
+
|
133
|
+
# @!attribute [r] customer
|
134
|
+
# Legal entity that receives the goods or services.
|
135
|
+
# @return [GOBL::Org::Party]
|
136
|
+
property :customer, GOBL::Org::Party
|
14
137
|
|
15
138
|
# @!attribute [r] payee
|
16
|
-
#
|
139
|
+
# Legal entity that receives the payment if not the supplier.
|
17
140
|
# @return [GOBL::Org::Party]
|
18
141
|
property :payee, GOBL::Org::Party
|
19
142
|
|
20
|
-
# @!attribute [r]
|
21
|
-
#
|
22
|
-
# @return [
|
23
|
-
property :
|
143
|
+
# @!attribute [r] lines
|
144
|
+
# List of documents that are being paid for.
|
145
|
+
# @return [Array<PaymentLine>]
|
146
|
+
property :lines, [PaymentLine]
|
147
|
+
validates_presence_of :lines
|
24
148
|
|
25
|
-
# @!attribute [r]
|
26
|
-
#
|
27
|
-
# @return [
|
28
|
-
property :
|
149
|
+
# @!attribute [r] ordering
|
150
|
+
# Ordering allows for additional information about the ordering process including references to other documents and alternative parties involved in the order-to-delivery process.
|
151
|
+
# @return [GOBL::Bill::Ordering]
|
152
|
+
property :ordering, GOBL::Bill::Ordering
|
29
153
|
|
30
|
-
# @!attribute [r]
|
31
|
-
#
|
32
|
-
# @return [GOBL::
|
33
|
-
property :
|
154
|
+
# @!attribute [r] total
|
155
|
+
# Total amount to be paid in this payment, either positive or negative according to the line types and totals. Calculated automatically.
|
156
|
+
# @return [GOBL::Num::Amount]
|
157
|
+
property :total, GOBL::Num::Amount
|
158
|
+
validates_presence_of :total
|
159
|
+
|
160
|
+
# @!attribute [r] notes
|
161
|
+
# Unstructured information that is relevant to the payment, such as correction or additional legal details.
|
162
|
+
# @return [Array<GOBL::Org::Note>]
|
163
|
+
property :notes, [GOBL::Org::Note]
|
164
|
+
|
165
|
+
# @!attribute [r] complements
|
166
|
+
# Additional complementary objects that add relevant information to the payment.
|
167
|
+
# @return [Array<GOBL::Schema::Object>]
|
168
|
+
property :complements, [GOBL::Schema::Object]
|
169
|
+
|
170
|
+
# @!attribute [r] meta
|
171
|
+
# Additional semi-structured data that doesn't fit into the body of the invoice.
|
172
|
+
# @return [GOBL::CBC::Meta]
|
173
|
+
property :meta, GOBL::CBC::Meta
|
34
174
|
end
|
35
175
|
end
|
36
176
|
end
|
@@ -0,0 +1,36 @@
|
|
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
|
+
# PaymentDetails contains details as to how the invoice should be paid.
|
11
|
+
class PaymentDetails < GOBL::Object
|
12
|
+
# The Schema ID of the GOBL PaymentDetails structure
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/payment-details'
|
14
|
+
|
15
|
+
# @!attribute [r] payee
|
16
|
+
# The party responsible for receiving payment of the invoice, if not the supplier.
|
17
|
+
# @return [GOBL::Org::Party]
|
18
|
+
property :payee, GOBL::Org::Party
|
19
|
+
|
20
|
+
# @!attribute [r] terms
|
21
|
+
# Payment terms or conditions.
|
22
|
+
# @return [GOBL::Pay::Terms]
|
23
|
+
property :terms, GOBL::Pay::Terms
|
24
|
+
|
25
|
+
# @!attribute [r] advances
|
26
|
+
# Any amounts that have been paid in advance and should be deducted from the amount due.
|
27
|
+
# @return [Array<GOBL::Pay::Advance>]
|
28
|
+
property :advances, [GOBL::Pay::Advance]
|
29
|
+
|
30
|
+
# @!attribute [r] instructions
|
31
|
+
# Details on how payment should be made.
|
32
|
+
# @return [GOBL::Pay::Instructions]
|
33
|
+
property :instructions, GOBL::Pay::Instructions
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,77 @@
|
|
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
|
+
# PaymentLine defines the details of a line item in a payment document.
|
11
|
+
class PaymentLine < GOBL::Object
|
12
|
+
# The Schema ID of the GOBL PaymentLine structure
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/payment#/$defs/PaymentLine'
|
14
|
+
|
15
|
+
# @!attribute [r] uuid
|
16
|
+
# Universally Unique Identifier.
|
17
|
+
# @return [String]
|
18
|
+
property :uuid, String
|
19
|
+
|
20
|
+
# @!attribute [r] i
|
21
|
+
# Line number within the parent document (automatically calculated)
|
22
|
+
# @return [Integer]
|
23
|
+
property :i, Integer
|
24
|
+
|
25
|
+
# @!attribute [r] refund
|
26
|
+
# Indicates whether this payment is a refund of a previous payment, effectively reversing the flow of funds between the supplier and customer or their representatives.
|
27
|
+
# @return [Boolean]
|
28
|
+
property :refund, Boolean
|
29
|
+
|
30
|
+
# @!attribute [r] document
|
31
|
+
# Reference to the document being paid
|
32
|
+
# @return [GOBL::Org::DocumentRef]
|
33
|
+
property :document, GOBL::Org::DocumentRef
|
34
|
+
|
35
|
+
# @!attribute [r] installment
|
36
|
+
# When making multiple payments for a single document, this specifies the installment number for this payment line.
|
37
|
+
# @return [Integer]
|
38
|
+
property :installment, Integer
|
39
|
+
|
40
|
+
# @!attribute [r] description
|
41
|
+
# Additional human readable description of the payment line which may be useful for explaining the purpose or special conditions. Notes should be used for more formal comments.
|
42
|
+
# @return [String]
|
43
|
+
property :description, String
|
44
|
+
|
45
|
+
# @!attribute [r] payable
|
46
|
+
# Payable reflects the amount of the document that is payable. This will be calculated from the embedded document's amount automatically and converted to the currency of the document.
|
47
|
+
# @return [GOBL::Num::Amount]
|
48
|
+
property :payable, GOBL::Num::Amount
|
49
|
+
|
50
|
+
# @!attribute [r] advances
|
51
|
+
# Amount already paid in previous installments, which may be required by some tax regimes or specific use cases.
|
52
|
+
# @return [GOBL::Num::Amount]
|
53
|
+
property :advances, GOBL::Num::Amount
|
54
|
+
|
55
|
+
# @!attribute [r] amount
|
56
|
+
# Amount of the total payment allocated to the referenced document.
|
57
|
+
# @return [GOBL::Num::Amount]
|
58
|
+
property :amount, GOBL::Num::Amount
|
59
|
+
validates_presence_of :amount
|
60
|
+
|
61
|
+
# @!attribute [r] due
|
62
|
+
# Due reflects how much still needs to be paid
|
63
|
+
# @return [GOBL::Num::Amount]
|
64
|
+
property :due, GOBL::Num::Amount
|
65
|
+
|
66
|
+
# @!attribute [r] tax
|
67
|
+
# Tax contains a breakdown of the taxes that will be applied to this payment line after taking into account currency conversion and the relative amounts.
|
68
|
+
# @return [GOBL::Tax::Total]
|
69
|
+
property :tax, GOBL::Tax::Total
|
70
|
+
|
71
|
+
# @!attribute [r] notes
|
72
|
+
# Additional notes specific to this line item for clarification purposes
|
73
|
+
# @return [Array<GOBL::Org::Note>]
|
74
|
+
property :notes, [GOBL::Org::Note]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,83 @@
|
|
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
|
+
# SubLine provides a simplified line that can be embedded inside other lines to provide a more detailed breakdown of the items being sold or substituted.
|
11
|
+
class SubLine < GOBL::Object
|
12
|
+
# The Schema ID of the GOBL SubLine structure
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/line#/$defs/SubLine'
|
14
|
+
|
15
|
+
# @!attribute [r] uuid
|
16
|
+
# Universally Unique Identifier.
|
17
|
+
# @return [String]
|
18
|
+
property :uuid, String
|
19
|
+
|
20
|
+
# @!attribute [r] i
|
21
|
+
# Line number inside the parent (calculated)
|
22
|
+
# @return [Integer]
|
23
|
+
property :i, Integer
|
24
|
+
|
25
|
+
# @!attribute [r] quantity
|
26
|
+
# Number of items
|
27
|
+
# @return [GOBL::Num::Amount]
|
28
|
+
property :quantity, GOBL::Num::Amount
|
29
|
+
validates_presence_of :quantity
|
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
|
+
|
51
|
+
# @!attribute [r] item
|
52
|
+
# Details about the item, service or good, that is being sold
|
53
|
+
# @return [GOBL::Org::Item]
|
54
|
+
property :item, GOBL::Org::Item
|
55
|
+
validates_presence_of :item
|
56
|
+
|
57
|
+
# @!attribute [r] sum
|
58
|
+
# Result of quantity multiplied by the item's price (calculated)
|
59
|
+
# @return [GOBL::Num::Amount]
|
60
|
+
property :sum, GOBL::Num::Amount
|
61
|
+
|
62
|
+
# @!attribute [r] discounts
|
63
|
+
# Discounts applied to this sub-line
|
64
|
+
# @return [Array<LineDiscount>]
|
65
|
+
property :discounts, [LineDiscount]
|
66
|
+
|
67
|
+
# @!attribute [r] charges
|
68
|
+
# Charges applied to this sub-line
|
69
|
+
# @return [Array<LineCharge>]
|
70
|
+
property :charges, [LineCharge]
|
71
|
+
|
72
|
+
# @!attribute [r] total
|
73
|
+
# Total sub-line amount after applying discounts to the sum (calculated).
|
74
|
+
# @return [GOBL::Num::Amount]
|
75
|
+
property :total, GOBL::Num::Amount
|
76
|
+
|
77
|
+
# @!attribute [r] notes
|
78
|
+
# Set of specific notes for this sub-line that may be required for clarification.
|
79
|
+
# @return [Array<GOBL::Org::Note>]
|
80
|
+
property :notes, [GOBL::Org::Note]
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -10,17 +10,31 @@ module GOBL
|
|
10
10
|
# Tax defines a summary of the taxes which may be applied to an invoice.
|
11
11
|
class Tax < GOBL::Object
|
12
12
|
# The Schema ID of the GOBL Tax structure
|
13
|
-
SCHEMA_ID = 'https://gobl.org/draft-0/bill/
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/tax'
|
14
14
|
|
15
15
|
# @!attribute [r] prices_include
|
16
16
|
# Category of the tax already included in the line item prices, especially useful for B2C retailers with customers who prefer final prices inclusive of tax.
|
17
17
|
# @return [GOBL::CBC::Code]
|
18
18
|
property :prices_include, GOBL::CBC::Code
|
19
19
|
|
20
|
-
#
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
# Enumeration of possible values for {#rounding} with their corresponding descriptions
|
21
|
+
ROUNDING_ENUM = {
|
22
|
+
'precise' => 'The default method of calculating the totals in GOBL, and provides the best results
|
23
|
+
for most cases as the precision is maintained to the maximum amount possible. The
|
24
|
+
tradeoff however is that sometimes the totals may not sum exactly based on what is visible.',
|
25
|
+
'currency' => 'The alternative method of calculating the totals that will first round all the amounts
|
26
|
+
to the currencys precision before making the sums. Totals using this approach can always
|
27
|
+
be recalculated using the amounts presented, but can lead to rounding errors in the case
|
28
|
+
of pre-payments and when line item prices include tax.s precision before making the sums. Totals using this approach can always
|
29
|
+
be recalculated using the amounts presented, but can lead to rounding errors in the case
|
30
|
+
of pre-payments and when line item prices include tax.'
|
31
|
+
}.freeze
|
32
|
+
|
33
|
+
# @!attribute [r] rounding
|
34
|
+
# Rounding model used to perform tax calculations on the invoice. This will be configured automatically based on the tax regime, or `sum-then-round` by default, but you can override here if needed. Use with caution, as some conversion tools may make assumptions about the rounding model used.
|
35
|
+
# @return [GOBL::CBC::Key]
|
36
|
+
property :rounding, GOBL::CBC::Key
|
37
|
+
validates_inclusion_of :rounding, in: ROUNDING_ENUM.keys, allow_blank: true
|
24
38
|
|
25
39
|
# @!attribute [r] ext
|
26
40
|
# Additional extensions that are applied to the invoice as a whole as opposed to specific sections.
|
@@ -10,74 +10,74 @@ module GOBL
|
|
10
10
|
# Totals contains the summaries of all calculations for the invoice.
|
11
11
|
class Totals < GOBL::Object
|
12
12
|
# The Schema ID of the GOBL Totals structure
|
13
|
-
SCHEMA_ID = 'https://gobl.org/draft-0/bill/
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/totals'
|
14
14
|
|
15
15
|
# @!attribute [r] sum
|
16
|
-
#
|
16
|
+
# Total of all line item amounts.
|
17
17
|
# @return [GOBL::Num::Amount]
|
18
18
|
property :sum, GOBL::Num::Amount
|
19
19
|
validates_presence_of :sum
|
20
20
|
|
21
21
|
# @!attribute [r] discount
|
22
|
-
#
|
22
|
+
# Total of all discounts applied at the document level.
|
23
23
|
# @return [GOBL::Num::Amount]
|
24
24
|
property :discount, GOBL::Num::Amount
|
25
25
|
|
26
26
|
# @!attribute [r] charge
|
27
|
-
#
|
27
|
+
# Total of all charges applied at the document level.
|
28
28
|
# @return [GOBL::Num::Amount]
|
29
29
|
property :charge, GOBL::Num::Amount
|
30
30
|
|
31
31
|
# @!attribute [r] tax_included
|
32
|
-
#
|
32
|
+
# Total tax amount included in the prices, if prices are tax-inclusive.
|
33
33
|
# @return [GOBL::Num::Amount]
|
34
34
|
property :tax_included, GOBL::Num::Amount
|
35
35
|
|
36
36
|
# @!attribute [r] total
|
37
|
-
#
|
37
|
+
# Net total amount after subtracting discounts and adding charges, excluding tax.
|
38
38
|
# @return [GOBL::Num::Amount]
|
39
39
|
property :total, GOBL::Num::Amount
|
40
40
|
validates_presence_of :total
|
41
41
|
|
42
42
|
# @!attribute [r] taxes
|
43
|
-
#
|
43
|
+
# Detailed breakdown of all taxes applied to the invoice.
|
44
44
|
# @return [GOBL::Tax::Total]
|
45
45
|
property :taxes, GOBL::Tax::Total
|
46
46
|
|
47
47
|
# @!attribute [r] tax
|
48
|
-
# Total
|
48
|
+
# Total indirect tax amount to be applied to the invoice.
|
49
49
|
# @return [GOBL::Num::Amount]
|
50
50
|
property :tax, GOBL::Num::Amount
|
51
51
|
|
52
52
|
# @!attribute [r] total_with_tax
|
53
|
-
#
|
53
|
+
# Final total amount after applying indirect taxes.
|
54
54
|
# @return [GOBL::Num::Amount]
|
55
55
|
property :total_with_tax, GOBL::Num::Amount
|
56
56
|
validates_presence_of :total_with_tax
|
57
57
|
|
58
|
-
# @!attribute [r]
|
59
|
-
#
|
58
|
+
# @!attribute [r] retained_tax
|
59
|
+
# Total tax amount retained or withheld by the customer to be paid to the tax authority.
|
60
60
|
# @return [GOBL::Num::Amount]
|
61
|
-
property :
|
61
|
+
property :retained_tax, GOBL::Num::Amount
|
62
62
|
|
63
|
-
# @!attribute [r]
|
64
|
-
#
|
63
|
+
# @!attribute [r] rounding
|
64
|
+
# Adjustment amount applied to the invoice totals to meet rounding rules or expectations.
|
65
65
|
# @return [GOBL::Num::Amount]
|
66
|
-
property :
|
66
|
+
property :rounding, GOBL::Num::Amount
|
67
67
|
|
68
68
|
# @!attribute [r] payable
|
69
|
-
#
|
69
|
+
# Final amount to be paid after retained taxes and rounding adjustments.
|
70
70
|
# @return [GOBL::Num::Amount]
|
71
71
|
property :payable, GOBL::Num::Amount
|
72
72
|
validates_presence_of :payable
|
73
73
|
|
74
74
|
# @!attribute [r] advance
|
75
|
-
# Total amount already paid in advance.
|
75
|
+
# Total amount already paid in advance by the customer.
|
76
76
|
# @return [GOBL::Num::Amount]
|
77
77
|
property :advance, GOBL::Num::Amount
|
78
78
|
|
79
79
|
# @!attribute [r] due
|
80
|
-
#
|
80
|
+
# Remaining amount that needs to be paid.
|
81
81
|
# @return [GOBL::Num::Amount]
|
82
82
|
property :due, GOBL::Num::Amount
|
83
83
|
end
|
@@ -0,0 +1,26 @@
|
|
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
|
+
# Tracking stores tracking information about a delivery.
|
11
|
+
class Tracking < GOBL::Object
|
12
|
+
# The Schema ID of the GOBL Tracking structure
|
13
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/bill/delivery#/$defs/Tracking'
|
14
|
+
|
15
|
+
# @!attribute [r] code
|
16
|
+
# Code used for tracking
|
17
|
+
# @return [GOBL::CBC::Code]
|
18
|
+
property :code, GOBL::CBC::Code
|
19
|
+
|
20
|
+
# @!attribute [r] website
|
21
|
+
# Website to access for more tracking details
|
22
|
+
# @return [GOBL::Org::Website]
|
23
|
+
property :website, GOBL::Org::Website
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -8,7 +8,7 @@
|
|
8
8
|
module GOBL
|
9
9
|
module Cal
|
10
10
|
# Civil date time in simplified ISO format with no time zone
|
11
|
-
# information, for example: 2021-05-26T13:45:00
|
11
|
+
# nor location information, for example: 2021-05-26T13:45:00
|
12
12
|
class DateTime < String
|
13
13
|
# The Schema ID of the GOBL DateTime structure
|
14
14
|
SCHEMA_ID = 'https://gobl.org/draft-0/cal/date-time'
|