gobl 0.22.0 → 0.24.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.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/data/regimes/ae.json +173 -0
  3. data/data/regimes/at.json +1 -0
  4. data/data/regimes/be.json +1 -0
  5. data/data/regimes/br.json +135 -0
  6. data/data/regimes/ca.json +1 -0
  7. data/data/regimes/ch.json +1 -0
  8. data/data/regimes/co.json +0 -221
  9. data/data/regimes/de.json +14 -1
  10. data/data/regimes/el.json +8 -1
  11. data/data/regimes/es.json +3 -2
  12. data/data/regimes/fr.json +1 -0
  13. data/data/regimes/gb.json +1 -0
  14. data/data/regimes/in.json +128 -0
  15. data/data/regimes/it.json +2 -14
  16. data/data/regimes/mx.json +1 -0
  17. data/data/regimes/nl.json +1 -0
  18. data/data/regimes/pl.json +8 -7
  19. data/data/regimes/pt.json +1573 -9
  20. data/lib/generated/gobl/bill/charge.rb +34 -19
  21. data/lib/generated/gobl/bill/correction_options.rb +6 -1
  22. data/lib/generated/gobl/bill/delivery.rb +187 -16
  23. data/lib/generated/gobl/bill/delivery_details.rb +41 -0
  24. data/lib/generated/gobl/bill/discount.rb +36 -13
  25. data/lib/generated/gobl/bill/invoice.rb +43 -33
  26. data/lib/generated/gobl/bill/line.rb +44 -4
  27. data/lib/generated/gobl/bill/line_charge.rb +56 -11
  28. data/lib/generated/gobl/bill/line_discount.rb +45 -12
  29. data/lib/generated/gobl/bill/order.rb +211 -0
  30. data/lib/generated/gobl/bill/ordering.rb +13 -3
  31. data/lib/generated/gobl/bill/payment.rb +158 -15
  32. data/lib/generated/gobl/bill/payment_details.rb +36 -0
  33. data/lib/generated/gobl/bill/payment_line.rb +77 -0
  34. data/lib/generated/gobl/bill/sub_line.rb +83 -0
  35. data/lib/generated/gobl/bill/tax.rb +20 -1
  36. data/lib/generated/gobl/bill/totals.rb +18 -18
  37. data/lib/generated/gobl/bill/tracking.rb +26 -0
  38. data/lib/generated/gobl/cal/date_time.rb +1 -1
  39. data/lib/generated/gobl/cal/time.rb +16 -0
  40. data/lib/generated/gobl/cbc/code.rb +2 -1
  41. data/lib/generated/gobl/cbc/{key_definition.rb → definition.rb} +18 -9
  42. data/lib/generated/gobl/cbc/source.rb +37 -0
  43. data/lib/generated/gobl/currency/code.rb +16 -16
  44. data/lib/generated/gobl/currency/exchange_rate.rb +10 -5
  45. data/lib/generated/gobl/org/address.rb +9 -4
  46. data/lib/generated/gobl/org/attachment.rb +57 -0
  47. data/lib/generated/gobl/org/document_ref.rb +26 -6
  48. data/lib/generated/gobl/org/identity.rb +6 -1
  49. data/lib/generated/gobl/org/inbox.rb +22 -14
  50. data/lib/generated/gobl/org/item.rb +7 -3
  51. data/lib/generated/gobl/{cbc → org}/note.rb +16 -5
  52. data/lib/generated/gobl/org/party.rb +4 -0
  53. data/lib/generated/gobl/org/person.rb +17 -2
  54. data/lib/generated/gobl/org/telephone.rb +1 -1
  55. data/lib/generated/gobl/org/unit.rb +11 -1
  56. data/lib/generated/gobl/pay/advance.rb +3 -1
  57. data/lib/generated/gobl/pay/card.rb +5 -2
  58. data/lib/generated/gobl/pay/instructions.rb +5 -3
  59. data/lib/generated/gobl/pay/terms.rb +7 -2
  60. data/lib/generated/gobl/regimes/mx/food_vouchers_line.rb +5 -0
  61. data/lib/generated/gobl/regimes/mx/fuel_account_line.rb +5 -0
  62. data/lib/generated/gobl/tax/addon_def.rb +19 -4
  63. data/lib/generated/gobl/tax/catalogue_def.rb +39 -0
  64. data/lib/generated/gobl/tax/category_def.rb +14 -4
  65. data/lib/generated/gobl/tax/category_total.rb +4 -0
  66. data/lib/generated/gobl/tax/combo.rb +8 -3
  67. data/lib/generated/gobl/tax/correction_definition.rb +5 -0
  68. data/lib/generated/gobl/tax/identity.rb +5 -0
  69. data/lib/generated/gobl/tax/key_def.rb +36 -0
  70. data/lib/generated/gobl/tax/rate_def.rb +9 -14
  71. data/lib/generated/gobl/tax/rate_total.rb +5 -5
  72. data/lib/generated/gobl/tax/rate_value_def.rb +1 -6
  73. data/lib/generated/gobl/tax/regime_def.rb +17 -22
  74. data/lib/generated/gobl/tax/scenario.rb +11 -6
  75. data/lib/generated/gobl/tax/scenario_note.rb +42 -0
  76. data/lib/generated/gobl/tax/tag_set.rb +2 -2
  77. data/lib/generated/gobl/tax/total.rb +6 -1
  78. data/lib/gobl/version.rb +1 -1
  79. metadata +25 -13
  80. data/lib/generated/gobl/bill/outlay.rb +0 -58
  81. data/lib/generated/gobl/cbc/value_definition.rb +0 -37
  82. data/lib/generated/gobl/tax/source.rb +0 -27
