facturx 1.0.0 → 1.1.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.
data/rbi/facturx.rbi CHANGED
@@ -1,17 +1,24 @@
1
1
  # typed: strict
2
2
 
3
3
  module Facturx
4
+ VERSION = T.let(T.unsafe(nil), String)
5
+
4
6
  class Error < StandardError
7
+ sig { params(message: T.nilable(String), details: T.untyped).void }
8
+ def initialize(message = nil, **details); end
9
+
5
10
  sig { returns(T::Hash[Symbol, T.untyped]) }
6
11
  attr_reader :details
7
12
  end
8
13
 
9
- class InvalidXmlError < Error; end
14
+ class ValidationError < Error; end
15
+ class InvalidDocumentError < ValidationError; end
16
+ class InvalidXmlError < ValidationError; end
10
17
  class UnknownProfileError < InvalidXmlError; end
11
18
  class XsdValidationError < InvalidXmlError; end
19
+ class SchemaLoadError < Error; end
20
+ class InvalidSourceError < Error; end
12
21
  class UnsupportedProfileError < Error; end
13
- class FormattingError < Error; end
14
- class ConformanceError < Error; end
15
22
  class InvalidPdfError < Error; end
16
23
  class ProtectedPdfError < InvalidPdfError; end
17
24
  class ComposerUnavailableError < Error; end
@@ -20,8 +27,8 @@ module Facturx
20
27
  class VerificationError < Error; end
21
28
 
22
29
  class << self
23
- sig { params(xml: String).returns(TrueClass) }
24
- def verify_xml(xml:); end
30
+ sig { params(xml: String).returns(Facturx::Validation::Report) }
31
+ def validate_xml(xml:); end
25
32
 
26
33
  sig { params(pdf: String, xml: String).returns(String) }
27
34
  def attach(pdf:, xml:); end
@@ -37,7 +44,7 @@ module Facturx
37
44
 
38
45
  sig do
39
46
  params(document: Facturx::Document, profile: T.any(Symbol, Facturx::Profile))
40
- .returns(Facturx::Conformance::Report)
47
+ .returns(Facturx::Validation::Report)
41
48
  end
42
49
  def validate_document(document:, profile:); end
43
50
 
@@ -51,10 +58,27 @@ module Facturx
51
58
  def generate(pdf:, document:, profile:); end
52
59
  end
53
60
 
54
- module Conformance
61
+ module Validation
55
62
  class Issue
63
+ sig do
64
+ params(
65
+ code: Symbol,
66
+ message: String,
67
+ layer: Symbol,
68
+ severity: Symbol,
69
+ term_id: T.nilable(String),
70
+ group_id: T.nilable(String),
71
+ path: T.nilable(String),
72
+ line: T.nilable(Integer),
73
+ column: T.nilable(Integer),
74
+ details: T::Hash[Symbol, T.untyped]
75
+ ).void
76
+ end
77
+ def initialize(code:, message:, layer:, severity: :error, term_id: nil, group_id: nil, path: nil,
78
+ line: nil, column: nil, details: {}); end
79
+
56
80
  sig { returns(Symbol) }
57
- attr_reader :code
81
+ attr_reader :code, :layer, :severity
58
82
 
59
83
  sig { returns(String) }
60
84
  attr_reader :message
@@ -62,15 +86,39 @@ module Facturx
62
86
  sig { returns(T.nilable(String)) }
63
87
  attr_reader :term_id, :group_id, :path
64
88
 
89
+ sig { returns(T.nilable(Integer)) }
90
+ attr_reader :line, :column
91
+
65
92
  sig { returns(T::Hash[Symbol, T.untyped]) }
66
93
  attr_reader :details
94
+
95
+ sig do
96
+ params(
97
+ code: Symbol,
98
+ message: String,
99
+ layer: Symbol,
100
+ severity: Symbol,
101
+ term_id: T.nilable(String),
102
+ group_id: T.nilable(String),
103
+ path: T.nilable(String),
104
+ line: T.nilable(Integer),
105
+ column: T.nilable(Integer),
106
+ details: T::Hash[Symbol, T.untyped]
107
+ ).returns(Facturx::Validation::Issue)
108
+ end
109
+ def with(code: self.code, message: self.message, layer: self.layer, severity: self.severity,
110
+ term_id: self.term_id, group_id: self.group_id, path: self.path, line: self.line,
111
+ column: self.column, details: self.details); end
67
112
  end
68
113
 
69
114
  class Report
70
- sig { returns(Facturx::Profile) }
115
+ sig { params(profile: T.nilable(Facturx::Profile), issues: T::Array[Facturx::Validation::Issue]).void }
116
+ def initialize(profile: nil, issues: []); end
117
+
118
+ sig { returns(T.nilable(Facturx::Profile)) }
71
119
  attr_reader :profile
72
120
 
73
- sig { returns(T::Array[Facturx::Conformance::Issue]) }
121
+ sig { returns(T::Array[Facturx::Validation::Issue]) }
74
122
  attr_reader :issues
75
123
 
76
124
  sig { returns(T::Boolean) }
@@ -78,48 +126,58 @@ module Facturx
78
126
 
79
127
  sig { returns(T::Boolean) }
80
128
  def invalid?; end
81
- end
82
- end
83
129
 
84
- class ProfileResolver
85
- sig { params(profile: T.any(Symbol, Facturx::Profile)).returns(Facturx::Profile) }
86
- def call(profile); end
87
- end
88
-
89
- class Writer
90
- sig { params(document: Facturx::Document, profile: Facturx::Profile).returns(String) }
91
- def call(document:, profile:); end
92
-
93
- sig do
94
- params(document: Facturx::Document, profile: Facturx::Profile)
95
- .returns(Facturx::Conformance::Report)
96
- end
97
- def validate(document:, profile:); end
98
- end
99
-
100
- class Generate
101
- sig do
102
- params(pdf: String, document: Facturx::Document, profile: T.any(Symbol, Facturx::Profile))
103
- .returns(String)
130
+ sig do
131
+ params(profile: T.nilable(Facturx::Profile), issues: T::Array[Facturx::Validation::Issue])
132
+ .returns(Facturx::Validation::Report)
133
+ end
134
+ def with(profile: self.profile, issues: self.issues); end
104
135
  end
