@trowdev/juno-pix-bacen
Version:
Lib para gerar pagamentos com a API do BCB ou com a API do Juno
68 lines (67 loc) • 1.92 kB
TypeScript
declare type JunoPixParams = {
clientId: string;
clientSecret: string;
resourceToken: string;
};
declare type JunoPixCharge = {
calendario: {
expiracao: number;
};
devedor: {
cpf?: string;
cnpj?: string;
nome: string;
};
valor: {
original: string;
};
chave: string;
solicitacaoPagador: string;
infoAdicionais: JuniPixChargeInfoAdd[];
};
declare type JuniPixChargeInfoAdd = {
nome: string;
valor: string;
};
declare type JunoPixEventType = 'CHARGE_STATUS_CHANGED' | 'TRANSFER_STATUS_CHANGED' | 'PAYMENT_NOTIFICATION' | 'P2P_TRANSFER_STATUS_CHANGED';
export interface JunoPixHeader {
'Content-Type': string;
'Authorization': string;
'X-API-Version': number;
'X-Resource-Token': string;
'X-Idempotency-Key'?: string;
}
export interface JunoWebhooks {
id: string;
url: string;
secret: string;
status: string;
eventTypes: JunoWebhookEventType[];
}
export interface JunoWebhookEventType {
id: string;
name: string;
label: string;
status: string;
}
export declare function JunoPIX({ clientId, clientSecret, resourceToken }: JunoPixParams): {
webhook: () => Promise<{
create: (url: string, eventTypes: JunoPixEventType[]) => Promise<any>;
findByEventType: (event: JunoPixEventType) => Promise<JunoWebhookEventType | undefined>;
list: (ignoreError?: boolean | undefined) => Promise<JunoWebhooks[]>;
}>;
charge: () => Promise<{
create: (dados: JunoPixCharge) => Promise<any>;
info: (txId: string) => Promise<{
txId: any;
status: any;
calendario: any;
valor: any;
referencia: any;
}>;
pix: (txId: string) => Promise<{
pixDados: string;
}>;
}>;
};
export {};