facturapi
Version:
SDK oficial de Facturapi para Node.js y navegadores. Integra facturación electrónica en México (CFDI) de forma simple y obtén una perspectiva fiscal completa de tu operación, con búsquedas indexadas, envío de documentos y trazabilidad.
71 lines (70 loc) • 2.64 kB
TypeScript
import { BinaryDownload, GenericResponse, Invoice, ReceiptsToInvoiceInput, Receipt, SearchResult, SendEmailBody, PreviewReceiptsToInvoicePdfInput } from '../types';
import { WrapperClient } from '../wrapper';
export default class Receipts {
client: WrapperClient;
constructor(client: WrapperClient);
/**
* Creates a new receipt
* @param data Receipt data
* @returns Receipt object
*/
create(data: Record<string, any>): Promise<Receipt>;
/**
* Gets a paginated list of receipts that belong to your organization
* @param params Search parameters
* @returns Search results object. The object contains a `data` property with the list of receipts.
*/
list(params?: Record<string, any> | null): Promise<SearchResult<Receipt>>;
/**
* Gets a single receipt object
* @param id Receipt Id
* @returns Receipt object
*/
retrieve(id: string): Promise<Receipt>;
/**
* Creates an invoice for this receipt
* @param id Receipt Id
* @param data Invoice data
* @returns Invoice object
*/
invoice(id: string, data: Record<string, any>): Promise<Invoice>;
/**
* Creates a global invoice for open receipts
* @param data
* @returns
*/
createGlobalInvoice(data: Record<string, any>): Promise<Invoice>;
/**
* Creates an invoice from multiple receipts by key.
* Supports dry-run summaries when `dry_run` is true.
* @param data Receipts to-invoice request data
* @returns Invoice object or dry-run summary
*/
toInvoice(data: ReceiptsToInvoiceInput): Promise<Invoice>;
/**
* Generates a PDF preview for a receipts-to-invoice request before stamping.
* @param data Receipts-to-invoice preview data
* @returns PDF file in a stream (Node.js) or Blob (browser)
*/
previewToInvoicePdf(data: PreviewReceiptsToInvoicePdfInput): Promise<BinaryDownload>;
/**
* Marks a receipt as canceled. The receipt won't be available for invoicing anymore.
* @param id
* @returns
*/
cancel(id: string): Promise<Receipt>;
/**
* Sends the receipt to the customer's email
* @param id Receipt Id
* @param data Additional arguments
* @param data.email Email address to send the receipt to
* @returns Email sent confirmation
*/
sendByEmail(id: string, data?: SendEmailBody): Promise<GenericResponse>;
/**
* Downloads the specified receipt in PDF format
* @param id Receipt Id
* @returns PDF file in a stream (Node.js) or Blob (browser)
*/
downloadPdf(id: string): Promise<BinaryDownload>;
}