105
- def call(pdf:, document:, profile:); end
106
136
  end
107
137
 
108
138
  class Profile
139
+ sig { params(id: Symbol, guideline_urn: String, conformance_level: String).void }
140
+ def initialize(id:, guideline_urn:, conformance_level:); end
141
+
109
142
  sig { returns(Symbol) }
110
143
  def id; end
111
144
 
112
145
  sig { returns(String) }
113
146
  def guideline_urn; end
114
147
 
115
- sig { returns(String) }
116
- def xsd_path; end
117
-
118
148
  sig { returns(String) }
119
149
  def conformance_level; end
150
+
151
+ sig do
152
+ params(id: Symbol, guideline_urn: String, conformance_level: String)
153
+ .returns(Facturx::Profile)
154
+ end
155
+ def with(id: self.id, guideline_urn: self.guideline_urn, conformance_level: self.conformance_level); end
156
+ end
157
+
158
+ module Profiles
159
+ sig { returns(T::Array[Facturx::Profile]) }
160
+ def self.all; end
161
+
162
+ sig { params(id: T.any(String, Symbol)).returns(Facturx::Profile) }
163
+ def self.fetch(id); end
164
+
165
+ sig { params(guideline_urn: String).returns(T.nilable(Facturx::Profile)) }
166
+ def self.for_guideline_urn(guideline_urn); end
120
167
  end
121
168
 
122
169
  class Diagnostic
170
+ sig do
171
+ params(
172
+ code: Symbol,
173
+ message: String,
174
+ term_id: T.nilable(String),
175
+ path: T.nilable(String),
176
+ details: T::Hash[Symbol, T.untyped]
177
+ ).void
178
+ end
179
+ def initialize(code:, message:, term_id: nil, path: nil, details: {}); end
180
+
123
181
  sig { returns(Symbol) }
124
182
  def code; end
125
183
 
@@ -134,9 +192,32 @@ module Facturx
134
192
 
135
193
  sig { returns(T::Hash[T.untyped, T.untyped]) }
136
194
  def details; end
195
+
196
+ sig do
197
+ params(
198
+ code: Symbol,
199
+ message: String,
200
+ term_id: T.nilable(String),
201
+ path: T.nilable(String),
202
+ details: T::Hash[Symbol, T.untyped]
203
+ ).returns(Facturx::Diagnostic)
204
+ end
205
+ def with(code: self.code, message: self.message, term_id: self.term_id, path: self.path,
206
+ details: self.details); end
137
207
  end
138
208
 
139
209
  class Reading
210
+ sig do
211
+ params(
212
+ document: Facturx::Document,
213
+ profile: Facturx::Profile,
214
+ source: String,
215
+ diagnostics: T::Array[Facturx::Diagnostic],
216
+ source_type: Symbol
217
+ ).void
218
+ end
219
+ def initialize(document:, profile:, source:, diagnostics: [], source_type: :xml); end
220
+
140
221
  sig { returns(Facturx::Document) }
141
222
  def document; end
142
223
 
@@ -151,42 +232,137 @@ module Facturx
151
232
 
152
233
  sig { returns(Symbol) }
153
234
  def source_type; end
235
+
236
+ sig do
237
+ params(
238
+ document: Facturx::Document,
239
+ profile: Facturx::Profile,
240
+ source: String,
241
+ diagnostics: T::Array[Facturx::Diagnostic],
242
+ source_type: Symbol
243
+ ).returns(Facturx::Reading)
244
+ end
245
+ def with(document: self.document, profile: self.profile, source: self.source,
246
+ diagnostics: self.diagnostics, source_type: self.source_type); end
154
247
  end
155
248
 
156
249
  class Note
250
+ sig { params(content: T.nilable(String), subject_code: T.nilable(String)).void }
251
+ def initialize(content: nil, subject_code: nil); end
252
+
157
253
  sig { returns(T.nilable(String)) }
158
254
  attr_reader :content, :subject_code
255
+
256
+ sig { params(content: T.nilable(String), subject_code: T.nilable(String)).returns(Facturx::Note) }
257
+ def with(content: self.content, subject_code: self.subject_code); end
159
258
  end
160
259
 
161
260
  class Identifier
261
+ sig { params(value: T.nilable(String), scheme_id: T.nilable(String)).void }
262
+ def initialize(value: nil, scheme_id: nil); end
263
+
162
264
  sig { returns(T.nilable(String)) }
163
265
  attr_reader :value, :scheme_id
266
+
267
+ sig { params(value: T.nilable(String), scheme_id: T.nilable(String)).returns(Facturx::Identifier) }
268
+ def with(value: self.value, scheme_id: self.scheme_id); end
164
269
  end
165
270
 
166
271
  class Period
272
+ sig { params(start_date: T.nilable(::Date), end_date: T.nilable(::Date)).void }
273
+ def initialize(start_date: nil, end_date: nil); end
274
+
167
275
  sig { returns(T.nilable(::Date)) }
168
276
  attr_reader :start_date, :end_date
277
+
278
+ sig { params(start_date: T.nilable(::Date), end_date: T.nilable(::Date)).returns(Facturx::Period) }
279
+ def with(start_date: self.start_date, end_date: self.end_date); end
169
280
  end
170
281
 
171
282
  class Quantity
283
+ sig { params(value: T.nilable(T.any(::BigDecimal, Integer)), unit_code: T.nilable(String)).void }
284
+ def initialize(value: nil, unit_code: nil); end
285
+
172
286
  sig { returns(T.nilable(T.any(::BigDecimal, Integer))) }