@@ -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/invoice#/$defs/Line'
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 what is being sold
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,25 @@ 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
+
92
+ # @!attribute [r] seller
93
+ # Seller of the item if different from the supplier or ordering seller. This can be useful for marketplace or drop-ship scenarios in locations that require the original seller to be indicated.
94
+ # @return [GOBL::Org::Party]
95
+ property :seller, GOBL::Org::Party
96
+
62
97
  # @!attribute [r] notes
63
98
  # Set of specific notes for this line that may be required for clarification.
64
- # @return [Array<GOBL::CBC::Note>]
65
- property :notes, [GOBL::CBC::Note]
99
+ # @return [Array<GOBL::Org::Note>]
100
+ property :notes, [GOBL::Org::Note]
101
+
102
+ # @!attribute [r] ext
103
+ # Extension codes that apply to the line
104
+ # @return [GOBL::Tax::Extensions]
105
+ property :ext, GOBL::Tax::Extensions
66
106
  end
67
107
  end
68
108
  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/invoice#/$defs/LineCharge'
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 if fixed amount not applied
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] code
26
- # Reference code.
27
- # @return [String]
28
- property :code, String
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/invoice#/$defs/LineDiscount'
13
+ SCHEMA_ID = 'https://gobl.org/draft-0/bill/line#/$defs/LineDiscount'
14
14
 
