factpulse 3.0.4 → 3.0.6
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/AdditionalDocument.md +26 -0
- data/docs/AllowanceCharge.md +32 -0
- data/docs/AllowanceTotalAmount.md +15 -0
- data/docs/{APIProfile.md → Amount.md} +2 -2
- data/docs/{DocumentType.md → BaseAmount.md} +2 -2
- data/docs/ChargeTotalAmount.md +15 -0
- data/docs/Contact.md +24 -0
- data/docs/ConvertErrorResponse.md +26 -0
- data/docs/ConvertPendingInputResponse.md +32 -0
- data/docs/ConvertResumeRequest.md +18 -0
- data/docs/ConvertSuccessResponse.md +36 -0
- data/docs/ConvertValidationFailedResponse.md +34 -0
- data/docs/DeliveryParty.md +24 -0
- data/docs/DocumentConversionApi.md +373 -0
- data/docs/DocumentTypeInfo.md +22 -0
- data/docs/ExtractionInfo.md +24 -0
- data/docs/FacturXInvoice.md +29 -1
- data/docs/FacturXProfile.md +15 -0
- data/docs/FileInfo.md +20 -0
- data/docs/FilesInfo.md +20 -0
- data/docs/GrossUnitPrice.md +15 -0
- data/docs/IncomingInvoice.md +1 -1
- data/docs/InvoiceLine.md +43 -9
- data/docs/InvoiceProcessingApi.md +8 -8
- data/docs/InvoiceReferences.md +26 -6
- data/docs/InvoiceTotals.md +10 -2
- data/docs/LineTotalAmount.md +15 -0
- data/docs/MissingField.md +28 -0
- data/docs/Payee.md +5 -1
- data/docs/PaymentCard.md +20 -0
- data/docs/Percentage.md +15 -0
- data/docs/PostalAddress.md +5 -1
- data/docs/PriceAllowanceAmount.md +15 -0
- data/docs/PriceBasisQuantity.md +15 -0
- data/docs/ProcessingOptions.md +3 -3
- data/docs/ProductCharacteristic.md +20 -0
- data/docs/ProductClassification.md +22 -0
- data/docs/Recipient.md +7 -1
- data/docs/RoundingAmount.md +15 -0
- data/docs/Supplier.md +17 -1
- data/docs/TaxRepresentative.md +22 -0
- data/docs/VATLine.md +2 -0
- data/docs/VATPointDateCode.md +15 -0
- data/docs/ValidationInfo.md +28 -0
- data/docs/VatRate.md +15 -0
- data/factpulse.gemspec +1 -1
- data/lib/factpulse/api/afnorpdppa_api.rb +1 -1
- data/lib/factpulse/api/afnorpdppa_directory_service_api.rb +1 -1
- data/lib/factpulse/api/afnorpdppa_flow_service_api.rb +1 -1
- data/lib/factpulse/api/chorus_pro_api.rb +1 -1
- data/lib/factpulse/api/document_conversion_api.rb +378 -0
- data/lib/factpulse/api/health_api.rb +1 -1
- data/lib/factpulse/api/invoice_processing_api.rb +9 -9
- data/lib/factpulse/api/pdfxml_verification_api.rb +1 -1
- data/lib/factpulse/api/user_api.rb +1 -1
- data/lib/factpulse/api_client.rb +1 -1
- data/lib/factpulse/api_error.rb +1 -1
- data/lib/factpulse/api_model_base.rb +1 -1
- data/lib/factpulse/configuration.rb +1 -1
- data/lib/factpulse/models/acknowledgment_status.rb +1 -1
- data/lib/factpulse/models/additional_document.rb +206 -0
- data/lib/factpulse/models/afnor_credentials.rb +1 -1
- data/lib/factpulse/models/afnor_destination.rb +1 -1
- data/lib/factpulse/models/afnor_health_check_response.rb +1 -1
- data/lib/factpulse/models/afnor_result.rb +1 -1
- data/lib/factpulse/models/allowance_charge.rb +252 -0
- data/lib/factpulse/models/allowance_reason_code.rb +1 -1
- data/lib/factpulse/models/allowance_total_amount.rb +104 -0
- data/lib/factpulse/models/amount.rb +104 -0
- data/lib/factpulse/models/amount_due.rb +2 -2
- data/lib/factpulse/models/api_error.rb +1 -1
- data/lib/factpulse/models/async_task_status.rb +1 -1
- data/lib/factpulse/models/base_amount.rb +104 -0
- data/lib/factpulse/models/bounding_box_schema.rb +1 -1
- data/lib/factpulse/models/celery_status.rb +1 -1
- data/lib/factpulse/models/certificate_info_response.rb +1 -1
- data/lib/factpulse/models/charge_total_amount.rb +104 -0
- data/lib/factpulse/models/chorus_pro_destination.rb +1 -1
- data/lib/factpulse/models/chorus_pro_result.rb +1 -1
- data/lib/factpulse/models/contact.rb +179 -0
- data/lib/factpulse/models/convert_error_response.rb +224 -0
- data/lib/factpulse/models/convert_pending_input_response.rb +322 -0
- data/lib/factpulse/models/convert_resume_request.rb +151 -0
- data/lib/factpulse/models/convert_success_response.rb +360 -0
- data/lib/factpulse/models/convert_validation_failed_response.rb +334 -0
- data/lib/factpulse/models/delivery_party.rb +179 -0
- data/lib/factpulse/models/destination.rb +1 -1
- data/lib/factpulse/models/document_type_info.rb +220 -0
- data/lib/factpulse/models/electronic_address.rb +1 -1
- data/lib/factpulse/models/enriched_invoice_info.rb +1 -1
- data/lib/factpulse/models/error_level.rb +1 -1
- data/lib/factpulse/models/error_source.rb +1 -1
- data/lib/factpulse/models/extraction_info.rb +217 -0
- data/lib/factpulse/models/factur_x_invoice.rb +150 -6
- data/lib/factpulse/models/{api_profile.rb → factur_x_profile.rb} +4 -4
- data/lib/factpulse/models/factur_xpdf_info.rb +1 -1
- data/lib/factpulse/models/facture_electronique_rest_api_schemas_chorus_pro_chorus_pro_credentials.rb +5 -5
- data/lib/factpulse/models/facture_electronique_rest_api_schemas_processing_chorus_pro_credentials.rb +1 -1
- data/lib/factpulse/models/field_status.rb +1 -1
- data/lib/factpulse/models/file_info.rb +161 -0
- data/lib/factpulse/models/files_info.rb +159 -0
- data/lib/factpulse/models/flow_direction.rb +1 -1
- data/lib/factpulse/models/flow_profile.rb +1 -1
- data/lib/factpulse/models/flow_summary.rb +1 -1
- data/lib/factpulse/models/flow_syntax.rb +1 -1
- data/lib/factpulse/models/flow_type.rb +1 -1
- data/lib/factpulse/models/generate_certificate_request.rb +6 -6
- data/lib/factpulse/models/generate_certificate_response.rb +1 -1
- data/lib/factpulse/models/get_chorus_pro_id_request.rb +2 -2
- data/lib/factpulse/models/get_chorus_pro_id_response.rb +1 -1
- data/lib/factpulse/models/get_invoice_request.rb +2 -2
- data/lib/factpulse/models/get_invoice_response.rb +1 -1
- data/lib/factpulse/models/get_structure_request.rb +3 -3
- data/lib/factpulse/models/get_structure_response.rb +1 -1
- data/lib/factpulse/models/global_allowance_amount.rb +2 -2
- data/lib/factpulse/models/gross_unit_price.rb +104 -0
- data/lib/factpulse/models/http_validation_error.rb +1 -1
- data/lib/factpulse/models/incoming_invoice.rb +2 -2
- data/lib/factpulse/models/incoming_supplier.rb +1 -1
- data/lib/factpulse/models/invoice_format.rb +1 -1
- data/lib/factpulse/models/invoice_line.rb +209 -25
- data/lib/factpulse/models/invoice_line_allowance_amount.rb +2 -2
- data/lib/factpulse/models/invoice_note.rb +1 -1
- data/lib/factpulse/models/invoice_references.rb +119 -16
- data/lib/factpulse/models/invoice_status.rb +1 -1
- data/lib/factpulse/models/invoice_totals.rb +52 -12
- data/lib/factpulse/models/invoice_totals_prepayment.rb +2 -2
- data/lib/factpulse/models/invoice_type_code.rb +1 -1
- data/lib/factpulse/models/invoicing_framework.rb +1 -1
- data/lib/factpulse/models/invoicing_framework_code.rb +1 -1
- data/lib/factpulse/models/line_net_amount.rb +2 -2
- data/lib/factpulse/models/line_total_amount.rb +104 -0
- data/lib/factpulse/models/mandatory_note_schema.rb +1 -1
- data/lib/factpulse/models/manual_rate.rb +2 -2
- data/lib/factpulse/models/manual_vat_rate.rb +2 -2
- data/lib/factpulse/models/missing_field.rb +269 -0
- data/lib/factpulse/models/operation_nature.rb +1 -1
- data/lib/factpulse/models/output_format.rb +1 -1
- data/lib/factpulse/models/page_dimensions_schema.rb +1 -1
- data/lib/factpulse/models/payee.rb +28 -6
- data/lib/factpulse/models/payment_card.rb +159 -0
- data/lib/factpulse/models/payment_means.rb +1 -1
- data/lib/factpulse/models/pdf_validation_result_api.rb +1 -1
- data/lib/factpulse/models/pdp_credentials.rb +6 -6
- data/lib/factpulse/models/percentage.rb +104 -0
- data/lib/factpulse/models/postal_address.rb +27 -7
- data/lib/factpulse/models/price_allowance_amount.rb +104 -0
- data/lib/factpulse/models/price_basis_quantity.rb +104 -0
- data/lib/factpulse/models/processing_options.rb +10 -10
- data/lib/factpulse/models/product_characteristic.rb +193 -0
- data/lib/factpulse/models/product_classification.rb +186 -0
- data/lib/factpulse/models/quantity.rb +2 -2
- data/lib/factpulse/models/recipient.rb +39 -7
- data/lib/factpulse/models/rounding_amount.rb +104 -0
- data/lib/factpulse/models/scheme_id.rb +12 -6
- data/lib/factpulse/models/search_flow_request.rb +8 -8
- data/lib/factpulse/models/search_flow_response.rb +1 -1
- data/lib/factpulse/models/search_services_response.rb +1 -1
- data/lib/factpulse/models/search_structure_request.rb +5 -5
- data/lib/factpulse/models/search_structure_response.rb +1 -1
- data/lib/factpulse/models/signature_info.rb +1 -1
- data/lib/factpulse/models/signature_info_api.rb +1 -1
- data/lib/factpulse/models/signature_parameters.rb +1 -1
- data/lib/factpulse/models/simplified_invoice_data.rb +1 -1
- data/lib/factpulse/models/structure_info.rb +1 -1
- data/lib/factpulse/models/structure_parameters.rb +1 -1
- data/lib/factpulse/models/structure_service.rb +1 -1
- data/lib/factpulse/models/submission_mode.rb +1 -1
- data/lib/factpulse/models/submit_complete_invoice_request.rb +1 -1
- data/lib/factpulse/models/submit_complete_invoice_response.rb +1 -1
- data/lib/factpulse/models/submit_flow_request.rb +7 -7
- data/lib/factpulse/models/submit_flow_response.rb +1 -1
- data/lib/factpulse/models/submit_gross_amount.rb +1 -1
- data/lib/factpulse/models/submit_invoice_request.rb +14 -14
- data/lib/factpulse/models/submit_invoice_response.rb +1 -1
- data/lib/factpulse/models/submit_net_amount.rb +1 -1
- data/lib/factpulse/models/submit_vat_amount.rb +1 -1
- data/lib/factpulse/models/supplementary_attachment.rb +1 -1
- data/lib/factpulse/models/supplier.rb +89 -7
- data/lib/factpulse/models/task_response.rb +1 -1
- data/lib/factpulse/models/tax_representative.rb +220 -0
- data/lib/factpulse/models/taxable_amount.rb +2 -2
- data/lib/factpulse/models/total_gross_amount.rb +2 -2
- data/lib/factpulse/models/total_net_amount.rb +2 -2
- data/lib/factpulse/models/total_vat_amount.rb +2 -2
- data/lib/factpulse/models/unit_net_price.rb +2 -2
- data/lib/factpulse/models/unit_of_measure.rb +1 -1
- data/lib/factpulse/models/validation_error.rb +1 -1
- data/lib/factpulse/models/validation_error_detail.rb +1 -1
- data/lib/factpulse/models/validation_error_loc_inner.rb +1 -1
- data/lib/factpulse/models/validation_error_response.rb +1 -1
- data/lib/factpulse/models/validation_info.rb +255 -0
- data/lib/factpulse/models/validation_success_response.rb +1 -1
- data/lib/factpulse/models/vat_accounting_code.rb +1 -1
- data/lib/factpulse/models/vat_amount.rb +2 -2
- data/lib/factpulse/models/vat_category.rb +1 -1
- data/lib/factpulse/models/vat_line.rb +13 -3
- data/lib/factpulse/models/{document_type.rb → vat_point_date_code.rb} +8 -10
- data/lib/factpulse/models/vat_rate.rb +104 -0
- data/lib/factpulse/models/verification_success_response.rb +1 -1
- data/lib/factpulse/models/verified_field_schema.rb +1 -1
- data/lib/factpulse/version.rb +2 -2
- data/lib/factpulse.rb +34 -3
- metadata +68 -6
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.19.0-SNAPSHOT
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module FactPulse
|
|
17
|
-
# Information about the invoice recipient (
|
|
17
|
+
# Information about the invoice recipient / buyer (BG-7).
|
|
18
18
|
class Recipient < ApiModelBase
|
|
19
19
|
attr_accessor :electronic_address
|
|
20
20
|
|
|
@@ -26,8 +26,14 @@ module FactPulse
|
|
|
26
26
|
|
|
27
27
|
attr_accessor :siret
|
|
28
28
|
|
|
29
|
+
attr_accessor :vat_number
|
|
30
|
+
|
|
29
31
|
attr_accessor :postal_address
|
|
30
32
|
|
|
33
|
+
attr_accessor :contact
|
|
34
|
+
|
|
35
|
+
attr_accessor :global_ids
|
|
36
|
+
|
|
31
37
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
32
38
|
def self.attribute_map
|
|
33
39
|
{
|
|
@@ -36,7 +42,10 @@ module FactPulse
|
|
|
36
42
|
:'name' => :'name',
|
|
37
43
|
:'siren' => :'siren',
|
|
38
44
|
:'siret' => :'siret',
|
|
39
|
-
:'
|
|
45
|
+
:'vat_number' => :'vat_number',
|
|
46
|
+
:'postal_address' => :'postal_address',
|
|
47
|
+
:'contact' => :'contact',
|
|
48
|
+
:'global_ids' => :'global_ids'
|
|
40
49
|
}
|
|
41
50
|
end
|
|
42
51
|
|
|
@@ -58,7 +67,10 @@ module FactPulse
|
|
|
58
67
|
:'name' => :'String',
|
|
59
68
|
:'siren' => :'String',
|
|
60
69
|
:'siret' => :'String',
|
|
61
|
-
:'
|
|
70
|
+
:'vat_number' => :'String',
|
|
71
|
+
:'postal_address' => :'PostalAddress',
|
|
72
|
+
:'contact' => :'Contact',
|
|
73
|
+
:'global_ids' => :'Array<ElectronicAddress>'
|
|
62
74
|
}
|
|
63
75
|
end
|
|
64
76
|
|
|
@@ -70,7 +82,10 @@ module FactPulse
|
|
|
70
82
|
:'name',
|
|
71
83
|
:'siren',
|
|
72
84
|
:'siret',
|
|
73
|
-
:'
|
|
85
|
+
:'vat_number',
|
|
86
|
+
:'postal_address',
|
|
87
|
+
:'contact',
|
|
88
|
+
:'global_ids'
|
|
74
89
|
])
|
|
75
90
|
end
|
|
76
91
|
|
|
@@ -112,9 +127,23 @@ module FactPulse
|
|
|
112
127
|
self.siret = attributes[:'siret']
|
|
113
128
|
end
|
|
114
129
|
|
|
130
|
+
if attributes.key?(:'vat_number')
|
|
131
|
+
self.vat_number = attributes[:'vat_number']
|
|
132
|
+
end
|
|
133
|
+
|
|
115
134
|
if attributes.key?(:'postal_address')
|
|
116
135
|
self.postal_address = attributes[:'postal_address']
|
|
117
136
|
end
|
|
137
|
+
|
|
138
|
+
if attributes.key?(:'contact')
|
|
139
|
+
self.contact = attributes[:'contact']
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if attributes.key?(:'global_ids')
|
|
143
|
+
if (value = attributes[:'global_ids']).is_a?(Array)
|
|
144
|
+
self.global_ids = value
|
|
145
|
+
end
|
|
146
|
+
end
|
|
118
147
|
end
|
|
119
148
|
|
|
120
149
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -142,7 +171,10 @@ module FactPulse
|
|
|
142
171
|
name == o.name &&
|
|
143
172
|
siren == o.siren &&
|
|
144
173
|
siret == o.siret &&
|
|
145
|
-
|
|
174
|
+
vat_number == o.vat_number &&
|
|
175
|
+
postal_address == o.postal_address &&
|
|
176
|
+
contact == o.contact &&
|
|
177
|
+
global_ids == o.global_ids
|
|
146
178
|
end
|
|
147
179
|
|
|
148
180
|
# @see the `==` method
|
|
@@ -154,7 +186,7 @@ module FactPulse
|
|
|
154
186
|
# Calculates hash code according to all attributes.
|
|
155
187
|
# @return [Integer] Hash code
|
|
156
188
|
def hash
|
|
157
|
-
[electronic_address, executing_service_code, name, siren, siret, postal_address].hash
|
|
189
|
+
[electronic_address, executing_service_code, name, siren, siret, vat_number, postal_address, contact, global_ids].hash
|
|
158
190
|
end
|
|
159
191
|
|
|
160
192
|
# Builds the object from hash
|
|
@@ -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.19.0-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module FactPulse
|
|
17
|
+
# Rounding amount added to total (BT-114).
|
|
18
|
+
module RoundingAmount
|
|
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
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.19.0-SNAPSHOT
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -16,13 +16,19 @@ require 'time'
|
|
|
16
16
|
module FactPulse
|
|
17
17
|
class SchemeID
|
|
18
18
|
FR_SIREN = "0225".freeze
|
|
19
|
-
GLN = "
|
|
20
|
-
DUNS = "
|
|
21
|
-
FR_TVA_INTRA = "
|
|
22
|
-
GLEIF = "
|
|
19
|
+
GLN = "0009".freeze
|
|
20
|
+
DUNS = "0002".freeze
|
|
21
|
+
FR_TVA_INTRA = "0088".freeze
|
|
22
|
+
GLEIF = "0060".freeze
|
|
23
|
+
N9957 = "9957".freeze
|
|
24
|
+
N0199 = "0199".freeze
|
|
25
|
+
N0231 = "0231".freeze
|
|
26
|
+
EM = "EM".freeze
|
|
27
|
+
N0177 = "0177".freeze
|
|
28
|
+
N0224 = "0224".freeze
|
|
23
29
|
|
|
24
30
|
def self.all_vars
|
|
25
|
-
@all_vars ||= [FR_SIREN, GLN, DUNS, FR_TVA_INTRA, GLEIF].freeze
|
|
31
|
+
@all_vars ||= [FR_SIREN, GLN, DUNS, FR_TVA_INTRA, GLEIF, N9957, N0199, N0231, EM, N0177, N0224].freeze
|
|
26
32
|
end
|
|
27
33
|
|
|
28
34
|
# Builds the enum from string
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.19.0-SNAPSHOT
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -61,13 +61,13 @@ module FactPulse
|
|
|
61
61
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
62
62
|
def self.attribute_map
|
|
63
63
|
{
|
|
64
|
-
:'updated_after' => :'
|
|
65
|
-
:'updated_before' => :'
|
|
66
|
-
:'flow_types' => :'
|
|
67
|
-
:'flow_directions' => :'
|
|
68
|
-
:'tracking_id' => :'
|
|
69
|
-
:'flow_id' => :'
|
|
70
|
-
:'acknowledgment_status' => :'
|
|
64
|
+
:'updated_after' => :'updatedAfter',
|
|
65
|
+
:'updated_before' => :'updatedBefore',
|
|
66
|
+
:'flow_types' => :'flowTypes',
|
|
67
|
+
:'flow_directions' => :'flowDirections',
|
|
68
|
+
:'tracking_id' => :'trackingId',
|
|
69
|
+
:'flow_id' => :'flowId',
|
|
70
|
+
:'acknowledgment_status' => :'acknowledgmentStatus',
|
|
71
71
|
:'offset' => :'offset',
|
|
72
72
|
:'limit' => :'limit'
|
|
73
73
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.19.0-SNAPSHOT
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -31,10 +31,10 @@ module FactPulse
|
|
|
31
31
|
def self.attribute_map
|
|
32
32
|
{
|
|
33
33
|
:'credentials' => :'credentials',
|
|
34
|
-
:'structure_identifier' => :'
|
|
35
|
-
:'structure_identifier_type' => :'
|
|
36
|
-
:'company_name' => :'
|
|
37
|
-
:'restrict_private_structures' => :'
|
|
34
|
+
:'structure_identifier' => :'structureIdentifier',
|
|
35
|
+
:'structure_identifier_type' => :'structureIdentifierType',
|
|
36
|
+
:'company_name' => :'companyName',
|
|
37
|
+
:'restrict_private_structures' => :'restrictPrivateStructures'
|
|
38
38
|
}
|
|
39
39
|
end
|
|
40
40
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.19.0-SNAPSHOT
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -55,12 +55,12 @@ module FactPulse
|
|
|
55
55
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
56
56
|
def self.attribute_map
|
|
57
57
|
{
|
|
58
|
-
:'flow_name' => :'
|
|
59
|
-
:'flow_syntax' => :'
|
|
60
|
-
:'flow_profile' => :'
|
|
61
|
-
:'tracking_id' => :'
|
|
62
|
-
:'request_id' => :'
|
|
63
|
-
:'pdp_credentials' => :'
|
|
58
|
+
:'flow_name' => :'flowName',
|
|
59
|
+
:'flow_syntax' => :'flowSyntax',
|
|
60
|
+
:'flow_profile' => :'flowProfile',
|
|
61
|
+
:'tracking_id' => :'trackingId',
|
|
62
|
+
:'request_id' => :'requestId',
|
|
63
|
+
:'pdp_credentials' => :'pdpCredentials'
|
|
64
64
|
}
|
|
65
65
|
end
|
|
66
66
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.19.0-SNAPSHOT
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -53,20 +53,20 @@ module FactPulse
|
|
|
53
53
|
def self.attribute_map
|
|
54
54
|
{
|
|
55
55
|
:'credentials' => :'credentials',
|
|
56
|
-
:'invoice_number' => :'
|
|
57
|
-
:'invoice_date' => :'
|
|
58
|
-
:'payment_due_date' => :'
|
|
59
|
-
:'structure_id' => :'
|
|
60
|
-
:'service_code' => :'
|
|
61
|
-
:'engagement_number' => :'
|
|
62
|
-
:'total_net_amount' => :'
|
|
63
|
-
:'vat_amount' => :'
|
|
64
|
-
:'total_gross_amount' => :'
|
|
65
|
-
:'main_attachment_id' => :'
|
|
66
|
-
:'main_attachment_label' => :'
|
|
56
|
+
:'invoice_number' => :'invoiceNumber',
|
|
57
|
+
:'invoice_date' => :'invoiceDate',
|
|
58
|
+
:'payment_due_date' => :'paymentDueDate',
|
|
59
|
+
:'structure_id' => :'structureId',
|
|
60
|
+
:'service_code' => :'serviceCode',
|
|
61
|
+
:'engagement_number' => :'engagementNumber',
|
|
62
|
+
:'total_net_amount' => :'totalNetAmount',
|
|
63
|
+
:'vat_amount' => :'vatAmount',
|
|
64
|
+
:'total_gross_amount' => :'totalGrossAmount',
|
|
65
|
+
:'main_attachment_id' => :'mainAttachmentId',
|
|
66
|
+
:'main_attachment_label' => :'mainAttachmentLabel',
|
|
67
67
|
:'comment' => :'comment',
|
|
68
|
-
:'purchase_order_reference' => :'
|
|
69
|
-
:'contract_reference' => :'
|
|
68
|
+
:'purchase_order_reference' => :'purchaseOrderReference',
|
|
69
|
+
:'contract_reference' => :'contractReference'
|
|
70
70
|
}
|
|
71
71
|
end
|
|
72
72
|
|