173
287
  attr_reader :value
174
288
 
175
289
  sig { returns(T.nilable(String)) }
176
290
  attr_reader :unit_code
291
+
292
+ sig do
293
+ params(value: T.nilable(T.any(::BigDecimal, Integer)), unit_code: T.nilable(String))
294
+ .returns(Facturx::Quantity)
295
+ end
296
+ def with(value: self.value, unit_code: self.unit_code); end
177
297
  end
178
298
 
179
299
  class Contact
300
+ sig { params(name: T.nilable(String), telephone: T.nilable(String), email: T.nilable(String)).void }
301
+ def initialize(name: nil, telephone: nil, email: nil); end
302
+
180
303
  sig { returns(T.nilable(String)) }
181
304
  attr_reader :name, :telephone, :email
305
+
306
+ sig do
307
+ params(name: T.nilable(String), telephone: T.nilable(String), email: T.nilable(String))
308
+ .returns(Facturx::Contact)
309
+ end
310
+ def with(name: self.name, telephone: self.telephone, email: self.email); end
182
311
  end
183
312
 
184
313
  class Address
314
+ sig do
315
+ params(
316
+ postcode: T.nilable(String),
317
+ line_one: T.nilable(String),
318
+ line_two: T.nilable(String),
319
+ line_three: T.nilable(String),
320
+ city: T.nilable(String),
321
+ country_code: T.nilable(String),
322
+ country_subdivision: T.nilable(String)
323
+ ).void
324
+ end
325
+ def initialize(postcode: nil, line_one: nil, line_two: nil, line_three: nil, city: nil,
326
+ country_code: nil, country_subdivision: nil); end
327
+
185
328
  sig { returns(T.nilable(String)) }
186
329
  attr_reader :postcode, :line_one, :line_two, :line_three, :city, :country_code, :country_subdivision
330
+
331
+ sig do
332
+ params(
333
+ postcode: T.nilable(String),
334
+ line_one: T.nilable(String),
335
+ line_two: T.nilable(String),
336
+ line_three: T.nilable(String),
337
+ city: T.nilable(String),
338
+ country_code: T.nilable(String),
339
+ country_subdivision: T.nilable(String)
340
+ ).returns(Facturx::Address)
341
+ end
342
+ def with(postcode: self.postcode, line_one: self.line_one, line_two: self.line_two,
343
+ line_three: self.line_three, city: self.city, country_code: self.country_code,
344
+ country_subdivision: self.country_subdivision); end
187
345
  end
188
346
 
189
347
  class Party
348
+ sig do
349
+ params(
350
+ identifiers: T::Array[Facturx::Identifier],
351
+ name: T.nilable(String),
352
+ description: T.nilable(String),
353
+ legal_registration: T.nilable(Facturx::Identifier),
354
+ trading_name: T.nilable(String),
355
+ address: T.nilable(Facturx::Address),
356
+ vat_identifier: T.nilable(Facturx::Identifier),
357
+ tax_identifier: T.nilable(Facturx::Identifier),
358
+ electronic_address: T.nilable(Facturx::Identifier),
359
+ contact: T.nilable(Facturx::Contact)
360
+ ).void
361
+ end
362
+ def initialize(identifiers: [], name: nil, description: nil, legal_registration: nil,
363
+ trading_name: nil, address: nil, vat_identifier: nil, tax_identifier: nil,
364
+ electronic_address: nil, contact: nil); end
365
+
190
366
  sig { returns(T.nilable(String)) }
191
367
  attr_reader :name, :description, :trading_name
192
368
 
@@ -210,9 +386,38 @@ module Facturx
210
386
 
211
387
  sig { returns(T.nilable(Facturx::Contact)) }
212
388
  def contact; end
389
+
390
+ sig do
391
+ params(
392
+ identifiers: T::Array[Facturx::Identifier],
393
+ name: T.nilable(String),
394
+ description: T.nilable(String),
395
+ legal_registration: T.nilable(Facturx::Identifier),
396
+ trading_name: T.nilable(String),
397
+ address: T.nilable(Facturx::Address),
398
+ vat_identifier: T.nilable(Facturx::Identifier),
399
+ tax_identifier: T.nilable(Facturx::Identifier),
400
+ electronic_address: T.nilable(Facturx::Identifier),
401
+ contact: T.nilable(Facturx::Contact)
402
+ ).returns(Facturx::Party)
403
+ end
404
+ def with(identifiers: self.identifiers, name: self.name, description: self.description,
405
+ legal_registration: self.legal_registration, trading_name: self.trading_name,
406
+ address: self.address, vat_identifier: self.vat_identifier,
407
+ tax_identifier: self.tax_identifier, electronic_address: self.electronic_address,
408
+ contact: self.contact); end
213
409
  end
214
410
 
215
411
  class CreditTransfer
412
+ sig do
413
+ params(
414
+ account_identifier: T.nilable(Facturx::Identifier),
415
+ account_name: T.nilable(String),
416
+ provider_identifier: T.nilable(Facturx::Identifier)
417
+ ).void
418
+ end
419
+ def initialize(account_identifier: nil, account_name: nil, provider_identifier: nil); end
420
+
216
421
  sig { returns(T.nilable(String)) }
217
422
  attr_reader :account_name
218
423
 
@@ -221,14 +426,42 @@ module Facturx
221
426
 
222
427
  sig { returns(T.nilable(Facturx::Identifier)) }
223
428
  def provider_identifier; end
429
+
430
+ sig do
431
+ params(
432
+ account_identifier: T.nilable(Facturx::Identifier),
433
+ account_name: T.nilable(String),
434
+ provider_identifier: T.nilable(Facturx::Identifier)
435
+ ).returns(Facturx::CreditTransfer)
436
+ end
437
+ def with(account_identifier: self.account_identifier, account_name: self.account_name,
438
+ provider_identifier: self.provider_identifier); end
224
439
  end