15
- # @!attribute [r] percent
16
- # Percentage if fixed amount not applied
17
- # @return [GOBL::Num::Percentage]
18
- property :percent, GOBL::Num::Percentage
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] amount
21
- # Fixed discount amount to apply (calculated if percent present).
22
- # @return [GOBL::Num::Amount]
23
- property :amount, GOBL::Num::Amount
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
- # Reason code.
27
- # @return [String]
28
- property :code, String
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,211 @@
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
+ 'IE' => 'Ireland',
30
+ 'IN' => 'India',
31
+ 'IT' => 'Italy',
32
+ 'MX' => 'Mexico',
33
+ 'NL' => 'The Netherlands',
34
+ 'PL' => 'Poland',
35
+ 'PT' => 'Portugal',
36
+ 'SE' => 'Sweden',
37
+ 'SG' => 'Singapore',
38
+ 'US' => 'United States of America'
39
+ }.freeze
40
+
41
+ # @!attribute [r] $regime
42
+ # @return [GOBL::L10n::TaxCountryCode]
43
+ property :$regime, GOBL::L10n::TaxCountryCode
44
+ validates_inclusion_of :$regime, in: $REGIME_ENUM.keys, allow_blank: true
45
+
46
+ # @!attribute [r] $addons
47
+ # Addons defines a list of keys used to identify tax addons that apply special normalization, scenarios, and validation rules to a document.
48
+ # @return [Array<GOBL::CBC::Key>]
49
+ property :$addons, [GOBL::CBC::Key]
50
+
51
+ # @!attribute [r] $tags
52
+ # Tags are used to help identify specific tax scenarios or requirements that may apply changes to the contents of the document or imply a specific meaning. Converters may use tags to help identify specific situations that do not have a specific extension, for example; self-billed or partial invoices may be identified by their respective tags.
53
+ # @return [Array<GOBL::CBC::Key>]
54
+ property :$tags, [GOBL::CBC::Key]
55
+
56
+ # @!attribute [r] uuid
57
+ # Universally Unique Identifier.
58
+ # @return [String]
59
+ property :uuid, String
60
+
61
+ # Enumeration of possible values for {#type} with their corresponding descriptions
62
+ TYPE_ENUM = {
63
+ 'purchase' => 'A purchase order is a document that a buyer sends to a seller to request goods or services.',
64
+ 'sale' => 'A sales order is a document that a seller sends to a buyer to confirm the sale of goods or services.',
65
+ 'quote' => 'A quote is a document that a seller sends to a buyer to provide a price for goods or services.'
66
+ }.freeze
67
+
68
+ # @!attribute [r] type
69
+ # Type of the order.
70
+ # @return [GOBL::CBC::Key]
71
+ property :type, GOBL::CBC::Key
72
+ validates_inclusion_of :type, in: TYPE_ENUM.keys, allow_blank: true
73
+
74
+ # @!attribute [r] series
75
+ # 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.
76
+ # @return [GOBL::CBC::Code]
77
+ property :series, GOBL::CBC::Code
78
+
79
+ # @!attribute [r] code
80
+ # Code is a sequential identifier that uniquely identifies the order. The code can be left empty initially, but is **required** to **sign** the document.
81
+ # @return [GOBL::CBC::Code]
82
+ property :code, GOBL::CBC::Code
83
+
84
+ # @!attribute [r] issue_date
85
+ # When the invoice was created.
86
+ # @return [GOBL::Cal::Date]
87
+ property :issue_date, GOBL::Cal::Date
88
+
89
+ # @!attribute [r] issue_time
90
+ # 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.
91
+ # @return [GOBL::Cal::Time]
92
+ property :issue_time, GOBL::Cal::Time
93
+
94
+ # @!attribute [r] op_date
95
+ # Date when the operation defined by the invoice became effective.
96
+ # @return [GOBL::Cal::Date]
97
+ property :op_date, GOBL::Cal::Date
98
+
99
+ # @!attribute [r] value_date
100
+ # When the taxes of this invoice become accountable, if none set, the issue date is used.
101
+ # @return [GOBL::Cal::Date]
102
+ property :value_date, GOBL::Cal::Date
103
+
104
+ # @!attribute [r] currency
105
+ # Currency for all invoice totals.
106
+ # @return [GOBL::Currency::Code]
107
+ property :currency, GOBL::Currency::Code
108
+
109
+ # @!attribute [r] exchange_rates
110
+ # Exchange rates to be used when converting the invoices monetary values into other currencies.
111
+ # @return [Array<GOBL::Currency::ExchangeRate>]
112
+ property :exchange_rates, [GOBL::Currency::ExchangeRate]
113
+
114
+ # @!attribute [r] contracts
115
+ # The identification of contracts.
116
+ # @return [Array<GOBL::Org::DocumentRef>]
117
+ property :contracts, [GOBL::Org::DocumentRef]
118
+
119
+ # @!attribute [r] preceding
120
+ # Key information regarding previous order documents.
121
+ # @return [Array<GOBL::Org::DocumentRef>]
122
+ property :preceding, [GOBL::Org::DocumentRef]
123
+
124
+ # @!attribute [r] identities
125
+ # Additional codes, IDs, SKUs, or other regional or custom identifiers that may be used to identify the order.
126
+ # @return [Array<GOBL::Org::Identity>]
127
+ property :identities, [GOBL::Org::Identity]
128
+
129
+ # @!attribute [r] period
130
+ # Period of time in which the order is valid.
131
+ # @return [GOBL::Cal::Period]
132
+ property :period, GOBL::Cal::Period
133
+
134
+ # @!attribute [r] tax
135
+ # Special tax configuration for billing.
136
+ # @return [GOBL::Bill::Tax]
137
+ property :tax, GOBL::Bill::Tax
138
+
139
+ # @!attribute [r] supplier
140
+ # The entity supplying the goods or services and usually responsible for paying taxes.
141
+ # @return [GOBL::Org::Party]
142
+ property :supplier, GOBL::Org::Party
143
+ validates_presence_of :supplier
144
+
145
+ # @!attribute [r] customer
146
+ # Legal entity receiving the goods or services, may be nil in certain circumstances such as simplified invoices.
147
+ # @return [GOBL::Org::Party]
148
+ property :customer, GOBL::Org::Party
149
+
150
+ # @!attribute [r] buyer
151
+ # Party who is responsible for issuing payment, if not the same as the customer.
152
+ # @return [GOBL::Org::Party]
153
+ property :buyer, GOBL::Org::Party
154
+
155
+ # @!attribute [r] seller
156
+ # Seller is the party liable to pay taxes on the transaction if not the same as the supplier.
157
+ # @return [GOBL::Org::Party]
158
+ property :seller, GOBL::Org::Party
159
+
160
+ # @!attribute [r] lines
161
+ # List of lines representing each of the items to be ordered.
162
+ # @return [Array<GOBL::Bill::Line>]
163
+ property :lines, [GOBL::Bill::Line]
164
+
165
+ # @!attribute [r] discounts
166
+ # Discounts or allowances applied to order totals
167
+ # @return [Array<GOBL::Bill::Discount>]
168
+ property :discounts, [GOBL::Bill::Discount]
169
+
170
+ # @!attribute [r] charges
171
+ # Charges or surcharges applied to order totals
172
+ # @return [Array<GOBL::Bill::Charge>]
173
+ property :charges, [GOBL::Bill::Charge]
174
+
175
+ # @!attribute [r] payment
176
+ # Information on when, how, and to whom a final invoice would be paid.
177
+ # @return [GOBL::Bill::PaymentDetails]
178
+ property :payment, GOBL::Bill::PaymentDetails
179
+
180
+ # @!attribute [r] delivery
181
+ # Specific details on delivery of the goods to copy to the final invoice.
182
+ # @return [GOBL::Bill::DeliveryDetails]
183
+ property :delivery, GOBL::Bill::DeliveryDetails
184
+
185
+ # @!attribute [r] totals
186
+ # Summary of all the order totals, including taxes (calculated).
187
+ # @return [GOBL::Bill::Totals]
188
+ property :totals, GOBL::Bill::Totals
189
+
190
+ # @!attribute [r] notes
191
+ # Unstructured information that is relevant to the order, such as correction or additional legal details.
192
+ # @return [Array<GOBL::Org::Note>]
193
+ property :notes, [GOBL::Org::Note]
194
+
195
+ # @!attribute [r] complements
196
+ # Additional complementary objects that add relevant information to the order.
197
+ # @return [Array<GOBL::Schema::Object>]
198
+ property :complements, [GOBL::Schema::Object]
199
+
200
+ # @!attribute [r] meta
201
+ # Additional semi-structured data that doesn't fit into the body of the order.
202
+ # @return [GOBL::CBC::Meta]
203
+ property :meta, GOBL::CBC::Meta
204
+
205
+ # @!attribute [r] attachments
206
+ # 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.
207
+ # @return [Array<GOBL::Org::Attachment>]
208
+ property :attachments, [GOBL::Org::Attachment]
209
+ end
210
+ end
211
+ end
@@ -10,7 +10,7 @@ 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/invoice#/$defs/Ordering'
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.
@@ -22,21 +22,31 @@ module GOBL
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
35
  # @!attribute [r] buyer
