factuplan 0.7.0 → 0.8.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
@@ -122,6 +122,11 @@ interface CreateInvoiceInput {
122
122
  /** List of payment methods for multi-payment support. */
123
123
  payments?: InvoicePayment[];
124
124
  additionalInfo?: Record<string, string>;
125
+ /**
126
+ * Whether to send the authorized invoice by email to the customer.
127
+ * @default true
128
+ */
129
+ sendEmail?: boolean;
125
130
  }
126
131
  interface ImportByAccessKeyInput {
127
132
  /** 49-digit SRI access key (claveAcceso) of an already-authorized invoice */
@@ -222,6 +227,12 @@ interface FactuplanOptions {
222
227
  baseUrl?: string;
223
228
  /** Request timeout in milliseconds (default: 30000) */
224
229
  timeout?: number;
230
+ /**
231
+ * Default taxpayer RUC sent as `x-taxpayer-ruc` header in every request.
232
+ * Required for most operations (emit, sign, customers, products, etc.).
233
+ * Not required for `queryExternalByAccessKey`.
234
+ */
235
+ ruc?: string;
225
236
  }
226
237
  interface QueryExternalByAccessKeyInput {
227
238
  /** Clave de acceso de 49 dígitos del comprobante en el SRI */
@@ -305,6 +316,7 @@ declare class Factuplan {
305
316
  private readonly apiKey;
306
317
  private readonly baseUrl;
307
318
  private readonly timeout;
319
+ private readonly options;
308
320
  readonly customers: CustomersResource;
309
321
  readonly products: ProductsResource;
310
322
  readonly invoices: InvoicesResource;
package/dist/index.d.ts CHANGED
@@ -122,6 +122,11 @@ interface CreateInvoiceInput {
122
122
  /** List of payment methods for multi-payment support. */
123
123
  payments?: InvoicePayment[];
124
124
  additionalInfo?: Record<string, string>;
125
+ /**
126
+ * Whether to send the authorized invoice by email to the customer.
127
+ * @default true
128
+ */
129
+ sendEmail?: boolean;
125
130
  }
126
131
  interface ImportByAccessKeyInput {
127
132
  /** 49-digit SRI access key (claveAcceso) of an already-authorized invoice */
@@ -222,6 +227,12 @@ interface FactuplanOptions {
222
227
  baseUrl?: string;
223
228
  /** Request timeout in milliseconds (default: 30000) */
224
229
  timeout?: number;
230
+ /**
231
+ * Default taxpayer RUC sent as `x-taxpayer-ruc` header in every request.
232
+ * Required for most operations (emit, sign, customers, products, etc.).
233
+ * Not required for `queryExternalByAccessKey`.
234
+ */
235
+ ruc?: string;
225
236
  }
226
237
  interface QueryExternalByAccessKeyInput {
227
238
  /** Clave de acceso de 49 dígitos del comprobante en el SRI */
@@ -305,6 +316,7 @@ declare class Factuplan {
305
316
  private readonly apiKey;
306
317
  private readonly baseUrl;
307
318
  private readonly timeout;
319
+ private readonly options;
308
320
  readonly customers: CustomersResource;
309
321
  readonly products: ProductsResource;
310
322
  readonly invoices: InvoicesResource;
package/dist/index.js CHANGED
@@ -167,6 +167,7 @@ var Factuplan = class {
167
167
  constructor(apiKey, options) {
168
168
  if (!apiKey) throw new Error("API key is required");
169
169
  this.apiKey = apiKey;
170
+ this.options = options;
170
171
  this.baseUrl = (options?.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
171
172
  this.timeout = options?.timeout ?? DEFAULT_TIMEOUT;
172
173
  const requester = this.request.bind(this);
@@ -197,6 +198,9 @@ var Factuplan = class {
197
198
  "x-api-key": this.apiKey,
198
199
  Accept: "application/json"
199
200
  };
201
+ if (this.options?.ruc) {
202
+ headers["x-taxpayer-ruc"] = this.options.ruc;
203
+ }
200
204
  if (body !== void 0) {
201
205
  headers["Content-Type"] = "application/json";
202
206
  }
package/dist/index.mjs CHANGED
@@ -138,6 +138,7 @@ var Factuplan = class {
138
138
  constructor(apiKey, options) {
139
139
  if (!apiKey) throw new Error("API key is required");
140
140
  this.apiKey = apiKey;
141
+ this.options = options;
141
142
  this.baseUrl = (options?.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
142
143
  this.timeout = options?.timeout ?? DEFAULT_TIMEOUT;
143
144
  const requester = this.request.bind(this);
@@ -168,6 +169,9 @@ var Factuplan = class {
168
169
  "x-api-key": this.apiKey,
169
170
  Accept: "application/json"
170
171
  };
172
+ if (this.options?.ruc) {
173
+ headers["x-taxpayer-ruc"] = this.options.ruc;
174
+ }
171
175
  if (body !== void 0) {
172
176
  headers["Content-Type"] = "application/json";
173
177
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "factuplan",
3
- "version": "0.7.0",
3
+ "version": "0.8.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",