225
440
 
226
441
  class PaymentCard
442
+ sig { params(primary_account_number: T.nilable(String), holder_name: T.nilable(String)).void }
443
+ def initialize(primary_account_number: nil, holder_name: nil); end
444
+
227
445
  sig { returns(T.nilable(String)) }
228
446
  attr_reader :primary_account_number, :holder_name
447
+
448
+ sig do
449
+ params(primary_account_number: T.nilable(String), holder_name: T.nilable(String))
450
+ .returns(Facturx::PaymentCard)
451
+ end
452
+ def with(primary_account_number: self.primary_account_number, holder_name: self.holder_name); end
229
453
  end
230
454
 
231
455
  class DirectDebit
456
+ sig do
457
+ params(
458
+ mandate_identifier: T.nilable(Facturx::Identifier),
459
+ creditor_identifier: T.nilable(Facturx::Identifier),
460
+ debtor_account_identifier: T.nilable(Facturx::Identifier)
461
+ ).void
462
+ end
463
+ def initialize(mandate_identifier: nil, creditor_identifier: nil, debtor_account_identifier: nil); end
464
+
232
465
  sig { returns(T.nilable(Facturx::Identifier)) }
233
466
  def mandate_identifier; end
234
467
 
@@ -237,9 +470,32 @@ module Facturx
237
470
 
238
471
  sig { returns(T.nilable(Facturx::Identifier)) }
239
472
  def debtor_account_identifier; end
473
+
474
+ sig do
475
+ params(
476
+ mandate_identifier: T.nilable(Facturx::Identifier),
477
+ creditor_identifier: T.nilable(Facturx::Identifier),
478
+ debtor_account_identifier: T.nilable(Facturx::Identifier)
479
+ ).returns(Facturx::DirectDebit)
480
+ end
481
+ def with(mandate_identifier: self.mandate_identifier, creditor_identifier: self.creditor_identifier,
482
+ debtor_account_identifier: self.debtor_account_identifier); end
240
483
  end
241
484
 
242
485
  class PaymentInstructions
486
+ sig do
487
+ params(
488
+ means_code: T.nilable(String),
489
+ means_text: T.nilable(String),
490
+ remittance_information: T.nilable(String),
491
+ credit_transfers: T::Array[Facturx::CreditTransfer],
492
+ payment_card: T.nilable(Facturx::PaymentCard),
493
+ direct_debit: T.nilable(Facturx::DirectDebit)
494
+ ).void
495
+ end
496
+ def initialize(means_code: nil, means_text: nil, remittance_information: nil,
497
+ credit_transfers: [], payment_card: nil, direct_debit: nil); end
498
+
243
499
  sig { returns(T.nilable(String)) }
244
500
  attr_reader :means_code, :means_text, :remittance_information
245
501
 
@@ -251,17 +507,61 @@ module Facturx
251
507
 
252
508
  sig { returns(T.nilable(Facturx::DirectDebit)) }
253
509
  def direct_debit; end
510
+
511
+ sig do
512
+ params(
513
+ means_code: T.nilable(String),
514
+ means_text: T.nilable(String),
515
+ remittance_information: T.nilable(String),
516
+ credit_transfers: T::Array[Facturx::CreditTransfer],
517
+ payment_card: T.nilable(Facturx::PaymentCard),
518
+ direct_debit: T.nilable(Facturx::DirectDebit)
519
+ ).returns(Facturx::PaymentInstructions)
520
+ end
521
+ def with(means_code: self.means_code, means_text: self.means_text,
522
+ remittance_information: self.remittance_information,
523
+ credit_transfers: self.credit_transfers, payment_card: self.payment_card,
524
+ direct_debit: self.direct_debit); end
254
525
  end
255
526
 
256
527
  class DocumentReference
528
+ sig do
529
+ params(
530
+ id: T.nilable(String),
531
+ line_id: T.nilable(String),
532
+ name: T.nilable(String),
533
+ issue_date: T.nilable(::Date)
534
+ ).void
535
+ end
536
+ def initialize(id: nil, line_id: nil, name: nil, issue_date: nil); end
537
+
257
538
  sig { returns(T.nilable(String)) }
258
539
  attr_reader :id, :line_id, :name
259
540
 
260
541
  sig { returns(T.nilable(::Date)) }
261
542
  attr_reader :issue_date
543
+
544
+ sig do
545
+ params(
546
+ id: T.nilable(String),
547
+ line_id: T.nilable(String),
548
+ name: T.nilable(String),
549
+ issue_date: T.nilable(::Date)
550
+ ).returns(Facturx::DocumentReference)
551
+ end
552
+ def with(id: self.id, line_id: self.line_id, name: self.name, issue_date: self.issue_date); end
262
553
  end
263
554
 
264
555
  class Delivery
556
+ sig do
557
+ params(
558
+ location_identifier: T.nilable(Facturx::Identifier),
559
+ party: T.nilable(Facturx::Party),
560
+ date: T.nilable(::Date)
561
+ ).void
562
+ end
563
+ def initialize(location_identifier: nil, party: nil, date: nil); end
564
+
265
565
  sig { returns(T.nilable(::Date)) }
266
566
  attr_reader :date
267
567
 
@@ -270,24 +570,92 @@ module Facturx
270
570
 
271
571
  sig { returns(T.nilable(Facturx::Party)) }
272
572
  def party; end
573
+
574
+ sig do
575
+ params(
576
+ location_identifier: T.nilable(Facturx::Identifier),
577
+ party: T.nilable(Facturx::Party),
578
+ date: T.nilable(::Date)
579
+ ).returns(Facturx::Delivery)
580
+ end
581
+ def with(location_identifier: self.location_identifier, party: self.party, date: self.date); end
273
582
  end
274
583
 
275
584
  class SupportingDocument
