UNPKG

pancake-client-sdk

Version:
104 lines 2.88 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EInvoiceResource = void 0; const base_1 = require("./base"); class EInvoiceResource extends base_1.BaseResource { /** * Get list of invoices */ async list(params) { return this.client.get(this.getShopPath('/einvoices'), params); } /** * Get invoice by ID */ async getById(invoiceId) { return this.client.get(this.getShopPath(`/einvoices/${invoiceId}`)); } /** * Create new invoice */ async create(data) { return this.client.post(this.getShopPath('/einvoices'), data); } /** * Update invoice */ async update(invoiceId, data) { return this.client.put(this.getShopPath(`/einvoices/${invoiceId}`), data); } /** * Sign invoice */ async sign(invoiceId) { return this.client.post(this.getShopPath(`/einvoices/${invoiceId}/sign`), {}); } /** * Cancel invoice */ async cancel(invoiceId, reason) { return this.client.post(this.getShopPath(`/einvoices/${invoiceId}/cancel`), { reason }); } /** * Send invoice to customer */ async send(invoiceId, data) { return this.client.post(this.getShopPath(`/einvoices/${invoiceId}/send`), data); } /** * Get invoice PDF */ async getPDF(invoiceId, template) { return this.client.get(this.getShopPath(`/einvoices/${invoiceId}/pdf`), { template }); } /** * Get invoice XML */ async getXML(invoiceId) { return this.client.get(this.getShopPath(`/einvoices/${invoiceId}/xml`)); } /** * List invoice templates */ async listTemplates() { return this.client.get(this.getShopPath('/einvoice-templates')); } /** * Get invoice statistics */ async getStats(params) { return this.client.get(this.getShopPath('/einvoices/stats'), params); } /** * Get invoices by order */ async getByOrder(orderId) { return this.client.get(this.getShopPath(`/orders/${orderId}/einvoices`)); } /** * Validate invoice data */ async validate(data) { return this.client.post(this.getShopPath('/einvoices/validate'), data); } /** * Get invoice numbering sequence */ async getNextNumber(series) { return this.client.get(this.getShopPath('/einvoices/next-number'), { series }); } /** * Get invoice settings */ async getSettings() { return this.client.get(this.getShopPath('/einvoice-settings')); } /** * Update invoice settings */ async updateSettings(settings) { return this.client.put(this.getShopPath('/einvoice-settings'), settings); } } exports.EInvoiceResource = EInvoiceResource; //# sourceMappingURL=einvoice.js.map