UNPKG

quivio-transaction-processor

Version:

React Native hook for Card payment integration with DataCap

54 lines (48 loc) 1.55 kB
export const EVENT_NAMES = [ 'onError', 'onCardReadSuccessfully', 'onSaleTransactionCompleted', 'onRecurringSaleCompleted', 'onReplaceCardCompleted', 'onClientVersionCompleted', 'onShowMessage', 'onConfigError', 'onConfigPingFailed', 'onConfigPingSuccess', 'onConfigCompleted', ] as const; export type EMVEventName = typeof EVENT_NAMES[number]; export interface CallbackLog { type: string; payload: any; timestamp: number; } export interface EMVPaymentHook { logs: CallbackLog[]; isDeviceConnected: boolean; loading: boolean; isInitialized: boolean; handleCardPayment: (amount: string) => void; handleInHousePayment: () => void; runRecurringTransaction: (amount: string) => void; replaceCardInRecurring: () => void; getClientVersion: () => void; setupConfig: () => void; pingConfig: () => void; clearTransactionListener: () => void; clearAllTransactions: () => void; cancelOperation: () => void; initializeEMV: (config: EMVConfig) => void; EVENTS: Record<EMVEventName, EMVEventName>; subscribeToEvent: (eventName: EMVEventName, callback: (payload: any) => void) => void; unsubscribeFromEvent: (eventName: EMVEventName, callback: (payload: any) => void) => void; } export interface PaymentContextType extends EMVPaymentHook { } export interface EMVConfig { merchantID: string; onlineMerchantID: string; isSandBox: boolean; secureDeviceName: string; operatorID: string; posPackageID: string; }