@facturino/node 1.0.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/LICENSE +21 -0
- package/README.md +204 -0
- package/dist/cjs/client.d.ts +24 -0
- package/dist/cjs/client.js +203 -0
- package/dist/cjs/errors.d.ts +76 -0
- package/dist/cjs/errors.js +128 -0
- package/dist/cjs/index.d.ts +59 -0
- package/dist/cjs/index.js +77 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/pagination.d.ts +24 -0
- package/dist/cjs/pagination.js +68 -0
- package/dist/cjs/resources/account.d.ts +58 -0
- package/dist/cjs/resources/account.js +48 -0
- package/dist/cjs/resources/archives.d.ts +16 -0
- package/dist/cjs/resources/archives.js +17 -0
- package/dist/cjs/resources/billing.d.ts +30 -0
- package/dist/cjs/resources/billing.js +45 -0
- package/dist/cjs/resources/companies.d.ts +47 -0
- package/dist/cjs/resources/companies.js +45 -0
- package/dist/cjs/resources/creditNotes.d.ts +64 -0
- package/dist/cjs/resources/creditNotes.js +62 -0
- package/dist/cjs/resources/customers.d.ts +17 -0
- package/dist/cjs/resources/customers.js +36 -0
- package/dist/cjs/resources/ereporting.d.ts +12 -0
- package/dist/cjs/resources/ereporting.js +23 -0
- package/dist/cjs/resources/events.d.ts +11 -0
- package/dist/cjs/resources/events.js +20 -0
- package/dist/cjs/resources/exports.d.ts +20 -0
- package/dist/cjs/resources/exports.js +31 -0
- package/dist/cjs/resources/health.d.ts +13 -0
- package/dist/cjs/resources/health.js +18 -0
- package/dist/cjs/resources/invoices.d.ts +112 -0
- package/dist/cjs/resources/invoices.js +141 -0
- package/dist/cjs/resources/jobs.d.ts +10 -0
- package/dist/cjs/resources/jobs.js +24 -0
- package/dist/cjs/resources/payments.d.ts +16 -0
- package/dist/cjs/resources/payments.js +25 -0
- package/dist/cjs/resources/products.d.ts +15 -0
- package/dist/cjs/resources/products.js +32 -0
- package/dist/cjs/resources/quotes.d.ts +44 -0
- package/dist/cjs/resources/quotes.js +58 -0
- package/dist/cjs/resources/received-invoices.d.ts +14 -0
- package/dist/cjs/resources/received-invoices.js +29 -0
- package/dist/cjs/resources/recurringInvoices.d.ts +15 -0
- package/dist/cjs/resources/recurringInvoices.js +32 -0
- package/dist/cjs/resources/reference.d.ts +45 -0
- package/dist/cjs/resources/reference.js +57 -0
- package/dist/cjs/resources/reporting.d.ts +11 -0
- package/dist/cjs/resources/reporting.js +30 -0
- package/dist/cjs/resources/sandbox.d.ts +12 -0
- package/dist/cjs/resources/sandbox.js +21 -0
- package/dist/cjs/resources/usage.d.ts +20 -0
- package/dist/cjs/resources/usage.js +25 -0
- package/dist/cjs/resources/validate.d.ts +18 -0
- package/dist/cjs/resources/validate.js +23 -0
- package/dist/cjs/resources/webhookEndpoints.d.ts +20 -0
- package/dist/cjs/resources/webhookEndpoints.js +31 -0
- package/dist/cjs/types.d.ts +1178 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/webhooks.d.ts +14 -0
- package/dist/cjs/webhooks.js +63 -0
- package/dist/esm/client.d.ts +25 -0
- package/dist/esm/client.d.ts.map +1 -0
- package/dist/esm/client.js +200 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/errors.d.ts +77 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +114 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.d.ts +60 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +61 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/pagination.d.ts +25 -0
- package/dist/esm/pagination.d.ts.map +1 -0
- package/dist/esm/pagination.js +65 -0
- package/dist/esm/pagination.js.map +1 -0
- package/dist/esm/resources/account.d.ts +59 -0
- package/dist/esm/resources/account.d.ts.map +1 -0
- package/dist/esm/resources/account.js +45 -0
- package/dist/esm/resources/account.js.map +1 -0
- package/dist/esm/resources/archives.d.ts +17 -0
- package/dist/esm/resources/archives.d.ts.map +1 -0
- package/dist/esm/resources/archives.js +14 -0
- package/dist/esm/resources/archives.js.map +1 -0
- package/dist/esm/resources/billing.d.ts +31 -0
- package/dist/esm/resources/billing.d.ts.map +1 -0
- package/dist/esm/resources/billing.js +42 -0
- package/dist/esm/resources/billing.js.map +1 -0
- package/dist/esm/resources/companies.d.ts +48 -0
- package/dist/esm/resources/companies.d.ts.map +1 -0
- package/dist/esm/resources/companies.js +42 -0
- package/dist/esm/resources/companies.js.map +1 -0
- package/dist/esm/resources/creditNotes.d.ts +65 -0
- package/dist/esm/resources/creditNotes.d.ts.map +1 -0
- package/dist/esm/resources/creditNotes.js +59 -0
- package/dist/esm/resources/creditNotes.js.map +1 -0
- package/dist/esm/resources/customers.d.ts +18 -0
- package/dist/esm/resources/customers.d.ts.map +1 -0
- package/dist/esm/resources/customers.js +33 -0
- package/dist/esm/resources/customers.js.map +1 -0
- package/dist/esm/resources/ereporting.d.ts +13 -0
- package/dist/esm/resources/ereporting.d.ts.map +1 -0
- package/dist/esm/resources/ereporting.js +20 -0
- package/dist/esm/resources/ereporting.js.map +1 -0
- package/dist/esm/resources/events.d.ts +12 -0
- package/dist/esm/resources/events.d.ts.map +1 -0
- package/dist/esm/resources/events.js +17 -0
- package/dist/esm/resources/events.js.map +1 -0
- package/dist/esm/resources/exports.d.ts +21 -0
- package/dist/esm/resources/exports.d.ts.map +1 -0
- package/dist/esm/resources/exports.js +28 -0
- package/dist/esm/resources/exports.js.map +1 -0
- package/dist/esm/resources/health.d.ts +14 -0
- package/dist/esm/resources/health.d.ts.map +1 -0
- package/dist/esm/resources/health.js +15 -0
- package/dist/esm/resources/health.js.map +1 -0
- package/dist/esm/resources/invoices.d.ts +113 -0
- package/dist/esm/resources/invoices.d.ts.map +1 -0
- package/dist/esm/resources/invoices.js +138 -0
- package/dist/esm/resources/invoices.js.map +1 -0
- package/dist/esm/resources/jobs.d.ts +11 -0
- package/dist/esm/resources/jobs.d.ts.map +1 -0
- package/dist/esm/resources/jobs.js +21 -0
- package/dist/esm/resources/jobs.js.map +1 -0
- package/dist/esm/resources/payments.d.ts +17 -0
- package/dist/esm/resources/payments.d.ts.map +1 -0
- package/dist/esm/resources/payments.js +22 -0
- package/dist/esm/resources/payments.js.map +1 -0
- package/dist/esm/resources/products.d.ts +16 -0
- package/dist/esm/resources/products.d.ts.map +1 -0
- package/dist/esm/resources/products.js +29 -0
- package/dist/esm/resources/products.js.map +1 -0
- package/dist/esm/resources/quotes.d.ts +45 -0
- package/dist/esm/resources/quotes.d.ts.map +1 -0
- package/dist/esm/resources/quotes.js +55 -0
- package/dist/esm/resources/quotes.js.map +1 -0
- package/dist/esm/resources/received-invoices.d.ts +15 -0
- package/dist/esm/resources/received-invoices.d.ts.map +1 -0
- package/dist/esm/resources/received-invoices.js +26 -0
- package/dist/esm/resources/received-invoices.js.map +1 -0
- package/dist/esm/resources/recurringInvoices.d.ts +16 -0
- package/dist/esm/resources/recurringInvoices.d.ts.map +1 -0
- package/dist/esm/resources/recurringInvoices.js +29 -0
- package/dist/esm/resources/recurringInvoices.js.map +1 -0
- package/dist/esm/resources/reference.d.ts +46 -0
- package/dist/esm/resources/reference.d.ts.map +1 -0
- package/dist/esm/resources/reference.js +54 -0
- package/dist/esm/resources/reference.js.map +1 -0
- package/dist/esm/resources/reporting.d.ts +12 -0
- package/dist/esm/resources/reporting.d.ts.map +1 -0
- package/dist/esm/resources/reporting.js +27 -0
- package/dist/esm/resources/reporting.js.map +1 -0
- package/dist/esm/resources/sandbox.d.ts +13 -0
- package/dist/esm/resources/sandbox.d.ts.map +1 -0
- package/dist/esm/resources/sandbox.js +18 -0
- package/dist/esm/resources/sandbox.js.map +1 -0
- package/dist/esm/resources/usage.d.ts +21 -0
- package/dist/esm/resources/usage.d.ts.map +1 -0
- package/dist/esm/resources/usage.js +22 -0
- package/dist/esm/resources/usage.js.map +1 -0
- package/dist/esm/resources/validate.d.ts +19 -0
- package/dist/esm/resources/validate.d.ts.map +1 -0
- package/dist/esm/resources/validate.js +20 -0
- package/dist/esm/resources/validate.js.map +1 -0
- package/dist/esm/resources/webhookEndpoints.d.ts +21 -0
- package/dist/esm/resources/webhookEndpoints.d.ts.map +1 -0
- package/dist/esm/resources/webhookEndpoints.js +28 -0
- package/dist/esm/resources/webhookEndpoints.js.map +1 -0
- package/dist/esm/types.d.ts +1179 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +5 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/webhooks.d.ts +15 -0
- package/dist/esm/webhooks.d.ts.map +1 -0
- package/dist/esm/webhooks.js +60 -0
- package/dist/esm/webhooks.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Webhooks } from './webhooks.js';
|
|
2
|
+
import { Invoices } from './resources/invoices.js';
|
|
3
|
+
import { Payments } from './resources/payments.js';
|
|
4
|
+
import { Customers } from './resources/customers.js';
|
|
5
|
+
import { Products } from './resources/products.js';
|
|
6
|
+
import { Quotes } from './resources/quotes.js';
|
|
7
|
+
import { CreditNotes } from './resources/creditNotes.js';
|
|
8
|
+
import { Events } from './resources/events.js';
|
|
9
|
+
import { WebhookEndpoints } from './resources/webhookEndpoints.js';
|
|
10
|
+
import { RecurringInvoices } from './resources/recurringInvoices.js';
|
|
11
|
+
import { Companies } from './resources/companies.js';
|
|
12
|
+
import { Exports } from './resources/exports.js';
|
|
13
|
+
import { EReportingResource } from './resources/ereporting.js';
|
|
14
|
+
import { Jobs } from './resources/jobs.js';
|
|
15
|
+
import { Sandbox } from './resources/sandbox.js';
|
|
16
|
+
import { ReceivedInvoices } from './resources/received-invoices.js';
|
|
17
|
+
import { Reporting } from './resources/reporting.js';
|
|
18
|
+
import { AccountResource } from './resources/account.js';
|
|
19
|
+
import { Billing } from './resources/billing.js';
|
|
20
|
+
import { Usage } from './resources/usage.js';
|
|
21
|
+
import { Validate } from './resources/validate.js';
|
|
22
|
+
import { Reference } from './resources/reference.js';
|
|
23
|
+
import { Archives } from './resources/archives.js';
|
|
24
|
+
import { Health } from './resources/health.js';
|
|
25
|
+
import type { FacturinoConfig } from './types.js';
|
|
26
|
+
/** Facturino API client for French e-invoicing — initialize with your API key to access all resources. */
|
|
27
|
+
declare class Facturino {
|
|
28
|
+
readonly account: AccountResource;
|
|
29
|
+
readonly billing: Billing;
|
|
30
|
+
readonly invoices: Invoices;
|
|
31
|
+
readonly payments: Payments;
|
|
32
|
+
readonly customers: Customers;
|
|
33
|
+
readonly products: Products;
|
|
34
|
+
readonly quotes: Quotes;
|
|
35
|
+
readonly creditNotes: CreditNotes;
|
|
36
|
+
readonly events: Events;
|
|
37
|
+
readonly webhookEndpoints: WebhookEndpoints;
|
|
38
|
+
readonly recurringInvoices: RecurringInvoices;
|
|
39
|
+
readonly companies: Companies;
|
|
40
|
+
readonly exports: Exports;
|
|
41
|
+
readonly ereporting: EReportingResource;
|
|
42
|
+
readonly jobs: Jobs;
|
|
43
|
+
readonly reference: Reference;
|
|
44
|
+
readonly sandbox: Sandbox;
|
|
45
|
+
readonly usage: Usage;
|
|
46
|
+
readonly validate: Validate;
|
|
47
|
+
readonly webhooks: Webhooks;
|
|
48
|
+
readonly receivedInvoices: ReceivedInvoices;
|
|
49
|
+
readonly reporting: Reporting;
|
|
50
|
+
readonly archives: Archives;
|
|
51
|
+
readonly health: Health;
|
|
52
|
+
constructor(apiKey: string, config?: FacturinoConfig);
|
|
53
|
+
}
|
|
54
|
+
export default Facturino;
|
|
55
|
+
export { Facturino };
|
|
56
|
+
export type { FacturinoConfig, RequestOptions, PaginationParams, PaginatedResponse, ApiErrorBody, Address, Contact, ContactRole, LineItem, VatBreakdown, Totals, CustomerRef, CustomerSnapshot, LifecycleEntry, Currency, Unit, VatCode, VatexCode, PaymentMethod, InvoiceType, InvoiceStatus, InvoiceDates, InvoicePaymentTerms, InvoiceEinvoicing, InvoicePortal, InvoiceArchive, InvoiceFiles, Invoice, InvoiceExpandField, InvoiceExpanded, InvoiceRetrieveParams, InvoiceBuyerParam, InvoiceCreateDates, InvoiceCreateParams, InvoiceLineItemParam, InvoiceUpdateParams, InvoiceListParams, IncomingInvoiceCreateParams, InvoiceStatusResponse, InvoiceVerifyResponse, DocumentUrlResponse, JobResponse, PaymentLinkResponse, PaymentLinkCreateParams, PaymentTokenResponse, Payment, PaymentCreateParams, Customer, CustomerCreateParams, CustomerUpdateParams, CustomerListParams, CustomerLookupParams, SireneLookupResponse, SireneCompany, Product, PriceHistoryEntry, ProductCreateParams, ProductUpdateParams, ProductListParams, QuoteStatus, QuoteDates, QuoteSignature, Quote, QuoteCreateParams, QuoteUpdateParams, QuoteListParams, CreditNoteType, CreditNoteStatus, CreditNoteReasonCode, CreditNote, CreditNoteCreateParams, CreditNoteUpdateParams, CreditNoteListParams, WebhookEventType, WebhookEvent, EventListParams, WebhookEndpoint, WebhookEndpointCreateParams, WebhookEndpointUpdateParams, RecurringFrequency, RecurringInvoice, RecurringInvoiceCreateParams, RecurringInvoiceUpdateParams, RecurringInvoiceListParams, BankDetails, InvoiceSettings, CreditNoteSettings, CreditNoteNumberingMode, Company, CompanyUpdateParams, CgvResponse, FecExportParams, EReportingType, EReportingStatus, EReportingLine, EReportingLineResponse, EReporting, EReportingCreateParams, EReportingListParams, JobType, JobStatus, Job, SandboxResetResponse, SimulateStatusParams, SimulateStatusResponse, ReceivedInvoiceStatus, ReceivedInvoice, ReceivedInvoiceListParams, ReceivedInvoiceRefuseParams, ReceivedInvoiceRecordPaymentParams, ReceivedInvoiceActionResponse, VatReportParams, VatReportBreakdown, VatReport, RevenueReportParams, RevenueReportBreakdownItem, RevenueReport, AccountPlan, Account, BillingCycle, BillingSubscription, PlatformInvoice, UsageMeter, UsageSummary, ValidateParams, ValidateResponse, LegalForm, NafCode, LegalFormInput, NafCodeInput, PaProvider, HealthStatus, } from './types.js';
|
|
57
|
+
export { FacturinoError, ApiError, InvalidRequestError, ValidationError, AuthenticationError, PermissionError, NotFoundError, ConflictError, RateLimitError, PlanLimitError, ApiInternalError, ConnectionError, } from './errors.js';
|
|
58
|
+
export { Webhooks } from './webhooks.js';
|
|
59
|
+
export { AutoPaginatingList } from './pagination.js';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AutoPaginatingList = exports.Webhooks = exports.ConnectionError = exports.ApiInternalError = exports.PlanLimitError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.PermissionError = exports.AuthenticationError = exports.ValidationError = exports.InvalidRequestError = exports.ApiError = exports.FacturinoError = exports.Facturino = void 0;
|
|
4
|
+
const client_js_1 = require("./client.js");
|
|
5
|
+
const webhooks_js_1 = require("./webhooks.js");
|
|
6
|
+
const invoices_js_1 = require("./resources/invoices.js");
|
|
7
|
+
const payments_js_1 = require("./resources/payments.js");
|
|
8
|
+
const customers_js_1 = require("./resources/customers.js");
|
|
9
|
+
const products_js_1 = require("./resources/products.js");
|
|
10
|
+
const quotes_js_1 = require("./resources/quotes.js");
|
|
11
|
+
const creditNotes_js_1 = require("./resources/creditNotes.js");
|
|
12
|
+
const events_js_1 = require("./resources/events.js");
|
|
13
|
+
const webhookEndpoints_js_1 = require("./resources/webhookEndpoints.js");
|
|
14
|
+
const recurringInvoices_js_1 = require("./resources/recurringInvoices.js");
|
|
15
|
+
const companies_js_1 = require("./resources/companies.js");
|
|
16
|
+
const exports_js_1 = require("./resources/exports.js");
|
|
17
|
+
const ereporting_js_1 = require("./resources/ereporting.js");
|
|
18
|
+
const jobs_js_1 = require("./resources/jobs.js");
|
|
19
|
+
const sandbox_js_1 = require("./resources/sandbox.js");
|
|
20
|
+
const received_invoices_js_1 = require("./resources/received-invoices.js");
|
|
21
|
+
const reporting_js_1 = require("./resources/reporting.js");
|
|
22
|
+
const account_js_1 = require("./resources/account.js");
|
|
23
|
+
const billing_js_1 = require("./resources/billing.js");
|
|
24
|
+
const usage_js_1 = require("./resources/usage.js");
|
|
25
|
+
const validate_js_1 = require("./resources/validate.js");
|
|
26
|
+
const reference_js_1 = require("./resources/reference.js");
|
|
27
|
+
const archives_js_1 = require("./resources/archives.js");
|
|
28
|
+
const health_js_1 = require("./resources/health.js");
|
|
29
|
+
/** Facturino API client for French e-invoicing — initialize with your API key to access all resources. */
|
|
30
|
+
class Facturino {
|
|
31
|
+
constructor(apiKey, config) {
|
|
32
|
+
const client = new client_js_1.HttpClient(apiKey, config);
|
|
33
|
+
this.account = new account_js_1.AccountResource(client);
|
|
34
|
+
this.billing = new billing_js_1.Billing(client);
|
|
35
|
+
this.invoices = new invoices_js_1.Invoices(client);
|
|
36
|
+
this.payments = new payments_js_1.Payments(client);
|
|
37
|
+
this.customers = new customers_js_1.Customers(client);
|
|
38
|
+
this.products = new products_js_1.Products(client);
|
|
39
|
+
this.quotes = new quotes_js_1.Quotes(client);
|
|
40
|
+
this.creditNotes = new creditNotes_js_1.CreditNotes(client);
|
|
41
|
+
this.events = new events_js_1.Events(client);
|
|
42
|
+
this.webhookEndpoints = new webhookEndpoints_js_1.WebhookEndpoints(client);
|
|
43
|
+
this.recurringInvoices = new recurringInvoices_js_1.RecurringInvoices(client);
|
|
44
|
+
this.companies = new companies_js_1.Companies(client);
|
|
45
|
+
this.exports = new exports_js_1.Exports(client);
|
|
46
|
+
this.ereporting = new ereporting_js_1.EReportingResource(client);
|
|
47
|
+
this.jobs = new jobs_js_1.Jobs(client);
|
|
48
|
+
this.reference = new reference_js_1.Reference(client);
|
|
49
|
+
this.sandbox = new sandbox_js_1.Sandbox(client);
|
|
50
|
+
this.usage = new usage_js_1.Usage(client);
|
|
51
|
+
this.validate = new validate_js_1.Validate(client);
|
|
52
|
+
this.webhooks = new webhooks_js_1.Webhooks();
|
|
53
|
+
this.receivedInvoices = new received_invoices_js_1.ReceivedInvoices(client);
|
|
54
|
+
this.reporting = new reporting_js_1.Reporting(client);
|
|
55
|
+
this.archives = new archives_js_1.Archives(client);
|
|
56
|
+
this.health = new health_js_1.Health(client);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.Facturino = Facturino;
|
|
60
|
+
exports.default = Facturino;
|
|
61
|
+
var errors_js_1 = require("./errors.js");
|
|
62
|
+
Object.defineProperty(exports, "FacturinoError", { enumerable: true, get: function () { return errors_js_1.FacturinoError; } });
|
|
63
|
+
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return errors_js_1.ApiError; } });
|
|
64
|
+
Object.defineProperty(exports, "InvalidRequestError", { enumerable: true, get: function () { return errors_js_1.InvalidRequestError; } });
|
|
65
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_js_1.ValidationError; } });
|
|
66
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return errors_js_1.AuthenticationError; } });
|
|
67
|
+
Object.defineProperty(exports, "PermissionError", { enumerable: true, get: function () { return errors_js_1.PermissionError; } });
|
|
68
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return errors_js_1.NotFoundError; } });
|
|
69
|
+
Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return errors_js_1.ConflictError; } });
|
|
70
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return errors_js_1.RateLimitError; } });
|
|
71
|
+
Object.defineProperty(exports, "PlanLimitError", { enumerable: true, get: function () { return errors_js_1.PlanLimitError; } });
|
|
72
|
+
Object.defineProperty(exports, "ApiInternalError", { enumerable: true, get: function () { return errors_js_1.ApiInternalError; } });
|
|
73
|
+
Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return errors_js_1.ConnectionError; } });
|
|
74
|
+
var webhooks_js_2 = require("./webhooks.js");
|
|
75
|
+
Object.defineProperty(exports, "Webhooks", { enumerable: true, get: function () { return webhooks_js_2.Webhooks; } });
|
|
76
|
+
var pagination_js_1 = require("./pagination.js");
|
|
77
|
+
Object.defineProperty(exports, "AutoPaginatingList", { enumerable: true, get: function () { return pagination_js_1.AutoPaginatingList; } });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { HttpClient } from './client.js';
|
|
2
|
+
import type { PaginatedResponse, PaginationParams } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Async-iterable list with auto-pagination.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* for await (const inv of facturino.invoices.list()) { ... }
|
|
8
|
+
* // or: const page = await facturino.invoices.list()
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare class AutoPaginatingList<T extends {
|
|
12
|
+
id: string;
|
|
13
|
+
}> implements AsyncIterable<T>, PromiseLike<PaginatedResponse<T>> {
|
|
14
|
+
private readonly client;
|
|
15
|
+
private readonly path;
|
|
16
|
+
private readonly params;
|
|
17
|
+
private firstPagePromise;
|
|
18
|
+
constructor(client: HttpClient, path: string, params?: PaginationParams);
|
|
19
|
+
/** Await resolves to the first page. */
|
|
20
|
+
then<TResult1 = PaginatedResponse<T>, TResult2 = never>(onfulfilled?: ((value: PaginatedResponse<T>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
21
|
+
/** Yields items across all pages. */
|
|
22
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
23
|
+
private getFirstPage;
|
|
24
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AutoPaginatingList = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Async-iterable list with auto-pagination.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* for await (const inv of facturino.invoices.list()) { ... }
|
|
9
|
+
* // or: const page = await facturino.invoices.list()
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
class AutoPaginatingList {
|
|
13
|
+
constructor(client, path, params) {
|
|
14
|
+
this.firstPagePromise = null;
|
|
15
|
+
this.client = client;
|
|
16
|
+
this.path = path;
|
|
17
|
+
this.params = { ...(params ?? {}) };
|
|
18
|
+
}
|
|
19
|
+
/** Await resolves to the first page. */
|
|
20
|
+
then(onfulfilled, onrejected) {
|
|
21
|
+
return this.getFirstPage().then(onfulfilled, onrejected);
|
|
22
|
+
}
|
|
23
|
+
/** Yields items across all pages. */
|
|
24
|
+
async *[Symbol.asyncIterator]() {
|
|
25
|
+
let cursor = this.params.starting_after;
|
|
26
|
+
const limit = this.params.limit ?? 25;
|
|
27
|
+
for (;;) {
|
|
28
|
+
const queryParams = {};
|
|
29
|
+
if (limit)
|
|
30
|
+
queryParams.limit = String(limit);
|
|
31
|
+
if (cursor)
|
|
32
|
+
queryParams.starting_after = cursor;
|
|
33
|
+
// Forward filter params (status, type, active, etc.)
|
|
34
|
+
for (const [key, value] of Object.entries(this.params)) {
|
|
35
|
+
if (key === 'limit' || key === 'starting_after')
|
|
36
|
+
continue;
|
|
37
|
+
if (value !== undefined && value !== null) {
|
|
38
|
+
queryParams[key] = String(value);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const qs = new URLSearchParams(queryParams).toString();
|
|
42
|
+
const url = qs ? `${this.path}?${qs}` : this.path;
|
|
43
|
+
const page = await this.client.get(url);
|
|
44
|
+
for (const item of page.data) {
|
|
45
|
+
yield item;
|
|
46
|
+
}
|
|
47
|
+
if (!page.has_more || page.data.length === 0) {
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
cursor = page.next_cursor ?? page.data[page.data.length - 1].id;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
getFirstPage() {
|
|
54
|
+
if (!this.firstPagePromise) {
|
|
55
|
+
const queryParams = {};
|
|
56
|
+
for (const [key, value] of Object.entries(this.params)) {
|
|
57
|
+
if (value !== undefined && value !== null) {
|
|
58
|
+
queryParams[key] = String(value);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const qs = new URLSearchParams(queryParams).toString();
|
|
62
|
+
const url = qs ? `${this.path}?${qs}` : this.path;
|
|
63
|
+
this.firstPagePromise = this.client.get(url);
|
|
64
|
+
}
|
|
65
|
+
return this.firstPagePromise;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.AutoPaginatingList = AutoPaginatingList;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import type { Account } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Result of `POST /v1/account/export` (202 Accepted). The export runs
|
|
5
|
+
* asynchronously — poll `exports.getExportStatus(id)` until the job exposes
|
|
6
|
+
* `download_url`.
|
|
7
|
+
*/
|
|
8
|
+
export interface AccountExportResponse {
|
|
9
|
+
object: 'job';
|
|
10
|
+
/** Job id (`job_…`) — poll it via `exports.getExportStatus`. */
|
|
11
|
+
id: string;
|
|
12
|
+
type: 'rgpd_export';
|
|
13
|
+
status: string;
|
|
14
|
+
}
|
|
15
|
+
/** Short-lived (5 min) signed-URL response for a prepared RGPD export. */
|
|
16
|
+
export interface AccountExportDownloadResponse {
|
|
17
|
+
object: 'export_url';
|
|
18
|
+
url: string;
|
|
19
|
+
/** ISO 8601 expiry of the signed URL (5 minutes). */
|
|
20
|
+
expires_at: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Account introspection — returns the authenticated user, the active
|
|
24
|
+
* company, the current plan and the scopes attached to the API key in
|
|
25
|
+
* use. Every integration should expose this on a "Connected to
|
|
26
|
+
* Facturino" surface so users can confirm which company and which
|
|
27
|
+
* environment (`fac_test_` vs `fac_live_`) their requests target.
|
|
28
|
+
*
|
|
29
|
+
* Also exposes the RGPD data-export endpoints (article 20): request a
|
|
30
|
+
* full export and download it once prepared.
|
|
31
|
+
*/
|
|
32
|
+
export declare class AccountResource {
|
|
33
|
+
private readonly client;
|
|
34
|
+
constructor(client: HttpClient);
|
|
35
|
+
/**
|
|
36
|
+
* Return the account context (user, company, plan, livemode, scopes)
|
|
37
|
+
* associated with the API key used by this client. Equivalent to
|
|
38
|
+
* Stripe's `accounts.retrieve('me')` — no path parameter, the key
|
|
39
|
+
* implicitly identifies "self".
|
|
40
|
+
*/
|
|
41
|
+
retrieve(): Promise<Account>;
|
|
42
|
+
/**
|
|
43
|
+
* Request a full export of the account's data (RGPD article 20).
|
|
44
|
+
* Returns 202 with a job id; the file is prepared asynchronously.
|
|
45
|
+
* Poll `exports.getExportStatus(id)` until the job carries a
|
|
46
|
+
* `download_url` (the user also receives an in-app notification).
|
|
47
|
+
*/
|
|
48
|
+
requestExport(): Promise<AccountExportResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Return a short-lived (5 minutes) signed URL for a prepared RGPD
|
|
51
|
+
* export. Takes the `rgpdexp_…` export id delivered by the
|
|
52
|
+
* `export_ready` notification — NOT the `job_…` id returned by
|
|
53
|
+
* {@link requestExport} (poll that one via `exports.getExportStatus`).
|
|
54
|
+
* The export metadata is keyed under the authenticated user —
|
|
55
|
+
* cross-user access is impossible.
|
|
56
|
+
*/
|
|
57
|
+
downloadExport(exportId: string): Promise<AccountExportDownloadResponse>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountResource = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Account introspection — returns the authenticated user, the active
|
|
6
|
+
* company, the current plan and the scopes attached to the API key in
|
|
7
|
+
* use. Every integration should expose this on a "Connected to
|
|
8
|
+
* Facturino" surface so users can confirm which company and which
|
|
9
|
+
* environment (`fac_test_` vs `fac_live_`) their requests target.
|
|
10
|
+
*
|
|
11
|
+
* Also exposes the RGPD data-export endpoints (article 20): request a
|
|
12
|
+
* full export and download it once prepared.
|
|
13
|
+
*/
|
|
14
|
+
class AccountResource {
|
|
15
|
+
constructor(client) {
|
|
16
|
+
this.client = client;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Return the account context (user, company, plan, livemode, scopes)
|
|
20
|
+
* associated with the API key used by this client. Equivalent to
|
|
21
|
+
* Stripe's `accounts.retrieve('me')` — no path parameter, the key
|
|
22
|
+
* implicitly identifies "self".
|
|
23
|
+
*/
|
|
24
|
+
async retrieve() {
|
|
25
|
+
return this.client.get('/v1/account');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Request a full export of the account's data (RGPD article 20).
|
|
29
|
+
* Returns 202 with a job id; the file is prepared asynchronously.
|
|
30
|
+
* Poll `exports.getExportStatus(id)` until the job carries a
|
|
31
|
+
* `download_url` (the user also receives an in-app notification).
|
|
32
|
+
*/
|
|
33
|
+
async requestExport() {
|
|
34
|
+
return this.client.post('/v1/account/export');
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Return a short-lived (5 minutes) signed URL for a prepared RGPD
|
|
38
|
+
* export. Takes the `rgpdexp_…` export id delivered by the
|
|
39
|
+
* `export_ready` notification — NOT the `job_…` id returned by
|
|
40
|
+
* {@link requestExport} (poll that one via `exports.getExportStatus`).
|
|
41
|
+
* The export metadata is keyed under the authenticated user —
|
|
42
|
+
* cross-user access is impossible.
|
|
43
|
+
*/
|
|
44
|
+
async downloadExport(exportId) {
|
|
45
|
+
return this.client.get(`/v1/account/exports/${exportId}/download`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.AccountResource = AccountResource;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import { AutoPaginatingList } from '../pagination.js';
|
|
3
|
+
import type { PaginationParams } from '../types.js';
|
|
4
|
+
/** Archive retrieval — access legally archived invoices and verify integrity. */
|
|
5
|
+
export declare class Archives {
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: HttpClient);
|
|
8
|
+
list(params?: PaginationParams): AutoPaginatingList<{
|
|
9
|
+
id: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}>;
|
|
12
|
+
get(invoiceId: string): Promise<{
|
|
13
|
+
id: string;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Archives = void 0;
|
|
4
|
+
const pagination_js_1 = require("../pagination.js");
|
|
5
|
+
/** Archive retrieval — access legally archived invoices and verify integrity. */
|
|
6
|
+
class Archives {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
list(params) {
|
|
11
|
+
return new pagination_js_1.AutoPaginatingList(this.client, '/v1/archives', params);
|
|
12
|
+
}
|
|
13
|
+
async get(invoiceId) {
|
|
14
|
+
return this.client.get(`/v1/archives/${invoiceId}`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.Archives = Archives;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import type { BillingSubscription, PaginatedResponse, PlatformInvoice } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Billing — read-only access to the current subscription and the
|
|
5
|
+
* Facturino → user platform-invoice history.
|
|
6
|
+
*
|
|
7
|
+
* Plan changes, checkout and the Stripe Customer Portal are handled
|
|
8
|
+
* through the Facturino dashboard, not the API.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Billing {
|
|
11
|
+
private readonly client;
|
|
12
|
+
constructor(client: HttpClient);
|
|
13
|
+
/** Current subscription (plan, status, period). */
|
|
14
|
+
retrieveSubscription(): Promise<BillingSubscription>;
|
|
15
|
+
/** Paginated list of platform invoices (Facturino → user) for the current account. */
|
|
16
|
+
listInvoices(params?: {
|
|
17
|
+
limit?: number;
|
|
18
|
+
starting_after?: string;
|
|
19
|
+
}): Promise<PaginatedResponse<PlatformInvoice>>;
|
|
20
|
+
/**
|
|
21
|
+
* Short-lived signed URL for a platform-invoice PDF. The URL expires
|
|
22
|
+
* within minutes — fetch it just-in-time when the user clicks
|
|
23
|
+
* "Download", do not store it.
|
|
24
|
+
*/
|
|
25
|
+
getInvoicePdf(invoiceId: string): Promise<{
|
|
26
|
+
object: 'file_url';
|
|
27
|
+
url: string;
|
|
28
|
+
expires_in: number;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Billing = void 0;
|
|
4
|
+
/** Encode a flat object as a `?k=v&…` query string (skips undefined/null). */
|
|
5
|
+
function buildQuery(params) {
|
|
6
|
+
const entries = [];
|
|
7
|
+
for (const [k, v] of Object.entries(params)) {
|
|
8
|
+
if (v === undefined || v === null)
|
|
9
|
+
continue;
|
|
10
|
+
entries.push([k, String(v)]);
|
|
11
|
+
}
|
|
12
|
+
if (entries.length === 0)
|
|
13
|
+
return '';
|
|
14
|
+
return `?${new URLSearchParams(entries).toString()}`;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Billing — read-only access to the current subscription and the
|
|
18
|
+
* Facturino → user platform-invoice history.
|
|
19
|
+
*
|
|
20
|
+
* Plan changes, checkout and the Stripe Customer Portal are handled
|
|
21
|
+
* through the Facturino dashboard, not the API.
|
|
22
|
+
*/
|
|
23
|
+
class Billing {
|
|
24
|
+
constructor(client) {
|
|
25
|
+
this.client = client;
|
|
26
|
+
}
|
|
27
|
+
/** Current subscription (plan, status, period). */
|
|
28
|
+
async retrieveSubscription() {
|
|
29
|
+
return this.client.get('/v1/billing/subscription');
|
|
30
|
+
}
|
|
31
|
+
/** Paginated list of platform invoices (Facturino → user) for the current account. */
|
|
32
|
+
async listInvoices(params) {
|
|
33
|
+
const qs = params ? buildQuery(params) : '';
|
|
34
|
+
return this.client.get(`/v1/billing/invoices${qs}`);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Short-lived signed URL for a platform-invoice PDF. The URL expires
|
|
38
|
+
* within minutes — fetch it just-in-time when the user clicks
|
|
39
|
+
* "Download", do not store it.
|
|
40
|
+
*/
|
|
41
|
+
async getInvoicePdf(invoiceId) {
|
|
42
|
+
return this.client.get(`/v1/billing/invoices/${invoiceId}/pdf`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.Billing = Billing;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import type { Address, BankDetails, Company, CompanyUpdateParams, CgvResponse, LegalFormInput, NafCodeInput, PaginatedResponse, RequestOptions } from '../types.js';
|
|
3
|
+
/** Body for `POST /v1/companies` — create a new company under the authenticated user. */
|
|
4
|
+
export interface CompanyCreateParams {
|
|
5
|
+
name: string;
|
|
6
|
+
siret: string;
|
|
7
|
+
address: Address;
|
|
8
|
+
vatNumber?: string;
|
|
9
|
+
legalForm?: LegalFormInput;
|
|
10
|
+
naf?: NafCodeInput;
|
|
11
|
+
tvaIntracom?: string;
|
|
12
|
+
rcs?: string;
|
|
13
|
+
capitalSocial?: string;
|
|
14
|
+
vatRegime?: 'normal' | 'franchise' | 'simplified' | 'debit';
|
|
15
|
+
email?: string;
|
|
16
|
+
phone?: string;
|
|
17
|
+
website?: string;
|
|
18
|
+
bankDetails?: BankDetails;
|
|
19
|
+
}
|
|
20
|
+
/** Company profile and settings — legal information, bank details, and CGV documents. */
|
|
21
|
+
export declare class Companies {
|
|
22
|
+
private readonly client;
|
|
23
|
+
constructor(client: HttpClient);
|
|
24
|
+
list(): Promise<PaginatedResponse<Company>>;
|
|
25
|
+
/**
|
|
26
|
+
* Create a new company under the authenticated user. Subject to the
|
|
27
|
+
* per-plan company quota (free: 1, essential: 1, pro: 3, cabinet_*: 50+);
|
|
28
|
+
* exceeding the quota returns a `402 plan_limit_error`.
|
|
29
|
+
*/
|
|
30
|
+
create(params: CompanyCreateParams, options?: RequestOptions): Promise<Company>;
|
|
31
|
+
get(id: string): Promise<Company>;
|
|
32
|
+
update(id: string, params: CompanyUpdateParams): Promise<Company>;
|
|
33
|
+
/**
|
|
34
|
+
* Mark an onboarding milestone as reached (e.g. `first_invoice_sent`,
|
|
35
|
+
* `pa_connected`, `bank_added`). Used by the dashboard to compute the
|
|
36
|
+
* onboarding progress and surface remaining steps.
|
|
37
|
+
*/
|
|
38
|
+
addMilestone(id: string, milestone: string): Promise<{
|
|
39
|
+
object: 'company_milestone';
|
|
40
|
+
milestone: string;
|
|
41
|
+
reachedAt: string;
|
|
42
|
+
}>;
|
|
43
|
+
/** Base64-encoded PDF, max 5 MB. */
|
|
44
|
+
uploadCgv(companyId: string, content: string, options?: RequestOptions): Promise<CgvResponse>;
|
|
45
|
+
getCgv(companyId: string): Promise<CgvResponse>;
|
|
46
|
+
deleteCgv(companyId: string): Promise<CgvResponse>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Companies = void 0;
|
|
4
|
+
/** Company profile and settings — legal information, bank details, and CGV documents. */
|
|
5
|
+
class Companies {
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
async list() {
|
|
10
|
+
return this.client.get('/v1/companies');
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create a new company under the authenticated user. Subject to the
|
|
14
|
+
* per-plan company quota (free: 1, essential: 1, pro: 3, cabinet_*: 50+);
|
|
15
|
+
* exceeding the quota returns a `402 plan_limit_error`.
|
|
16
|
+
*/
|
|
17
|
+
async create(params, options) {
|
|
18
|
+
return this.client.post('/v1/companies', params, options);
|
|
19
|
+
}
|
|
20
|
+
async get(id) {
|
|
21
|
+
return this.client.get(`/v1/companies/${id}`);
|
|
22
|
+
}
|
|
23
|
+
async update(id, params) {
|
|
24
|
+
return this.client.patch(`/v1/companies/${id}`, params);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Mark an onboarding milestone as reached (e.g. `first_invoice_sent`,
|
|
28
|
+
* `pa_connected`, `bank_added`). Used by the dashboard to compute the
|
|
29
|
+
* onboarding progress and surface remaining steps.
|
|
30
|
+
*/
|
|
31
|
+
async addMilestone(id, milestone) {
|
|
32
|
+
return this.client.post(`/v1/companies/${id}/milestones`, { milestone });
|
|
33
|
+
}
|
|
34
|
+
/** Base64-encoded PDF, max 5 MB. */
|
|
35
|
+
async uploadCgv(companyId, content, options) {
|
|
36
|
+
return this.client.post(`/v1/companies/${companyId}/cgv`, { content }, options);
|
|
37
|
+
}
|
|
38
|
+
async getCgv(companyId) {
|
|
39
|
+
return this.client.get(`/v1/companies/${companyId}/cgv`);
|
|
40
|
+
}
|
|
41
|
+
async deleteCgv(companyId) {
|
|
42
|
+
return this.client.del(`/v1/companies/${companyId}/cgv`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.Companies = Companies;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import { AutoPaginatingList } from '../pagination.js';
|
|
3
|
+
import type { CreditNote, CreditNoteCreateParams, CreditNoteUpdateParams, CreditNoteListParams, DocumentUrlResponse, JobResponse, PaymentMethod, RequestOptions } from '../types.js';
|
|
4
|
+
/** Credit note operations — the legal way to correct or cancel a finalized invoice. */
|
|
5
|
+
export declare class CreditNotes {
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: HttpClient);
|
|
8
|
+
create(params: CreditNoteCreateParams, options?: RequestOptions): Promise<CreditNote>;
|
|
9
|
+
list(params?: CreditNoteListParams): AutoPaginatingList<CreditNote>;
|
|
10
|
+
get(id: string): Promise<CreditNote>;
|
|
11
|
+
update(id: string, params: CreditNoteUpdateParams): Promise<CreditNote>;
|
|
12
|
+
del(id: string): Promise<void>;
|
|
13
|
+
/** Assign number and lock. Irreversible. */
|
|
14
|
+
finalize(id: string, options?: RequestOptions): Promise<CreditNote>;
|
|
15
|
+
/** Submit to PA. */
|
|
16
|
+
send(id: string, options?: RequestOptions): Promise<{
|
|
17
|
+
id: string;
|
|
18
|
+
object: 'credit_note';
|
|
19
|
+
status: string;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Send the credit note to its customer by email with the PDF (and optional
|
|
23
|
+
* Factur-X XML) attached. Returns `{status: 'sent'}` on success or
|
|
24
|
+
* `{status: 'pending'}` if the PDF is still being generated.
|
|
25
|
+
*/
|
|
26
|
+
email(id: string, params?: {
|
|
27
|
+
recipientEmail?: string;
|
|
28
|
+
customMessage?: string;
|
|
29
|
+
includeXml?: boolean;
|
|
30
|
+
customSubject?: string;
|
|
31
|
+
}, options?: RequestOptions): Promise<{
|
|
32
|
+
status: 'sent';
|
|
33
|
+
creditNoteId: string;
|
|
34
|
+
recipient: string;
|
|
35
|
+
sentAt: string;
|
|
36
|
+
} | {
|
|
37
|
+
status: 'pending';
|
|
38
|
+
creditNoteId: string;
|
|
39
|
+
jobId: string;
|
|
40
|
+
pollUrl: string;
|
|
41
|
+
reason: string;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Record the disbursement of a finalized credit note back to the customer.
|
|
45
|
+
* Writes a negative `refund` payment on the linked invoice (mirrors the app).
|
|
46
|
+
* `amount` is in integer centimes and defaults to the full credit-note total.
|
|
47
|
+
*/
|
|
48
|
+
refund(id: string, params?: {
|
|
49
|
+
amount?: number;
|
|
50
|
+
method?: PaymentMethod;
|
|
51
|
+
refundedAt?: string;
|
|
52
|
+
}, options?: RequestOptions): Promise<{
|
|
53
|
+
id: string;
|
|
54
|
+
object: 'refund';
|
|
55
|
+
creditNoteId: string;
|
|
56
|
+
invoiceId: string;
|
|
57
|
+
amount: number;
|
|
58
|
+
}>;
|
|
59
|
+
getPdf(id: string): Promise<DocumentUrlResponse | JobResponse>;
|
|
60
|
+
/** Factur-X PDF/A-3 with embedded XML. URL or async job. */
|
|
61
|
+
getFacturx(id: string): Promise<DocumentUrlResponse | JobResponse>;
|
|
62
|
+
/** Raw CII or UBL XML. */
|
|
63
|
+
getXml(id: string, format?: 'cii' | 'ubl'): Promise<string>;
|
|
64
|
+
}
|