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