31
- # Party who is responsible for making the purchase, but is not responsible for handling taxes.
36
+ # Party who is responsible for issuing payment, if not the same as the customer.
32
37
  # @return [GOBL::Org::Party]
33
38
  property :buyer, GOBL::Org::Party
34
39
 
35
40
  # @!attribute [r] seller
36
- # Party who is selling the goods but is not responsible for taxes like the supplier.
41
+ # Seller is the party liable to pay taxes on the transaction if not the same as the supplier.
37
42
  # @return [GOBL::Org::Party]
38
43
  property :seller, GOBL::Org::Party
39
44
 
45
+ # @!attribute [r] issuer
46
+ # Issuer represents a third party responsible for issuing the invoice, but is not responsible for tax. Some tax regimes and formats require this field.
47
+ # @return [GOBL::Org::Party]
48
+ property :issuer, GOBL::Org::Party
49
+
40
50
  # @!attribute [r] projects
41
51
  # Projects this invoice refers to.
42
52
  # @return [Array<GOBL::Org::DocumentRef>]
@@ -7,30 +7,173 @@
7
7
 
8
8
  module GOBL
9
9
  module Bill
10
- # Payment contains details as to how the invoice should be paid.
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/invoice#/$defs/Payment'
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
+ 'IE' => 'Ireland',
30
+ 'IN' => 'India',
31
+ 'IT' => 'Italy',
32
+ 'MX' => 'Mexico',
33
+ 'NL' => 'The Netherlands',
34
+ 'PL' => 'Poland',
35
+ 'PT' => 'Portugal',
36
+ 'SE' => 'Sweden',
37
+ 'SG' => 'Singapore',
38
+ 'US' => 'United States of America'
39
+ }.freeze
40
+
41
+ # @!attribute [r] $regime
42
+ # @return [GOBL::L10n::TaxCountryCode]
43
+ property :$regime, GOBL::L10n::TaxCountryCode
44
+ validates_inclusion_of :$regime, in: $REGIME_ENUM.keys, allow_blank: true
45
+
46
+ # @!attribute [r] $addons
47
+ # Addons defines a list of keys used to identify tax addons that apply special normalization, scenarios, and validation rules to a document.
48
+ # @return [Array<GOBL::CBC::Key>]
49
+ property :$addons, [GOBL::CBC::Key]
50
+
51
+ # @!attribute [r] $tags
52
+ # Tags are used to help identify specific tax scenarios or requirements that may apply changes to the contents of the document or imply a specific meaning. Converters may use tags to help identify specific situations that do not have a specific extension, for example; self-billed or partial invoices may be identified by their respective tags.
53
+ # @return [Array<GOBL::CBC::Key>]
54
+ property :$tags, [GOBL::CBC::Key]
55
+
56
+ # @!attribute [r] uuid
57
+ # Universally Unique Identifier.
58
+ # @return [String]
59
+ property :uuid, String
60
+
61
+ # Enumeration of possible values for {#type} with their corresponding descriptions
62
+ TYPE_ENUM = {
63
+ 'request' => 'A payment request sent from the supplier to a customer indicating that they are
64
+ requesting a transfer of funds from the customer directly or a payer.
65
+ This is used to request payment for specific documents and invoices.',
66
+ 'advice' => 'A remittance advice sent from the customer to the supplier reflecting that payment for
67
+ the referenced documents has been made.',
68
+ 'receipt' => 'A payment receipt sent from the supplier to a customer indicating that they have
69
+ received a transfer of funds from the customer directly or a payer.
70
+ This is the default payment type and may be required by some tax
71
+ regimes in order to communicate the payment of specific documents and invoices.'
72
+ }.freeze
73
+
74
+ # @!attribute [r] type
75
+ # Type of payment document being issued.
76
+ # @return [GOBL::CBC::Key]
77
+ property :type, GOBL::CBC::Key
78
+ validates_inclusion_of :type, in: TYPE_ENUM.keys, allow_blank: true
79
+
80
+ # @!attribute [r] method
81
+ # Details on how the payment was made based on the original instructions.
82
+ # @return [GOBL::Pay::Instructions]
83
+ property :method, GOBL::Pay::Instructions
84
+
85
+ # @!attribute [r] series
86
+ # 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.
87
+ # @return [GOBL::CBC::Code]
88
+ property :series, GOBL::CBC::Code
89
+
90
+ # @!attribute [r] code
91
+ # Code is a sequential identifier that uniquely identifies the payment. The code can be left empty initially, but is **required** to **sign** the document.
92
+ # @return [GOBL::CBC::Code]
93
+ property :code, GOBL::CBC::Code
94
+
95
+ # @!attribute [r] issue_date
96
+ # When the payment was issued.
97
+ # @return [GOBL::Cal::Date]
98
+ property :issue_date, GOBL::Cal::Date
99
+
100
+ # @!attribute [r] issue_time
101
+ # IssueTime is an optional field that may be useful to indicate the time of day when the payment was issued.
102
+ # @return [GOBL::Cal::Time]
103
+ property :issue_time, GOBL::Cal::Time
104
+
105
+ # @!attribute [r] value_date
106
+ # When the taxes of this payment become accountable, if none set, the issue date is assumed.
107
+ # @return [GOBL::Cal::Date]
108
+ property :value_date, GOBL::Cal::Date
109
+
110
+ # @!attribute [r] currency
111
+ # Currency for all payment totals.
112
+ # @return [GOBL::Currency::Code]
113
+ property :currency, GOBL::Currency::Code
114
+
115
+ # @!attribute [r] exchange_rates
116
+ # Exchange rates to be used when converting the payment's monetary values into other currencies.
117
+ # @return [Array<GOBL::Currency::ExchangeRate>]
118
+ property :exchange_rates, [GOBL::Currency::ExchangeRate]
119
+
120
+ # @!attribute [r] ext
121
+ # Extensions for additional codes that may be required.
122
+ # @return [GOBL::Tax::Extensions]
123
+ property :ext, GOBL::Tax::Extensions
124
+
125
+ # @!attribute [r] preceding
126
+ # Key information regarding previous versions of this document.
127
+ # @return [Array<GOBL::Org::DocumentRef>]
128
+ property :preceding, [GOBL::Org::DocumentRef]
129
+
130
+ # @!attribute [r] supplier
131
+ # The taxable entity who is responsible for supplying goods or services.
132
+ # @return [GOBL::Org::Party]
133
+ property :supplier, GOBL::Org::Party
134
+ validates_presence_of :supplier
135
+
136
+ # @!attribute [r] customer
137
+ # Legal entity that receives the goods or services.
138
+ # @return [GOBL::Org::Party]
139
+ property :customer, GOBL::Org::Party
14
140
 