585
+ sig do
586
+ params(
587
+ reference: T.nilable(String),
588
+ description: T.nilable(String),
589
+ external_location: T.nilable(String),
590
+ content: T.nilable(String),
591
+ mime_code: T.nilable(String),
592
+ filename: T.nilable(String)
593
+ ).void
594
+ end
595
+ def initialize(reference: nil, description: nil, external_location: nil, content: nil,
596
+ mime_code: nil, filename: nil); end
597
+
276
598
  sig { returns(T.nilable(String)) }
277
599
  attr_reader :reference, :description, :external_location, :content, :mime_code, :filename
600
+
601
+ sig do
602
+ params(
603
+ reference: T.nilable(String),
604
+ description: T.nilable(String),
605
+ external_location: T.nilable(String),
606
+ content: T.nilable(String),
607
+ mime_code: T.nilable(String),
608
+ filename: T.nilable(String)
609
+ ).returns(Facturx::SupportingDocument)
610
+ end
611
+ def with(reference: self.reference, description: self.description,
612
+ external_location: self.external_location, content: self.content,
613
+ mime_code: self.mime_code, filename: self.filename); end
278
614
  end
279
615
 
280
616
  class ProductAttribute
617
+ sig { params(name: T.nilable(String), value: T.nilable(String)).void }
618
+ def initialize(name: nil, value: nil); end
619
+
281
620
  sig { returns(T.nilable(String)) }
282
621
  attr_reader :name, :value
622
+
623
+ sig { params(name: T.nilable(String), value: T.nilable(String)).returns(Facturx::ProductAttribute) }
624
+ def with(name: self.name, value: self.value); end
283
625
  end
284
626
 
285
627
  class ProductClassification
628
+ sig do
629
+ params(code: T.nilable(String), list_id: T.nilable(String), list_version_id: T.nilable(String)).void
630
+ end
631
+ def initialize(code: nil, list_id: nil, list_version_id: nil); end
632
+
286
633
  sig { returns(T.nilable(String)) }
287
634
  attr_reader :code, :list_id, :list_version_id
635
+
636
+ sig do
637
+ params(code: T.nilable(String), list_id: T.nilable(String), list_version_id: T.nilable(String))
638
+ .returns(Facturx::ProductClassification)
639
+ end
640
+ def with(code: self.code, list_id: self.list_id, list_version_id: self.list_version_id); end
288
641
  end
289
642
 
290
643
  class Product
644
+ sig do
645
+ params(
646
+ name: T.nilable(String),
647
+ description: T.nilable(String),
648
+ seller_identifier: T.nilable(Facturx::Identifier),
649
+ buyer_identifier: T.nilable(Facturx::Identifier),
650
+ global_identifier: T.nilable(Facturx::Identifier),
651
+ attributes: T::Array[Facturx::ProductAttribute],
652
+ classifications: T::Array[Facturx::ProductClassification],
653
+ origin_country_code: T.nilable(String)
654
+ ).void
655
+ end
656
+ def initialize(name: nil, description: nil, seller_identifier: nil, buyer_identifier: nil,
657
+ global_identifier: nil, attributes: [], classifications: [], origin_country_code: nil); end
658
+
291
659
  sig { returns(T.nilable(String)) }
292
660
  attr_reader :name, :description, :origin_country_code
293
661
 
@@ -305,25 +673,107 @@ module Facturx
305
673
 
306
674
  sig { returns(T::Array[Facturx::ProductClassification]) }
307
675
  def classifications; end
676
+
677
+ sig do
678
+ params(
679
+ name: T.nilable(String),
680
+ description: T.nilable(String),
681
+ seller_identifier: T.nilable(Facturx::Identifier),
682
+ buyer_identifier: T.nilable(Facturx::Identifier),
683
+ global_identifier: T.nilable(Facturx::Identifier),
684
+ attributes: T::Array[Facturx::ProductAttribute],
685
+ classifications: T::Array[Facturx::ProductClassification],
686
+ origin_country_code: T.nilable(String)
687
+ ).returns(Facturx::Product)
688
+ end
689
+ def with(name: self.name, description: self.description,
690
+ seller_identifier: self.seller_identifier, buyer_identifier: self.buyer_identifier,
691
+ global_identifier: self.global_identifier, attributes: self.attributes,
692
+ classifications: self.classifications, origin_country_code: self.origin_country_code); end
308
693
  end
309
694
 
310
695
  class Price
696
+ sig do
697
+ params(
698
+ amount: T.nilable(T.any(::BigDecimal, Integer)),
699
+ basis_quantity: T.nilable(Facturx::Quantity),
700
+ discount: T.nilable(T.any(::BigDecimal, Integer))
701
+ ).void
702
+ end
703
+ def initialize(amount: nil, basis_quantity: nil, discount: nil); end
704
+
311
705
  sig { returns(T.nilable(T.any(::BigDecimal, Integer))) }
312
706
  attr_reader :amount, :discount
313
707
 
314
708
  sig { returns(T.nilable(Facturx::Quantity)) }
315
709
  def basis_quantity; end
710
+
711
+ sig do
712
+ params(
713
+ amount: T.nilable(T.any(::BigDecimal, Integer)),
714
+ basis_quantity: T.nilable(Facturx::Quantity),
715
+ discount: T.nilable(T.any(::BigDecimal, Integer))
716
+ ).returns(Facturx::Price)
717
+ end
718
+ def with(amount: self.amount, basis_quantity: self.basis_quantity, discount: self.discount); end
316
719
  end
317
720
 
318
721
  class TaxBreakdown
722
+ sig do
723
+ params(
724
+ type_code: T.nilable(String),
725
+ category_code: T.nilable(String),
726
+ rate: T.nilable(T.any(::BigDecimal, Integer)),
727
+ basis_amount: T.nilable(T.any(::BigDecimal, Integer)),
728
+ tax_amount: T.nilable(T.any(::BigDecimal, Integer)),
729
+ exemption_reason: T.nilable(String),
730
+ exemption_reason_code: T.nilable(String),
731
+ due_date_type_code: T.nilable(String)
732
+ ).void
733
+ end
734
+ def initialize(type_code: nil, category_code: nil, rate: nil, basis_amount: nil, tax_amount: nil,
735
+ exemption_reason: nil, exemption_reason_code: nil, due_date_type_code: nil); end
736
+
319
737
  sig { returns(T.nilable(String)) }
