/** * @module Resources/TransactionTokens */ import { PaymentError } from "../errors/APIError.js"; import { AuthParams, SendData } from "../api/RestAPI.js"; import { BankTransferBrand, CardBrand, CardCategory, CardSubBrand, CardType, OnlineBrand, OnlineGateway, ProcessingMode, QRBrand, QRGateway } from "./common/enums.js"; import { Metadata, PhoneNumber, WithStoreMerchantName } from "./common/types.js"; import { CRUDAOSItemsResponse, CRUDPaginationParams, CRUDResource } from "./CRUDResource.js"; export declare enum TokenThreeDsMode { NORMAL = "normal",// default FORCE = "force", SKIP = "skip", IF_AVAILABLE = "if_available" } export type TokenThreeDsIssuerToken = { issuerToken: string; callMethod: "http_post" | "http_get"; payload: Record; paymentType: PaymentType; contentType: string; }; export declare enum UsageLimit { DAILY = "daily", WEEKLY = "weekly", MONTHLY = "monthly", ANNUALLY = "annually" } export declare enum PaymentType { CARD = "card", QR_SCAN = "qr_scan", KONBINI = "konbini", APPLE_PAY = "apple_pay", PAIDY = "paidy", QR_MERCHANT = "qr_merchant", ONLINE = "online", BANK_TRANSFER = "bank_transfer" } export declare enum ConvenienceStore { SEVEN_ELEVEN = "seven_eleven", FAMILY_MART = "family_mart", LAWSON = "lawson", MINI_STOP = "mini_stop", SEICO_MART = "seico_mart", PAY_EASY = "pay_easy", CIRCLE_K = "circle_k", SUNKUS = "sunkus", DAILY_YAMAZAKI = "daily_yamazaki", YAMAZAKI_DAILY_STORE = "yamazaki_daily_store" } export declare enum TransactionTokenType { ONE_TIME = "one_time", SUBSCRIPTION = "subscription", RECURRING = "recurring" } export declare enum RecurringTokenPrivilege { NONE = "none", BOUNDED = "bounded", INFINITE = "infinite" } export declare enum CvvAuthorizedStatus { PENDING = "pending", FAILED = "failed", CURRENT = "current", INACTIVE = "inactive" } export declare enum OnlineCallMethod { HTTP_GET = "http_get", HTTP_GET_MOBILE = "http_get_mobile", HTTP_POST = "http_post", SDK = "sdk", WEB = "web", APP = "app" } export declare enum OSType { IOS = "ios", ANDROID = "android" } export declare enum ThreeDsStatus { SUCCESSFUL = "successful", FAILED = "failed", ERROR = "error", AWAITING = "awaiting", PENDING = "pending" } export interface TransactionTokenCardData { cardholder: string; cardNumber: string; expMonth: number | string; expYear: number | string; cvv: string; line1?: string; line2?: string; state?: string; city?: string; country?: string; zip?: string; phoneNumber?: PhoneNumber; cvvAuthorize?: { enabled: boolean; status: CvvAuthorizedStatus; chargeId?: string; credentialsId?: string; currency?: string; }; threeDs?: { enabled: boolean; status: ThreeDsStatus; error?: PaymentError; exempted?: boolean; }; } export interface TransactionTokenQRScanData { scannedQR: string; } export interface TransactionTokenConvenienceData { customerName: string; convenienceStore: ConvenienceStore; phoneNumber: PhoneNumber; /** * Time with Time Zone. * HH:mm:ss.SSSZ (e.g: 09:00:00.000+09:00) */ expirationTimeShift?: string; /** * Interval (e.g P7D) */ expirationPeriod?: string; } export interface TransactionTokenOnlineData { brand: OnlineBrand; callMethod?: OnlineCallMethod; userIdentifier?: string; /** @deprecated Use `brand` instead */ gateway?: OnlineGateway; } export interface TransactionTokenPaidyData { paidyToken: string; phoneNumber?: PhoneNumber; shippingAddress: TransactionTokenPaidyBilling; } export type TransactionTokenBankTransferData = { accountHolderName: string | null; accountId: string | null; accountNumber: string | null; bankCode: string; bankName: string; branchCode: string | null; branchName: string | null; brand: BankTransferBrand; /** * Time with Time Zone. * HH:mm:ss.SSSZ (e.g: 09:00:00.000+09:00) */ expirationTimeShift?: string; /** * Interval (e.g P7D) */ expirationPeriod?: string; }; export type TransactionTokenBankTransferCreateData = { brand: BankTransferBrand; /** * Time with Time Zone. * HH:mm:ss.SSSZ (e.g: 09:00:00.000+09:00) */ expirationTimeShift?: string; /** * Interval (e.g P7D) */ expirationPeriod?: string; }; export interface TransactionTokenCreateParams { paymentType: PaymentType; type: TransactionTokenType; email?: string; usageLimit?: UsageLimit; data: TransactionTokenCardData | TransactionTokenQRScanData | TransactionTokenConvenienceData | TransactionTokenOnlineData | TransactionTokenPaidyData | TransactionTokenBankTransferCreateData; useConfirmation?: boolean; threeDs?: { mode?: TokenThreeDsMode; redirectEndpoint?: string; redirectId?: string; }; /** * Metadata or stringified JSON object */ metadata?: string | Metadata; } export interface TransactionTokenListParams extends CRUDPaginationParams { customerId?: string; type?: TransactionTokenType; search?: string; mode?: ProcessingMode; paymentType?: PaymentType; /** * Requires secret * id of the token that was replaced by the current token using the renew/replace routes */ previousTransactionTokenId?: string; } export interface TransactionTokenUpdateParams { email?: string; data?: { cvv?: string; cvvAuthorize?: { enabled: boolean; }; cardholder?: string; line1?: string; line2?: string; state?: string; city?: string; country?: string; zip?: string; phoneNumber?: { countryCode?: string; localNumber?: string; }; expirationPeriod?: string; expirationTimeShift?: string; }; /** * Metadata or stringified JSON object */ metadata?: string | Metadata; } export type TransactionTokenRenewParams = { data?: { email?: string; cardholder: string; expMonth: number | string; expYear: number | string; line1?: string; line2?: string; state?: string; city?: string; country?: string; zip?: string; phoneNumber?: { countryCode?: string; localNumber?: string; }; }; }; export interface TransactionTokenConfirmParams { confirmationCode: string; } export interface TransactionTokenCardDetails { cardholder: string; expMonth: number; expYear: number; lastFour: string; brand: CardBrand; cardType?: CardType; country?: string; subBrand?: CardSubBrand; issuer?: string; category?: CardCategory; cardBin?: string; } export interface TransactionTokenPaidyBilling { line1?: string; line2?: string; city?: string; state?: string; zip: string; } export interface TransactionTokenCardBilling { line1?: string; line2?: string; state?: string; city?: string; country?: string; zip?: string; phoneNumber?: PhoneNumber; } export interface TransactionTokenBase { cvvAuthorize?: { enabled: boolean; status: CvvAuthorizedStatus; chargeId?: string; credentialsId: string; currency?: string; }; threeDs?: { enabled: boolean; status: ThreeDsStatus; error?: PaymentError; exempted?: boolean; }; } export interface TransactionTokenCardDataItem extends TransactionTokenBase { card?: TransactionTokenCardDetails; billing?: TransactionTokenCardBilling; } export interface TransactionTokenQRScanDataItem extends TransactionTokenBase { brand: QRBrand; gateway?: QRGateway; } export interface TransactionTokenOnlineDataItem extends TransactionTokenBase { brand: OnlineBrand; /** @deprecated Use `brand` instead */ gateway?: OnlineGateway; } export interface TransactionTokenConvenienceDataItem extends TransactionTokenBase { convenienceStore?: ConvenienceStore; customerName?: string; expirationPeriod?: string; expirationTimeShift?: string; phoneNumber?: PhoneNumber; } export interface TransactionTokenItem { active: boolean; id: string; storeId: string; email: string; mode: ProcessingMode; createdOn: string; lastUsedOn: string; type: TransactionTokenType; paymentType: PaymentType; usageLimit?: UsageLimit; confirmed?: boolean; previousId?: string; data?: TransactionTokenData & { cvvAuthorize?: { status: CvvAuthorizedStatus; }; threeDs?: { enabled: boolean; status: ThreeDsStatus; mode?: TokenThreeDsMode; redirectEndpoint?: string; redirectId?: string; error?: PaymentError; exempted?: boolean; }; }; metadata?: T; } export type TransactionTokenListItem = WithStoreMerchantName>; export type ResponseTransactionToken = TransactionTokenItem; export type ResponseTransactionTokens = CRUDAOSItemsResponse>; export declare class TransactionTokens extends CRUDResource { static requiredParams: string[]; static routeBase: string; create(data: SendData, auth?: AuthParams): Promise>; private _get?; get(storeId: string | null, id: string | null, data?: SendData | null, auth?: AuthParams): Promise>; private _list?; list(data?: SendData | null, auth?: AuthParams | null, storeId?: string): Promise>; private _update?; update(storeId: string | null, id: string | null, data?: SendData | null, auth?: AuthParams): Promise>; private _renew?; renew(storeId: string, id: string, data: SendData, auth?: AuthParams): Promise & { previousId: string; }>; private _delete?; delete(storeId: string | null, id: string | null, data?: SendData | null, auth?: AuthParams): Promise; private _confirm?; confirm(storeId: string, id: string, data: SendData, auth?: AuthParams): Promise; private _threeDsIssuerToken?; threeDsIssuerToken(storeId: string, id: string, auth?: AuthParams): Promise; private _enableThreeDs?; enableThreeDs(storeId: string, id: string, auth?: AuthParams): Promise>; private _disableThreeDs?; disableThreeDs(storeId: string, id: string, auth?: AuthParams): Promise>; }