factuplan 0.6.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 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
- paymentMethod?: string;
122
+ /** List of payment methods for multi-payment support. */
123
+ payments?: InvoicePayment[];
116
124
  additionalInfo?: Record<string, string>;
117
125
  }
118
126
  interface ImportByAccessKeyInput {
@@ -215,6 +223,30 @@ interface FactuplanOptions {
215
223
  /** Request timeout in milliseconds (default: 30000) */
216
224
  timeout?: number;
217
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
+ }
218
250
 
219
251
  type Requester$3 = (method: string, path: string, body?: unknown, params?: Record<string, string | number | undefined>) => Promise<unknown>;
220
252
  declare class CustomersResource {
@@ -241,6 +273,7 @@ declare class InvoicesResource {
241
273
  downloadXml(id: string): Promise<DownloadUrlResponse>;
242
274
  downloadPdf(id: string): Promise<DownloadUrlResponse>;
243
275
  importByAccessKey(input: ImportByAccessKeyInput): Promise<Invoice>;
276
+ queryExternalByAccessKey(input: QueryExternalByAccessKeyInput): Promise<QueryExternalByAccessKeyResponse>;
244
277
  }
245
278
 
246
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
- paymentMethod?: string;
122
+ /** List of payment methods for multi-payment support. */
123
+ payments?: InvoicePayment[];
116
124
  additionalInfo?: Record<string, string>;
117
125
  }
118
126
  interface ImportByAccessKeyInput {
@@ -215,6 +223,30 @@ interface FactuplanOptions {
215
223
  /** Request timeout in milliseconds (default: 30000) */
216
224
  timeout?: number;
217
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
+ }
218
250
 
219
251
  type Requester$3 = (method: string, path: string, body?: unknown, params?: Record<string, string | number | undefined>) => Promise<unknown>;
220
252
  declare class CustomersResource {
@@ -241,6 +273,7 @@ declare class InvoicesResource {
241
273
  downloadXml(id: string): Promise<DownloadUrlResponse>;
242
274
  downloadPdf(id: string): Promise<DownloadUrlResponse>;
243
275
  importByAccessKey(input: ImportByAccessKeyInput): Promise<Invoice>;
276
+ queryExternalByAccessKey(input: QueryExternalByAccessKeyInput): Promise<QueryExternalByAccessKeyResponse>;
244
277
  }
245
278
 
246
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
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "factuplan",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Official Factuplan SDK for JavaScript & TypeScript — Create electronic invoices for Ecuador (SRI)",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",