320
738
  attr_reader :type_code, :category_code, :exemption_reason, :exemption_reason_code, :due_date_type_code
321
739
 
322
740
  sig { returns(T.nilable(T.any(::BigDecimal, Integer))) }
323
741
  attr_reader :rate, :basis_amount, :tax_amount
742
+
743
+ sig do
744
+ params(
745
+ type_code: T.nilable(String),
746
+ category_code: T.nilable(String),
747
+ rate: T.nilable(T.any(::BigDecimal, Integer)),
748
+ basis_amount: T.nilable(T.any(::BigDecimal, Integer)),
749
+ tax_amount: T.nilable(T.any(::BigDecimal, Integer)),
750
+ exemption_reason: T.nilable(String),
751
+ exemption_reason_code: T.nilable(String),
752
+ due_date_type_code: T.nilable(String)
753
+ ).returns(Facturx::TaxBreakdown)
754
+ end
755
+ def with(type_code: self.type_code, category_code: self.category_code, rate: self.rate,
756
+ basis_amount: self.basis_amount, tax_amount: self.tax_amount,
757
+ exemption_reason: self.exemption_reason,
758
+ exemption_reason_code: self.exemption_reason_code,
759
+ due_date_type_code: self.due_date_type_code); end
324
760
  end
325
761
 
326
762
  class AllowanceCharge
763
+ sig do
764
+ params(
765
+ indicator: T.nilable(T::Boolean),
766
+ amount: T.nilable(T.any(::BigDecimal, Integer)),
767
+ base_amount: T.nilable(T.any(::BigDecimal, Integer)),
768
+ percentage: T.nilable(T.any(::BigDecimal, Integer)),
769
+ reason: T.nilable(String),
770
+ reason_code: T.nilable(String),
771
+ tax: T.nilable(Facturx::TaxBreakdown)
772
+ ).void
773
+ end
774
+ def initialize(indicator: nil, amount: nil, base_amount: nil, percentage: nil, reason: nil,
775
+ reason_code: nil, tax: nil); end
776
+
327
777
  sig { returns(T.nilable(T::Boolean)) }
328
778
  attr_reader :indicator
329
779
 
@@ -335,15 +785,91 @@ module Facturx
335
785
 
336
786
  sig { returns(T.nilable(Facturx::TaxBreakdown)) }
337
787
  def tax; end
788
+
789
+ sig do
790
+ params(
791
+ indicator: T.nilable(T::Boolean),
792
+ amount: T.nilable(T.any(::BigDecimal, Integer)),
793
+ base_amount: T.nilable(T.any(::BigDecimal, Integer)),
794
+ percentage: T.nilable(T.any(::BigDecimal, Integer)),
795
+ reason: T.nilable(String),
796
+ reason_code: T.nilable(String),
797
+ tax: T.nilable(Facturx::TaxBreakdown)
798
+ ).returns(Facturx::AllowanceCharge)
799
+ end
800
+ def with(indicator: self.indicator, amount: self.amount, base_amount: self.base_amount,
801
+ percentage: self.percentage, reason: self.reason, reason_code: self.reason_code,
802
+ tax: self.tax); end
338
803
  end
339
804
 
340
805
  class Totals
806
+ sig do
807
+ params(
808
+ line_total: T.nilable(T.any(::BigDecimal, Integer)),
809
+ charge_total: T.nilable(T.any(::BigDecimal, Integer)),
810
+ allowance_total: T.nilable(T.any(::BigDecimal, Integer)),
811
+ tax_basis_total: T.nilable(T.any(::BigDecimal, Integer)),
812
+ tax_total: T.nilable(T.any(::BigDecimal, Integer)),
813
+ tax_total_in_tax_currency: T.nilable(T.any(::BigDecimal, Integer)),
814
+ grand_total: T.nilable(T.any(::BigDecimal, Integer)),
815
+ prepaid: T.nilable(T.any(::BigDecimal, Integer)),
816
+ rounding: T.nilable(T.any(::BigDecimal, Integer)),
817
+ due_payable: T.nilable(T.any(::BigDecimal, Integer))
818
+ ).void
819
+ end
820
+ def initialize(line_total: nil, charge_total: nil, allowance_total: nil, tax_basis_total: nil,
821
+ tax_total: nil, tax_total_in_tax_currency: nil, grand_total: nil, prepaid: nil,
822
+ rounding: nil, due_payable: nil); end
823
+
341
824
  sig { returns(T.nilable(T.any(::BigDecimal, Integer))) }
342
825
  attr_reader :line_total, :charge_total, :allowance_total, :tax_basis_total, :tax_total,
343
826
  :tax_total_in_tax_currency, :grand_total, :prepaid, :rounding, :due_payable
827
+
828
+ sig do
829
+ params(
830
+ line_total: T.nilable(T.any(::BigDecimal, Integer)),
831
+ charge_total: T.nilable(T.any(::BigDecimal, Integer)),
832
+ allowance_total: T.nilable(T.any(::BigDecimal, Integer)),
833
+ tax_basis_total: T.nilable(T.any(::BigDecimal, Integer)),
834
+ tax_total: T.nilable(T.any(::BigDecimal, Integer)),
835
+ tax_total_in_tax_currency: T.nilable(T.any(::BigDecimal, Integer)),
836
+ grand_total: T.nilable(T.any(::BigDecimal, Integer)),
837
+ prepaid: T.nilable(T.any(::BigDecimal, Integer)),
838
+ rounding: T.nilable(T.any(::BigDecimal, Integer)),
839
+ due_payable: T.nilable(T.any(::BigDecimal, Integer))
840
+ ).returns(Facturx::Totals)
841
+ end
842
+ def with(line_total: self.line_total, charge_total: self.charge_total,
843
+ allowance_total: self.allowance_total, tax_basis_total: self.tax_basis_total,
844
+ tax_total: self.tax_total, tax_total_in_tax_currency: self.tax_total_in_tax_currency,
845
+ grand_total: self.grand_total, prepaid: self.prepaid, rounding: self.rounding,
846
+ due_payable: self.due_payable); end
344
847
  end
