e-invoice-api 0.6.0 → 0.8.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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +5 -5
  4. data/lib/e_invoice_api/client.rb +4 -0
  5. data/lib/e_invoice_api/internal/type/base_model.rb +5 -5
  6. data/lib/e_invoice_api/models/allowance.rb +96 -0
  7. data/lib/e_invoice_api/models/charge.rb +96 -0
  8. data/lib/e_invoice_api/models/document_create.rb +666 -19
  9. data/lib/e_invoice_api/models/document_create_from_pdf_params.rb +32 -0
  10. data/lib/e_invoice_api/models/document_create_from_pdf_response.rb +584 -0
  11. data/lib/e_invoice_api/models/document_response.rb +265 -23
  12. data/lib/e_invoice_api/models/document_validate_params.rb +14 -0
  13. data/lib/e_invoice_api/models/documents/ubl_create_from_ubl_params.rb +22 -0
  14. data/lib/e_invoice_api/models/me_retrieve_params.rb +14 -0
  15. data/lib/e_invoice_api/models/me_retrieve_response.rb +149 -0
  16. data/lib/e_invoice_api/models.rb +10 -0
  17. data/lib/e_invoice_api/resources/documents/ubl.rb +22 -0
  18. data/lib/e_invoice_api/resources/documents.rb +64 -8
  19. data/lib/e_invoice_api/resources/me.rb +32 -0
  20. data/lib/e_invoice_api/resources/validate.rb +12 -8
  21. data/lib/e_invoice_api/version.rb +1 -1
  22. data/lib/e_invoice_api.rb +9 -0
  23. data/rbi/e_invoice_api/client.rbi +3 -0
  24. data/rbi/e_invoice_api/models/allowance.rbi +124 -0
  25. data/rbi/e_invoice_api/models/charge.rbi +122 -0
  26. data/rbi/e_invoice_api/models/document_create.rbi +1180 -3
  27. data/rbi/e_invoice_api/models/document_create_from_pdf_params.rbi +56 -0
  28. data/rbi/e_invoice_api/models/document_create_from_pdf_response.rbi +1014 -0
  29. data/rbi/e_invoice_api/models/document_response.rbi +456 -43
  30. data/rbi/e_invoice_api/models/document_validate_params.rbi +30 -0
  31. data/rbi/e_invoice_api/models/documents/ubl_create_from_ubl_params.rbi +43 -0
  32. data/rbi/e_invoice_api/models/me_retrieve_params.rbi +27 -0
  33. data/rbi/e_invoice_api/models/me_retrieve_response.rbi +195 -0
  34. data/rbi/e_invoice_api/models.rbi +10 -0
  35. data/rbi/e_invoice_api/resources/documents/ubl.rbi +10 -0
  36. data/rbi/e_invoice_api/resources/documents.rbi +54 -1
  37. data/rbi/e_invoice_api/resources/me.rbi +21 -0
  38. data/rbi/e_invoice_api/resources/validate.rbi +20 -1
  39. data/sig/e_invoice_api/client.rbs +2 -0
  40. data/sig/e_invoice_api/models/allowance.rbs +69 -0
  41. data/sig/e_invoice_api/models/charge.rbs +69 -0
  42. data/sig/e_invoice_api/models/document_create.rbs +388 -4
  43. data/sig/e_invoice_api/models/document_create_from_pdf_params.rbs +36 -0
  44. data/sig/e_invoice_api/models/document_create_from_pdf_response.rbs +512 -0
  45. data/sig/e_invoice_api/models/document_response.rbs +168 -32
  46. data/sig/e_invoice_api/models/document_validate_params.rbs +15 -0
  47. data/sig/e_invoice_api/models/documents/ubl_create_from_ubl_params.rbs +26 -0
  48. data/sig/e_invoice_api/models/me_retrieve_params.rbs +15 -0
  49. data/sig/e_invoice_api/models/me_retrieve_response.rbs +107 -0
  50. data/sig/e_invoice_api/models.rbs +10 -0
  51. data/sig/e_invoice_api/resources/documents/ubl.rbs +5 -0
  52. data/sig/e_invoice_api/resources/documents.rbs +15 -1
  53. data/sig/e_invoice_api/resources/me.rbs +11 -0
  54. data/sig/e_invoice_api/resources/validate.rbs +3 -1
  55. metadata +28 -1