15
141
  # @!attribute [r] payee
16
- # The party responsible for receiving payment of the invoice, if not the supplier.
142
+ # Legal entity that receives the payment if not the supplier.
17
143
  # @return [GOBL::Org::Party]
18
144
  property :payee, GOBL::Org::Party
19
145
 
20
- # @!attribute [r] terms
21
- # Payment terms or conditions.
22
- # @return [GOBL::Pay::Terms]
23
- property :terms, GOBL::Pay::Terms
146
+ # @!attribute [r] lines
147
+ # List of documents that are being paid for.
148
+ # @return [Array<PaymentLine>]
149
+ property :lines, [PaymentLine]
150
+ validates_presence_of :lines
24
151
 
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]
152
+ # @!attribute [r] ordering
153
+ # Ordering allows for additional information about the ordering process including references to other documents and alternative parties involved in the order-to-delivery process.
154
+ # @return [GOBL::Bill::Ordering]
155
+ property :ordering, GOBL::Bill::Ordering
29
156
 
30
- # @!attribute [r] instructions
31
- # Details on how payment should be made.
32
- # @return [GOBL::Pay::Instructions]
33
- property :instructions, GOBL::Pay::Instructions
157
+ # @!attribute [r] total
158
+ # Total amount to be paid in this payment, either positive or negative according to the line types and totals. Calculated automatically.
159
+ # @return [GOBL::Num::Amount]
160
+ property :total, GOBL::Num::Amount
161
+ validates_presence_of :total
162
+
163
+ # @!attribute [r] notes
164
+ # Unstructured information that is relevant to the payment, such as correction or additional legal details.
165
+ # @return [Array<GOBL::Org::Note>]
166
+ property :notes, [GOBL::Org::Note]
167
+
168
+ # @!attribute [r] complements
169
+ # Additional complementary objects that add relevant information to the payment.
170
+ # @return [Array<GOBL::Schema::Object>]
171
+ property :complements, [GOBL::Schema::Object]
172
+
173
+ # @!attribute [r] meta
174
+ # Additional semi-structured data that doesn't fit into the body of the invoice.
175
+ # @return [GOBL::CBC::Meta]
176
+ property :meta, GOBL::CBC::Meta
34
177
  end
35
178
  end
36
179
  end