factpulse 3.0.36 → 4.0.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.
@@ -1,21 +1,45 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module FactPulse
3
- module Helpers
4
- class FactPulseError < StandardError; end
5
- class FactPulseAuthError < FactPulseError; end
6
- class FactPulsePollingTimeout < FactPulseError
7
- attr_reader :task_id, :timeout
8
- def initialize(task_id, timeout); @task_id, @timeout = task_id, timeout; super("Timeout (#{timeout}ms) for #{task_id}"); end
4
+ # Additional error types (base Error class is in client.rb)
5
+ class AuthError < Error; end
6
+
7
+ class PollingTimeout < Error
8
+ attr_reader :task_id, :timeout
9
+
10
+ def initialize(task_id, timeout)
11
+ @task_id = task_id
12
+ @timeout = timeout
13
+ super("Timeout (#{timeout}ms) for #{task_id}")
9
14
  end
10
- class ValidationErrorDetail
11
- attr_accessor :level, :item, :reason, :source, :code
12
- def initialize(level: '', item: '', reason: '', source: nil, code: nil); @level, @item, @reason, @source, @code = level, item, reason, source, code; end
13
- def to_s; "[#{@item.to_s.empty? ? 'unknown' : @item}] #{@reason.to_s.empty? ? 'Unknown error' : @reason}"; end
14
- def self.from_hash(h); new(level: h['level']||'', item: h['item']||'', reason: h['reason']||'', source: h['source'], code: h['code']); end
15
+ end
16
+
17
+ class ValidationErrorDetail
18
+ attr_accessor :level, :item, :reason, :source, :code
19
+
20
+ def initialize(level: '', item: '', reason: '', source: nil, code: nil)
21
+ @level = level
22
+ @item = item
23
+ @reason = reason
24
+ @source = source
25
+ @code = code
26
+ end
27
+
28
+ def to_s
29
+ "[#{@item.to_s.empty? ? 'unknown' : @item}] #{@reason.to_s.empty? ? 'Unknown error' : @reason}"
15
30
  end