@@ -0,0 +1,30 @@
1
+ # typed: strong
2
+
3
+ module EInvoiceAPI
4
+ module Models
5
+ class DocumentValidateParams < EInvoiceAPI::Internal::Type::BaseModel
6
+ extend EInvoiceAPI::Internal::Type::RequestParameters::Converter
7
+ include EInvoiceAPI::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ EInvoiceAPI::DocumentValidateParams,
13
+ EInvoiceAPI::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig do
18
+ params(request_options: EInvoiceAPI::RequestOptions::OrHash).returns(
19
+ T.attached_class
20
+ )
21
+ end
22
+ def self.new(request_options: {})
23
+ end
24
+
25
+ sig { override.returns({ request_options: EInvoiceAPI::RequestOptions }) }
26
+ def to_hash
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,43 @@
1
+ # typed: strong
2
+
3
+ module EInvoiceAPI
4
+ module Models
5
+ module Documents
6
+ class UblCreateFromUblParams < EInvoiceAPI::Internal::Type::BaseModel
7
+ extend EInvoiceAPI::Internal::Type::RequestParameters::Converter
8
+ include EInvoiceAPI::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ EInvoiceAPI::Documents::UblCreateFromUblParams,
14
+ EInvoiceAPI::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(EInvoiceAPI::Internal::FileInput) }
19
+ attr_accessor :file
20
+
21
+ sig do
22
+ params(
23
+ file: EInvoiceAPI::Internal::FileInput,
24
+ request_options: EInvoiceAPI::RequestOptions::OrHash
25
+ ).returns(T.attached_class)
26
+ end
27
+ def self.new(file:, request_options: {})
28
+ end
29
+
30
+ sig do
31
+ override.returns(
32
+ {
33
+ file: EInvoiceAPI::Internal::FileInput,
34
+ request_options: EInvoiceAPI::RequestOptions
35
+ }
36
+ )
37
+ end
38
+ def to_hash
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module EInvoiceAPI
4
+ module Models
5
+ class MeRetrieveParams < EInvoiceAPI::Internal::Type::BaseModel
6
+ extend EInvoiceAPI::Internal::Type::RequestParameters::Converter
7
+ include EInvoiceAPI::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(EInvoiceAPI::MeRetrieveParams, EInvoiceAPI::Internal::AnyHash)
12
+ end
13
+
14
+ sig do
15
+ params(request_options: EInvoiceAPI::RequestOptions::OrHash).returns(
16
+ T.attached_class
17
+ )
18
+ end
19
+ def self.new(request_options: {})
20
+ end
21
+
22
+ sig { override.returns({ request_options: EInvoiceAPI::RequestOptions }) }
23
+ def to_hash
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,195 @@
1
+ # typed: strong
2
+
3
+ module EInvoiceAPI
4
+ module Models
5
+ class MeRetrieveResponse < EInvoiceAPI::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ EInvoiceAPI::Models::MeRetrieveResponse,
10
+ EInvoiceAPI::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # Credit balance of the tenant
15
+ sig { returns(Integer) }
16
+ attr_accessor :credit_balance
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :name
20
+
21
+ # Plan of the tenant
22
+ sig do
23
+ returns(EInvoiceAPI::Models::MeRetrieveResponse::Plan::TaggedSymbol)
24
+ end
25
+ attr_accessor :plan
26
+
27
+ # BCC recipient email to deliver documents
28
+ sig { returns(T.nilable(String)) }
29
+ attr_accessor :bcc_recipient_email
30
+
31
+ # Address of the company
32
+ sig { returns(T.nilable(String)) }
33
+ attr_accessor :company_address
34
+
35
+ # City of the company
36
+ sig { returns(T.nilable(String)) }
37
+ attr_accessor :company_city
38
+
39
+ # Country of the company
40
+ sig { returns(T.nilable(String)) }
41
+ attr_accessor :company_country
42
+
43
+ # Email of the company
44
+ sig { returns(T.nilable(String)) }
45
+ attr_accessor :company_email
46
+
47
+ # Name of the company
48
+ sig { returns(T.nilable(String)) }
49
+ attr_accessor :company_name
50
+
51
+ # Company number
52
+ sig { returns(T.nilable(String)) }
53
+ attr_accessor :company_number
54
+
55
+ # Zip code of the company
56
+ sig { returns(T.nilable(String)) }
57
+ attr_accessor :company_zip
58
+
59
+ sig { returns(T.nilable(String)) }
60
+ attr_accessor :description
61
+
62
+ # IBANs of the tenant
63
+ sig { returns(T.nilable(T::Array[String])) }
64
+ attr_accessor :ibans
65
+
66
+ # Peppol IDs of the tenant
67
+ sig { returns(T.nilable(T::Array[String])) }
68
+ attr_accessor :peppol_ids
69
+
70
+ # Whether the tenant is registered on our SMP
71
+ sig { returns(T.nilable(T::Boolean)) }
72
+ attr_accessor :smp_registration
73
+
74
+ # Date when the tenant was registered on SMP
75
+ sig { returns(T.nilable(Time)) }
76
+ attr_accessor :smp_registration_date
77
+
78
+ sig do
79
+ params(
80
+ credit_balance: Integer,
81
+ name: String,
82
+ plan: EInvoiceAPI::Models::MeRetrieveResponse::Plan::OrSymbol,
83
+ bcc_recipient_email: T.nilable(String),
84
+ company_address: T.nilable(String),
85
+ company_city: T.nilable(String),
86
+ company_country: T.nilable(String),
87
+ company_email: T.nilable(String),
88
+ company_name: T.nilable(String),
89
+ company_number: T.nilable(String),
90
+ company_zip: T.nilable(String),
91
+ description: T.nilable(String),
92
+ ibans: T.nilable(T::Array[String]),
93
+ peppol_ids: T.nilable(T::Array[String]),
94
+ smp_registration: T.nilable(T::Boolean),
95
+ smp_registration_date: T.nilable(Time)
96
+ ).returns(T.attached_class)
97
+ end
98
+ def self.new(
99
+ # Credit balance of the tenant
100
+ credit_balance:,
101
+ name:,
102
+ # Plan of the tenant
103
+ plan:,
104
+ # BCC recipient email to deliver documents
105
+ bcc_recipient_email: nil,
106
+ # Address of the company
107
+ company_address: nil,
108
+ # City of the company
109
+ company_city: nil,
110
+ # Country of the company
111
+ company_country: nil,
112
+ # Email of the company
113
+ company_email: nil,
114
+ # Name of the company
115
+ company_name: nil,
116
+ # Company number
117
+ company_number: nil,
118
+ # Zip code of the company
119
+ company_zip: nil,
120
+ description: nil,
121
+ # IBANs of the tenant
122
+ ibans: nil,
123
+ # Peppol IDs of the tenant
124
+ peppol_ids: nil,
125
+ # Whether the tenant is registered on our SMP
126
+ smp_registration: nil,
127
+ # Date when the tenant was registered on SMP
128
+ smp_registration_date: nil
129
+ )
130
+ end
131
+
132
+ sig do
133
+ override.returns(
134
+ {
135
+ credit_balance: Integer,
136
+ name: String,
137
+ plan: EInvoiceAPI::Models::MeRetrieveResponse::Plan::TaggedSymbol,
138
+ bcc_recipient_email: T.nilable(String),
139
+ company_address: T.nilable(String),
140
+ company_city: T.nilable(String),
141
+ company_country: T.nilable(String),
142
+ company_email: T.nilable(String),
143
+ company_name: T.nilable(String),
144
+ company_number: T.nilable(String),
145
+ company_zip: T.nilable(String),
146
+ description: T.nilable(String),
147
+ ibans: T.nilable(T::Array[String]),
148
+ peppol_ids: T.nilable(T::Array[String]),
149
+ smp_registration: T.nilable(T::Boolean),
150
+ smp_registration_date: T.nilable(Time)
151
+ }
152
+ )
153
+ end
154
+ def to_hash
155
+ end
156
+
157
+ # Plan of the tenant
158
+ module Plan
159
+ extend EInvoiceAPI::Internal::Type::Enum
160
+
161
+ TaggedSymbol =
162
+ T.type_alias do
163
+ T.all(Symbol, EInvoiceAPI::Models::MeRetrieveResponse::Plan)
164
+ end
165
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
166
+
167
+ STARTER =
168
+ T.let(
169
+ :starter,
170
+ EInvoiceAPI::Models::MeRetrieveResponse::Plan::TaggedSymbol
171
+ )
172
+ PRO =
173
+ T.let(
174
+ :pro,
175
+ EInvoiceAPI::Models::MeRetrieveResponse::Plan::TaggedSymbol
176
+ )
177
+ ENTERPRISE =
178
+ T.let(
179
+ :enterprise,
180
+ EInvoiceAPI::Models::MeRetrieveResponse::Plan::TaggedSymbol
181
+ )
182
+
183
+ sig do
184
+ override.returns(
185
+ T::Array[
186
+ EInvoiceAPI::Models::MeRetrieveResponse::Plan::TaggedSymbol
187
+ ]
188
+ )
189
+ end
190
+ def self.values
191
+ end
192
+ end
193
+ end
194
+ end
195
+ end
@@ -1,14 +1,20 @@
1
1
  # typed: strong
