UNPKG

bitpay-sdk

Version:

Complete version of the NodeJS library for the new cryptographically secure BitPay API

111 lines (110 loc) 4.53 kB
import { Facade } from '../Facade'; import { Invoice, InvoiceInterface } from '../Model'; import { InvoiceEventTokenInterface } from '../Model/Invoice/InvoiceEventToken'; import { TokenContainer } from '../TokenContainer'; import { GuidGenerator } from '../util/GuidGenerator'; import { BitPayClient } from './BitPayClient'; export declare class InvoiceClient { private bitPayClient; private tokenContainer; private guidGenerator; constructor(bitPayClient: BitPayClient, tokenContainer: TokenContainer, guidGenerator: GuidGenerator); /** * Create a BitPay invoice. * * @param invoice An Invoice object with request parameters defined * @param facade The facade used to create it. * @param signRequest Signed request. * @returns Invoice * @throws BitPayApiException BitPayApiException class * @throws BitPayGenericException BitPayGenericException class */ create(invoice: Invoice, facade: Facade, signRequest: boolean): Promise<InvoiceInterface>; /** * Retrieve a BitPay invoice by invoice id using the specified facade. The client must have been previously * authorized for the specified facade (the public facade requires no authorization). * * @param invoiceId The id of the invoice to retrieve. * @param facade The facade used to create it. * @param signRequest Signed request. * @returns Invoice * @throws BitPayApiException BitPayApiException class * @throws BitPayGenericException BitPayGenericException class */ get(invoiceId: string, facade: Facade, signRequest: boolean): Promise<InvoiceInterface>; /** * @param guid * @param facade * @param signRequest * @returns Invoice * @throws BitPayApiException BitPayApiException class * @throws BitPayGenericException BitPayGenericException class */ getByGuid(guid: string, facade: Facade, signRequest: boolean): Promise<InvoiceInterface>; /** * Retrieve a collection of BitPay invoices. * * @param params * @returns Invoice[] * @throws BitPayApiException BitPayApiException class * @throws BitPayGenericException BitPayGenericException class */ getInvoices(params: object): Promise<InvoiceInterface[]>; /** * * @param invoiceId * @returns */ getInvoiceEventToken(invoiceId: string): Promise<InvoiceEventTokenInterface>; /** * Update a BitPay invoice. * * @param invoiceId The id of the invoice to updated. * @param params * @returns Invoice * @throws BitPayApiException BitPayApiException class * @throws BitPayGenericException BitPayGenericException class */ update(invoiceId: string, params: object): Promise<InvoiceInterface>; /** * Pay an invoice with a mock transaction * * @param invoiceId The id of the invoice. * @param status Status the invoice will become. Acceptable values are confirmed (default) and complete. * @returns Invoice Invoice object. * @throws BitPayApiException BitPayApiException class * @throws BitPayGenericException BitPayGenericException class */ pay(invoiceId: string, status: string): Promise<InvoiceInterface>; /** * Cancel a BitPay invoice. * * @param invoiceId The id of the invoice to updated. * @param forceCancel * @returns Invoice Cancelled invoice object. * @throws BitPayApiException BitPayApiException class * @throws BitPayGenericException BitPayGenericException class */ cancel(invoiceId: string, forceCancel: boolean): Promise<InvoiceInterface>; /** * Cancel a BitPay invoice. * * @param guid The guid of the invoice to cancel. * @param forceCancel * @returns Invoice Cancelled invoice object. * @throws BitPayApiException BitPayApiException class * @throws BitPayGenericException BitPayGenericException class */ cancelByGuid(guid: string, forceCancel: boolean): Promise<InvoiceInterface>; /** * Request a BitPay Invoice Webhook. * * @param invoiceId A BitPay invoice ID. * @param invoiceToken The resource token for the invoiceId. * This token can be retrieved from the Bitpay's invoice object. * @returns boolean * @throws BitPayApiException BitPayApiException class * @throws BitPayGenericException BitPayGenericException class */ requestInvoiceWebhookToBeResent(invoiceId: string, invoiceToken: string): Promise<boolean>; }