345
848
 
346
849
  class Line
850
+ sig do
851
+ params(
852
+ id: T.nilable(String),
853
+ note: T.nilable(String),
854
+ product: T.nilable(Facturx::Product),
855
+ quantity: T.nilable(Facturx::Quantity),
856
+ gross_price: T.nilable(Facturx::Price),
857
+ net_price: T.nilable(Facturx::Price),
858
+ tax: T.nilable(Facturx::TaxBreakdown),
859
+ period: T.nilable(Facturx::Period),
860
+ net_amount: T.nilable(T.any(::BigDecimal, Integer)),
861
+ allowances: T::Array[Facturx::AllowanceCharge],
862
+ charges: T::Array[Facturx::AllowanceCharge],
863
+ buyer_order_reference: T.nilable(Facturx::DocumentReference),
864
+ invoiced_object_identifier: T.nilable(Facturx::Identifier),
865
+ buyer_accounting_reference: T.nilable(String)
866
+ ).void
867
+ end
868
+ def initialize(id: nil, note: nil, product: nil, quantity: nil, gross_price: nil,
869
+ net_price: nil, tax: nil, period: nil, net_amount: nil, allowances: [], charges: [],
870
+ buyer_order_reference: nil, invoiced_object_identifier: nil,
871
+ buyer_accounting_reference: nil); end
872
+
347
873
  sig { returns(T.nilable(String)) }
348
874
  attr_reader :id, :note, :buyer_accounting_reference
349
875
 
@@ -379,9 +905,86 @@ module Facturx
379
905
 
380
906
  sig { returns(T.nilable(Facturx::Identifier)) }
381
907
  def invoiced_object_identifier; end
908
+
909
+ sig do
910
+ params(
911
+ id: T.nilable(String),
912
+ note: T.nilable(String),
913
+ product: T.nilable(Facturx::Product),
914
+ quantity: T.nilable(Facturx::Quantity),
915
+ gross_price: T.nilable(Facturx::Price),
916
+ net_price: T.nilable(Facturx::Price),
917
+ tax: T.nilable(Facturx::TaxBreakdown),
918
+ period: T.nilable(Facturx::Period),
919
+ net_amount: T.nilable(T.any(::BigDecimal, Integer)),
920
+ allowances: T::Array[Facturx::AllowanceCharge],
921
+ charges: T::Array[Facturx::AllowanceCharge],
922
+ buyer_order_reference: T.nilable(Facturx::DocumentReference),
923
+ invoiced_object_identifier: T.nilable(Facturx::Identifier),
924
+ buyer_accounting_reference: T.nilable(String)
925
+ ).returns(Facturx::Line)
926
+ end
927
+ def with(id: self.id, note: self.note, product: self.product, quantity: self.quantity,
928
+ gross_price: self.gross_price, net_price: self.net_price, tax: self.tax,
929
+ period: self.period, net_amount: self.net_amount, allowances: self.allowances,
930
+ charges: self.charges, buyer_order_reference: self.buyer_order_reference,
931
+ invoiced_object_identifier: self.invoiced_object_identifier,
932
+ buyer_accounting_reference: self.buyer_accounting_reference); end
382
933
  end
383
934
 
384
935
  class Document
936
+ sig do
937
+ params(
938
+ guideline_urn: T.nilable(String),
939
+ business_process: T.nilable(String),
940
+ invoice_number: T.nilable(String),
941
+ type_code: T.nilable(String),
942
+ issue_date: T.nilable(::Date),
943
+ notes: T::Array[Facturx::Note],
944
+ currency: T.nilable(String),
945
+ tax_currency: T.nilable(String),
946
+ vat_point_date: T.nilable(::Date),
947
+ vat_point_date_code: T.nilable(String),
948
+ buyer_reference: T.nilable(String),
949
+ project_reference: T.nilable(Facturx::DocumentReference),
950
+ contract_reference: T.nilable(Facturx::DocumentReference),
951
+ purchase_order_reference: T.nilable(Facturx::DocumentReference),
952
+ sales_order_reference: T.nilable(Facturx::DocumentReference),
953
+ receiving_advice_reference: T.nilable(Facturx::DocumentReference),
954
+ despatch_advice_reference: T.nilable(Facturx::DocumentReference),
955
+ tender_or_lot_reference: T.nilable(Facturx::DocumentReference),
956
+ invoiced_object_identifier: T.nilable(Facturx::Identifier),
957
+ seller: T.nilable(Facturx::Party),
958
+ buyer: T.nilable(Facturx::Party),
959
+ payee: T.nilable(Facturx::Party),
960
+ tax_representative: T.nilable(Facturx::Party),
961
+ delivery: T.nilable(Facturx::Delivery),
962
+ billing_period: T.nilable(Facturx::Period),
963
+ payment: T.nilable(Facturx::PaymentInstructions),
964
+ payment_terms: T.nilable(String),
965
+ payment_due_date: T.nilable(::Date),
966
+ lines: T::Array[Facturx::Line],
967
+ tax_breakdowns: T::Array[Facturx::TaxBreakdown],
968
+ allowances: T::Array[Facturx::AllowanceCharge],
969
+ charges: T::Array[Facturx::AllowanceCharge],
970
+ totals: T.nilable(Facturx::Totals),
971
+ preceding_invoices: T::Array[Facturx::DocumentReference],
972
+ supporting_documents: T::Array[Facturx::SupportingDocument],
973
+ buyer_accounting_reference: T.nilable(String)
974
+ ).void
975
+ end
976
+ def initialize(guideline_urn: nil, business_process: nil, invoice_number: nil, type_code: nil,
977
+ issue_date: nil, notes: [], currency: nil, tax_currency: nil,
978
+ vat_point_date: nil, vat_point_date_code: nil, buyer_reference: nil,
979
+ project_reference: nil, contract_reference: nil, purchase_order_reference: nil,
980
+ sales_order_reference: nil, receiving_advice_reference: nil,
981
+ despatch_advice_reference: nil, tender_or_lot_reference: nil,
982
+ invoiced_object_identifier: nil, seller: nil, buyer: nil, payee: nil,
983
+ tax_representative: nil, delivery: nil, billing_period: nil, payment: nil,
984
+ payment_terms: nil, payment_due_date: nil, lines: [], tax_breakdowns: [],
985
+ allowances: [], charges: [], totals: nil, preceding_invoices: [],
986
+ supporting_documents: [], buyer_accounting_reference: nil); end
987
+
385
988
  sig { returns(T.nilable(String)) }
