UNPKG

asaaas

Version:

Unofficial Asaas Payment Gateway SDK

53 lines (52 loc) 2.07 kB
import { InvoicesWebhook } from '@/enums/InvoicesWebhook'; import { PaymentsWebhook } from '@/enums/PaymentsWebhook'; import { IAsaasPagination, IAsaasPaymentResponse } from '@/types/AsaasTypes'; import { IInvoiceResponse } from '@/types/InvoiceTypes'; import { IBillResponse } from '@/types/BillTypes'; import { AccountStatusWebhook, BillWebhook, PhoneRechargeWebhook, ReceivableWebhook, TransferWebhook } from '@/enums'; import { ITransferResponse } from './TransferTypes'; import { IAccountStatus } from './AccountTypes'; export type WebhookSendType = 'SEQUENTIALLY' | 'NON_SEQUENTIALLY'; export interface ICreateWebhookParams { name: string; url: string; email: string; sendType: WebhookSendType; enabled?: boolean; interrupted?: boolean; authToken?: string; events: (AccountStatusWebhook | BillWebhook | InvoicesWebhook | PaymentsWebhook | PhoneRechargeWebhook | ReceivableWebhook | TransferWebhook)[]; } export type IUpdateWebhookParams = ICreateWebhookParams; export interface IWebhookResponse extends ICreateWebhookParams { id: string; } export type IListWebhooksResponse = IAsaasPagination<IWebhookResponse>; interface IAsaasWebhookBase { id: string; dateCreated: string; } export interface IAsaasWebhookAccountStatus extends IAsaasWebhookBase { event: AccountStatusWebhook; accountStatus: IAccountStatus; } export interface IAsaasWebhookBill extends IAsaasWebhookBase { event: BillWebhook; bill: IBillResponse; } export interface IAsaasWebhookTransfer extends IAsaasWebhookBase { event: TransferWebhook; bill: ITransferResponse; } export interface IAsaasWebhookPayment extends IAsaasWebhookBase { event: PaymentsWebhook; payment: IAsaasPaymentResponse & { subscription?: string; }; } export interface IAsaasWebhookInvoice extends IAsaasWebhookBase { event: InvoicesWebhook; invoice: IInvoiceResponse; } export type IAsaasWebhook = IAsaasWebhookAccountStatus | IAsaasWebhookBill | IAsaasWebhookTransfer | IAsaasWebhookPayment | IAsaasWebhookInvoice; export {};