16
- class FactPulseValidationError < FactPulseError
17
- attr_reader :errors
18
- def initialize(msg, errors = []); @errors = errors; super(errors.empty? ? msg : "#{msg}\n\nDetails:\n#{errors.map{|e| " - #{e}"}.join("\n")}"); end
31
+
32
+ def self.from_hash(h)
33
+ new(level: h['level'] || '', item: h['item'] || '', reason: h['reason'] || '', source: h['source'], code: h['code'])
34
+ end
35
+ end
36
+
37
+ class ValidationError < Error
38
+ attr_reader :errors
39
+
40
+ def initialize(msg, errors = [])
41
+ @errors = errors
42
+ super(errors.empty? ? msg : "#{msg}\n\nDetails:\n#{errors.map { |e| " - #{e}" }.join("\n")}")
19
43
  end
20
44
  end
21
45
  end
@@ -1,13 +1,14 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'exceptions'
2
+
3
+ # Load client first (defines FactPulse::Error base class)
3
4
  require_relative 'client'
5
+ # Then load additional exception types
6
+ require_relative 'exceptions'
7
+
4
8
  module FactPulse
5
9
  module Helpers
6
- def self.create_client(**opts); FactPulseClient.new(**opts); end
7
- def self.format_amount(m); AmountHelpers.amount(m); end
8
- def self.amount(m); AmountHelpers.amount(m); end
9
- def self.invoice_totals(*args, **kwargs); AmountHelpers.invoice_totals(*args, **kwargs); end
10
- def self.invoice_line(*args, **kwargs); AmountHelpers.invoice_line(*args, **kwargs); end
11
- def self.vat_line(*args, **kwargs); AmountHelpers.vat_line(*args, **kwargs); end
10
+ def self.create_client(**opts)
11
+ FactPulse::Client.new(**opts)
12
+ end
12
13
  end
13
14
  end
@@ -14,15 +14,26 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module FactPulse
17
- class FactureElectroniqueRestApiSchemasEreportingInvoiceTypeCode
18
- N380 = "380".freeze
19
- N381 = "381".freeze
20
- N384 = "384".freeze
21
- N389 = "389".freeze
22
- N386 = "386".freeze
17
+ class FactureElectroniqueModelsInvoiceTypeCode
18
+ INVOICE = "380".freeze
19
+ SELF_BILLED_INVOICE = "389".freeze
20
+ FACTORED_INVOICE = "393".freeze
21
+ SELF_BILLED_FACTORED_INVOICE = "501".freeze
22
+ PREPAYMENT_INVOICE = "386".freeze
23
+ SELF_BILLED_PREPAYMENT_INVOICE = "500".freeze
24
+ CORRECTIVE_INVOICE = "384".freeze
25
+ SELF_BILLED_CORRECTIVE_INVOICE = "471".freeze
26
+ FACTORED_CORRECTIVE_INVOICE = "472".freeze
27
+ SELF_BILLED_FACTORED_CORRECTIVE_INVOICE = "473".freeze
28
+ CREDIT_NOTE = "381".freeze
29
+ SELF_BILLED_CREDIT_NOTE = "261".freeze
30
+ GLOBAL_ALLOWANCE_CREDIT_NOTE = "262".freeze
31
+ FACTORED_CREDIT_NOTE = "396".freeze
32
+ SELF_BILLED_FACTORED_CREDIT_NOTE = "502".freeze
33
+ PREPAYMENT_CREDIT_NOTE = "503".freeze
23
34
 
24
35
  def self.all_vars
25
- @all_vars ||= [N380, N381, N384, N389, N386].freeze
36
+ @all_vars ||= [INVOICE, SELF_BILLED_INVOICE, FACTORED_INVOICE, SELF_BILLED_FACTORED_INVOICE, PREPAYMENT_INVOICE, SELF_BILLED_PREPAYMENT_INVOICE, CORRECTIVE_INVOICE, SELF_BILLED_CORRECTIVE_INVOICE, FACTORED_CORRECTIVE_INVOICE, SELF_BILLED_FACTORED_CORRECTIVE_INVOICE, CREDIT_NOTE, SELF_BILLED_CREDIT_NOTE, GLOBAL_ALLOWANCE_CREDIT_NOTE, FACTORED_CREDIT_NOTE, SELF_BILLED_FACTORED_CREDIT_NOTE, PREPAYMENT_CREDIT_NOTE].freeze
26
37
  end
27
38
 
28
39
  # Builds the enum from string
@@ -36,8 +47,8 @@ module FactPulse
36
47
  # @param [String] The enum value in the form of the string
37
48
  # @return [String] The enum value
38
49
  def build_from_hash(value)
39
- return value if FactureElectroniqueRestApiSchemasEreportingInvoiceTypeCode.all_vars.include?(value)
40
- raise "Invalid ENUM value #{value} for class #FactureElectroniqueRestApiSchemasEreportingInvoiceTypeCode"
50
+ return value if FactureElectroniqueModelsInvoiceTypeCode.all_vars.include?(value)
51
+ raise "Invalid ENUM value #{value} for class #FactureElectroniqueModelsInvoiceTypeCode"
41
52
  end
42
53
  end
43
54
  end
@@ -112,7 +112,7 @@ module FactPulse
112
112
  {
113
113
  :'invoice_id' => :'String',
114
114
  :'issue_date' => :'Date',
115
- :'type_code' => :'FactureElectroniqueRestApiSchemasEreportingInvoiceTypeCode',
115
+ :'type_code' => :'InvoiceTypeCode',
116
116
  :'currency' => :'Currency',
117
117
  :'due_date' => :'Date',
118
118
  :'seller_siren' => :'String',
@@ -15,25 +15,14 @@ require 'time'
15
15
 
16
16
  module FactPulse
17
17
  class InvoiceTypeCode
18
- INVOICE = "380".freeze
19
- SELF_BILLED_INVOICE = "389".freeze
20
- FACTORED_INVOICE = "393".freeze
21
- SELF_BILLED_FACTORED_INVOICE = "501".freeze
22
- PREPAYMENT_INVOICE = "386".freeze
23
- SELF_BILLED_PREPAYMENT_INVOICE = "500".freeze
24
- CORRECTIVE_INVOICE = "384".freeze
25
- SELF_BILLED_CORRECTIVE_INVOICE = "471".freeze
26
- FACTORED_CORRECTIVE_INVOICE = "472".freeze
27
- SELF_BILLED_FACTORED_CORRECTIVE_INVOICE = "473".freeze
28
- CREDIT_NOTE = "381".freeze
29
- SELF_BILLED_CREDIT_NOTE = "261".freeze
30
- GLOBAL_ALLOWANCE_CREDIT_NOTE = "262".freeze
31
- FACTORED_CREDIT_NOTE = "396".freeze
32
- SELF_BILLED_FACTORED_CREDIT_NOTE = "502".freeze
33
- PREPAYMENT_CREDIT_NOTE = "503".freeze
18
+ N380 = "380".freeze
19
+ N381 = "381".freeze
20
+ N384 = "384".freeze
21
+ N389 = "389".freeze
22
+ N386 = "386".freeze
34
23
 
35
24
  def self.all_vars
36
- @all_vars ||= [INVOICE, SELF_BILLED_INVOICE, FACTORED_INVOICE, SELF_BILLED_FACTORED_INVOICE, PREPAYMENT_INVOICE, SELF_BILLED_PREPAYMENT_INVOICE, CORRECTIVE_INVOICE, SELF_BILLED_CORRECTIVE_INVOICE, FACTORED_CORRECTIVE_INVOICE, SELF_BILLED_FACTORED_CORRECTIVE_INVOICE, CREDIT_NOTE, SELF_BILLED_CREDIT_NOTE, GLOBAL_ALLOWANCE_CREDIT_NOTE, FACTORED_CREDIT_NOTE, SELF_BILLED_FACTORED_CREDIT_NOTE, PREPAYMENT_CREDIT_NOTE].freeze
25
+ @all_vars ||= [N380, N381, N384, N389, N386].freeze
37
26
  end
38
27
 
39
28
  # Builds the enum from string
@@ -107,8 +107,6 @@ module FactPulse
107
107
 
108
108
  if attributes.key?(:'electronic_address')
109
109
  self.electronic_address = attributes[:'electronic_address']
110
- else
111
- self.electronic_address = nil
112
110
  end
113
111
 
114
112
  if attributes.key?(:'executing_service_code')
@@ -15,9 +15,9 @@ require 'time'
15
15
 
16
16
  module FactPulse
17
17
  class SchemeID
18
- FR_SIREN = "0225".freeze
18
+ FR_ELECTRONIC_ADDRESS = "0225".freeze
19
+ FR_SIREN = "0002".freeze
19
20
  FR_SIRET = "0009".freeze
20
- FR_SIREN_OLD = "0002".freeze
21
21
  GLN = "0088".freeze
22
22
  DUNS = "0060".freeze
23
23
  FR_VAT_INTRA = "9957".freeze
@@ -35,7 +35,7 @@ module FactPulse
35
35
  PT_VAT = "9934".freeze
36
36
 
37
37
  def self.all_vars
38
- @all_vars ||= [FR_SIREN, FR_SIRET, FR_SIREN_OLD, GLN, DUNS, FR_VAT_INTRA, GLEIF, DT_DIRECTORY_ID, EMAIL, ODETTE, FR_CHORUS_PRO_ROUTING, DE_VAT, AT_VAT, BE_VAT, ES_VAT, IT_VAT, NL_VAT, PT_VAT].freeze
38
+ @all_vars ||= [FR_ELECTRONIC_ADDRESS, FR_SIREN, FR_SIRET, GLN, DUNS, FR_VAT_INTRA, GLEIF, DT_DIRECTORY_ID, EMAIL, ODETTE, FR_CHORUS_PRO_ROUTING, DE_VAT, AT_VAT, BE_VAT, ES_VAT, IT_VAT, NL_VAT, PT_VAT].freeze
39
39
  end
40
40
 
41
41
  # Builds the enum from string
@@ -111,7 +111,7 @@ module FactPulse
111
111
  :'comment' => :'String',
112
112
  :'purchase_order_reference' => :'String',
113
113
  :'contract_reference' => :'String',
114
- :'invoice_type' => :'InvoiceTypeCode',
114
+ :'invoice_type' => :'FactureElectroniqueModelsInvoiceTypeCode',
115
115
  :'preceding_invoice_reference' => :'String',
116
116
  :'operation_nature' => :'OperationNature',
117
117
  :'invoicing_framework' => :'InvoicingFrameworkCode'
@@ -35,7 +35,7 @@ module FactPulse
35
35
  attr_accessor :signature
36
36
 
37
37
  # Generated Factur-X PDF (and signed if requested) base64-encoded
38
- attr_accessor :pdf_base64
38
+ attr_accessor :content_b64
39
39
 
40
40
  # Return message
41
41
  attr_accessor :message
@@ -72,7 +72,7 @@ module FactPulse
72
72
  :'enriched_invoice' => :'enrichedInvoice',
73
73
  :'facturx_pdf' => :'facturxPdf',
74
74
  :'signature' => :'signature',
75
- :'pdf_base64' => :'pdfBase64',
75
+ :'content_b64' => :'contentB64',
76
76
  :'message' => :'message'
77
77
  }
78
78
  end
@@ -97,7 +97,7 @@ module FactPulse
97
97
  :'enriched_invoice' => :'EnrichedInvoiceInfo',
98
98
  :'facturx_pdf' => :'FacturXPDFInfo',
99
99
  :'signature' => :'SignatureInfo',
100
- :'pdf_base64' => :'String',
100
+ :'content_b64' => :'String',
101
101
  :'message' => :'String'
102
102
  }
103
103
  end
@@ -163,10 +163,10 @@ module FactPulse
163
163
  self.signature = attributes[:'signature']
164
164
  end
165
165
 
166
- if attributes.key?(:'pdf_base64')
167
- self.pdf_base64 = attributes[:'pdf_base64']
166
+ if attributes.key?(:'content_b64')
167
+ self.content_b64 = attributes[:'content_b64']
168
168
  else
169
- self.pdf_base64 = nil
169
+ self.content_b64 = nil
170
170
  end
171
171
 
172
172
  if attributes.key?(:'message')
@@ -197,8 +197,8 @@ module FactPulse
197
197
  invalid_properties.push('invalid value for "facturx_pdf", facturx_pdf cannot be nil.')
198
198
  end
199
199
 
200
- if @pdf_base64.nil?
201
- invalid_properties.push('invalid value for "pdf_base64", pdf_base64 cannot be nil.')
200
+ if @content_b64.nil?
201
+ invalid_properties.push('invalid value for "content_b64", content_b64 cannot be nil.')
202
202
  end
203
203
 
204
204
  if @message.nil?
@@ -218,7 +218,7 @@ module FactPulse
218
218
  return false unless destination_type_validator.valid?(@destination_type)
219
219
  return false if @enriched_invoice.nil?
220
220
  return false if @facturx_pdf.nil?
221
- return false if @pdf_base64.nil?
221
+ return false if @content_b64.nil?
222
222
  return false if @message.nil?
223
223
  true
224
224
  end
@@ -264,13 +264,13 @@ module FactPulse
264
264
  end
265
265
 
266
266
  # Custom attribute writer method with validation
267
- # @param [Object] pdf_base64 Value to be assigned
268
- def pdf_base64=(pdf_base64)
269
- if pdf_base64.nil?
270
- fail ArgumentError, 'pdf_base64 cannot be nil'
267
+ # @param [Object] content_b64 Value to be assigned
268
+ def content_b64=(content_b64)
269
+ if content_b64.nil?
270
+ fail ArgumentError, 'content_b64 cannot be nil'
271
271
  end
272
272
 
273
- @pdf_base64 = pdf_base64
273
+ @content_b64 = content_b64
274
274
  end
275
275
 
276
276
  # Custom attribute writer method with validation
@@ -295,7 +295,7 @@ module FactPulse
295
295
  enriched_invoice == o.enriched_invoice &&
296
296
  facturx_pdf == o.facturx_pdf &&
297
297
  signature == o.signature &&
298
- pdf_base64 == o.pdf_base64 &&
298
+ content_b64 == o.content_b64 &&
299
299
  message == o.message
300
300
  end
301
301
 
@@ -308,7 +308,7 @@ module FactPulse
308
308
  # Calculates hash code according to all attributes.
309
309
  # @return [Integer] Hash code
310
310
  def hash
311
- [success, destination_type, chorus_result, afnor_result, enriched_invoice, facturx_pdf, signature, pdf_base64, message].hash
311
+ [success, destination_type, chorus_result, afnor_result, enriched_invoice, facturx_pdf, signature, content_b64, message].hash
312
312
  end
313
313
 
314
314
  # Builds the object from hash
@@ -151,8 +151,6 @@ module FactPulse
151
151
 
152
152
  if attributes.key?(:'electronic_address')
153
153
  self.electronic_address = attributes[:'electronic_address']
154
- else
155
- self.electronic_address = nil
156
154
  end
157
155
 
158
156
  if attributes.key?(:'supplier_id')
@@ -11,5 +11,5 @@ Generator version: 7.19.0-SNAPSHOT
11
11
  =end
12
12
 
13
13
  module FactPulse
14
- VERSION = '3.0.36'
14
+ VERSION = '4.0.0'
15
15
  end
data/lib/factpulse.rb CHANGED
@@ -165,8 +165,8 @@ require 'factpulse/models/error_source'
165
165
  require 'factpulse/models/extraction_info'
166
166
  require 'factpulse/models/factur_x_invoice'
167
167
  require 'factpulse/models/factur_xpdf_info'
168
+ require 'factpulse/models/facture_electronique_models_invoice_type_code'
168
169
  require 'factpulse/models/facture_electronique_rest_api_schemas_cdar_validation_error_response'
169
- require 'factpulse/models/facture_electronique_rest_api_schemas_ereporting_invoice_type_code'
170
170
  require 'factpulse/models/facture_electronique_rest_api_schemas_processing_chorus_pro_credentials'
171
171
  require 'factpulse/models/field_status'
172
172
  require 'factpulse/models/file_info'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factpulse
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.36
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAPI-Generator
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-17 00:00:00.000000000 Z
11
+ date: 2026-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -271,8 +271,8 @@ files:
271
271
  - docs/ExtractionInfo.md
272
272
  - docs/FacturXInvoice.md
273
273
  - docs/FacturXPDFInfo.md
274
+ - docs/FactureElectroniqueModelsInvoiceTypeCode.md
274
275
  - docs/FactureElectroniqueRestApiSchemasCdarValidationErrorResponse.md
275
- - docs/FactureElectroniqueRestApiSchemasEreportingInvoiceTypeCode.md
276
276
  - docs/FactureElectroniqueRestApiSchemasProcessingChorusProCredentials.md
277
277
  - docs/FieldStatus.md
278
278
  - docs/FileInfo.md
@@ -590,8 +590,8 @@ files:
590
590
  - lib/factpulse/models/extraction_info.rb
591
591
  - lib/factpulse/models/factur_x_invoice.rb
592
592
  - lib/factpulse/models/factur_xpdf_info.rb
593
+ - lib/factpulse/models/facture_electronique_models_invoice_type_code.rb
593
594
  - lib/factpulse/models/facture_electronique_rest_api_schemas_cdar_validation_error_response.rb
594
- - lib/factpulse/models/facture_electronique_rest_api_schemas_ereporting_invoice_type_code.rb
595
595
  - lib/factpulse/models/facture_electronique_rest_api_schemas_processing_chorus_pro_credentials.rb
596
596
  - lib/factpulse/models/field_status.rb
597
597
  - lib/factpulse/models/file_info.rb
@@ -1,15 +0,0 @@
1
- # FactPulse::FactureElectroniqueRestApiSchemasEreportingInvoiceTypeCode
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
-
8
- ## Example
9
-
10
- ```ruby
11
- require 'factpulse'
12
-
13
- instance = FactPulse::FactureElectroniqueRestApiSchemasEreportingInvoiceTypeCode.new()
14
- ```
15
-