factuplan 0.5.0 → 0.7.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.
- package/dist/index.d.mts +41 -3
- package/dist/index.d.ts +41 -3
- package/dist/index.js +8 -1
- package/dist/index.mjs +8 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -103,6 +103,13 @@ interface InvoiceItem {
|
|
|
103
103
|
/** Tax rate override for IVA_RATE. Valid: 0, 5, 8, 12, 14, 15. Default: 15 */
|
|
104
104
|
tax?: number;
|
|
105
105
|
}
|
|
106
|
+
type PaymentTimeUnit = 'dias' | 'meses' | 'anios';
|
|
107
|
+
interface InvoicePayment {
|
|
108
|
+
method: string;
|
|
109
|
+
amount: number;
|
|
110
|
+
term?: number;
|
|
111
|
+
timeUnit?: PaymentTimeUnit;
|
|
112
|
+
}
|
|
106
113
|
interface CreateInvoiceInput {
|
|
107
114
|
/** UUID of the emission point. Optional if using establishment + emissionPoint codes, or if the taxpayer has a single active emission point. */
|
|
108
115
|
emissionPointId?: string;
|
|
@@ -112,7 +119,8 @@ interface CreateInvoiceInput {
|
|
|
112
119
|
emissionPoint?: string;
|
|
113
120
|
customer: InvoiceCustomer;
|
|
114
121
|
items: InvoiceItem[];
|
|
115
|
-
|
|
122
|
+
/** List of payment methods for multi-payment support. */
|
|
123
|
+
payments?: InvoicePayment[];
|
|
116
124
|
additionalInfo?: Record<string, string>;
|
|
117
125
|
}
|
|
118
126
|
interface ImportByAccessKeyInput {
|
|
@@ -134,8 +142,13 @@ interface InvoiceStatus {
|
|
|
134
142
|
authorizationDate?: string;
|
|
135
143
|
}
|
|
136
144
|
interface DownloadUrlResponse {
|
|
145
|
+
/** URL pre-firmada de S3 — expira en 5 minutos */
|
|
137
146
|
url: string;
|
|
138
|
-
|
|
147
|
+
/**
|
|
148
|
+
* URL permanente de visualización del comprobante en Factuplan.
|
|
149
|
+
* No expira. Formato: https://app.factuplan.com.ec/verify?clave={accessKey}
|
|
150
|
+
*/
|
|
151
|
+
previewUrl?: string;
|
|
139
152
|
}
|
|
140
153
|
interface SignAndAuthorizeInput {
|
|
141
154
|
/** Unsigned XML string */
|
|
@@ -205,11 +218,35 @@ interface WebhookReceiptData {
|
|
|
205
218
|
customerIdentification: string;
|
|
206
219
|
}
|
|
207
220
|
interface FactuplanOptions {
|
|
208
|
-
/** Base URL of the API (default: https://api.factuplan.com/
|
|
221
|
+
/** Base URL of the API (default: https://api-rest.factuplan.com.ec/v1) */
|
|
209
222
|
baseUrl?: string;
|
|
210
223
|
/** Request timeout in milliseconds (default: 30000) */
|
|
211
224
|
timeout?: number;
|
|
212
225
|
}
|
|
226
|
+
interface QueryExternalByAccessKeyInput {
|
|
227
|
+
/** Clave de acceso de 49 dígitos del comprobante en el SRI */
|
|
228
|
+
accessKey: string;
|
|
229
|
+
/**
|
|
230
|
+
* Si es true (por defecto), guarda el contribuyente, documento, XML y PDF.
|
|
231
|
+
* Si es false, solo verifica el comprobante y descuenta el contador sin guardar registros.
|
|
232
|
+
* @default true
|
|
233
|
+
*/
|
|
234
|
+
save?: boolean;
|
|
235
|
+
}
|
|
236
|
+
interface QueryExternalByAccessKeyResponse {
|
|
237
|
+
/** ID del comprobante guardado en Factuplan; null cuando save=false */
|
|
238
|
+
id: string | null;
|
|
239
|
+
/** Clave de acceso de 49 dígitos */
|
|
240
|
+
accessKey: string;
|
|
241
|
+
/** Número secuencial del comprobante (ej: '000000001') */
|
|
242
|
+
sequential: string;
|
|
243
|
+
/** Estado del comprobante ('AUTHORIZED') */
|
|
244
|
+
status: string;
|
|
245
|
+
/** Total del comprobante */
|
|
246
|
+
total: number;
|
|
247
|
+
/** XML completo autorizado del SRI (envelope <autorizacion>) en base64 */
|
|
248
|
+
xmlBase64: string;
|
|
249
|
+
}
|
|
213
250
|
|
|
214
251
|
type Requester$3 = (method: string, path: string, body?: unknown, params?: Record<string, string | number | undefined>) => Promise<unknown>;
|
|
215
252
|
declare class CustomersResource {
|
|
@@ -236,6 +273,7 @@ declare class InvoicesResource {
|
|
|
236
273
|
downloadXml(id: string): Promise<DownloadUrlResponse>;
|
|
237
274
|
downloadPdf(id: string): Promise<DownloadUrlResponse>;
|
|
238
275
|
importByAccessKey(input: ImportByAccessKeyInput): Promise<Invoice>;
|
|
276
|
+
queryExternalByAccessKey(input: QueryExternalByAccessKeyInput): Promise<QueryExternalByAccessKeyResponse>;
|
|
239
277
|
}
|
|
240
278
|
|
|
241
279
|
type Requester$1 = (method: string, path: string, body?: unknown, params?: Record<string, string | number | undefined>) => Promise<unknown>;
|
package/dist/index.d.ts
CHANGED
|
@@ -103,6 +103,13 @@ interface InvoiceItem {
|
|
|
103
103
|
/** Tax rate override for IVA_RATE. Valid: 0, 5, 8, 12, 14, 15. Default: 15 */
|
|
104
104
|
tax?: number;
|
|
105
105
|
}
|
|
106
|
+
type PaymentTimeUnit = 'dias' | 'meses' | 'anios';
|
|
107
|
+
interface InvoicePayment {
|
|
108
|
+
method: string;
|
|
109
|
+
amount: number;
|
|
110
|
+
term?: number;
|
|
111
|
+
timeUnit?: PaymentTimeUnit;
|
|
112
|
+
}
|
|
106
113
|
interface CreateInvoiceInput {
|
|
107
114
|
/** UUID of the emission point. Optional if using establishment + emissionPoint codes, or if the taxpayer has a single active emission point. */
|
|
108
115
|
emissionPointId?: string;
|
|
@@ -112,7 +119,8 @@ interface CreateInvoiceInput {
|
|
|
112
119
|
emissionPoint?: string;
|
|
113
120
|
customer: InvoiceCustomer;
|
|
114
121
|
items: InvoiceItem[];
|
|
115
|
-
|
|
122
|
+
/** List of payment methods for multi-payment support. */
|
|
123
|
+
payments?: InvoicePayment[];
|
|
116
124
|
additionalInfo?: Record<string, string>;
|
|
117
125
|
}
|
|
118
126
|
interface ImportByAccessKeyInput {
|
|
@@ -134,8 +142,13 @@ interface InvoiceStatus {
|
|
|
134
142
|
authorizationDate?: string;
|
|
135
143
|
}
|
|
136
144
|
interface DownloadUrlResponse {
|
|
145
|
+
/** URL pre-firmada de S3 — expira en 5 minutos */
|
|
137
146
|
url: string;
|
|
138
|
-
|
|
147
|
+
/**
|
|
148
|
+
* URL permanente de visualización del comprobante en Factuplan.
|
|
149
|
+
* No expira. Formato: https://app.factuplan.com.ec/verify?clave={accessKey}
|
|
150
|
+
*/
|
|
151
|
+
previewUrl?: string;
|
|
139
152
|
}
|
|
140
153
|
interface SignAndAuthorizeInput {
|
|
141
154
|
/** Unsigned XML string */
|
|
@@ -205,11 +218,35 @@ interface WebhookReceiptData {
|
|
|
205
218
|
customerIdentification: string;
|
|
206
219
|
}
|
|
207
220
|
interface FactuplanOptions {
|
|
208
|
-
/** Base URL of the API (default: https://api.factuplan.com/
|
|
221
|
+
/** Base URL of the API (default: https://api-rest.factuplan.com.ec/v1) */
|
|
209
222
|
baseUrl?: string;
|
|
210
223
|
/** Request timeout in milliseconds (default: 30000) */
|
|
211
224
|
timeout?: number;
|
|
212
225
|
}
|
|
226
|
+
interface QueryExternalByAccessKeyInput {
|
|
227
|
+
/** Clave de acceso de 49 dígitos del comprobante en el SRI */
|
|
228
|
+
accessKey: string;
|
|
229
|
+
/**
|
|
230
|
+
* Si es true (por defecto), guarda el contribuyente, documento, XML y PDF.
|
|
231
|
+
* Si es false, solo verifica el comprobante y descuenta el contador sin guardar registros.
|
|
232
|
+
* @default true
|
|
233
|
+
*/
|
|
234
|
+
save?: boolean;
|
|
235
|
+
}
|
|
236
|
+
interface QueryExternalByAccessKeyResponse {
|
|
237
|
+
/** ID del comprobante guardado en Factuplan; null cuando save=false */
|
|
238
|
+
id: string | null;
|
|
239
|
+
/** Clave de acceso de 49 dígitos */
|
|
240
|
+
accessKey: string;
|
|
241
|
+
/** Número secuencial del comprobante (ej: '000000001') */
|
|
242
|
+
sequential: string;
|
|
243
|
+
/** Estado del comprobante ('AUTHORIZED') */
|
|
244
|
+
status: string;
|
|
245
|
+
/** Total del comprobante */
|
|
246
|
+
total: number;
|
|
247
|
+
/** XML completo autorizado del SRI (envelope <autorizacion>) en base64 */
|
|
248
|
+
xmlBase64: string;
|
|
249
|
+
}
|
|
213
250
|
|
|
214
251
|
type Requester$3 = (method: string, path: string, body?: unknown, params?: Record<string, string | number | undefined>) => Promise<unknown>;
|
|
215
252
|
declare class CustomersResource {
|
|
@@ -236,6 +273,7 @@ declare class InvoicesResource {
|
|
|
236
273
|
downloadXml(id: string): Promise<DownloadUrlResponse>;
|
|
237
274
|
downloadPdf(id: string): Promise<DownloadUrlResponse>;
|
|
238
275
|
importByAccessKey(input: ImportByAccessKeyInput): Promise<Invoice>;
|
|
276
|
+
queryExternalByAccessKey(input: QueryExternalByAccessKeyInput): Promise<QueryExternalByAccessKeyResponse>;
|
|
239
277
|
}
|
|
240
278
|
|
|
241
279
|
type Requester$1 = (method: string, path: string, body?: unknown, params?: Record<string, string | number | undefined>) => Promise<unknown>;
|
package/dist/index.js
CHANGED
|
@@ -107,6 +107,13 @@ var InvoicesResource = class {
|
|
|
107
107
|
async importByAccessKey(input) {
|
|
108
108
|
return this.request("POST", "/developer/invoices/import", input);
|
|
109
109
|
}
|
|
110
|
+
async queryExternalByAccessKey(input) {
|
|
111
|
+
return this.request(
|
|
112
|
+
"POST",
|
|
113
|
+
"/developer/receipts/query",
|
|
114
|
+
input
|
|
115
|
+
);
|
|
116
|
+
}
|
|
110
117
|
};
|
|
111
118
|
|
|
112
119
|
// src/resources/products.ts
|
|
@@ -154,7 +161,7 @@ var WebhooksResource = class {
|
|
|
154
161
|
};
|
|
155
162
|
|
|
156
163
|
// src/client.ts
|
|
157
|
-
var DEFAULT_BASE_URL = "https://api-rest.factuplan.com.ec/
|
|
164
|
+
var DEFAULT_BASE_URL = "https://api-rest.factuplan.com.ec/v1";
|
|
158
165
|
var DEFAULT_TIMEOUT = 3e4;
|
|
159
166
|
var Factuplan = class {
|
|
160
167
|
constructor(apiKey, options) {
|
package/dist/index.mjs
CHANGED
|
@@ -78,6 +78,13 @@ var InvoicesResource = class {
|
|
|
78
78
|
async importByAccessKey(input) {
|
|
79
79
|
return this.request("POST", "/developer/invoices/import", input);
|
|
80
80
|
}
|
|
81
|
+
async queryExternalByAccessKey(input) {
|
|
82
|
+
return this.request(
|
|
83
|
+
"POST",
|
|
84
|
+
"/developer/receipts/query",
|
|
85
|
+
input
|
|
86
|
+
);
|
|
87
|
+
}
|
|
81
88
|
};
|
|
82
89
|
|
|
83
90
|
// src/resources/products.ts
|
|
@@ -125,7 +132,7 @@ var WebhooksResource = class {
|
|
|
125
132
|
};
|
|
126
133
|
|
|
127
134
|
// src/client.ts
|
|
128
|
-
var DEFAULT_BASE_URL = "https://api-rest.factuplan.com.ec/
|
|
135
|
+
var DEFAULT_BASE_URL = "https://api-rest.factuplan.com.ec/v1";
|
|
129
136
|
var DEFAULT_TIMEOUT = 3e4;
|
|
130
137
|
var Factuplan = class {
|
|
131
138
|
constructor(apiKey, options) {
|
package/package.json
CHANGED