factpulse 3.0.1 → 3.0.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -3
- data/Gemfile.lock +1 -1
- data/docs/{TaskStatus.md → AsyncTaskStatus.md} +2 -2
- data/docs/ChorusProApi.md +1 -1
- data/docs/InvoiceProcessingApi.md +4 -4
- data/docs/PDFXMLVerificationApi.md +8 -8
- data/docs/SubmitGrossAmount.md +15 -0
- data/docs/SubmitInvoiceRequest.md +3 -3
- data/docs/{VatAmount.md → SubmitNetAmount.md} +2 -2
- data/docs/SubmitVatAmount.md +15 -0
- data/lib/factpulse/api/invoice_processing_api.rb +3 -3
- data/lib/factpulse/api/pdfxml_verification_api.rb +6 -6
- data/lib/factpulse/models/{task_status.rb → async_task_status.rb} +3 -3
- data/lib/factpulse/models/submit_gross_amount.rb +104 -0
- data/lib/factpulse/models/submit_invoice_request.rb +3 -3
- data/lib/factpulse/models/submit_net_amount.rb +104 -0
- data/lib/factpulse/models/submit_vat_amount.rb +104 -0
- data/lib/factpulse/models/vat_amount.rb +2 -2
- data/lib/factpulse/version.rb +1 -1
- data/lib/factpulse.rb +4 -2
- metadata +9 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 65c1cffbd2a4bad195565f89a351948891d7a21ba9285c79ec82a4f473c81c62
|
|
4
|
+
data.tar.gz: a5b525f26223adfe3fb6b724de189b79b8c876a1cd73bc89ec76d056166a94ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 36e9f3719236e58672f688bb8b3c20ffe3836f128eb215913b34549e634c55e49b81f8a92ed4455572a47127fec6aad61def2053d89d2b9a1608abb00619bafd
|
|
7
|
+
data.tar.gz: 1ba42040938fb701a9c0e728f1d12d9e00cc004212d88da7fce86d5c151be0ba463d365e1f9d843bad6cba0e0626cbb0755b01e7bf767c4e859f252ac9c8181e
|
data/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,7 @@ et ce projet adhère au [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
## [3.0.
|
|
10
|
+
## [3.0.3] - 2025-12-19
|
|
11
11
|
|
|
12
12
|
### Added
|
|
13
13
|
- Version initiale du SDK ruby
|
|
@@ -24,5 +24,5 @@ et ce projet adhère au [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
24
24
|
- Guide d'authentification JWT
|
|
25
25
|
- Configuration avancée (timeout, proxy, debug)
|
|
26
26
|
|
|
27
|
-
[Unreleased]: https://github.com/factpulse/sdk-ruby/compare/v3.0.
|
|
28
|
-
[3.0.
|
|
27
|
+
[Unreleased]: https://github.com/factpulse/sdk-ruby/compare/v3.0.3...HEAD
|
|
28
|
+
[3.0.3]: https://github.com/factpulse/sdk-ruby/releases/tag/v3.0.3
|
data/Gemfile.lock
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# FactPulse::
|
|
1
|
+
# FactPulse::AsyncTaskStatus
|
|
2
2
|
|
|
3
3
|
## Properties
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
```ruby
|
|
14
14
|
require 'factpulse'
|
|
15
15
|
|
|
16
|
-
instance = FactPulse::
|
|
16
|
+
instance = FactPulse::AsyncTaskStatus.new(
|
|
17
17
|
task_id: null,
|
|
18
18
|
status: null,
|
|
19
19
|
result: null
|
data/docs/ChorusProApi.md
CHANGED
|
@@ -732,7 +732,7 @@ FactPulse.configure do |config|
|
|
|
732
732
|
end
|
|
733
733
|
|
|
734
734
|
api_instance = FactPulse::ChorusProApi.new
|
|
735
|
-
submit_invoice_request = FactPulse::SubmitInvoiceRequest.new({invoice_number: 'invoice_number_example', invoice_date: 'invoice_date_example', structure_id: 37, total_net_amount: FactPulse::
|
|
735
|
+
submit_invoice_request = FactPulse::SubmitInvoiceRequest.new({invoice_number: 'invoice_number_example', invoice_date: 'invoice_date_example', structure_id: 37, total_net_amount: FactPulse::SubmitNetAmount.new, vat_amount: FactPulse::SubmitVatAmount.new, total_gross_amount: FactPulse::SubmitGrossAmount.new}) # SubmitInvoiceRequest |
|
|
736
736
|
|
|
737
737
|
begin
|
|
738
738
|
# Submit an invoice to Chorus Pro
|
|
@@ -167,7 +167,7 @@ end
|
|
|
167
167
|
|
|
168
168
|
## get_task_status_api_v1_processing_tasks_task_id_status_get
|
|
169
169
|
|
|
170
|
-
> <
|
|
170
|
+
> <AsyncTaskStatus> get_task_status_api_v1_processing_tasks_task_id_status_get(task_id)
|
|
171
171
|
|
|
172
172
|
Get task generation status
|
|
173
173
|
|
|
@@ -200,7 +200,7 @@ end
|
|
|
200
200
|
|
|
201
201
|
This returns an Array which contains the response data, status code and headers.
|
|
202
202
|
|
|
203
|
-
> <Array(<
|
|
203
|
+
> <Array(<AsyncTaskStatus>, Integer, Hash)> get_task_status_api_v1_processing_tasks_task_id_status_get_with_http_info(task_id)
|
|
204
204
|
|
|
205
205
|
```ruby
|
|
206
206
|
begin
|
|
@@ -208,7 +208,7 @@ begin
|
|
|
208
208
|
data, status_code, headers = api_instance.get_task_status_api_v1_processing_tasks_task_id_status_get_with_http_info(task_id)
|
|
209
209
|
p status_code # => 2xx
|
|
210
210
|
p headers # => { ... }
|
|
211
|
-
p data # => <
|
|
211
|
+
p data # => <AsyncTaskStatus>
|
|
212
212
|
rescue FactPulse::ApiError => e
|
|
213
213
|
puts "Error when calling InvoiceProcessingApi->get_task_status_api_v1_processing_tasks_task_id_status_get_with_http_info: #{e}"
|
|
214
214
|
end
|
|
@@ -222,7 +222,7 @@ end
|
|
|
222
222
|
|
|
223
223
|
### Return type
|
|
224
224
|
|
|
225
|
-
[**
|
|
225
|
+
[**AsyncTaskStatus**](AsyncTaskStatus.md)
|
|
226
226
|
|
|
227
227
|
### Authorization
|
|
228
228
|
|
|
@@ -14,7 +14,7 @@ All URIs are relative to *http://localhost*
|
|
|
14
14
|
|
|
15
15
|
## get_verification_status_api_v1_verification_verify_async_task_id_status_get
|
|
16
16
|
|
|
17
|
-
> <
|
|
17
|
+
> <AsyncTaskStatus> get_verification_status_api_v1_verification_verify_async_task_id_status_get(task_id)
|
|
18
18
|
|
|
19
19
|
Get status of an asynchronous verification
|
|
20
20
|
|
|
@@ -47,7 +47,7 @@ end
|
|
|
47
47
|
|
|
48
48
|
This returns an Array which contains the response data, status code and headers.
|
|
49
49
|
|
|
50
|
-
> <Array(<
|
|
50
|
+
> <Array(<AsyncTaskStatus>, Integer, Hash)> get_verification_status_api_v1_verification_verify_async_task_id_status_get_with_http_info(task_id)
|
|
51
51
|
|
|
52
52
|
```ruby
|
|
53
53
|
begin
|
|
@@ -55,7 +55,7 @@ begin
|
|
|
55
55
|
data, status_code, headers = api_instance.get_verification_status_api_v1_verification_verify_async_task_id_status_get_with_http_info(task_id)
|
|
56
56
|
p status_code # => 2xx
|
|
57
57
|
p headers # => { ... }
|
|
58
|
-
p data # => <
|
|
58
|
+
p data # => <AsyncTaskStatus>
|
|
59
59
|
rescue FactPulse::ApiError => e
|
|
60
60
|
puts "Error when calling PDFXMLVerificationApi->get_verification_status_api_v1_verification_verify_async_task_id_status_get_with_http_info: #{e}"
|
|
61
61
|
end
|
|
@@ -69,7 +69,7 @@ end
|
|
|
69
69
|
|
|
70
70
|
### Return type
|
|
71
71
|
|
|
72
|
-
[**
|
|
72
|
+
[**AsyncTaskStatus**](AsyncTaskStatus.md)
|
|
73
73
|
|
|
74
74
|
### Authorization
|
|
75
75
|
|
|
@@ -83,7 +83,7 @@ end
|
|
|
83
83
|
|
|
84
84
|
## get_verification_status_api_v1_verification_verify_async_task_id_status_get_0
|
|
85
85
|
|
|
86
|
-
> <
|
|
86
|
+
> <AsyncTaskStatus> get_verification_status_api_v1_verification_verify_async_task_id_status_get_0(task_id)
|
|
87
87
|
|
|
88
88
|
Get status of an asynchronous verification
|
|
89
89
|
|
|
@@ -116,7 +116,7 @@ end
|
|
|
116
116
|
|
|
117
117
|
This returns an Array which contains the response data, status code and headers.
|
|
118
118
|
|
|
119
|
-
> <Array(<
|
|
119
|
+
> <Array(<AsyncTaskStatus>, Integer, Hash)> get_verification_status_api_v1_verification_verify_async_task_id_status_get_0_with_http_info(task_id)
|
|
120
120
|
|
|
121
121
|
```ruby
|
|
122
122
|
begin
|
|
@@ -124,7 +124,7 @@ begin
|
|
|
124
124
|
data, status_code, headers = api_instance.get_verification_status_api_v1_verification_verify_async_task_id_status_get_0_with_http_info(task_id)
|
|
125
125
|
p status_code # => 2xx
|
|
126
126
|
p headers # => { ... }
|
|
127
|
-
p data # => <
|
|
127
|
+
p data # => <AsyncTaskStatus>
|
|
128
128
|
rescue FactPulse::ApiError => e
|
|
129
129
|
puts "Error when calling PDFXMLVerificationApi->get_verification_status_api_v1_verification_verify_async_task_id_status_get_0_with_http_info: #{e}"
|
|
130
130
|
end
|
|
@@ -138,7 +138,7 @@ end
|
|
|
138
138
|
|
|
139
139
|
### Return type
|
|
140
140
|
|
|
141
|
-
[**
|
|
141
|
+
[**AsyncTaskStatus**](AsyncTaskStatus.md)
|
|
142
142
|
|
|
143
143
|
### Authorization
|
|
144
144
|
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
| **structure_id** | **Integer** | Chorus Pro recipient structure ID | |
|
|
12
12
|
| **service_code** | **String** | | [optional] |
|
|
13
13
|
| **engagement_number** | **String** | | [optional] |
|
|
14
|
-
| **total_net_amount** | [**
|
|
15
|
-
| **vat_amount** | [**
|
|
16
|
-
| **total_gross_amount** | [**
|
|
14
|
+
| **total_net_amount** | [**SubmitNetAmount**](SubmitNetAmount.md) | | |
|
|
15
|
+
| **vat_amount** | [**SubmitVatAmount**](SubmitVatAmount.md) | | |
|
|
16
|
+
| **total_gross_amount** | [**SubmitGrossAmount**](SubmitGrossAmount.md) | | |
|
|
17
17
|
| **main_attachment_id** | **Integer** | | [optional] |
|
|
18
18
|
| **main_attachment_label** | **String** | | [optional] |
|
|
19
19
|
| **comment** | **String** | | [optional] |
|
|
@@ -172,7 +172,7 @@ module FactPulse
|
|
|
172
172
|
# Retrieves the progress status of an invoice generation task. ## Possible states The `status` field uses the `CeleryStatus` enum with values: - **PENDING, STARTED, SUCCESS, FAILURE, RETRY** See the `CeleryStatus` schema documentation for details. ## Business result When `status=\"SUCCESS\"`, the `result` field contains: - `status`: \"SUCCESS\" or \"ERROR\" (business result) - `content_b64`: Base64 encoded content (if success) - `errorCode`, `errorMessage`, `details`: AFNOR format (if business error) ## Usage Poll this endpoint every 2-3 seconds until `status` is `SUCCESS` or `FAILURE`.
|
|
173
173
|
# @param task_id [String]
|
|
174
174
|
# @param [Hash] opts the optional parameters
|
|
175
|
-
# @return [
|
|
175
|
+
# @return [AsyncTaskStatus]
|
|
176
176
|
def get_task_status_api_v1_processing_tasks_task_id_status_get(task_id, opts = {})
|
|
177
177
|
data, _status_code, _headers = get_task_status_api_v1_processing_tasks_task_id_status_get_with_http_info(task_id, opts)
|
|
178
178
|
data
|
|
@@ -182,7 +182,7 @@ module FactPulse
|
|
|
182
182
|
# Retrieves the progress status of an invoice generation task. ## Possible states The `status` field uses the `CeleryStatus` enum with values: - **PENDING, STARTED, SUCCESS, FAILURE, RETRY** See the `CeleryStatus` schema documentation for details. ## Business result When `status=\"SUCCESS\"`, the `result` field contains: - `status`: \"SUCCESS\" or \"ERROR\" (business result) - `content_b64`: Base64 encoded content (if success) - `errorCode`, `errorMessage`, `details`: AFNOR format (if business error) ## Usage Poll this endpoint every 2-3 seconds until `status` is `SUCCESS` or `FAILURE`.
|
|
183
183
|
# @param task_id [String]
|
|
184
184
|
# @param [Hash] opts the optional parameters
|
|
185
|
-
# @return [Array<(
|
|
185
|
+
# @return [Array<(AsyncTaskStatus, Integer, Hash)>] AsyncTaskStatus data, response status code and response headers
|
|
186
186
|
def get_task_status_api_v1_processing_tasks_task_id_status_get_with_http_info(task_id, opts = {})
|
|
187
187
|
if @api_client.config.debugging
|
|
188
188
|
@api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.get_task_status_api_v1_processing_tasks_task_id_status_get ...'
|
|
@@ -209,7 +209,7 @@ module FactPulse
|
|
|
209
209
|
post_body = opts[:debug_body]
|
|
210
210
|
|
|
211
211
|
# return_type
|
|
212
|
-
return_type = opts[:debug_return_type] || '
|
|
212
|
+
return_type = opts[:debug_return_type] || 'AsyncTaskStatus'
|
|
213
213
|
|
|
214
214
|
# auth_names
|
|
215
215
|
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
@@ -23,7 +23,7 @@ module FactPulse
|
|
|
23
23
|
# Retrieves the status and result of an asynchronous verification task. **Possible statuses:** - `PENDING`: Task waiting in queue - `STARTED`: Task currently running - `SUCCESS`: Task completed successfully (see `result`) - `FAILURE`: System error (unhandled exception) **Note:** The `result.status` field can be \"SUCCESS\" or \"ERROR\" independently of Celery status (which will always be SUCCESS if the task ran).
|
|
24
24
|
# @param task_id [String]
|
|
25
25
|
# @param [Hash] opts the optional parameters
|
|
26
|
-
# @return [
|
|
26
|
+
# @return [AsyncTaskStatus]
|
|
27
27
|
def get_verification_status_api_v1_verification_verify_async_task_id_status_get(task_id, opts = {})
|
|
28
28
|
data, _status_code, _headers = get_verification_status_api_v1_verification_verify_async_task_id_status_get_with_http_info(task_id, opts)
|
|
29
29
|
data
|
|
@@ -33,7 +33,7 @@ module FactPulse
|
|
|
33
33
|
# Retrieves the status and result of an asynchronous verification task. **Possible statuses:** - `PENDING`: Task waiting in queue - `STARTED`: Task currently running - `SUCCESS`: Task completed successfully (see `result`) - `FAILURE`: System error (unhandled exception) **Note:** The `result.status` field can be \"SUCCESS\" or \"ERROR\" independently of Celery status (which will always be SUCCESS if the task ran).
|
|
34
34
|
# @param task_id [String]
|
|
35
35
|
# @param [Hash] opts the optional parameters
|
|
36
|
-
# @return [Array<(
|
|
36
|
+
# @return [Array<(AsyncTaskStatus, Integer, Hash)>] AsyncTaskStatus data, response status code and response headers
|
|
37
37
|
def get_verification_status_api_v1_verification_verify_async_task_id_status_get_with_http_info(task_id, opts = {})
|
|
38
38
|
if @api_client.config.debugging
|
|
39
39
|
@api_client.config.logger.debug 'Calling API: PDFXMLVerificationApi.get_verification_status_api_v1_verification_verify_async_task_id_status_get ...'
|
|
@@ -60,7 +60,7 @@ module FactPulse
|
|
|
60
60
|
post_body = opts[:debug_body]
|
|
61
61
|
|
|
62
62
|
# return_type
|
|
63
|
-
return_type = opts[:debug_return_type] || '
|
|
63
|
+
return_type = opts[:debug_return_type] || 'AsyncTaskStatus'
|
|
64
64
|
|
|
65
65
|
# auth_names
|
|
66
66
|
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
@@ -86,7 +86,7 @@ module FactPulse
|
|
|
86
86
|
# Retrieves the status and result of an asynchronous verification task. **Possible statuses:** - `PENDING`: Task waiting in queue - `STARTED`: Task currently running - `SUCCESS`: Task completed successfully (see `result`) - `FAILURE`: System error (unhandled exception) **Note:** The `result.status` field can be \"SUCCESS\" or \"ERROR\" independently of Celery status (which will always be SUCCESS if the task ran).
|
|
87
87
|
# @param task_id [String]
|
|
88
88
|
# @param [Hash] opts the optional parameters
|
|
89
|
-
# @return [
|
|
89
|
+
# @return [AsyncTaskStatus]
|
|
90
90
|
def get_verification_status_api_v1_verification_verify_async_task_id_status_get_0(task_id, opts = {})
|
|
91
91
|
data, _status_code, _headers = get_verification_status_api_v1_verification_verify_async_task_id_status_get_0_with_http_info(task_id, opts)
|
|
92
92
|
data
|
|
@@ -96,7 +96,7 @@ module FactPulse
|
|
|
96
96
|
# Retrieves the status and result of an asynchronous verification task. **Possible statuses:** - `PENDING`: Task waiting in queue - `STARTED`: Task currently running - `SUCCESS`: Task completed successfully (see `result`) - `FAILURE`: System error (unhandled exception) **Note:** The `result.status` field can be \"SUCCESS\" or \"ERROR\" independently of Celery status (which will always be SUCCESS if the task ran).
|
|
97
97
|
# @param task_id [String]
|
|
98
98
|
# @param [Hash] opts the optional parameters
|
|
99
|
-
# @return [Array<(
|
|
99
|
+
# @return [Array<(AsyncTaskStatus, Integer, Hash)>] AsyncTaskStatus data, response status code and response headers
|
|
100
100
|
def get_verification_status_api_v1_verification_verify_async_task_id_status_get_0_with_http_info(task_id, opts = {})
|
|
101
101
|
if @api_client.config.debugging
|
|
102
102
|
@api_client.config.logger.debug 'Calling API: PDFXMLVerificationApi.get_verification_status_api_v1_verification_verify_async_task_id_status_get_0 ...'
|
|
@@ -123,7 +123,7 @@ module FactPulse
|
|
|
123
123
|
post_body = opts[:debug_body]
|
|
124
124
|
|
|
125
125
|
# return_type
|
|
126
|
-
return_type = opts[:debug_return_type] || '
|
|
126
|
+
return_type = opts[:debug_return_type] || 'AsyncTaskStatus'
|
|
127
127
|
|
|
128
128
|
# auth_names
|
|
129
129
|
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
@@ -15,7 +15,7 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module FactPulse
|
|
17
17
|
# Complete description of an async task status. The `status` field indicates the Celery state of the task. When `status=\"SUCCESS\"`, check `result.status` for the business result (\"SUCCESS\" or \"ERROR\").
|
|
18
|
-
class
|
|
18
|
+
class AsyncTaskStatus < ApiModelBase
|
|
19
19
|
# Unique task identifier
|
|
20
20
|
attr_accessor :task_id
|
|
21
21
|
|
|
@@ -85,14 +85,14 @@ module FactPulse
|
|
|
85
85
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
86
86
|
def initialize(attributes = {})
|
|
87
87
|
if (!attributes.is_a?(Hash))
|
|
88
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::
|
|
88
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::AsyncTaskStatus` initialize method"
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
92
92
|
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
93
93
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
94
94
|
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
95
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::
|
|
95
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::AsyncTaskStatus`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
96
96
|
end
|
|
97
97
|
h[k.to_sym] = v
|
|
98
98
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#FactPulse REST API
|
|
3
|
+
|
|
4
|
+
# REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### 📄 Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### ✅ Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### 📡 AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### 🔄 Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## 🔒 Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### 🔑 Method 1: `/api/token/` API (Recommended) **URL:** `https://www.factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://www.factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://www.factpulse.fr/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://www.factpulse.fr/documentation-api/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.18.0-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module FactPulse
|
|
17
|
+
# Total gross amount
|
|
18
|
+
module SubmitGrossAmount
|
|
19
|
+
class << self
|
|
20
|
+
# List of class defined in anyOf (OpenAPI v3)
|
|
21
|
+
def openapi_any_of
|
|
22
|
+
[
|
|
23
|
+
:'Float',
|
|
24
|
+
:'String'
|
|
25
|
+
]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Builds the object
|
|
29
|
+
# @param [Mixed] Data to be matched against the list of anyOf items
|
|
30
|
+
# @return [Object] Returns the model or the data itself
|
|
31
|
+
def build(data)
|
|
32
|
+
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
|
33
|
+
# Note:
|
|
34
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
35
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
36
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
37
|
+
# - TODO: logging when debugging is set.
|
|
38
|
+
openapi_any_of.each do |klass|
|
|
39
|
+
begin
|
|
40
|
+
next if klass == :AnyType # "nullable: true"
|
|
41
|
+
return find_and_cast_into_type(klass, data)
|
|
42
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
openapi_any_of.include?(:AnyType) ? data : nil
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
SchemaMismatchError = Class.new(StandardError)
|
|
52
|
+
|
|
53
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
54
|
+
def find_and_cast_into_type(klass, data)
|
|
55
|
+
return if data.nil?
|
|
56
|
+
|
|
57
|
+
case klass.to_s
|
|
58
|
+
when 'Boolean'
|
|
59
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
60
|
+
when 'Float'
|
|
61
|
+
return data if data.instance_of?(Float)
|
|
62
|
+
when 'Integer'
|
|
63
|
+
return data if data.instance_of?(Integer)
|
|
64
|
+
when 'Time'
|
|
65
|
+
return Time.parse(data)
|
|
66
|
+
when 'Date'
|
|
67
|
+
return Date.iso8601(data)
|
|
68
|
+
when 'String'
|
|
69
|
+
return data if data.instance_of?(String)
|
|
70
|
+
when 'Object' # "type: object"
|
|
71
|
+
return data if data.instance_of?(Hash)
|
|
72
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
73
|
+
if data.instance_of?(Array)
|
|
74
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
75
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
76
|
+
end
|
|
77
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
78
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
79
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
80
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
81
|
+
end
|
|
82
|
+
else # model
|
|
83
|
+
const = FactPulse.const_get(klass)
|
|
84
|
+
if const
|
|
85
|
+
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
|
86
|
+
model = const.build(data)
|
|
87
|
+
return model if model
|
|
88
|
+
else
|
|
89
|
+
# raise if data contains keys that are not known to the model
|
|
90
|
+
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
91
|
+
model = const.build_from_hash(data)
|
|
92
|
+
return model if model
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
raise # if no match by now, raise
|
|
98
|
+
rescue
|
|
99
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
end
|
|
@@ -90,9 +90,9 @@ module FactPulse
|
|
|
90
90
|
:'structure_id' => :'Integer',
|
|
91
91
|
:'service_code' => :'String',
|
|
92
92
|
:'engagement_number' => :'String',
|
|
93
|
-
:'total_net_amount' => :'
|
|
94
|
-
:'vat_amount' => :'
|
|
95
|
-
:'total_gross_amount' => :'
|
|
93
|
+
:'total_net_amount' => :'SubmitNetAmount',
|
|
94
|
+
:'vat_amount' => :'SubmitVatAmount',
|
|
95
|
+
:'total_gross_amount' => :'SubmitGrossAmount',
|
|
96
96
|
:'main_attachment_id' => :'Integer',
|
|
97
97
|
:'main_attachment_label' => :'String',
|
|
98
98
|
:'comment' => :'String',
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#FactPulse REST API
|
|
3
|
+
|
|
4
|
+
# REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### 📄 Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### ✅ Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### 📡 AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### 🔄 Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## 🔒 Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### 🔑 Method 1: `/api/token/` API (Recommended) **URL:** `https://www.factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://www.factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://www.factpulse.fr/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://www.factpulse.fr/documentation-api/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.18.0-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module FactPulse
|
|
17
|
+
# Total net amount
|
|
18
|
+
module SubmitNetAmount
|
|
19
|
+
class << self
|
|
20
|
+
# List of class defined in anyOf (OpenAPI v3)
|
|
21
|
+
def openapi_any_of
|
|
22
|
+
[
|
|
23
|
+
:'Float',
|
|
24
|
+
:'String'
|
|
25
|
+
]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Builds the object
|
|
29
|
+
# @param [Mixed] Data to be matched against the list of anyOf items
|
|
30
|
+
# @return [Object] Returns the model or the data itself
|
|
31
|
+
def build(data)
|
|
32
|
+
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
|
33
|
+
# Note:
|
|
34
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
35
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
36
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
37
|
+
# - TODO: logging when debugging is set.
|
|
38
|
+
openapi_any_of.each do |klass|
|
|
39
|
+
begin
|
|
40
|
+
next if klass == :AnyType # "nullable: true"
|
|
41
|
+
return find_and_cast_into_type(klass, data)
|
|
42
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
openapi_any_of.include?(:AnyType) ? data : nil
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
SchemaMismatchError = Class.new(StandardError)
|
|
52
|
+
|
|
53
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
54
|
+
def find_and_cast_into_type(klass, data)
|
|
55
|
+
return if data.nil?
|
|
56
|
+
|
|
57
|
+
case klass.to_s
|
|
58
|
+
when 'Boolean'
|
|
59
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
60
|
+
when 'Float'
|
|
61
|
+
return data if data.instance_of?(Float)
|
|
62
|
+
when 'Integer'
|
|
63
|
+
return data if data.instance_of?(Integer)
|
|
64
|
+
when 'Time'
|
|
65
|
+
return Time.parse(data)
|
|
66
|
+
when 'Date'
|
|
67
|
+
return Date.iso8601(data)
|
|
68
|
+
when 'String'
|
|
69
|
+
return data if data.instance_of?(String)
|
|
70
|
+
when 'Object' # "type: object"
|
|
71
|
+
return data if data.instance_of?(Hash)
|
|
72
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
73
|
+
if data.instance_of?(Array)
|
|
74
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
75
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
76
|
+
end
|
|
77
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
78
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
79
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
80
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
81
|
+
end
|
|
82
|
+
else # model
|
|
83
|
+
const = FactPulse.const_get(klass)
|
|
84
|
+
if const
|
|
85
|
+
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
|
86
|
+
model = const.build(data)
|
|
87
|
+
return model if model
|
|
88
|
+
else
|
|
89
|
+
# raise if data contains keys that are not known to the model
|
|
90
|
+
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
91
|
+
model = const.build_from_hash(data)
|
|
92
|
+
return model if model
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
raise # if no match by now, raise
|
|
98
|
+
rescue
|
|
99
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#FactPulse REST API
|
|
3
|
+
|
|
4
|
+
# REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### 📄 Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### ✅ Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### 📡 AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### 🔄 Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## 🔒 Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### 🔑 Method 1: `/api/token/` API (Recommended) **URL:** `https://www.factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://www.factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://www.factpulse.fr/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://www.factpulse.fr/documentation-api/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.18.0-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module FactPulse
|
|
17
|
+
# VAT amount
|
|
18
|
+
module SubmitVatAmount
|
|
19
|
+
class << self
|
|
20
|
+
# List of class defined in anyOf (OpenAPI v3)
|
|
21
|
+
def openapi_any_of
|
|
22
|
+
[
|
|
23
|
+
:'Float',
|
|
24
|
+
:'String'
|
|
25
|
+
]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Builds the object
|
|
29
|
+
# @param [Mixed] Data to be matched against the list of anyOf items
|
|
30
|
+
# @return [Object] Returns the model or the data itself
|
|
31
|
+
def build(data)
|
|
32
|
+
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
|
33
|
+
# Note:
|
|
34
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
35
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
36
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
37
|
+
# - TODO: logging when debugging is set.
|
|
38
|
+
openapi_any_of.each do |klass|
|
|
39
|
+
begin
|
|
40
|
+
next if klass == :AnyType # "nullable: true"
|
|
41
|
+
return find_and_cast_into_type(klass, data)
|
|
42
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
openapi_any_of.include?(:AnyType) ? data : nil
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
SchemaMismatchError = Class.new(StandardError)
|
|
52
|
+
|
|
53
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
54
|
+
def find_and_cast_into_type(klass, data)
|
|
55
|
+
return if data.nil?
|
|
56
|
+
|
|
57
|
+
case klass.to_s
|
|
58
|
+
when 'Boolean'
|
|
59
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
60
|
+
when 'Float'
|
|
61
|
+
return data if data.instance_of?(Float)
|
|
62
|
+
when 'Integer'
|
|
63
|
+
return data if data.instance_of?(Integer)
|
|
64
|
+
when 'Time'
|
|
65
|
+
return Time.parse(data)
|
|
66
|
+
when 'Date'
|
|
67
|
+
return Date.iso8601(data)
|
|
68
|
+
when 'String'
|
|
69
|
+
return data if data.instance_of?(String)
|
|
70
|
+
when 'Object' # "type: object"
|
|
71
|
+
return data if data.instance_of?(Hash)
|
|
72
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
73
|
+
if data.instance_of?(Array)
|
|
74
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
75
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
76
|
+
end
|
|
77
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
78
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
79
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
80
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
81
|
+
end
|
|
82
|
+
else # model
|
|
83
|
+
const = FactPulse.const_get(klass)
|
|
84
|
+
if const
|
|
85
|
+
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
|
86
|
+
model = const.build(data)
|
|
87
|
+
return model if model
|
|
88
|
+
else
|
|
89
|
+
# raise if data contains keys that are not known to the model
|
|
90
|
+
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
91
|
+
model = const.build_from_hash(data)
|
|
92
|
+
return model if model
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
raise # if no match by now, raise
|
|
98
|
+
rescue
|
|
99
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
end
|
|
@@ -14,8 +14,8 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module FactPulse
|
|
17
|
-
# VAT amount
|
|
18
|
-
module
|
|
17
|
+
# VAT amount for this line. (Accepte number, string ou integer)
|
|
18
|
+
module VATAmount
|
|
19
19
|
class << self
|
|
20
20
|
# List of class defined in anyOf (OpenAPI v3)
|
|
21
21
|
def openapi_any_of
|
data/lib/factpulse/version.rb
CHANGED
data/lib/factpulse.rb
CHANGED
|
@@ -27,6 +27,7 @@ require 'factpulse/models/api_profile'
|
|
|
27
27
|
require 'factpulse/models/acknowledgment_status'
|
|
28
28
|
require 'factpulse/models/allowance_reason_code'
|
|
29
29
|
require 'factpulse/models/amount_due'
|
|
30
|
+
require 'factpulse/models/async_task_status'
|
|
30
31
|
require 'factpulse/models/bounding_box_schema'
|
|
31
32
|
require 'factpulse/models/celery_status'
|
|
32
33
|
require 'factpulse/models/certificate_info_response'
|
|
@@ -104,12 +105,14 @@ require 'factpulse/models/submit_complete_invoice_request'
|
|
|
104
105
|
require 'factpulse/models/submit_complete_invoice_response'
|
|
105
106
|
require 'factpulse/models/submit_flow_request'
|
|
106
107
|
require 'factpulse/models/submit_flow_response'
|
|
108
|
+
require 'factpulse/models/submit_gross_amount'
|
|
107
109
|
require 'factpulse/models/submit_invoice_request'
|
|
108
110
|
require 'factpulse/models/submit_invoice_response'
|
|
111
|
+
require 'factpulse/models/submit_net_amount'
|
|
112
|
+
require 'factpulse/models/submit_vat_amount'
|
|
109
113
|
require 'factpulse/models/supplementary_attachment'
|
|
110
114
|
require 'factpulse/models/supplier'
|
|
111
115
|
require 'factpulse/models/task_response'
|
|
112
|
-
require 'factpulse/models/task_status'
|
|
113
116
|
require 'factpulse/models/taxable_amount'
|
|
114
117
|
require 'factpulse/models/total_gross_amount'
|
|
115
118
|
require 'factpulse/models/total_net_amount'
|
|
@@ -125,7 +128,6 @@ require 'factpulse/models/validation_error_detail'
|
|
|
125
128
|
require 'factpulse/models/validation_error_loc_inner'
|
|
126
129
|
require 'factpulse/models/validation_error_response'
|
|
127
130
|
require 'factpulse/models/validation_success_response'
|
|
128
|
-
require 'factpulse/models/vat_amount'
|
|
129
131
|
require 'factpulse/models/verification_success_response'
|
|
130
132
|
require 'factpulse/models/verified_field_schema'
|
|
131
133
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: factpulse
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenAPI-Generator
|
|
@@ -128,6 +128,7 @@ files:
|
|
|
128
128
|
- docs/AcknowledgmentStatus.md
|
|
129
129
|
- docs/AllowanceReasonCode.md
|
|
130
130
|
- docs/AmountDue.md
|
|
131
|
+
- docs/AsyncTaskStatus.md
|
|
131
132
|
- docs/BoundingBoxSchema.md
|
|
132
133
|
- docs/CeleryStatus.md
|
|
133
134
|
- docs/CertificateInfoResponse.md
|
|
@@ -209,12 +210,14 @@ files:
|
|
|
209
210
|
- docs/SubmitCompleteInvoiceResponse.md
|
|
210
211
|
- docs/SubmitFlowRequest.md
|
|
211
212
|
- docs/SubmitFlowResponse.md
|
|
213
|
+
- docs/SubmitGrossAmount.md
|
|
212
214
|
- docs/SubmitInvoiceRequest.md
|
|
213
215
|
- docs/SubmitInvoiceResponse.md
|
|
216
|
+
- docs/SubmitNetAmount.md
|
|
217
|
+
- docs/SubmitVatAmount.md
|
|
214
218
|
- docs/SupplementaryAttachment.md
|
|
215
219
|
- docs/Supplier.md
|
|
216
220
|
- docs/TaskResponse.md
|
|
217
|
-
- docs/TaskStatus.md
|
|
218
221
|
- docs/TaxableAmount.md
|
|
219
222
|
- docs/TotalGrossAmount.md
|
|
220
223
|
- docs/TotalNetAmount.md
|
|
@@ -231,7 +234,6 @@ files:
|
|
|
231
234
|
- docs/ValidationErrorLocInner.md
|
|
232
235
|
- docs/ValidationErrorResponse.md
|
|
233
236
|
- docs/ValidationSuccessResponse.md
|
|
234
|
-
- docs/VatAmount.md
|
|
235
237
|
- docs/VerificationSuccessResponse.md
|
|
236
238
|
- docs/VerifiedFieldSchema.md
|
|
237
239
|
- factpulse.gemspec
|
|
@@ -261,6 +263,7 @@ files:
|
|
|
261
263
|
- lib/factpulse/models/amount_due.rb
|
|
262
264
|
- lib/factpulse/models/api_error.rb
|
|
263
265
|
- lib/factpulse/models/api_profile.rb
|
|
266
|
+
- lib/factpulse/models/async_task_status.rb
|
|
264
267
|
- lib/factpulse/models/bounding_box_schema.rb
|
|
265
268
|
- lib/factpulse/models/celery_status.rb
|
|
266
269
|
- lib/factpulse/models/certificate_info_response.rb
|
|
@@ -338,12 +341,14 @@ files:
|
|
|
338
341
|
- lib/factpulse/models/submit_complete_invoice_response.rb
|
|
339
342
|
- lib/factpulse/models/submit_flow_request.rb
|
|
340
343
|
- lib/factpulse/models/submit_flow_response.rb
|
|
344
|
+
- lib/factpulse/models/submit_gross_amount.rb
|
|
341
345
|
- lib/factpulse/models/submit_invoice_request.rb
|
|
342
346
|
- lib/factpulse/models/submit_invoice_response.rb
|
|
347
|
+
- lib/factpulse/models/submit_net_amount.rb
|
|
348
|
+
- lib/factpulse/models/submit_vat_amount.rb
|
|
343
349
|
- lib/factpulse/models/supplementary_attachment.rb
|
|
344
350
|
- lib/factpulse/models/supplier.rb
|
|
345
351
|
- lib/factpulse/models/task_response.rb
|
|
346
|
-
- lib/factpulse/models/task_status.rb
|
|
347
352
|
- lib/factpulse/models/taxable_amount.rb
|
|
348
353
|
- lib/factpulse/models/total_gross_amount.rb
|
|
349
354
|
- lib/factpulse/models/total_net_amount.rb
|