facturapi
Version:
Librería oficial de Facturapi. Crea CFDIs timbrados y enviados al SAT, XML y PDF
58 lines (57 loc) • 1.98 kB
TypeScript
import { GenericResponse, Invoice, Receipt, SearchResult, SendEmailBody } 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>;
/**
* 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<NodeJS.ReadableStream | Blob>;
}