pix-client
Version:
Uma lib para facilitar o uso da API do mercado pago para pagamentos via PIX
66 lines (65 loc) • 2.7 kB
TypeScript
import EventEmitter from 'events';
import { Payment } from 'mercadopago';
import { PixClient } from '../PixClient/index.js';
import { QRCode } from '../QRCode/index.js';
import { PaymentStatusType, type PaymentEvents, type PixPaymentOptions } from './types.js';
export declare class PixPayment extends EventEmitter<PaymentEvents> {
pixClient: PixClient;
mpPayment: Payment;
description: string | undefined;
transactionAmount: number;
durationMinutes: number;
payerEmail: string;
status: PaymentStatusType;
id: string | null;
qrCode: QRCode;
webhookCallback: ((id?: string) => void) | null;
expireTimeout?: ReturnType<typeof setTimeout> | null;
constructor(pixClient: PixClient, options: PixPaymentOptions);
get isComplete(): boolean;
get statusObject(): {
readonly type: "pending";
readonly title: "Aguardando";
readonly description: "O usuário ainda não concluiu o processo de pagamento...";
} | {
readonly type: "approved";
readonly title: "Aprovado";
readonly description: "O pagamento foi aprovado e creditado com sucesso.";
} | {
readonly type: "authorized";
readonly title: "Autorizado";
readonly description: "O pagamento foi autorizado, mas ainda não foi capturado.";
} | {
readonly type: "in_process";
readonly title: "Em Análise";
readonly description: "O pagamento está em análise.";
} | {
readonly type: "in_mediation";
readonly title: "Em Mediação";
readonly description: "O usuário iniciou uma disputa.";
} | {
readonly type: "rejected";
readonly title: "Rejeitado";
readonly description: "O pagamento foi rejeitado (o usuário pode tentar pagar novamente).";
} | {
readonly type: "cancelled";
readonly title: "Cancelado";
readonly description: "O pagamento foi cancelado por uma das partes ou expirou.";
} | {
readonly type: "refunded";
readonly title: "Reembolsado";
readonly description: "O pagamento foi reembolsado ao usuário.";
} | {
readonly type: "charged_back";
readonly title: "Estornado";
readonly description: "Um chargeback foi aplicado no cartão de crédito do comprador.";
};
generate(): Promise<this>;
addWebhookListener(): void;
removeWebhookListener(): void;
startExpirationTimeout(): void;
updateStatus(): Promise<void>;
getStatus(): Promise<"pending" | "approved" | "authorized" | "in_process" | "in_mediation" | "rejected" | "cancelled" | "refunded" | "charged_back">;
cancel(): Promise<void>;
cleanup(): void;
}