@pronesoft-rd/ecf-sdk
v0.0.7
Published
OpenAPI client for @pronesoft-rd/ecf-sdk
Readme
@pronesoft-rd/[email protected]
A TypeScript SDK client for the api.ecf.sandbox.pronesoft.com API.
Installation
npm install @pronesoft-rd/ecf-sdkRecommended usage
This SDK includes an IntegrationClient that manages:
- OAuth token acquisition
- token cache
- automatic refresh on 401
The recommended pattern is:
- Create one IntegrationClient for the app or integration.
- When the ERP user logs in, resolve the active tenant.
- Create a tenant session with startSession(tenantId).
- Reuse session.getClient() while that tenant stays active.
import { Environment, IntegrationClient } from "@pronesoft-rd/ecf-sdk";
const integrationClient = new IntegrationClient({
baseUrl: "https://ecf.sandbox.pronesoft.com",
clientId: process.env.PRONESOFT_CLIENT_ID!,
clientSecret: process.env.PRONESOFT_CLIENT_SECRET!,
});
const session = integrationClient.startSession("130862346");
const client = session.getClient();
const response = await client.ecfSubmission.submitEcf({
environment: Environment.TesteCF,
electronicDocument: payload,
});If the user changes company during the ERP session:
session.setCurrentTenant("101234567");
const client = session.getClient();If you want to work without a session wrapper, you can also create a tenant-scoped client directly:
const client = integrationClient.forTenant("130862346");Documentation
API Endpoints
All URIs are relative to https://api.ecf.sandbox.pronesoft.com/api/v1
| Class | Method | HTTP request | Description | | --------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------ | | AssociatedCompaniesApi | createAssociatedCompany | POST /associated-companies | Create associated company / branch | | AssociatedCompaniesApi | deleteAssociatedCompany | DELETE /associated-companies/{companyId} | Delete associated company | | AssociatedCompaniesApi | getCompanyDocumentMetrics | GET /associated-companies/{companyId}/documents-metrics | Get company document metrics | | AssociatedCompaniesApi | getCompanyMetrics | GET /associated-companies/{companyId}/metrics | Get company metrics | | AssociatedCompaniesApi | listAssociatedCompanies | GET /associated-companies | List associated companies / branches | | AssociatedCompaniesApi | updateAssociatedCompany | PUT /associated-companies/{companyId} | Update associated company | | AuthenticationApi | getAccessToken | POST /oauth/token | Get access token (OAuth 2.0) | | AutomatedCertificationApi | downloadCertification | GET /dgii-ecf/automated-certification/{id}/download | Download certification ZIP | | AutomatedCertificationApi | getCertificationStatus | GET /dgii-ecf/automated-certification/{id}/status | Get certification process status | | AutomatedCertificationApi | listCertificationNiches | GET /dgii-ecf/automated-certification/niches | List certification niches | | AutomatedCertificationApi | startCertification | POST /dgii-ecf/automated-certification/start | Start certification process | | CommercialApprovalsApi | listApprovals | GET /documents/approvals/all | List commercial approvals | | DigitalCertificatesApi | uploadCertificate | POST /{rnc}/certificates | Upload digital certificate (P12/PFX) | | DocumentsReceivedApi | getReceivedDocumentStats | GET /documents/received/stats/summary | Get received documents statistics | | DocumentsReceivedApi | listReceivedDocuments | GET /documents/received/all | List received documents | | DocumentsSentApi | downloadDocument | GET /documents/download | Download document XML | | DocumentsSentApi | getDocument | GET /documents/{id} | Get document details | | DocumentsSentApi | getDocumentStats | GET /documents/stats/summary | Get document statistics | | DocumentsSentApi | listSentDocuments | GET /documents/sent | List sent documents | | ECFSubmissionApi | getEcfHistory | GET /{environment}/ecf/responses/history | Get submission history (last 50 documents) | | ECFSubmissionApi | getEcfStats | GET /{environment}/ecf/responses/stats | Get submission statistics (last 30 days) | | ECFSubmissionApi | getEcfStatus | GET /{environment}/ecf/status/{trackId} | Get document status by trackId | | ECFSubmissionApi | submitEcf | POST /{environment}/ecf/submit | Submit e-CF document to DGII | | ReportsApi | export606 | GET /dgii/606/export | Export Format 606 (Purchases) | | ReportsApi | exportSentDocuments | GET /dgii/sent/export | Export sent documents report | | TaxSequencesApi | createTaxSequence | POST /tax-sequences/create | Create new tax sequence | | TaxSequencesApi | getNextNumber | GET /tax-sequences/next | Get next available fiscal number | | TaxSequencesApi | listTaxSequences | GET /tax-sequences | List tax sequences | | TaxSequencesApi | updateTaxSequence | PATCH /tax-sequences/update | Update tax sequence | | TaxSequencesApi | voidTaxSequence | POST /tax-sequences/void | Void a range of fiscal numbers | | WebhookConfigurationApi | getWebhook | GET /{rnc}/webhooks/{webhookId} | Get webhook details | | WebhookConfigurationApi | getWebhookStats | GET /{rnc}/webhooks/{webhookId}/stats | Get webhook delivery statistics | | WebhookConfigurationApi | listWebhooks | GET /{rnc}/webhooks | List webhook configurations |
Models
- AccountType
- AdditionalInfo
- AdditionalTax
- AlternativeCurrency
- ApprovalItem
- ApprovalListResponse
- AssociatedCompany
- AssociatedCompanySubscription
- AssociatedCompanySubscriptionPlan
- BillingIndicator
- Buyer
- CertificationNiche
- CertificationNicheNicheItemsInner
- CertificationStatus
- CompanyDocumentMetrics
- CompanyDocumentMetricsGroupByStatusInner
- CompanyDocumentMetricsGroupByStatusInnerCount
- CompanyDocumentMetricsMainBusiness
- CompanyDocumentMetricsTotals
- CompanyMetrics
- CompanyMetricsDocumentsStatus
- CreateAssociatedCompany201Response
- CreateTaxSequence201Response
- CreateTaxSequenceRequest
- DeleteAssociatedCompany200Response
- DgiiMessage
- DiscountOrSurcharge
- DocumentStatsResponse
- DocumentStatus
- EcfHistoryItem
- EcfStatsResponse
- EcfStatusResponse
- EcfSubmissionResponse
- EcfSubmissionResponseDgiiResponse
- ElectronicDocument
- Environment
- ErrorResponse
- GetNextNumber200Response
- GetNextNumber200ResponseData
- InvoiceType
- InvoiceTypeSequence
- Item
- ItemAdditionalTax
- ItemAlternativeCurrency
- ItemAmount
- ItemCodesInner
- ItemDiscountInner
- ItemMiningInfo
- ItemQuantity
- ItemSurchargeInner
- ItemUnitPrice
- ItemWithheldITBISAmount
- ListTaxSequences200Response
- OAuthTokenRequest
- OAuthTokenResponse
- Page
- PaginationMeta
- PaymentForm
- PaymentMethod
- PrintFormat
- ProcessingLog
- RateLimitErrorResponse
- ReceivedDocument
- ReceivedDocumentListResponse
- ReceivedDocumentStatsResponse
- ReferenceInfo
- SentDocumentDetail
- SentDocumentListResponse
- SentDocumentSummary
- SentDocumentSummaryBusiness
- StartCertification200Response
- StartCertificationRequest
- Subquantity
- Subtotal
- TaxSequence
- TaxSequenceCreated
- Totals
- TotalsItbisRate1
- TotalsItbisRate2
- TotalsItbisRate3
- TotalsTotalAmount
- Transport
- UpdateTaxSequenceRequest
- UploadCertificateResponse
- VoidTaxSequence200Response
- VoidTaxSequence200ResponseData
- VoidTaxSequenceRequest
- WebhookConfigDetail
- WebhookConfigResponse
- WebhookEventType
- WebhookNotificationPayload
- WebhookStats
- WebhookStatsStats
Authorization
Authentication schemes defined for the API:
bearerAuth
- Type: HTTP Bearer Token authentication (JWT)
oauth2 application
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes:
business:read: Read company data.business:create: Create a new company.business:update: Update company data.members:read: View team members.members:invite: Invite new members.members:revoke: Revoke member access.certificates:read: View digital certificates.certificates:upload: Upload new certificates.certificates:update: Update existing certificates.documents:read: List and view document details.documents:create: Create drafts or internal documents.documents:send: Submit e-CF to the DGII.documents:receive: Receive e-CF from third parties.documents:update: Modify document metadata.approvals:read: View approval statuses.approvals:commercial: Perform commercial approvals or rejections.sequences:read: View NCF/e-NCF ranges.sequences:create: Request or add new sequences.sequences:update: Modify sequence configurations.sequences:cancel: Cancel unused sequences.business_info:read: Access dashboard statistics and metrics.certification:read: View DGII certification progress.certification:write: Execute automated DGII certification tests.reports:read: Generate and export reports (e.g. format 606).
About
This TypeScript SDK client supports the Fetch API and is automatically generated by the OpenAPI Generator project:
- API version:
1.2.0 - Package version:
0.0.6 - Generator version:
7.21.0 - Build package:
org.openapitools.codegen.languages.TypeScriptFetchClientCodegen
The generated npm module supports the following:
- Environments
- Node.js
- Webpack
- Browserify
- Language levels
- ES5 - you must have a Promises/A+ library installed
- ES6
- Module systems
- CommonJS
- ES6 module system
For more information, please visit https://pronesoft.com
Development
Building
To build the TypeScript source code, you need to have Node.js and npm installed. After cloning the repository, navigate to the project directory and run:
npm install
npm run buildPublishing
Once you've built the package, you can publish it to npm:
npm publish