2
2
 
3
3
  module EInvoiceAPI
4
+ Allowance = EInvoiceAPI::Models::Allowance
5
+
4
6
  Certificate = EInvoiceAPI::Models::Certificate
5
7
 
8
+ Charge = EInvoiceAPI::Models::Charge
9
+
6
10
  CurrencyCode = EInvoiceAPI::Models::CurrencyCode
7
11
 
8
12
  DocumentAttachmentCreate = EInvoiceAPI::Models::DocumentAttachmentCreate
9
13
 
10
14
  DocumentCreate = EInvoiceAPI::Models::DocumentCreate
11
15
 
16
+ DocumentCreateFromPdfParams = EInvoiceAPI::Models::DocumentCreateFromPdfParams
17
+
12
18
  DocumentCreateParams = EInvoiceAPI::Models::DocumentCreateParams
13
19
 
14
20
  DocumentDeleteParams = EInvoiceAPI::Models::DocumentDeleteParams
@@ -27,6 +33,8 @@ module EInvoiceAPI
27
33
 
28
34
  DocumentType = EInvoiceAPI::Models::DocumentType
29
35
 
36
+ DocumentValidateParams = EInvoiceAPI::Models::DocumentValidateParams
37
+
30
38
  InboxListCreditNotesParams = EInvoiceAPI::Models::InboxListCreditNotesParams
