/** * @module Resources/Charges */ import { AuthParams, PollData, PollParams, SendData } from "../api/RestAPI.js"; import { PaymentError } from "../errors/APIError.js"; import { ProcessingMode } from "./common/enums.js"; import { Metadata, WithStoreMerchantName } from "./common/types.js"; import { CaptureStatus } from "./Captures.js"; import { CRUDAOSItemsResponse, CRUDPaginationParams, CRUDResource } from "./CRUDResource.js"; import { PaymentType, TransactionTokenType } from "./TransactionTokens.js"; export declare enum ChargeStatus { PENDING = "pending", SUCCESSFUL = "successful", FAILED = "failed", ERROR = "error", CANCELED = "canceled", AWAITING = "awaiting", AUTHORIZED = "authorized" } export type ChargeExpiry = { id: string; chargeId: string; expirationDate: string; extensionCount: number; createdOn: string; updatedOn: string; }; export type ChargesListParams = CRUDPaginationParams & { metadata?: string; }; export declare enum ChargeThreeDsMode { NORMAL = "normal",// default FORCE = "force", SKIP = "skip", IF_AVAILABLE = "if_available", REQUIRE = "require", PROVIDED = "provided" } export type ChargeThreeDsIssuerToken = { issuerToken: string; callMethod: "http_post" | "http_get"; payload: Record; paymentType: PaymentType; contentType: string; }; export interface ChargeCreateParams { transactionTokenId: string; amount: number; currency: string; captureAt?: string | number; capture?: boolean; descriptor?: string; ignoreDescriptorOnError?: boolean; onlyDirectCurrency?: boolean; redirect?: { endpoint: string; }; feeAmount?: number | null; feeCurrency?: string | null; threeDs?: { mode?: ChargeThreeDsMode; redirectEndpoint?: string; redirectId?: string; }; /** * Pricing token jwt */ mcpToken?: string; /** * IP address override for backend usage in order to identify the user */ ipAddress?: string; /** * Metadata or stringified JSON object */ metadata?: T | string; } export type ChargeIssuerTokenGetParams = void; export declare enum ChargeType { NORMAL = "normal", CVV_AUTH = "cvv_auth" } export interface ChargeItem { id: string; merchantId: string; storeId: string; mode: ProcessingMode; transactionTokenType: TransactionTokenType; status: ChargeStatus; createdOn: string; descriptor: string; onlyDirectCurrency: boolean; requestedAmount: number; requestedCurrency: string; requestedAmountFormatted: number; chargedAmount: number; chargedCurrency: string; chargedAmountFormatted: number; threeDs?: { mode?: ChargeThreeDsMode; redirectEndpoint?: string; redirectId?: string; }; mcpTokenId?: string; ledgerId?: string; subscriptionId?: string; captureAt?: string; captureStatus?: CaptureStatus; error?: PaymentError; transactionTokenId?: string; redirect?: { redirectId?: string; }; feeAmount?: number | null; feeCurrency?: string | null; feeAmountFormatted?: string | null; metadata?: T; type?: ChargeType; } export interface IssuerTokenItem { issuerToken: string; callMethod: "http_get" | "http_post" | "sdk"; } export type ChargeListItem = WithStoreMerchantName>; export type ResponseCharge = ChargeItem; export type ResponseCharges = CRUDAOSItemsResponse>; export type ResponseIssuerToken = IssuerTokenItem; export declare class Charges extends CRUDResource { static requiredParams: string[]; static routeBase: string; private _list?; list(data?: SendData, auth?: AuthParams, storeId?: string): Promise>; create(data: SendData, auth?: AuthParams): Promise>; private _get?; get(storeId: string | null, id: string | null, data?: SendData, auth?: AuthParams): Promise>; private _getIssuerToken?; getIssuerToken(storeId: string, chargeId: string, data?: SendData, auth?: AuthParams): Promise; poll(storeId: string, id: string, data?: SendData, auth?: AuthParams, pollParams?: Partial>>): Promise>; private _expiry?; expiry(id: string, data?: SendData | null, auth?: AuthParams | null, storeId?: string): Promise; private _threeDsIssuerToken?; threeDsIssuerToken(storeId: string, id: string, auth?: AuthParams): Promise; }