factpulse 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +74 -0
- data/LICENSE +21 -0
- data/README.md +220 -0
- data/Rakefile +10 -0
- data/docs/AFNORAcknowledgement.md +20 -0
- data/docs/AFNORAcknowledgementDetail.md +24 -0
- data/docs/AFNORAddressEdit.md +30 -0
- data/docs/AFNORAddressPatch.md +30 -0
- data/docs/AFNORAddressPut.md +30 -0
- data/docs/AFNORAddressRead.md +32 -0
- data/docs/AFNORAlgorithm.md +15 -0
- data/docs/AFNORContainsOperator.md +15 -0
- data/docs/AFNORCreateDirectoryLineBody.md +20 -0
- data/docs/AFNORCreateDirectoryLineBodyAddressingInformation.md +24 -0
- data/docs/AFNORCreateDirectoryLineBodyPeriod.md +20 -0
- data/docs/AFNORCreateRoutingCodeBody.md +32 -0
- data/docs/AFNORCredentials.md +22 -0
- data/docs/AFNORDestination.md +26 -0
- data/docs/AFNORDiffusionStatus.md +15 -0
- data/docs/AFNORDirectoryLineField.md +15 -0
- data/docs/AFNORDirectoryLinePayloadHistoryLegalUnitFacilityRoutingCode.md +32 -0
- data/docs/AFNORDirectoryLinePayloadHistoryLegalUnitFacilityRoutingCodePlatform.md +20 -0
- data/docs/AFNORDirectoryLinePayloadHistoryLegalUnitFacilityRoutingCodeRoutingCode.md +28 -0
- data/docs/AFNORDirectoryLinePost201Response.md +22 -0
- data/docs/AFNORDirectoryLineSearchPost200Response.md +22 -0
- data/docs/AFNOREntityType.md +15 -0
- data/docs/AFNORError.md +26 -0
- data/docs/AFNORFacilityAdministrativeStatus.md +15 -0
- data/docs/AFNORFacilityNature.md +15 -0
- data/docs/AFNORFacilityPayloadHistory.md +34 -0
- data/docs/AFNORFacilityPayloadHistoryUleB2gAdditionalData.md +28 -0
- data/docs/AFNORFacilityPayloadIncluded.md +32 -0
- data/docs/AFNORFacilityType.md +15 -0
- data/docs/AFNORFlow.md +38 -0
- data/docs/AFNORFlowAckStatus.md +15 -0
- data/docs/AFNORFlowDirection.md +15 -0
- data/docs/AFNORFlowInfo.md +28 -0
- data/docs/AFNORFlowProfile.md +15 -0
- data/docs/AFNORFlowSyntax.md +15 -0
- data/docs/AFNORFlowType.md +15 -0
- data/docs/AFNORFullFlowInfo.md +32 -0
- data/docs/AFNORHealthCheckResponse.md +22 -0
- data/docs/AFNORLegalUnitAdministrativeStatus.md +15 -0
- data/docs/AFNORLegalUnitPayloadHistory.md +24 -0
- data/docs/AFNORLegalUnitPayloadIncluded.md +24 -0
- data/docs/AFNORLegalUnitPayloadIncludedNoSiren.md +22 -0
- data/docs/AFNORPDPPAApi.md +150 -0
- data/docs/AFNORPDPPADirectoryServiceApi.md +1223 -0
- data/docs/AFNORPDPPAFlowServiceApi.md +270 -0
- data/docs/AFNORPlatformStatus.md +15 -0
- data/docs/AFNORProcessingRule.md +15 -0
- data/docs/AFNORReasonCode.md +49 -0
- data/docs/AFNORReasonCodeEnum.md +15 -0
- data/docs/AFNORRecipientPlatformType.md +15 -0
- data/docs/AFNORResult.md +32 -0
- data/docs/AFNORRoutingCodeAdministrativeStatus.md +15 -0
- data/docs/AFNORRoutingCodeField.md +15 -0
- data/docs/AFNORRoutingCodePayloadHistoryLegalUnitFacility.md +34 -0
- data/docs/AFNORRoutingCodePost201Response.md +22 -0
- data/docs/AFNORRoutingCodeSearch.md +28 -0
- data/docs/AFNORRoutingCodeSearchFilters.md +30 -0
- data/docs/AFNORRoutingCodeSearchFiltersAdministrativeStatus.md +20 -0
- data/docs/AFNORRoutingCodeSearchFiltersRoutingCodeName.md +20 -0
- data/docs/AFNORRoutingCodeSearchFiltersRoutingIdentifier.md +20 -0
- data/docs/AFNORRoutingCodeSearchPost200Response.md +22 -0
- data/docs/AFNORRoutingCodeSearchSortingInner.md +20 -0
- data/docs/AFNORSearchDirectoryLine.md +26 -0
- data/docs/AFNORSearchDirectoryLineFilters.md +26 -0
- data/docs/AFNORSearchDirectoryLineFiltersAddressingIdentifier.md +20 -0
- data/docs/AFNORSearchDirectoryLineFiltersAddressingSuffix.md +20 -0
- data/docs/AFNORSearchDirectoryLineSortingInner.md +20 -0
- data/docs/AFNORSearchFlowContent.md +22 -0
- data/docs/AFNORSearchFlowFilters.md +30 -0
- data/docs/AFNORSearchFlowParams.md +20 -0
- data/docs/AFNORSearchSiren.md +26 -0
- data/docs/AFNORSearchSirenFilters.md +24 -0
- data/docs/AFNORSearchSirenFiltersAdministrativeStatus.md +20 -0
- data/docs/AFNORSearchSirenFiltersBusinessName.md +20 -0
- data/docs/AFNORSearchSirenFiltersEntityType.md +20 -0
- data/docs/AFNORSearchSirenFiltersSiren.md +20 -0
- data/docs/AFNORSearchSirenSortingInner.md +20 -0
- data/docs/AFNORSearchSiret.md +28 -0
- data/docs/AFNORSearchSiretFilters.md +34 -0
- data/docs/AFNORSearchSiretFiltersAddressLines.md +20 -0
- data/docs/AFNORSearchSiretFiltersAdministrativeStatus.md +20 -0
- data/docs/AFNORSearchSiretFiltersCountrySubdivision.md +20 -0
- data/docs/AFNORSearchSiretFiltersFacilityType.md +20 -0
- data/docs/AFNORSearchSiretFiltersLocality.md +20 -0
- data/docs/AFNORSearchSiretFiltersName.md +20 -0
- data/docs/AFNORSearchSiretFiltersPostalCode.md +20 -0
- data/docs/AFNORSearchSiretFiltersSiret.md +20 -0
- data/docs/AFNORSearchSiretSortingInner.md +20 -0
- data/docs/AFNORSirenField.md +15 -0
- data/docs/AFNORSirenSearchPost200Response.md +22 -0
- data/docs/AFNORSiretField.md +15 -0
- data/docs/AFNORSiretSearchPost200Response.md +22 -0
- data/docs/AFNORSortingOrder.md +15 -0
- data/docs/AFNORStrictOperator.md +15 -0
- data/docs/AFNORUpdatePatchDirectoryLineBody.md +18 -0
- data/docs/AFNORUpdatePatchRoutingCodeBody.md +24 -0
- data/docs/AFNORUpdatePutRoutingCodeBody.md +24 -0
- data/docs/AFNORWebhookCallbackContent.md +18 -0
- data/docs/APIError.md +22 -0
- data/docs/APIProfile.md +15 -0
- data/docs/AcknowledgmentStatus.md +15 -0
- data/docs/ActionCodeInfo.md +22 -0
- data/docs/ActionCodesResponse.md +22 -0
- data/docs/AdditionalDocument.md +26 -0
- data/docs/AggregatedPaymentInput.md +22 -0
- data/docs/AggregatedTransactionInput.md +32 -0
- data/docs/AllowanceCharge.md +32 -0
- data/docs/AllowanceChargeReasonCode.md +15 -0
- data/docs/AllowanceReasonCode.md +15 -0
- data/docs/AllowanceTotalAmount.md +15 -0
- data/docs/Amount.md +15 -0
- data/docs/Amount1.md +15 -0
- data/docs/Amount2.md +15 -0
- data/docs/AmountDue.md +15 -0
- data/docs/AsyncTaskStatus.md +22 -0
- data/docs/AsyncTasksApi.md +82 -0
- data/docs/BaseAmount.md +15 -0
- data/docs/BoundingBoxSchema.md +30 -0
- data/docs/Buyercountry.md +15 -0
- data/docs/CeleryStatus.md +15 -0
- data/docs/CertificateInfoResponse.md +40 -0
- data/docs/ChargeTotalAmount.md +15 -0
- data/docs/ChorusProApi.md +1207 -0
- data/docs/ChorusProCredentials.md +26 -0
- data/docs/ChorusProDestination.md +20 -0
- data/docs/ChorusProResult.md +22 -0
- data/docs/ClientActivateResponse.md +22 -0
- data/docs/ClientCreateRequest.md +22 -0
- data/docs/ClientDetail.md +38 -0
- data/docs/ClientListResponse.md +24 -0
- data/docs/ClientManagementApi.md +921 -0
- data/docs/ClientSummary.md +38 -0
- data/docs/ClientUpdateRequest.md +22 -0
- data/docs/Contact.md +24 -0
- data/docs/ConvertResumeRequest.md +18 -0
- data/docs/ConvertSuccessResponse.md +36 -0
- data/docs/ConvertValidationFailedResponse.md +34 -0
- data/docs/CountryCode.md +15 -0
- data/docs/CreateAggregatedReportRequest.md +36 -0
- data/docs/CreateCDARRequest.md +52 -0
- data/docs/CreateEReportingRequest.md +38 -0
- data/docs/Currency.md +15 -0
- data/docs/CurrencyCode.md +15 -0
- data/docs/DeliveryParty.md +24 -0
- data/docs/Destination.md +79 -0
- data/docs/DocType.md +15 -0
- data/docs/DocumentTypeInfo.md +22 -0
- data/docs/DownloadsApi.md +161 -0
- data/docs/EReportingFlowType.md +15 -0
- data/docs/EReportingValidationError.md +22 -0
- data/docs/ElectronicAddress.md +20 -0
- data/docs/ElectronicSignatureApi.md +339 -0
- data/docs/Encaisseamount.md +15 -0
- data/docs/Encaisseamount1.md +15 -0
- data/docs/EncaisseeRequest.md +40 -0
- data/docs/EnrichedInvoiceInfo.md +32 -0
- data/docs/ErrorLevel.md +15 -0
- data/docs/ErrorSource.md +15 -0
- data/docs/ExtractionInfo.md +24 -0
- data/docs/FacturXConversionApi.md +319 -0
- data/docs/FacturXGenerationApi.md +254 -0
- data/docs/FacturXInvoice.md +76 -0
- data/docs/FacturXPDFInfo.md +22 -0
- data/docs/FacturXPDFXMLVerificationApi.md +240 -0
- data/docs/FacturXValidationApi.md +256 -0
- data/docs/FactureElectroniqueRestApiSchemasEreportingInvoiceTypeCode.md +15 -0
- data/docs/FactureElectroniqueRestApiSchemasProcessingChorusProCredentials.md +26 -0
- data/docs/FactureElectroniqueRestApiSchemasValidationValidationErrorResponse.md +18 -0
- data/docs/FieldStatus.md +15 -0
- data/docs/FileInfo.md +20 -0
- data/docs/FilesInfo.md +20 -0
- data/docs/FlowDirection.md +15 -0
- data/docs/FlowProfile.md +15 -0
- data/docs/FlowSummary.md +32 -0
- data/docs/FlowSyntax.md +15 -0
- data/docs/FlowType.md +15 -0
- data/docs/Flux10EReportingApi.md +814 -0
- data/docs/Flux6InvoiceLifecycleCDARApi.md +698 -0
- data/docs/GenerateAggregatedReportResponse.md +30 -0
- data/docs/GenerateCDARResponse.md +26 -0
- data/docs/GenerateCertificateRequest.md +38 -0
- data/docs/GenerateCertificateResponse.md +32 -0
- data/docs/GenerateEReportingResponse.md +26 -0
- data/docs/GetChorusProIdRequest.md +22 -0
- data/docs/GetChorusProIdResponse.md +24 -0
- data/docs/GetInvoiceRequest.md +20 -0
- data/docs/GetInvoiceResponse.md +34 -0
- data/docs/GetStructureRequest.md +22 -0
- data/docs/GetStructureResponse.md +34 -0
- data/docs/GlobalAllowanceAmount.md +15 -0
- data/docs/GrossUnitPrice.md +15 -0
- data/docs/HTTPValidationError.md +18 -0
- data/docs/HealthApi.md +203 -0
- data/docs/IncomingInvoice.md +54 -0
- data/docs/IncomingSupplier.md +32 -0
- data/docs/InvoiceFormat.md +15 -0
- data/docs/InvoiceInput.md +50 -0
- data/docs/InvoiceLine.md +84 -0
- data/docs/InvoiceLineAllowanceAmount.md +15 -0
- data/docs/InvoiceNote.md +20 -0
- data/docs/InvoicePaymentInput.md +26 -0
- data/docs/InvoiceReferences.md +52 -0
- data/docs/InvoiceStatus.md +22 -0
- data/docs/InvoiceTotals.md +38 -0
- data/docs/InvoiceTotalsPrepayment.md +15 -0
- data/docs/InvoiceTypeCode.md +15 -0
- data/docs/InvoiceTypeCodeOutput.md +15 -0
- data/docs/InvoicingFramework.md +24 -0
- data/docs/InvoicingFrameworkCode.md +15 -0
- data/docs/IssuerRoleCode.md +15 -0
- data/docs/KeyRotationRequest.md +20 -0
- data/docs/KeyRotationResponse.md +24 -0
- data/docs/LineNetAmount.md +15 -0
- data/docs/LineSubType.md +15 -0
- data/docs/LineTotalAmount.md +15 -0
- data/docs/LocationInner.md +15 -0
- data/docs/MandatoryNoteSchema.md +30 -0
- data/docs/ManualRate.md +15 -0
- data/docs/ManualVatRate.md +15 -0
- data/docs/MissingField.md +28 -0
- data/docs/OperationNature.md +15 -0
- data/docs/OutputFormat.md +15 -0
- data/docs/PDFValidationResultAPI.md +62 -0
- data/docs/PDPConfigResponse.md +46 -0
- data/docs/PDPConfigUpdateRequest.md +30 -0
- data/docs/PDPCredentials.md +26 -0
- data/docs/PageDimensionsSchema.md +20 -0
- data/docs/Payee.md +32 -0
- data/docs/PaymentAmountByRate.md +20 -0
- data/docs/PaymentCard.md +20 -0
- data/docs/PaymentMeans.md +15 -0
- data/docs/Percentage.md +15 -0
- data/docs/PostalAddress.md +30 -0
- data/docs/PriceAllowanceAmount.md +15 -0
- data/docs/PriceBasisQuantity.md +15 -0
- data/docs/ProcessingOptions.md +24 -0
- data/docs/ProcessingRule.md +15 -0
- data/docs/ProductCharacteristic.md +20 -0
- data/docs/ProductClassification.md +22 -0
- data/docs/Quantity.md +15 -0
- data/docs/Rate.md +15 -0
- data/docs/Rate1.md +15 -0
- data/docs/ReasonCodeInfo.md +22 -0
- data/docs/ReasonCodesResponse.md +22 -0
- data/docs/Recipient.md +34 -0
- data/docs/RecipientInput.md +26 -0
- data/docs/RefuseeRequest.md +40 -0
- data/docs/ReportIssuer.md +24 -0
- data/docs/ReportPeriod.md +20 -0
- data/docs/ReportSender.md +22 -0
- data/docs/RoundingAmount.md +15 -0
- data/docs/SchematronValidationError.md +32 -0
- data/docs/SchemeID.md +15 -0
- data/docs/SearchFlowRequest.md +34 -0
- data/docs/SearchFlowResponse.md +24 -0
- data/docs/SearchServicesResponse.md +24 -0
- data/docs/SearchStructureRequest.md +26 -0
- data/docs/SearchStructureResponse.md +24 -0
- data/docs/SecretStatus.md +24 -0
- data/docs/Sellercountry.md +15 -0
- data/docs/SignatureInfo.md +22 -0
- data/docs/SignatureInfoAPI.md +28 -0
- data/docs/SignatureParameters.md +34 -0
- data/docs/SimplifiedCDARResponse.md +26 -0
- data/docs/SimplifiedInvoiceData.md +42 -0
- data/docs/StatusCodeInfo.md +22 -0
- data/docs/StatusCodesResponse.md +22 -0
- data/docs/StructureInfo.md +26 -0
- data/docs/StructureParameters.md +22 -0
- data/docs/StructureService.md +24 -0
- data/docs/SubmissionMode.md +15 -0
- data/docs/SubmitAggregatedReportRequest.md +28 -0
- data/docs/SubmitCDARRequest.md +62 -0
- data/docs/SubmitCDARResponse.md +24 -0
- data/docs/SubmitCDARXMLRequest.md +30 -0
- data/docs/SubmitCompleteInvoiceRequest.md +26 -0
- data/docs/SubmitCompleteInvoiceResponse.md +34 -0
- data/docs/SubmitEReportingRequest.md +28 -0
- data/docs/SubmitEReportingResponse.md +32 -0
- data/docs/SubmitFlowRequest.md +28 -0
- data/docs/SubmitFlowResponse.md +30 -0
- data/docs/SubmitGrossAmount.md +15 -0
- data/docs/SubmitInvoiceRequest.md +46 -0
- data/docs/SubmitInvoiceResponse.md +24 -0
- data/docs/SubmitNetAmount.md +15 -0
- data/docs/SubmitVatAmount.md +15 -0
- data/docs/SupplementaryAttachment.md +26 -0
- data/docs/Supplier.md +52 -0
- data/docs/TaskResponse.md +18 -0
- data/docs/TaxBreakdownInput.md +22 -0
- data/docs/TaxDueDateType.md +15 -0
- data/docs/TaxRepresentative.md +22 -0
- data/docs/TaxableAmount.md +15 -0
- data/docs/Taxableamount.md +15 -0
- data/docs/Taxamount.md +15 -0
- data/docs/Taxamount1.md +15 -0
- data/docs/Taxamount2.md +15 -0
- data/docs/Taxexclusiveamount.md +15 -0
- data/docs/Taxexclusiveamount1.md +15 -0
- data/docs/TotalGrossAmount.md +15 -0
- data/docs/TotalNetAmount.md +15 -0
- data/docs/TotalVATAmount.md +15 -0
- data/docs/TransactionCategory.md +15 -0
- data/docs/TransmissionTypeCode.md +15 -0
- data/docs/UnitNetPrice.md +15 -0
- data/docs/UnitOfMeasure.md +15 -0
- data/docs/VATAccountingCode.md +15 -0
- data/docs/VATAmount.md +15 -0
- data/docs/VATCategory.md +15 -0
- data/docs/VATLine.md +32 -0
- data/docs/VATPointDateCode.md +15 -0
- data/docs/ValidateCDARRequest.md +32 -0
- data/docs/ValidateCDARResponse.md +22 -0
- data/docs/ValidateEReportingRequest.md +18 -0
- data/docs/ValidateEReportingResponse.md +28 -0
- data/docs/ValidationError.md +22 -0
- data/docs/ValidationErrorDetail.md +26 -0
- data/docs/ValidationErrorResponse.md +24 -0
- data/docs/ValidationInfo.md +28 -0
- data/docs/ValidationSuccessResponse.md +18 -0
- data/docs/VatRate.md +15 -0
- data/docs/VerificationSuccessResponse.md +36 -0
- data/docs/VerifiedFieldSchema.md +34 -0
- data/docs/WebhookSecretDeleteResponse.md +20 -0
- data/docs/WebhookSecretGenerateResponse.md +24 -0
- data/docs/WebhookSecretStatusResponse.md +20 -0
- data/factpulse.gemspec +39 -0
- data/git_push.sh +57 -0
- data/lib/factpulse/api/afnorpdppa_api.rb +148 -0
- data/lib/factpulse/api/afnorpdppa_directory_service_api.rb +1183 -0
- data/lib/factpulse/api/afnorpdppa_flow_service_api.rb +289 -0
- data/lib/factpulse/api/async_tasks_api.rb +85 -0
- data/lib/factpulse/api/chorus_pro_api.rb +1105 -0
- data/lib/factpulse/api/client_management_api.rb +831 -0
- data/lib/factpulse/api/downloads_api.rb +151 -0
- data/lib/factpulse/api/electronic_signature_api.rb +339 -0
- data/lib/factpulse/api/factur_x_conversion_api.rb +306 -0
- data/lib/factpulse/api/factur_x_generation_api.rb +254 -0
- data/lib/factpulse/api/factur_x_validation_api.rb +256 -0
- data/lib/factpulse/api/factur_xpdfxml_verification_api.rb +232 -0
- data/lib/factpulse/api/flux10_e_reporting_api.rb +777 -0
- data/lib/factpulse/api/flux6_invoice_lifecycle_cdar_api.rb +670 -0
- data/lib/factpulse/api/health_api.rb +193 -0
- data/lib/factpulse/api_client.rb +397 -0
- data/lib/factpulse/api_error.rb +58 -0
- data/lib/factpulse/api_model_base.rb +88 -0
- data/lib/factpulse/configuration.rb +319 -0
- data/lib/factpulse/helpers/client.rb +272 -0
- data/lib/factpulse/helpers/exceptions.rb +45 -0
- data/lib/factpulse/helpers/helpers.rb +14 -0
- data/lib/factpulse/models/acknowledgment_status.rb +41 -0
- data/lib/factpulse/models/action_code_info.rb +220 -0
- data/lib/factpulse/models/action_codes_response.rb +207 -0
- data/lib/factpulse/models/additional_document.rb +206 -0
- data/lib/factpulse/models/afnor_acknowledgement.rb +216 -0
- data/lib/factpulse/models/afnor_acknowledgement_detail.rb +267 -0
- data/lib/factpulse/models/afnor_address_edit.rb +353 -0
- data/lib/factpulse/models/afnor_address_patch.rb +386 -0
- data/lib/factpulse/models/afnor_address_put.rb +435 -0
- data/lib/factpulse/models/afnor_address_read.rb +382 -0
- data/lib/factpulse/models/afnor_algorithm.rb +43 -0
- data/lib/factpulse/models/afnor_contains_operator.rb +39 -0
- data/lib/factpulse/models/afnor_create_directory_line_body.rb +156 -0
- data/lib/factpulse/models/afnor_create_directory_line_body_addressing_information.rb +294 -0
- data/lib/factpulse/models/afnor_create_directory_line_body_period.rb +175 -0
- data/lib/factpulse/models/afnor_create_routing_code_body.rb +412 -0
- data/lib/factpulse/models/afnor_credentials.rb +169 -0
- data/lib/factpulse/models/afnor_destination.rb +224 -0
- data/lib/factpulse/models/afnor_diffusion_status.rb +40 -0
- data/lib/factpulse/models/afnor_directory_line_field.rb +44 -0
- data/lib/factpulse/models/afnor_directory_line_payload_history_legal_unit_facility_routing_code.rb +312 -0
- data/lib/factpulse/models/afnor_directory_line_payload_history_legal_unit_facility_routing_code_platform.rb +178 -0
- data/lib/factpulse/models/afnor_directory_line_payload_history_legal_unit_facility_routing_code_routing_code.rb +308 -0
- data/lib/factpulse/models/afnor_directory_line_post201_response.rb +187 -0
- data/lib/factpulse/models/afnor_directory_line_search_post200_response.rb +168 -0
- data/lib/factpulse/models/afnor_entity_type.rb +40 -0
- data/lib/factpulse/models/afnor_error.rb +214 -0
- data/lib/factpulse/models/afnor_facility_administrative_status.rb +40 -0
- data/lib/factpulse/models/afnor_facility_nature.rb +40 -0
- data/lib/factpulse/models/afnor_facility_payload_history.rb +323 -0
- data/lib/factpulse/models/afnor_facility_payload_history_ule_b2g_additional_data.rb +198 -0
- data/lib/factpulse/models/afnor_facility_payload_included.rb +314 -0
- data/lib/factpulse/models/afnor_facility_type.rb +40 -0
- data/lib/factpulse/models/afnor_flow.rb +315 -0
- data/lib/factpulse/models/afnor_flow_ack_status.rb +41 -0
- data/lib/factpulse/models/afnor_flow_direction.rb +40 -0
- data/lib/factpulse/models/afnor_flow_info.rb +293 -0
- data/lib/factpulse/models/afnor_flow_profile.rb +41 -0
- data/lib/factpulse/models/afnor_flow_syntax.rb +43 -0
- data/lib/factpulse/models/afnor_flow_type.rb +51 -0
- data/lib/factpulse/models/afnor_full_flow_info.rb +339 -0
- data/lib/factpulse/models/afnor_health_check_response.rb +220 -0
- data/lib/factpulse/models/afnor_legal_unit_administrative_status.rb +40 -0
- data/lib/factpulse/models/afnor_legal_unit_payload_history.rb +247 -0
- data/lib/factpulse/models/afnor_legal_unit_payload_included.rb +247 -0
- data/lib/factpulse/models/afnor_legal_unit_payload_included_no_siren.rb +207 -0
- data/lib/factpulse/models/afnor_platform_status.rb +40 -0
- data/lib/factpulse/models/afnor_processing_rule.rb +44 -0
- data/lib/factpulse/models/afnor_reason_code.rb +105 -0
- data/lib/factpulse/models/afnor_reason_code_enum.rb +53 -0
- data/lib/factpulse/models/afnor_recipient_platform_type.rb +40 -0
- data/lib/factpulse/models/afnor_result.rb +270 -0
- data/lib/factpulse/models/afnor_routing_code_administrative_status.rb +40 -0
- data/lib/factpulse/models/afnor_routing_code_field.rb +46 -0
- data/lib/factpulse/models/afnor_routing_code_payload_history_legal_unit_facility.rb +366 -0
- data/lib/factpulse/models/afnor_routing_code_post201_response.rb +228 -0
- data/lib/factpulse/models/afnor_routing_code_search.rb +224 -0
- data/lib/factpulse/models/afnor_routing_code_search_filters.rb +201 -0
- data/lib/factpulse/models/afnor_routing_code_search_filters_administrative_status.rb +178 -0
- data/lib/factpulse/models/afnor_routing_code_search_filters_routing_code_name.rb +209 -0
- data/lib/factpulse/models/afnor_routing_code_search_filters_routing_identifier.rb +209 -0
- data/lib/factpulse/models/afnor_routing_code_search_post200_response.rb +168 -0
- data/lib/factpulse/models/afnor_routing_code_search_sorting_inner.rb +179 -0
- data/lib/factpulse/models/afnor_search_directory_line.rb +191 -0
- data/lib/factpulse/models/afnor_search_directory_line_filters.rb +183 -0
- data/lib/factpulse/models/afnor_search_directory_line_filters_addressing_identifier.rb +198 -0
- data/lib/factpulse/models/afnor_search_directory_line_filters_addressing_suffix.rb +198 -0
- data/lib/factpulse/models/afnor_search_directory_line_sorting_inner.rb +179 -0
- data/lib/factpulse/models/afnor_search_flow_content.rb +168 -0
- data/lib/factpulse/models/afnor_search_flow_filters.rb +250 -0
- data/lib/factpulse/models/afnor_search_flow_params.rb +195 -0
- data/lib/factpulse/models/afnor_search_siren.rb +191 -0
- data/lib/factpulse/models/afnor_search_siren_filters.rb +174 -0
- data/lib/factpulse/models/afnor_search_siren_filters_administrative_status.rb +178 -0
- data/lib/factpulse/models/afnor_search_siren_filters_business_name.rb +198 -0
- data/lib/factpulse/models/afnor_search_siren_filters_entity_type.rb +178 -0
- data/lib/factpulse/models/afnor_search_siren_filters_siren.rb +209 -0
- data/lib/factpulse/models/afnor_search_siren_sorting_inner.rb +179 -0
- data/lib/factpulse/models/afnor_search_siret.rb +224 -0
- data/lib/factpulse/models/afnor_search_siret_filters.rb +219 -0
- data/lib/factpulse/models/afnor_search_siret_filters_address_lines.rb +198 -0
- data/lib/factpulse/models/afnor_search_siret_filters_administrative_status.rb +178 -0
- data/lib/factpulse/models/afnor_search_siret_filters_country_subdivision.rb +198 -0
- data/lib/factpulse/models/afnor_search_siret_filters_facility_type.rb +178 -0
- data/lib/factpulse/models/afnor_search_siret_filters_locality.rb +198 -0
- data/lib/factpulse/models/afnor_search_siret_filters_name.rb +198 -0
- data/lib/factpulse/models/afnor_search_siret_filters_postal_code.rb +209 -0
- data/lib/factpulse/models/afnor_search_siret_filters_siret.rb +209 -0
- data/lib/factpulse/models/afnor_search_siret_sorting_inner.rb +179 -0
- data/lib/factpulse/models/afnor_siren_field.rb +43 -0
- data/lib/factpulse/models/afnor_siren_search_post200_response.rb +168 -0
- data/lib/factpulse/models/afnor_siret_field.rb +52 -0
- data/lib/factpulse/models/afnor_siret_search_post200_response.rb +168 -0
- data/lib/factpulse/models/afnor_sorting_order.rb +40 -0
- data/lib/factpulse/models/afnor_strict_operator.rb +39 -0
- data/lib/factpulse/models/afnor_update_patch_directory_line_body.rb +148 -0
- data/lib/factpulse/models/afnor_update_patch_routing_code_body.rb +258 -0
- data/lib/factpulse/models/afnor_update_put_routing_code_body.rb +289 -0
- data/lib/factpulse/models/afnor_webhook_callback_content.rb +148 -0
- data/lib/factpulse/models/aggregated_payment_input.rb +213 -0
- data/lib/factpulse/models/aggregated_transaction_input.rb +349 -0
- data/lib/factpulse/models/allowance_charge.rb +274 -0
- data/lib/factpulse/models/allowance_charge_reason_code.rb +76 -0
- data/lib/factpulse/models/allowance_reason_code.rb +45 -0
- data/lib/factpulse/models/allowance_total_amount.rb +104 -0
- data/lib/factpulse/models/amount.rb +104 -0
- data/lib/factpulse/models/amount1.rb +104 -0
- data/lib/factpulse/models/amount2.rb +104 -0
- data/lib/factpulse/models/amount_due.rb +104 -0
- data/lib/factpulse/models/api_error.rb +205 -0
- data/lib/factpulse/models/api_profile.rb +43 -0
- data/lib/factpulse/models/async_task_status.rb +227 -0
- data/lib/factpulse/models/base_amount.rb +104 -0
- data/lib/factpulse/models/bounding_box_schema.rb +332 -0
- data/lib/factpulse/models/buyercountry.rb +104 -0
- data/lib/factpulse/models/celery_status.rb +43 -0
- data/lib/factpulse/models/certificate_info_response.rb +446 -0
- data/lib/factpulse/models/charge_total_amount.rb +104 -0
- data/lib/factpulse/models/chorus_pro_credentials.rb +259 -0
- data/lib/factpulse/models/chorus_pro_destination.rb +194 -0
- data/lib/factpulse/models/chorus_pro_result.rb +186 -0
- data/lib/factpulse/models/client_activate_response.rb +220 -0
- data/lib/factpulse/models/client_create_request.rb +236 -0
- data/lib/factpulse/models/client_detail.rb +368 -0
- data/lib/factpulse/models/client_list_response.rb +249 -0
- data/lib/factpulse/models/client_summary.rb +368 -0
- data/lib/factpulse/models/client_update_request.rb +225 -0
- data/lib/factpulse/models/contact.rb +179 -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 +339 -0
- data/lib/factpulse/models/country_code.rb +208 -0
- data/lib/factpulse/models/create_aggregated_report_request.rb +320 -0
- data/lib/factpulse/models/create_cdar_request.rb +414 -0
- data/lib/factpulse/models/create_e_reporting_request.rb +347 -0
- data/lib/factpulse/models/currency.rb +104 -0
- data/lib/factpulse/models/currency_code.rb +91 -0
- data/lib/factpulse/models/delivery_party.rb +179 -0
- data/lib/factpulse/models/destination.rb +56 -0
- data/lib/factpulse/models/doc_type.rb +42 -0
- data/lib/factpulse/models/document_type_info.rb +220 -0
- data/lib/factpulse/models/e_reporting_flow_type.rb +42 -0
- data/lib/factpulse/models/e_reporting_validation_error.rb +203 -0
- data/lib/factpulse/models/electronic_address.rb +198 -0
- data/lib/factpulse/models/encaisseamount.rb +104 -0
- data/lib/factpulse/models/encaisseamount1.rb +103 -0
- data/lib/factpulse/models/encaissee_request.rb +347 -0
- data/lib/factpulse/models/enriched_invoice_info.rb +354 -0
- data/lib/factpulse/models/error_level.rb +40 -0
- data/lib/factpulse/models/error_source.rb +47 -0
- data/lib/factpulse/models/extraction_info.rb +217 -0
- data/lib/factpulse/models/factur_x_invoice.rb +580 -0
- data/lib/factpulse/models/factur_xpdf_info.rb +205 -0
- data/lib/factpulse/models/facture_electronique_rest_api_schemas_ereporting_invoice_type_code.rb +43 -0
- data/lib/factpulse/models/facture_electronique_rest_api_schemas_processing_chorus_pro_credentials.rb +191 -0
- data/lib/factpulse/models/facture_electronique_rest_api_schemas_validation_validation_error_response.rb +168 -0
- data/lib/factpulse/models/field_status.rb +43 -0
- 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 +40 -0
- data/lib/factpulse/models/flow_profile.rb +41 -0
- data/lib/factpulse/models/flow_summary.rb +253 -0
- data/lib/factpulse/models/flow_syntax.rb +43 -0
- data/lib/factpulse/models/flow_type.rb +51 -0
- data/lib/factpulse/models/generate_aggregated_report_response.rb +330 -0
- data/lib/factpulse/models/generate_cdar_response.rb +273 -0
- data/lib/factpulse/models/generate_certificate_request.rb +323 -0
- data/lib/factpulse/models/generate_certificate_response.rb +254 -0
- data/lib/factpulse/models/generate_e_reporting_response.rb +274 -0
- data/lib/factpulse/models/get_chorus_pro_id_request.rb +188 -0
- data/lib/factpulse/models/get_chorus_pro_id_response.rb +230 -0
- data/lib/factpulse/models/get_invoice_request.rb +176 -0
- data/lib/factpulse/models/get_invoice_response.rb +263 -0
- data/lib/factpulse/models/get_structure_request.rb +188 -0
- data/lib/factpulse/models/get_structure_response.rb +263 -0
- data/lib/factpulse/models/global_allowance_amount.rb +104 -0
- data/lib/factpulse/models/gross_unit_price.rb +104 -0
- data/lib/factpulse/models/http_validation_error.rb +149 -0
- data/lib/factpulse/models/incoming_invoice.rb +489 -0
- data/lib/factpulse/models/incoming_supplier.rb +236 -0
- data/lib/factpulse/models/invoice_format.rb +41 -0
- data/lib/factpulse/models/invoice_input.rb +439 -0
- data/lib/factpulse/models/invoice_line.rb +593 -0
- data/lib/factpulse/models/invoice_line_allowance_amount.rb +104 -0
- data/lib/factpulse/models/invoice_note.rb +176 -0
- data/lib/factpulse/models/invoice_payment_input.rb +267 -0
- data/lib/factpulse/models/invoice_references.rb +393 -0
- data/lib/factpulse/models/invoice_status.rb +203 -0
- data/lib/factpulse/models/invoice_totals.rb +312 -0
- data/lib/factpulse/models/invoice_totals_prepayment.rb +104 -0
- data/lib/factpulse/models/invoice_type_code.rb +54 -0
- data/lib/factpulse/models/invoice_type_code_output.rb +54 -0
- data/lib/factpulse/models/invoicing_framework.rb +218 -0
- data/lib/factpulse/models/invoicing_framework_code.rb +42 -0
- data/lib/factpulse/models/issuer_role_code.rb +40 -0
- data/lib/factpulse/models/key_rotation_request.rb +211 -0
- data/lib/factpulse/models/key_rotation_response.rb +232 -0
- data/lib/factpulse/models/line_net_amount.rb +104 -0
- data/lib/factpulse/models/line_sub_type.rb +41 -0
- data/lib/factpulse/models/line_total_amount.rb +104 -0
- data/lib/factpulse/models/location_inner.rb +103 -0
- data/lib/factpulse/models/mandatory_note_schema.rb +265 -0
- data/lib/factpulse/models/manual_rate.rb +104 -0
- data/lib/factpulse/models/manual_vat_rate.rb +104 -0
- data/lib/factpulse/models/missing_field.rb +269 -0
- data/lib/factpulse/models/operation_nature.rb +52 -0
- data/lib/factpulse/models/output_format.rb +40 -0
- data/lib/factpulse/models/page_dimensions_schema.rb +193 -0
- data/lib/factpulse/models/payee.rb +281 -0
- data/lib/factpulse/models/payment_amount_by_rate.rb +191 -0
- data/lib/factpulse/models/payment_card.rb +159 -0
- data/lib/factpulse/models/payment_means.rb +44 -0
- data/lib/factpulse/models/pdf_validation_result_api.rb +523 -0
- data/lib/factpulse/models/pdp_config_response.rb +306 -0
- data/lib/factpulse/models/pdp_config_update_request.rb +315 -0
- data/lib/factpulse/models/pdp_credentials.rb +257 -0
- data/lib/factpulse/models/percentage.rb +104 -0
- data/lib/factpulse/models/postal_address.rb +209 -0
- 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 +207 -0
- data/lib/factpulse/models/processing_rule.rb +44 -0
- data/lib/factpulse/models/product_characteristic.rb +193 -0
- data/lib/factpulse/models/product_classification.rb +186 -0
- data/lib/factpulse/models/quantity.rb +104 -0
- data/lib/factpulse/models/rate.rb +104 -0
- data/lib/factpulse/models/rate1.rb +104 -0
- data/lib/factpulse/models/reason_code_info.rb +220 -0
- data/lib/factpulse/models/reason_codes_response.rb +207 -0
- data/lib/factpulse/models/recipient.rb +231 -0
- data/lib/factpulse/models/recipient_input.rb +191 -0
- data/lib/factpulse/models/refusee_request.rb +346 -0
- data/lib/factpulse/models/report_issuer.rb +236 -0
- data/lib/factpulse/models/report_period.rb +193 -0
- data/lib/factpulse/models/report_sender.rb +221 -0
- data/lib/factpulse/models/rounding_amount.rb +104 -0
- data/lib/factpulse/models/schematron_validation_error.rb +294 -0
- data/lib/factpulse/models/scheme_id.rb +56 -0
- data/lib/factpulse/models/search_flow_request.rb +306 -0
- data/lib/factpulse/models/search_flow_response.rb +249 -0
- data/lib/factpulse/models/search_services_response.rb +217 -0
- data/lib/factpulse/models/search_structure_request.rb +191 -0
- data/lib/factpulse/models/search_structure_response.rb +216 -0
- data/lib/factpulse/models/secret_status.rb +213 -0
- data/lib/factpulse/models/sellercountry.rb +104 -0
- data/lib/factpulse/models/signature_info.rb +186 -0
- data/lib/factpulse/models/signature_info_api.rb +216 -0
- data/lib/factpulse/models/signature_parameters.rb +235 -0
- data/lib/factpulse/models/simplified_cdar_response.rb +274 -0
- data/lib/factpulse/models/simplified_invoice_data.rb +404 -0
- data/lib/factpulse/models/status_code_info.rb +220 -0
- data/lib/factpulse/models/status_codes_response.rb +207 -0
- data/lib/factpulse/models/structure_info.rb +274 -0
- data/lib/factpulse/models/structure_parameters.rb +175 -0
- data/lib/factpulse/models/structure_service.rb +247 -0
- data/lib/factpulse/models/submission_mode.rb +41 -0
- data/lib/factpulse/models/submit_aggregated_report_request.rb +216 -0
- data/lib/factpulse/models/submit_cdar_request.rb +466 -0
- data/lib/factpulse/models/submit_cdar_response.rb +213 -0
- data/lib/factpulse/models/submit_cdarxml_request.rb +228 -0
- data/lib/factpulse/models/submit_complete_invoice_request.rb +239 -0
- data/lib/factpulse/models/submit_complete_invoice_response.rb +355 -0
- data/lib/factpulse/models/submit_e_reporting_request.rb +216 -0
- data/lib/factpulse/models/submit_e_reporting_response.rb +306 -0
- data/lib/factpulse/models/submit_flow_request.rb +238 -0
- data/lib/factpulse/models/submit_flow_response.rb +294 -0
- data/lib/factpulse/models/submit_gross_amount.rb +104 -0
- data/lib/factpulse/models/submit_invoice_request.rb +388 -0
- data/lib/factpulse/models/submit_invoice_response.rb +213 -0
- data/lib/factpulse/models/submit_net_amount.rb +104 -0
- data/lib/factpulse/models/submit_vat_amount.rb +104 -0
- data/lib/factpulse/models/supplementary_attachment.rb +274 -0
- data/lib/factpulse/models/supplier.rb +337 -0
- data/lib/factpulse/models/task_response.rb +166 -0
- data/lib/factpulse/models/tax_breakdown_input.rb +217 -0
- data/lib/factpulse/models/tax_due_date_type.rb +44 -0
- data/lib/factpulse/models/tax_representative.rb +220 -0
- data/lib/factpulse/models/taxable_amount.rb +104 -0
- data/lib/factpulse/models/taxableamount.rb +104 -0
- data/lib/factpulse/models/taxamount.rb +104 -0
- data/lib/factpulse/models/taxamount1.rb +104 -0
- data/lib/factpulse/models/taxamount2.rb +104 -0
- data/lib/factpulse/models/taxexclusiveamount.rb +104 -0
- data/lib/factpulse/models/taxexclusiveamount1.rb +104 -0
- data/lib/factpulse/models/total_gross_amount.rb +104 -0
- data/lib/factpulse/models/total_net_amount.rb +104 -0
- data/lib/factpulse/models/total_vat_amount.rb +104 -0
- data/lib/factpulse/models/transaction_category.rb +42 -0
- data/lib/factpulse/models/transmission_type_code.rb +40 -0
- data/lib/factpulse/models/unit_net_price.rb +104 -0
- data/lib/factpulse/models/unit_of_measure.rb +44 -0
- data/lib/factpulse/models/validate_cdar_request.rb +219 -0
- data/lib/factpulse/models/validate_cdar_response.rb +190 -0
- data/lib/factpulse/models/validate_e_reporting_request.rb +166 -0
- data/lib/factpulse/models/validate_e_reporting_response.rb +271 -0
- data/lib/factpulse/models/validation_error.rb +218 -0
- data/lib/factpulse/models/validation_error_detail.rb +245 -0
- data/lib/factpulse/models/validation_error_response.rb +215 -0
- data/lib/factpulse/models/validation_info.rb +255 -0
- data/lib/factpulse/models/validation_success_response.rb +166 -0
- data/lib/factpulse/models/vat_accounting_code.rb +42 -0
- data/lib/factpulse/models/vat_amount.rb +104 -0
- data/lib/factpulse/models/vat_category.rb +47 -0
- data/lib/factpulse/models/vat_line.rb +272 -0
- data/lib/factpulse/models/vat_point_date_code.rb +41 -0
- data/lib/factpulse/models/vat_rate.rb +104 -0
- data/lib/factpulse/models/verification_success_response.rb +343 -0
- data/lib/factpulse/models/verified_field_schema.rb +334 -0
- data/lib/factpulse/models/webhook_secret_delete_response.rb +193 -0
- data/lib/factpulse/models/webhook_secret_generate_response.rb +247 -0
- data/lib/factpulse/models/webhook_secret_status_response.rb +176 -0
- data/lib/factpulse/version.rb +15 -0
- data/lib/factpulse.rb +369 -0
- metadata +806 -0
|
@@ -0,0 +1,88 @@
|
|
|
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 - 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) ### ✅ Factur-X - Validation - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) ### ✍️ 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 ### 📋 Flux 6 - Invoice Lifecycle (CDAR) - **CDAR Messages**: Acknowledgements, invoice statuses - **PPF Statuses**: REFUSED (210), PAID (212) ### 📊 Flux 10 - E-Reporting - **Tax Declarations**: International B2B, B2C - **Flow Types**: 10.1 (B2B transactions), 10.2 (B2B payments), 10.3 (B2C transactions), 10.4 (B2C payments) ### 📡 AFNOR PDP/PA (XP Z12-013) - **Flow Service**: Submit and search flows to PDPs - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user ### 🏛️ Chorus Pro - **Public Sector Invoicing**: Complete API for Chorus Pro ### ⏳ Async Tasks - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **Webhooks**: Automatic notifications when tasks complete ## 🔒 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://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://factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://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://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://factpulse.fr/api/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://factpulse.fr/documentation-api/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: contact@factpulse.fr
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.20.0-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module FactPulse
|
|
14
|
+
class ApiModelBase
|
|
15
|
+
# Deserializes the data based on type
|
|
16
|
+
# @param string type Data type
|
|
17
|
+
# @param string value Value to be deserialized
|
|
18
|
+
# @return [Object] Deserialized data
|
|
19
|
+
def self._deserialize(type, value)
|
|
20
|
+
case type.to_sym
|
|
21
|
+
when :Time
|
|
22
|
+
Time.parse(value)
|
|
23
|
+
when :Date
|
|
24
|
+
Date.parse(value)
|
|
25
|
+
when :String
|
|
26
|
+
value.to_s
|
|
27
|
+
when :Integer
|
|
28
|
+
value.to_i
|
|
29
|
+
when :Float
|
|
30
|
+
value.to_f
|
|
31
|
+
when :Boolean
|
|
32
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
33
|
+
true
|
|
34
|
+
else
|
|
35
|
+
false
|
|
36
|
+
end
|
|
37
|
+
when :Object
|
|
38
|
+
# generic object (usually a Hash), return directly
|
|
39
|
+
value
|
|
40
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
41
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
42
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
43
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
44
|
+
k_type = Regexp.last_match[:k_type]
|
|
45
|
+
v_type = Regexp.last_match[:v_type]
|
|
46
|
+
{}.tap do |hash|
|
|
47
|
+
value.each do |k, v|
|
|
48
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
else # model
|
|
52
|
+
# models (e.g. Pet) or oneOf
|
|
53
|
+
klass = FactPulse.const_get(type)
|
|
54
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Returns the string representation of the object
|
|
59
|
+
# @return [String] String presentation of the object
|
|
60
|
+
def to_s
|
|
61
|
+
to_hash.to_s
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
65
|
+
# @return [Hash] Returns the object in the form of hash
|
|
66
|
+
def to_body
|
|
67
|
+
to_hash
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Outputs non-array value in the form of hash
|
|
71
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
72
|
+
# @param [Object] value Any valid value
|
|
73
|
+
# @return [Hash] Returns the value in the form of hash
|
|
74
|
+
def _to_hash(value)
|
|
75
|
+
if value.is_a?(Array)
|
|
76
|
+
value.compact.map { |v| _to_hash(v) }
|
|
77
|
+
elsif value.is_a?(Hash)
|
|
78
|
+
{}.tap do |hash|
|
|
79
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
80
|
+
end
|
|
81
|
+
elsif value.respond_to? :to_hash
|
|
82
|
+
value.to_hash
|
|
83
|
+
else
|
|
84
|
+
value
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,319 @@
|
|
|
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 - 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) ### ✅ Factur-X - Validation - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) ### ✍️ 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 ### 📋 Flux 6 - Invoice Lifecycle (CDAR) - **CDAR Messages**: Acknowledgements, invoice statuses - **PPF Statuses**: REFUSED (210), PAID (212) ### 📊 Flux 10 - E-Reporting - **Tax Declarations**: International B2B, B2C - **Flow Types**: 10.1 (B2B transactions), 10.2 (B2B payments), 10.3 (B2C transactions), 10.4 (B2C payments) ### 📡 AFNOR PDP/PA (XP Z12-013) - **Flow Service**: Submit and search flows to PDPs - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user ### 🏛️ Chorus Pro - **Public Sector Invoicing**: Complete API for Chorus Pro ### ⏳ Async Tasks - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **Webhooks**: Automatic notifications when tasks complete ## 🔒 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://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://factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://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://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://factpulse.fr/api/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://factpulse.fr/documentation-api/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: contact@factpulse.fr
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.20.0-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module FactPulse
|
|
14
|
+
class Configuration
|
|
15
|
+
# Defines url scheme
|
|
16
|
+
attr_accessor :scheme
|
|
17
|
+
|
|
18
|
+
# Defines url host
|
|
19
|
+
attr_accessor :host
|
|
20
|
+
|
|
21
|
+
# Defines url base path
|
|
22
|
+
attr_accessor :base_path
|
|
23
|
+
|
|
24
|
+
# Define server configuration index
|
|
25
|
+
attr_accessor :server_index
|
|
26
|
+
|
|
27
|
+
# Define server operation configuration index
|
|
28
|
+
attr_accessor :server_operation_index
|
|
29
|
+
|
|
30
|
+
# Default server variables
|
|
31
|
+
attr_accessor :server_variables
|
|
32
|
+
|
|
33
|
+
# Default server operation variables
|
|
34
|
+
attr_accessor :server_operation_variables
|
|
35
|
+
|
|
36
|
+
# Defines API keys used with API Key authentications.
|
|
37
|
+
#
|
|
38
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
|
39
|
+
#
|
|
40
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
|
41
|
+
# config.api_key['api_key'] = 'xxx'
|
|
42
|
+
attr_accessor :api_key
|
|
43
|
+
|
|
44
|
+
# Defines API key prefixes used with API Key authentications.
|
|
45
|
+
#
|
|
46
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
|
47
|
+
#
|
|
48
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
|
49
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
|
50
|
+
attr_accessor :api_key_prefix
|
|
51
|
+
|
|
52
|
+
# Defines the username used with HTTP basic authentication.
|
|
53
|
+
#
|
|
54
|
+
# @return [String]
|
|
55
|
+
attr_accessor :username
|
|
56
|
+
|
|
57
|
+
# Defines the password used with HTTP basic authentication.
|
|
58
|
+
#
|
|
59
|
+
# @return [String]
|
|
60
|
+
attr_accessor :password
|
|
61
|
+
|
|
62
|
+
# Defines the access token (Bearer) used with OAuth2.
|
|
63
|
+
attr_accessor :access_token
|
|
64
|
+
|
|
65
|
+
# Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
|
|
66
|
+
# Overrides the access_token if set
|
|
67
|
+
# @return [Proc]
|
|
68
|
+
attr_accessor :access_token_getter
|
|
69
|
+
|
|
70
|
+
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
|
|
71
|
+
# HTTP responses with return type `File` will be returned as a stream of binary data.
|
|
72
|
+
# Default to false.
|
|
73
|
+
attr_accessor :return_binary_data
|
|
74
|
+
|
|
75
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
|
76
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
|
77
|
+
# Default to false.
|
|
78
|
+
#
|
|
79
|
+
# @return [true, false]
|
|
80
|
+
attr_accessor :debugging
|
|
81
|
+
|
|
82
|
+
# Set this to ignore operation servers for the API client. This is useful when you need to
|
|
83
|
+
# send requests to a different server than the one specified in the OpenAPI document.
|
|
84
|
+
# Will default to the base url defined in the spec but can be overridden by setting
|
|
85
|
+
# `scheme`, `host`, `base_path` directly.
|
|
86
|
+
# Default to false.
|
|
87
|
+
# @return [true, false]
|
|
88
|
+
attr_accessor :ignore_operation_servers
|
|
89
|
+
|
|
90
|
+
# Defines the logger used for debugging.
|
|
91
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
|
92
|
+
#
|
|
93
|
+
# @return [#debug]
|
|
94
|
+
attr_accessor :logger
|
|
95
|
+
|
|
96
|
+
# Defines the temporary folder to store downloaded files
|
|
97
|
+
# (for API endpoints that have file response).
|
|
98
|
+
# Default to use `Tempfile`.
|
|
99
|
+
#
|
|
100
|
+
# @return [String]
|
|
101
|
+
attr_accessor :temp_folder_path
|
|
102
|
+
|
|
103
|
+
# The time limit for HTTP request in seconds.
|
|
104
|
+
# Default to 0 (never times out).
|
|
105
|
+
attr_accessor :timeout
|
|
106
|
+
|
|
107
|
+
# Set this to false to skip client side validation in the operation.
|
|
108
|
+
# Default to true.
|
|
109
|
+
# @return [true, false]
|
|
110
|
+
attr_accessor :client_side_validation
|
|
111
|
+
|
|
112
|
+
### TLS/SSL setting
|
|
113
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
|
114
|
+
# Default to true.
|
|
115
|
+
#
|
|
116
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
|
117
|
+
#
|
|
118
|
+
# @return [true, false]
|
|
119
|
+
attr_accessor :verify_ssl
|
|
120
|
+
|
|
121
|
+
### TLS/SSL setting
|
|
122
|
+
# Set this to false to skip verifying SSL host name
|
|
123
|
+
# Default to true.
|
|
124
|
+
#
|
|
125
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
|
126
|
+
#
|
|
127
|
+
# @return [true, false]
|
|
128
|
+
attr_accessor :verify_ssl_host
|
|
129
|
+
|
|
130
|
+
### TLS/SSL setting
|
|
131
|
+
# Set this to customize the certificate file to verify the peer.
|
|
132
|
+
#
|
|
133
|
+
# @return [String] the path to the certificate file
|
|
134
|
+
#
|
|
135
|
+
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
|
136
|
+
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
|
137
|
+
attr_accessor :ssl_ca_cert
|
|
138
|
+
|
|
139
|
+
### TLS/SSL setting
|
|
140
|
+
# Client certificate file (for client certificate)
|
|
141
|
+
attr_accessor :cert_file
|
|
142
|
+
|
|
143
|
+
### TLS/SSL setting
|
|
144
|
+
# Client private key file (for client certificate)
|
|
145
|
+
attr_accessor :key_file
|
|
146
|
+
|
|
147
|
+
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
|
148
|
+
# Default to nil.
|
|
149
|
+
#
|
|
150
|
+
# @see The params_encoding option of Ethon. Related source code:
|
|
151
|
+
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
|
152
|
+
attr_accessor :params_encoding
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
attr_accessor :inject_format
|
|
156
|
+
|
|
157
|
+
attr_accessor :force_ending_format
|
|
158
|
+
|
|
159
|
+
def initialize
|
|
160
|
+
@scheme = 'https'
|
|
161
|
+
@host = 'factpulse.fr'
|
|
162
|
+
@base_path = ''
|
|
163
|
+
@server_index = nil
|
|
164
|
+
@server_operation_index = {}
|
|
165
|
+
@server_variables = {}
|
|
166
|
+
@server_operation_variables = {}
|
|
167
|
+
@api_key = {}
|
|
168
|
+
@api_key_prefix = {}
|
|
169
|
+
@client_side_validation = true
|
|
170
|
+
@verify_ssl = true
|
|
171
|
+
@verify_ssl_host = true
|
|
172
|
+
@cert_file = nil
|
|
173
|
+
@key_file = nil
|
|
174
|
+
@timeout = 0
|
|
175
|
+
@params_encoding = nil
|
|
176
|
+
@debugging = false
|
|
177
|
+
@ignore_operation_servers = false
|
|
178
|
+
@inject_format = false
|
|
179
|
+
@force_ending_format = false
|
|
180
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
|
181
|
+
|
|
182
|
+
yield(self) if block_given?
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# The default Configuration object.
|
|
186
|
+
def self.default
|
|
187
|
+
@@default ||= Configuration.new
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def configure
|
|
191
|
+
yield(self) if block_given?
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def scheme=(scheme)
|
|
195
|
+
# remove :// from scheme
|
|
196
|
+
@scheme = scheme.sub(/:\/\//, '')
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def host=(host)
|
|
200
|
+
# remove http(s):// and anything after a slash
|
|
201
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
def base_path=(base_path)
|
|
205
|
+
# Add leading and trailing slashes to base_path
|
|
206
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
|
207
|
+
@base_path = '' if @base_path == '/'
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Returns base URL for specified operation based on server settings
|
|
211
|
+
def base_url(operation = nil)
|
|
212
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
|
|
213
|
+
if operation_server_settings.key?(operation) then
|
|
214
|
+
index = server_operation_index.fetch(operation, server_index)
|
|
215
|
+
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
|
216
|
+
else
|
|
217
|
+
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Gets API key (with prefix if set).
|
|
222
|
+
# @param [String] param_name the parameter name of API key auth
|
|
223
|
+
def api_key_with_prefix(param_name, param_alias = nil)
|
|
224
|
+
key = @api_key[param_name]
|
|
225
|
+
key = @api_key.fetch(param_alias, key) unless param_alias.nil?
|
|
226
|
+
if @api_key_prefix[param_name]
|
|
227
|
+
"#{@api_key_prefix[param_name]} #{key}"
|
|
228
|
+
else
|
|
229
|
+
key
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# Gets access_token using access_token_getter or uses the static access_token
|
|
234
|
+
def access_token_with_refresh
|
|
235
|
+
return access_token if access_token_getter.nil?
|
|
236
|
+
access_token_getter.call
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Gets Basic Auth token string
|
|
240
|
+
def basic_auth_token
|
|
241
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Returns Auth Settings hash for api client.
|
|
245
|
+
def auth_settings
|
|
246
|
+
{
|
|
247
|
+
'HTTPBearer' =>
|
|
248
|
+
{
|
|
249
|
+
type: 'bearer',
|
|
250
|
+
in: 'header',
|
|
251
|
+
key: 'Authorization',
|
|
252
|
+
value: "Bearer #{access_token_with_refresh}"
|
|
253
|
+
},
|
|
254
|
+
'APIKeyHeader' =>
|
|
255
|
+
{
|
|
256
|
+
type: 'api_key',
|
|
257
|
+
in: 'header',
|
|
258
|
+
key: 'X-API-Key',
|
|
259
|
+
value: api_key_with_prefix('X-API-Key')
|
|
260
|
+
},
|
|
261
|
+
}
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Returns an array of Server setting
|
|
265
|
+
def server_settings
|
|
266
|
+
[
|
|
267
|
+
{
|
|
268
|
+
url: "https://factpulse.fr",
|
|
269
|
+
description: "Production",
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
url: "http://localhost:8001",
|
|
273
|
+
description: "Local development",
|
|
274
|
+
}
|
|
275
|
+
]
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
def operation_server_settings
|
|
279
|
+
{
|
|
280
|
+
}
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
# Returns URL based on server settings
|
|
284
|
+
#
|
|
285
|
+
# @param index array index of the server settings
|
|
286
|
+
# @param variables hash of variable and the corresponding value
|
|
287
|
+
def server_url(index, variables = {}, servers = nil)
|
|
288
|
+
servers = server_settings if servers == nil
|
|
289
|
+
|
|
290
|
+
# check array index out of bound
|
|
291
|
+
if (index.nil? || index < 0 || index >= servers.size)
|
|
292
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
server = servers[index]
|
|
296
|
+
url = server[:url]
|
|
297
|
+
|
|
298
|
+
return url unless server.key? :variables
|
|
299
|
+
|
|
300
|
+
# go through variable and assign a value
|
|
301
|
+
server[:variables].each do |name, variable|
|
|
302
|
+
if variables.key?(name)
|
|
303
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
|
304
|
+
url.gsub! "{" + name.to_s + "}", variables[name]
|
|
305
|
+
else
|
|
306
|
+
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
|
307
|
+
end
|
|
308
|
+
else
|
|
309
|
+
# use default value
|
|
310
|
+
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
url
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
end
|
|
319
|
+
end
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# FactPulse SDK - Thin HTTP wrapper with auto-polling.
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# client = FactPulseClient.new('email', 'password', 'client_uid')
|
|
7
|
+
#
|
|
8
|
+
# # POST /api/v1/processing/invoices/submit-complete-async
|
|
9
|
+
# result = client.post('processing/invoices/submit-complete-async',
|
|
10
|
+
# invoiceData: {...},
|
|
11
|
+
# destination: { type: 'afnor' }
|
|
12
|
+
# )
|
|
13
|
+
# pdf_bytes = result['content'] # auto-decoded, auto-polled
|
|
14
|
+
|
|
15
|
+
require 'net/http'
|
|
16
|
+
require 'json'
|
|
17
|
+
require 'base64'
|
|
18
|
+
require 'uri'
|
|
19
|
+
|
|
20
|
+
module FactPulse
|
|
21
|
+
class Error < StandardError
|
|
22
|
+
attr_reader :status_code, :details
|
|
23
|
+
|
|
24
|
+
def initialize(message, status_code: nil, details: [])
|
|
25
|
+
super(message)
|
|
26
|
+
@status_code = status_code
|
|
27
|
+
@details = details
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class Client
|
|
32
|
+
DEFAULT_API_URL = 'https://factpulse.fr'
|
|
33
|
+
|
|
34
|
+
def initialize(email, password, client_uid, api_url: DEFAULT_API_URL, timeout: 60, polling_timeout: 120)
|
|
35
|
+
@email = email
|
|
36
|
+
@password = password
|
|
37
|
+
@client_uid = client_uid
|
|
38
|
+
@api_url = api_url.chomp('/')
|
|
39
|
+
@timeout = timeout
|
|
40
|
+
@polling_timeout = polling_timeout
|
|
41
|
+
@token = nil
|
|
42
|
+
@token_expires_at = 0
|
|
43
|
+
@token_mutex = Mutex.new
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# POST request to /api/v1/{path} (JSON body)
|
|
47
|
+
def post(path, **data)
|
|
48
|
+
request('POST', path, data, retry_auth: true)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# POST request with multipart/form-data (for file uploads)
|
|
52
|
+
def post_multipart(path, data: {}, files: {})
|
|
53
|
+
request_multipart(path, data, files, retry_auth: true)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# GET request to /api/v1/{path}
|
|
57
|
+
def get(path, **params)
|
|
58
|
+
request('GET', path, params, retry_auth: true)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
private
|
|
62
|
+
|
|
63
|
+
def request(method, path, data, retry_auth:)
|
|
64
|
+
ensure_auth
|
|
65
|
+
url = "#{@api_url}/api/v1/#{path}"
|
|
66
|
+
uri = URI(url)
|
|
67
|
+
|
|
68
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
69
|
+
http.use_ssl = uri.scheme == 'https'
|
|
70
|
+
http.read_timeout = @timeout
|
|
71
|
+
|
|
72
|
+
if method == 'POST'
|
|
73
|
+
req = Net::HTTP::Post.new(uri)
|
|
74
|
+
req['Content-Type'] = 'application/json'
|
|
75
|
+
req.body = JSON.generate(data)
|
|
76
|
+
else
|
|
77
|
+
uri.query = URI.encode_www_form(data) unless data.empty?
|
|
78
|
+
req = Net::HTTP::Get.new(uri)
|
|
79
|
+
end
|
|
80
|
+
req['Authorization'] = "Bearer #{@token}"
|
|
81
|
+
|
|
82
|
+
response = http.request(req)
|
|
83
|
+
|
|
84
|
+
if response.code == '401' && retry_auth
|
|
85
|
+
invalidate_token
|
|
86
|
+
return request(method, path, data, retry_auth: false)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
result = parse_response(response)
|
|
90
|
+
|
|
91
|
+
# Auto-poll: support both taskId (camelCase) and task_id (snake_case)
|
|
92
|
+
if result.is_a?(Hash)
|
|
93
|
+
task_id = result['taskId'] || result['task_id']
|
|
94
|
+
result = poll(task_id) if task_id
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Auto-decode: support both content_b64 and contentB64
|
|
98
|
+
if result.is_a?(Hash)
|
|
99
|
+
b64_content = result.delete('content_b64') || result.delete('contentB64')
|
|
100
|
+
result['content'] = Base64.decode64(b64_content) if b64_content
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
result
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def request_multipart(path, data, files, retry_auth:)
|
|
107
|
+
ensure_auth
|
|
108
|
+
url = "#{@api_url}/api/v1/#{path}"
|
|
109
|
+
uri = URI(url)
|
|
110
|
+
|
|
111
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
112
|
+
http.use_ssl = uri.scheme == 'https'
|
|
113
|
+
http.read_timeout = @timeout
|
|
114
|
+
|
|
115
|
+
# Build multipart body
|
|
116
|
+
boundary = "----RubyFormBoundary#{rand(1_000_000)}"
|
|
117
|
+
body = []
|
|
118
|
+
|
|
119
|
+
data.each do |key, value|
|
|
120
|
+
body << "--#{boundary}\r\n"
|
|
121
|
+
body << "Content-Disposition: form-data; name=\"#{key}\"\r\n\r\n"
|
|
122
|
+
body << "#{value}\r\n"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
files.each do |key, content|
|
|
126
|
+
body << "--#{boundary}\r\n"
|
|
127
|
+
body << "Content-Disposition: form-data; name=\"#{key}\"; filename=\"#{key}\"\r\n"
|
|
128
|
+
body << "Content-Type: application/octet-stream\r\n\r\n"
|
|
129
|
+
body << content
|
|
130
|
+
body << "\r\n"
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
body << "--#{boundary}--\r\n"
|
|
134
|
+
|
|
135
|
+
req = Net::HTTP::Post.new(uri)
|
|
136
|
+
req['Authorization'] = "Bearer #{@token}"
|
|
137
|
+
req['Content-Type'] = "multipart/form-data; boundary=#{boundary}"
|
|
138
|
+
req.body = body.join
|
|
139
|
+
|
|
140
|
+
response = http.request(req)
|
|
141
|
+
|
|
142
|
+
if response.code == '401' && retry_auth
|
|
143
|
+
invalidate_token
|
|
144
|
+
return request_multipart(path, data, files, retry_auth: false)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
result = parse_response(response)
|
|
148
|
+
|
|
149
|
+
# Auto-poll
|
|
150
|
+
if result.is_a?(Hash)
|
|
151
|
+
task_id = result['taskId'] || result['task_id']
|
|
152
|
+
result = poll(task_id) if task_id
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Auto-decode
|
|
156
|
+
if result.is_a?(Hash)
|
|
157
|
+
b64_content = result.delete('content_b64') || result.delete('contentB64')
|
|
158
|
+
result['content'] = Base64.decode64(b64_content) if b64_content
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
result
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def parse_response(response)
|
|
165
|
+
body = response.body
|
|
166
|
+
data = body && !body.empty? ? JSON.parse(body) : {}
|
|
167
|
+
|
|
168
|
+
return data if response.is_a?(Net::HTTPSuccess)
|
|
169
|
+
|
|
170
|
+
msg = "HTTP #{response.code}"
|
|
171
|
+
details = []
|
|
172
|
+
|
|
173
|
+
if data.is_a?(Hash)
|
|
174
|
+
if data['detail'].is_a?(Array)
|
|
175
|
+
details = data['detail']
|
|
176
|
+
msgs = data['detail'].map do |e|
|
|
177
|
+
loc = e['loc'] || []
|
|
178
|
+
"#{loc.last || '?'}: #{e['msg'] || '?'}"
|
|
179
|
+
end
|
|
180
|
+
msg = "Validation error: #{msgs.join('; ')}"
|
|
181
|
+
elsif data['detail'].is_a?(String)
|
|
182
|
+
msg = data['detail']
|
|
183
|
+
elsif data['errorMessage'].is_a?(String)
|
|
184
|
+
msg = data['errorMessage']
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
raise Error.new(msg, status_code: response.code.to_i, details: details)
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def poll(task_id)
|
|
192
|
+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
193
|
+
interval = 1.0
|
|
194
|
+
|
|
195
|
+
loop do
|
|
196
|
+
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
|
|
197
|
+
if elapsed >= @polling_timeout
|
|
198
|
+
raise Error.new("Polling timeout after #{@polling_timeout}s for task #{task_id}")
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
ensure_auth
|
|
202
|
+
uri = URI("#{@api_url}/api/v1/processing/tasks/#{task_id}/status")
|
|
203
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
204
|
+
http.use_ssl = uri.scheme == 'https'
|
|
205
|
+
http.read_timeout = @timeout
|
|
206
|
+
|
|
207
|
+
req = Net::HTTP::Get.new(uri)
|
|
208
|
+
req['Authorization'] = "Bearer #{@token}"
|
|
209
|
+
response = http.request(req)
|
|
210
|
+
|
|
211
|
+
if response.code == '401'
|
|
212
|
+
invalidate_token
|
|
213
|
+
next
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
data = parse_response(response)
|
|
217
|
+
status = data['status']
|
|
218
|
+
|
|
219
|
+
if status == 'SUCCESS'
|
|
220
|
+
result = data['result'] || {}
|
|
221
|
+
# Support both content_b64 and contentB64
|
|
222
|
+
b64_content = result.delete('content_b64') || result.delete('contentB64')
|
|
223
|
+
result['content'] = Base64.decode64(b64_content) if b64_content
|
|
224
|
+
return result
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
if status == 'FAILURE'
|
|
228
|
+
res = data['result'] || {}
|
|
229
|
+
raise Error.new(res['errorMessage'] || 'Task failed', details: res['details'] || [])
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
sleep([interval, @polling_timeout - elapsed].min)
|
|
233
|
+
interval = [interval * 1.5, 10].min
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
def ensure_auth
|
|
238
|
+
@token_mutex.synchronize do
|
|
239
|
+
if Process.clock_gettime(Process::CLOCK_MONOTONIC) >= @token_expires_at
|
|
240
|
+
refresh_token
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def refresh_token
|
|
246
|
+
uri = URI("#{@api_url}/api/token/")
|
|
247
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
248
|
+
http.use_ssl = uri.scheme == 'https'
|
|
249
|
+
http.read_timeout = @timeout
|
|
250
|
+
|
|
251
|
+
req = Net::HTTP::Post.new(uri)
|
|
252
|
+
req['Content-Type'] = 'application/json'
|
|
253
|
+
req.body = JSON.generate(username: @email, password: @password, client_uid: @client_uid)
|
|
254
|
+
|
|
255
|
+
response = http.request(req)
|
|
256
|
+
|
|
257
|
+
unless response.is_a?(Net::HTTPSuccess)
|
|
258
|
+
raise Error.new("Authentication failed: HTTP #{response.code}", status_code: response.code.to_i)
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
data = JSON.parse(response.body)
|
|
262
|
+
@token = data['access'] || raise(Error.new('Invalid auth response'))
|
|
263
|
+
@token_expires_at = Process.clock_gettime(Process::CLOCK_MONOTONIC) + 28 * 60
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
def invalidate_token
|
|
267
|
+
@token_mutex.synchronize do
|
|
268
|
+
@token_expires_at = 0
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
end
|