31
39
 
32
40
  InboxListInvoicesParams = EInvoiceAPI::Models::InboxListInvoicesParams
@@ -38,6 +46,8 @@ module EInvoiceAPI
38
46
  LookupRetrieveParticipantsParams =
39
47
  EInvoiceAPI::Models::LookupRetrieveParticipantsParams
40
48
 
49
+ MeRetrieveParams = EInvoiceAPI::Models::MeRetrieveParams
50
+
41
51
  OutboxListDraftDocumentsParams =
42
52
  EInvoiceAPI::Models::OutboxListDraftDocumentsParams
43
53
 
@@ -4,6 +4,16 @@ module EInvoiceAPI
4
4
  module Resources
5
5
  class Documents
6
6
  class Ubl
7
+ # Create a new invoice or credit note from a UBL file
8
+ sig do
9
+ params(
10
+ file: EInvoiceAPI::Internal::FileInput,
11
+ request_options: EInvoiceAPI::RequestOptions::OrHash
12
+ ).returns(EInvoiceAPI::DocumentResponse)
13
+ end
14
+ def create_from_ubl(file:, request_options: {})
15
+ end
16
+
7
17
  # Get the UBL for an invoice or credit note
8
18
  sig do
9
19
  params(
@@ -12,12 +12,16 @@ module EInvoiceAPI
12
12
  # Create a new invoice or credit note
13
13
  sig do
14
14
  params(
15
+ allowances:
16
+ T.nilable(T::Array[EInvoiceAPI::DocumentCreate::Allowance::OrHash]),
15
17
  amount_due:
16
18
  T.nilable(EInvoiceAPI::DocumentCreate::AmountDue::Variants),
17
19
  attachments:
18
20
  T.nilable(T::Array[EInvoiceAPI::DocumentAttachmentCreate::OrHash]),
19
21
  billing_address: T.nilable(String),
20
22
  billing_address_recipient: T.nilable(String),
23
+ charges:
24
+ T.nilable(T::Array[EInvoiceAPI::DocumentCreate::Charge::OrHash]),
21
25
  currency: EInvoiceAPI::CurrencyCode::OrSymbol,
22
26
  customer_address: T.nilable(String),
23
27
  customer_address_recipient: T.nilable(String),
@@ -32,7 +36,7 @@ module EInvoiceAPI
32
36
  invoice_id: T.nilable(String),
33
37
  invoice_total:
34
38
  T.nilable(EInvoiceAPI::DocumentCreate::InvoiceTotal::Variants),
35
- items: T.nilable(T::Array[EInvoiceAPI::DocumentCreate::Item::OrHash]),
39
+ items: T::Array[EInvoiceAPI::DocumentCreate::Item::OrHash],
36
40
  note: T.nilable(String),
37
41
  payment_details:
38
42
  T.nilable(T::Array[EInvoiceAPI::PaymentDetailCreate::OrHash]),
@@ -69,10 +73,14 @@ module EInvoiceAPI
69
73
  ).returns(EInvoiceAPI::DocumentResponse)
70
74
  end
71
75
  def create(
76
+ allowances: nil,
77
+ # The amount due of the invoice. Must be positive and rounded to maximum 2
78
+ # decimals
72
79
  amount_due: nil,
73
80
  attachments: nil,
74
81
  billing_address: nil,
75
82
  billing_address_recipient: nil,
83
+ charges: nil,
76
84
  # Currency of the invoice
77
85
  currency: nil,
78
86
  customer_address: nil,
@@ -86,11 +94,16 @@ module EInvoiceAPI
86
94
  due_date: nil,
87
95
  invoice_date: nil,
88
96
  invoice_id: nil,
97
+ # The total amount of the invoice (so invoice_total = subtotal + total_tax +
98
+ # total_discount). Must be positive and rounded to maximum 2 decimals
89
99
  invoice_total: nil,
100
+ # At least one line item is required
90
101
  items: nil,
91
102
  note: nil,
92
103
  payment_details: nil,
93
104
  payment_term: nil,
105
+ # The previous unpaid balance of the invoice, if any. Must be positive and rounded
106
+ # to maximum 2 decimals
94
107
  previous_unpaid_balance: nil,
95
108
  purchase_order: nil,
96
109
  remittance_address: nil,
@@ -102,11 +115,17 @@ module EInvoiceAPI
102
115
  shipping_address: nil,
103
116
  shipping_address_recipient: nil,
104
117
  state: nil,
118
+ # The taxable base of the invoice. Should be the sum of all line items -
119
+ # allowances (for example commercial discounts) + charges with impact on VAT. Must
120
+ # be positive and rounded to maximum 2 decimals
105
121
  subtotal: nil,
106
122
  # Tax category code of the invoice
107
123
  tax_code: nil,
108
124
  tax_details: nil,
125
+ # The total financial discount of the invoice (so discounts not subject to VAT).
126
+ # Must be positive and rounded to maximum 2 decimals
109
127
  total_discount: nil,
128
+ # The total tax of the invoice. Must be positive and rounded to maximum 2 decimals
110
129
  total_tax: nil,
111
130
  # VATEX code list for VAT exemption reasons
112
131
  #
@@ -143,6 +162,30 @@ module EInvoiceAPI
143
162
  def delete(document_id, request_options: {})
144
163
  end
145
164
 
165
+ # Create a new invoice or credit note from a PDF file. If the 'ubl_document' field
166
+ # is set in the response, it indicates that sufficient details were extracted from
167
+ # the PDF to automatically generate a valid UBL document ready for sending. If
168
+ # 'ubl_document' is not set, human intervention may be required to ensure
169
+ # compliance.
170
+ sig do
171
+ params(
172
+ file: EInvoiceAPI::Internal::FileInput,
173
+ customer_tax_id: T.nilable(String),
174
+ vendor_tax_id: T.nilable(String),
175
+ request_options: EInvoiceAPI::RequestOptions::OrHash
176
+ ).returns(EInvoiceAPI::Models::DocumentCreateFromPdfResponse)
177
+ end
178
+ def create_from_pdf(
179
+ # Body param:
180
+ file:,
181
+ # Query param:
182
+ customer_tax_id: nil,
183
+ # Query param:
184
+ vendor_tax_id: nil,
185
+ request_options: {}
186
+ )
187
+ end
188
+
146
189
  # Send an invoice or credit note via Peppol
147
190
  sig do
148
191
  params(
@@ -166,6 +209,16 @@ module EInvoiceAPI
166
209
  )
167
210
  end
168
211
 
212
+ # Validate a UBL document according to Peppol BIS Billing 3.0
213
+ sig do
214
+ params(
215
+ document_id: String,
216
+ request_options: EInvoiceAPI::RequestOptions::OrHash
217
+ ).returns(EInvoiceAPI::UblDocumentValidation)
218
+ end
219
+ def validate(document_id, request_options: {})
220
+ end
221
+
169
222
  # @api private
170
223
  sig { params(client: EInvoiceAPI::Client).returns(T.attached_class) }
171
224
  def self.new(client:)
@@ -0,0 +1,21 @@
1
+ # typed: strong
2
+
3
+ module EInvoiceAPI
4
+ module Resources
5
+ class Me
6
+ # Retrieve information about your account.
7
+ sig do
8
+ params(request_options: EInvoiceAPI::RequestOptions::OrHash).returns(
9
+ EInvoiceAPI::Models::MeRetrieveResponse
10
+ )
11
+ end
12
+ def retrieve(request_options: {})
13
+ end
14
+
15
+ # @api private
16
+ sig { params(client: EInvoiceAPI::Client).returns(T.attached_class) }
17
+ def self.new(client:)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -6,12 +6,16 @@ module EInvoiceAPI
6
6
  # Validate if the JSON document can be converted to a valid UBL document
7
7
  sig do
8
8
  params(
9
+ allowances:
10
+ T.nilable(T::Array[EInvoiceAPI::DocumentCreate::Allowance::OrHash]),
9
11
  amount_due:
10
12
  T.nilable(EInvoiceAPI::DocumentCreate::AmountDue::Variants),
11
13
  attachments:
12
14
  T.nilable(T::Array[EInvoiceAPI::DocumentAttachmentCreate::OrHash]),
13
15
  billing_address: T.nilable(String),
14
16
  billing_address_recipient: T.nilable(String),
17
+ charges:
18
+ T.nilable(T::Array[EInvoiceAPI::DocumentCreate::Charge::OrHash]),
15
19
  currency: EInvoiceAPI::CurrencyCode::OrSymbol,
16
20
  customer_address: T.nilable(String),
17
21
  customer_address_recipient: T.nilable(String),
@@ -26,7 +30,7 @@ module EInvoiceAPI
26
30
  invoice_id: T.nilable(String),
27
31
  invoice_total:
28
32
  T.nilable(EInvoiceAPI::DocumentCreate::InvoiceTotal::Variants),
29
- items: T.nilable(T::Array[EInvoiceAPI::DocumentCreate::Item::OrHash]),
33
+ items: T::Array[EInvoiceAPI::DocumentCreate::Item::OrHash],
30
34
  note: T.nilable(String),
31
35
  payment_details:
32
36
  T.nilable(T::Array[EInvoiceAPI::PaymentDetailCreate::OrHash]),
@@ -63,10 +67,14 @@ module EInvoiceAPI
63
67
  ).returns(EInvoiceAPI::UblDocumentValidation)
64
68
  end
65
69
  def validate_json(
70
+ allowances: nil,
71
+ # The amount due of the invoice. Must be positive and rounded to maximum 2
72
+ # decimals
66
73
  amount_due: nil,
67
74
  attachments: nil,
68
75
  billing_address: nil,
69
76
  billing_address_recipient: nil,
77
+ charges: nil,
70
78
  # Currency of the invoice
71
79
  currency: nil,
72
80
  customer_address: nil,
@@ -80,11 +88,16 @@ module EInvoiceAPI
80
88
  due_date: nil,
81
89
  invoice_date: nil,
82
90
  invoice_id: nil,
91
+ # The total amount of the invoice (so invoice_total = subtotal + total_tax +
92
+ # total_discount). Must be positive and rounded to maximum 2 decimals
83
93
  invoice_total: nil,
94
+ # At least one line item is required
84
95
  items: nil,
85
96
  note: nil,
86
97
  payment_details: nil,
87
98
  payment_term: nil,
99
+ # The previous unpaid balance of the invoice, if any. Must be positive and rounded
100
+ # to maximum 2 decimals
88
101
  previous_unpaid_balance: nil,
89
102
  purchase_order: nil,
90
103
  remittance_address: nil,
@@ -96,11 +109,17 @@ module EInvoiceAPI
96
109
  shipping_address: nil,
97
110
  shipping_address_recipient: nil,
98
111
  state: nil,
112
+ # The taxable base of the invoice. Should be the sum of all line items -
113
+ # allowances (for example commercial discounts) + charges with impact on VAT. Must
114
+ # be positive and rounded to maximum 2 decimals
99
115
  subtotal: nil,
100
116
  # Tax category code of the invoice
101
117
  tax_code: nil,
102
118
  tax_details: nil,
119
+ # The total financial discount of the invoice (so discounts not subject to VAT).
120
+ # Must be positive and rounded to maximum 2 decimals
103
121
  total_discount: nil,
122
+ # The total tax of the invoice. Must be positive and rounded to maximum 2 decimals
104
123
  total_tax: nil,
105
124
  # VATEX code list for VAT exemption reasons
106
125
  #
@@ -20,6 +20,8 @@ module EInvoiceAPI
20
20
 
21
21
  attr_reader lookup: EInvoiceAPI::Resources::Lookup
22
22
 
23
+ attr_reader me: EInvoiceAPI::Resources::Me
24
+
23
25
  attr_reader webhooks: EInvoiceAPI::Resources::Webhooks
24
26
 
25
27
  private def auth_headers: -> ::Hash[String, String]
@@ -0,0 +1,69 @@
1
+ module EInvoiceAPI
2
+ module Models
3
+ type allowance =
4
+ {
5
+ amount: String?,
6
+ base_amount: String?,
7
+ multiplier_factor: String?,
8
+ reason: String?,
9
+ reason_code: String?,
10
+ tax_code: EInvoiceAPI::Models::Allowance::tax_code?,
11
+ tax_rate: String?
12
+ }
13
+
14
+ class Allowance < EInvoiceAPI::Internal::Type::BaseModel
15
+ attr_accessor amount: String?
16
+
17
+ attr_accessor base_amount: String?
18
+
19
+ attr_accessor multiplier_factor: String?
20
+
21
+ attr_accessor reason: String?
22
+
23
+ attr_accessor reason_code: String?
24
+
25
+ attr_accessor tax_code: EInvoiceAPI::Models::Allowance::tax_code?
26
+
27
+ attr_accessor tax_rate: String?
28
+
29
+ def initialize: (
30
+ ?amount: String?,
31
+ ?base_amount: String?,
32
+ ?multiplier_factor: String?,
33
+ ?reason: String?,
34
+ ?reason_code: String?,
35
+ ?tax_code: EInvoiceAPI::Models::Allowance::tax_code?,
36
+ ?tax_rate: String?
37
+ ) -> void
38
+
39
+ def to_hash: -> {
40
+ amount: String?,
41
+ base_amount: String?,
42
+ multiplier_factor: String?,
43
+ reason: String?,
44
+ reason_code: String?,
45
+ tax_code: EInvoiceAPI::Models::Allowance::tax_code?,
46
+ tax_rate: String?
47
+ }
48
+
49
+ type tax_code = :AE | :E | :S | :Z | :G | :O | :K | :L | :M | :B
50
+
51
+ module TaxCode
52
+ extend EInvoiceAPI::Internal::Type::Enum
53
+
54
+ AE: :AE
55
+ E: :E
56
+ S: :S
57
+ Z: :Z
58
+ G: :G
59
+ O: :O
60
+ K: :K
61
+ L: :L
62
+ M: :M
63
+ B: :B
64
+
65
+ def self?.values: -> ::Array[EInvoiceAPI::Models::Allowance::tax_code]
66
+ end
67
+ end
68
+ end
69
+ end