386
989
  attr_reader :guideline_urn, :business_process, :invoice_number, :type_code, :currency, :tax_currency,
387
990
  :vat_point_date_code, :buyer_reference, :buyer_accounting_reference, :payment_terms
@@ -465,6 +1068,66 @@ module Facturx
465
1068
 
466
1069
  sig { returns(T::Array[Facturx::SupportingDocument]) }
467
1070
  def supporting_documents; end
1071
+
1072
+ sig do
1073
+ params(
1074
+ guideline_urn: T.nilable(String),
1075
+ business_process: T.nilable(String),
1076
+ invoice_number: T.nilable(String),
1077
+ type_code: T.nilable(String),
1078
+ issue_date: T.nilable(::Date),
1079
+ notes: T::Array[Facturx::Note],
1080
+ currency: T.nilable(String),
1081
+ tax_currency: T.nilable(String),
1082
+ vat_point_date: T.nilable(::Date),
1083
+ vat_point_date_code: T.nilable(String),
1084
+ buyer_reference: T.nilable(String),
1085
+ project_reference: T.nilable(Facturx::DocumentReference),
1086
+ contract_reference: T.nilable(Facturx::DocumentReference),
1087
+ purchase_order_reference: T.nilable(Facturx::DocumentReference),
1088
+ sales_order_reference: T.nilable(Facturx::DocumentReference),
1089
+ receiving_advice_reference: T.nilable(Facturx::DocumentReference),
1090
+ despatch_advice_reference: T.nilable(Facturx::DocumentReference),
1091
+ tender_or_lot_reference: T.nilable(Facturx::DocumentReference),
1092
+ invoiced_object_identifier: T.nilable(Facturx::Identifier),
1093
+ seller: T.nilable(Facturx::Party),
1094
+ buyer: T.nilable(Facturx::Party),
1095
+ payee: T.nilable(Facturx::Party),
1096
+ tax_representative: T.nilable(Facturx::Party),
1097
+ delivery: T.nilable(Facturx::Delivery),
1098
+ billing_period: T.nilable(Facturx::Period),
1099
+ payment: T.nilable(Facturx::PaymentInstructions),
1100
+ payment_terms: T.nilable(String),
1101
+ payment_due_date: T.nilable(::Date),
1102
+ lines: T::Array[Facturx::Line],
1103
+ tax_breakdowns: T::Array[Facturx::TaxBreakdown],
1104
+ allowances: T::Array[Facturx::AllowanceCharge],
1105
+ charges: T::Array[Facturx::AllowanceCharge],
1106
+ totals: T.nilable(Facturx::Totals),
1107
+ preceding_invoices: T::Array[Facturx::DocumentReference],
1108
+ supporting_documents: T::Array[Facturx::SupportingDocument],
1109
+ buyer_accounting_reference: T.nilable(String)
1110
+ ).returns(Facturx::Document)
1111
+ end
1112
+ def with(guideline_urn: self.guideline_urn, business_process: self.business_process,
1113
+ invoice_number: self.invoice_number, type_code: self.type_code, issue_date: self.issue_date,
1114
+ notes: self.notes, currency: self.currency, tax_currency: self.tax_currency,
1115
+ vat_point_date: self.vat_point_date, vat_point_date_code: self.vat_point_date_code,
1116
+ buyer_reference: self.buyer_reference, project_reference: self.project_reference,
1117
+ contract_reference: self.contract_reference,
1118
+ purchase_order_reference: self.purchase_order_reference,
1119
+ sales_order_reference: self.sales_order_reference,
1120
+ receiving_advice_reference: self.receiving_advice_reference,
1121
+ despatch_advice_reference: self.despatch_advice_reference,
1122
+ tender_or_lot_reference: self.tender_or_lot_reference,
1123
+ invoiced_object_identifier: self.invoiced_object_identifier, seller: self.seller,
1124
+ buyer: self.buyer, payee: self.payee, tax_representative: self.tax_representative,
1125
+ delivery: self.delivery, billing_period: self.billing_period, payment: self.payment,
1126
+ payment_terms: self.payment_terms, payment_due_date: self.payment_due_date,
1127
+ lines: self.lines, tax_breakdowns: self.tax_breakdowns, allowances: self.allowances,
1128
+ charges: self.charges, totals: self.totals, preceding_invoices: self.preceding_invoices,
1129
+ supporting_documents: self.supporting_documents,
1130
+ buyer_accounting_reference: self.buyer_accounting_reference); end
468
1131
  end
469
1132
 
470
1133
  module Builders
@@ -1087,4 +1750,6 @@ module Facturx
1087
1750
  def build; end
1088
1751
  end
1089
1752
  end
1753
+
1754
+ private_constant :Builders
1090
1755
  end