declare class Zibal { constructor(config: Zibal.Config); readonly merchant: string; readonly callbackUrl?: string; readonly timeout: number; update(config?: Partial>): this; /** @deprecated Use update({ merchant }) instead. */ setMerchant(merchant: string): this; /** @deprecated Use update(config) instead. */ init(config: Omit): this; request(payload: Zibal.RequestPayload): Promise; verify(payload: Zibal.VerifyPayload): Promise; static Zibal: typeof Zibal; static errors: { ZibalError: typeof Zibal.ZibalError; ZibalValidationError: typeof Zibal.ZibalValidationError; ZibalApiError: typeof Zibal.ZibalApiError; ZibalNetworkError: typeof Zibal.ZibalNetworkError; ZibalTimeoutError: typeof Zibal.ZibalTimeoutError; ZibalAbortError: typeof Zibal.ZibalAbortError; ZibalHttpError: typeof Zibal.ZibalHttpError; ZibalResponseError: typeof Zibal.ZibalResponseError; ZibalIntegrityError: typeof Zibal.ZibalIntegrityError; }; static getPersianMessage(result?: number): string; static getPersianStatus(status?: number): string; } declare namespace Zibal { interface FetchResponse { ok: boolean; status: number; text(): Promise; } type FetchImplementation = ( url: string, init: { method: "POST"; headers: Record; body: string; signal: AbortSignal; }, ) => Promise; interface Config { merchant: string; callbackUrl?: string; timeout?: number; fetch?: FetchImplementation; } interface RequestPayload { amount: number; callbackUrl?: string; merchant?: string; orderId?: string | number; mobile?: string; multiplexingInfos?: unknown[]; description?: string; allowedCards?: string[]; nationalCode?: string; checkMobileWithCard?: boolean; linkToPay?: boolean; sms?: boolean; percentMode?: 0 | 1; feeMode?: 0 | 1; signal?: AbortSignal; } interface VerifyPayload { merchant?: string; trackId: number | string; expectedAmount: number; expectedOrderId?: string | number; signal?: AbortSignal; } interface BaseResponse { result: number; success: true; persianMessage: string; message?: string; amount?: number; orderId?: string | number; [key: string]: unknown; } interface RequestResponse extends BaseResponse { trackId: number | string; paymentUrl: string; } interface VerifyResponse extends BaseResponse { paidAt?: string; cardNumber?: string; status: 1; amount: number; refNumber?: number | string; description?: string; orderId?: string | number; multiplexingInfos?: unknown[]; } interface ErrorOptions { cause?: unknown; code?: string; details?: Record; } class ZibalError extends Error { constructor(message: string, options?: ErrorOptions); code?: string; details?: Record; cause?: unknown; toJSON(): Record; } class ZibalValidationError extends ZibalError {} class ZibalApiError extends ZibalError {} class ZibalNetworkError extends ZibalError {} class ZibalTimeoutError extends ZibalNetworkError {} class ZibalAbortError extends ZibalNetworkError {} class ZibalHttpError extends ZibalError {} class ZibalResponseError extends ZibalError {} class ZibalIntegrityError extends ZibalError {} } export = Zibal;