quivio-transaction-processor 1.23.2-beta → 1.23.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/emvPaymentProvider/EMVPaymentProvider.js +63 -144
- package/dist/emvPaymentProvider/EMVPaymentProvider.js.map +1 -1
- package/dist/emvPaymentProvider/types.d.ts +2 -5
- package/dist/example/EMVPaymentScreen.d.ts +1 -4
- package/dist/example/EMVPaymentScreen.js +8 -101
- package/dist/example/EMVPaymentScreen.js.map +1 -1
- package/dist/example/EMVSettingsScreen.js +6 -4
- package/dist/example/EMVSettingsScreen.js.map +1 -1
- package/dist/example/ExternalSystemsScreen.js +3 -123
- package/dist/example/ExternalSystemsScreen.js.map +1 -1
- package/dist/example/MainScreen.js +1 -1
- package/dist/example/MainScreen.js.map +1 -1
- package/libs/emvCardReaderLib/src/main/java/com/rohan/emvcardreaderlib/POSTransactionExecutor.kt +25 -29
- package/libs/emvCardReaderLib/src/main/java/com/rohan/emvcardreaderlib/builder/DsiEMVRequestBuilder.kt +7 -14
- package/libs/emvCardReaderLib/src/main/java/com/rohan/emvcardreaderlib/manager/EMVPaymentManager.kt +20 -28
- package/libs/emvNative/src/main/java/com/quivio_transaction_processor/EMVPaymentManagerModule.kt +7 -16
- package/package.json +1 -1
- package/src/emvPaymentProvider/EMVPaymentProvider.tsx +64 -105
- package/src/emvPaymentProvider/types.ts +2 -5
- package/src/example/EMVPaymentScreen.tsx +18 -75
- package/src/example/EMVSettingsScreen.tsx +5 -3
- package/src/example/ExternalSystemsScreen.tsx +27 -116
- package/src/example/MainScreen.tsx +1 -1
- package/dist/example/helper/deviceStore.d.ts +0 -11
- package/dist/example/helper/deviceStore.js +0 -37
- package/dist/example/helper/deviceStore.js.map +0 -1
- package/src/example/helper/deviceStore.ts +0 -40
|
@@ -34,21 +34,9 @@ const EMVPaymentProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
34
34
|
'onTransactionCancelled',
|
|
35
35
|
];
|
|
36
36
|
|
|
37
|
-
// Initialization Flag
|
|
38
|
-
const [isLibraryInitialized, setIsInitialzed] = useState(false);
|
|
39
|
-
|
|
40
37
|
// Device Connected State
|
|
41
38
|
const { isDeviceConnected } = useUSBDevice();
|
|
42
39
|
|
|
43
|
-
const [deviceSerialNumber, setDeviceSerialNumber] = useState('');
|
|
44
|
-
|
|
45
|
-
// Buffered Device Connection Flag
|
|
46
|
-
const [isIDTECHConnected, setIDTECHConnected] = useState(isDeviceConnected);
|
|
47
|
-
|
|
48
|
-
const disconnectTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(
|
|
49
|
-
null,
|
|
50
|
-
);
|
|
51
|
-
|
|
52
40
|
// Show Display Message Cache
|
|
53
41
|
const [displayMessage, setDisplayMessage] = useState('');
|
|
54
42
|
|
|
@@ -74,59 +62,55 @@ const EMVPaymentProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
74
62
|
Map<EMVEventName, Set<(payload: any) => void>>
|
|
75
63
|
>(new Map());
|
|
76
64
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
65
|
+
// Ref to maintain timeout during configuration
|
|
66
|
+
// Because after a successfull EMVParamDownload
|
|
67
|
+
// Device reboots which leads to USB disconnection
|
|
68
|
+
// and connection
|
|
69
|
+
const unconfigureTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(
|
|
70
|
+
null,
|
|
71
|
+
);
|
|
83
72
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}, [deviceSerialNumber]);
|
|
73
|
+
// Ref to maintain device connection/disconnection
|
|
74
|
+
const isDeviceConnectedRef = useRef<boolean>(isDeviceConnected);
|
|
87
75
|
|
|
88
76
|
useEffect(() => {
|
|
89
|
-
//
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
// If device connects -> update immediately
|
|
93
|
-
if (isDeviceConnected) {
|
|
94
|
-
setIDTECHConnected(true);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
77
|
+
// Always sync ref first
|
|
78
|
+
isDeviceConnectedRef.current = isDeviceConnected;
|
|
97
79
|
|
|
98
|
-
//
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}, 2000);
|
|
102
|
-
|
|
103
|
-
return () => {
|
|
104
|
-
clearDisconnectTimeout();
|
|
105
|
-
};
|
|
106
|
-
}, [isDeviceConnected]);
|
|
107
|
-
|
|
108
|
-
useEffect(() => {
|
|
109
|
-
if (!isIDTECHConnected) {
|
|
110
|
-
setIsConfigured(false);
|
|
80
|
+
// Handle disconnect logic
|
|
81
|
+
if (!isDeviceConnected) {
|
|
82
|
+
unconfigureDevice(false);
|
|
111
83
|
setConfigurationInProgress(false);
|
|
112
84
|
setTransactionCurrentlyRunning(false);
|
|
113
85
|
setCancellationRunning(false);
|
|
114
|
-
setDeviceSerialNumber('');
|
|
115
|
-
setDisplayMessage('');
|
|
116
86
|
}
|
|
117
|
-
}, [
|
|
87
|
+
}, [isDeviceConnected]);
|
|
118
88
|
|
|
119
89
|
// Logging helper
|
|
120
90
|
const pushLog = (type: string, payload: any) => {
|
|
121
91
|
setLogs(prev => [...prev, { type, payload, timestamp: Date.now() }]);
|
|
122
92
|
};
|
|
123
93
|
|
|
124
|
-
//
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
94
|
+
// Exposed Method to unconfigure Device
|
|
95
|
+
const unconfigureDevice = (immediate: boolean = false) => {
|
|
96
|
+
// Cancel any pending delayed unconfigure
|
|
97
|
+
if (unconfigureTimeoutRef.current) {
|
|
98
|
+
clearTimeout(unconfigureTimeoutRef.current);
|
|
99
|
+
unconfigureTimeoutRef.current = null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (immediate) {
|
|
103
|
+
setIsConfigured(false);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Delayed unconfigure (handles IDTECH reboot)
|
|
108
|
+
unconfigureTimeoutRef.current = setTimeout(() => {
|
|
109
|
+
if (!isDeviceConnectedRef.current) {
|
|
110
|
+
setIsConfigured(false);
|
|
111
|
+
}
|
|
112
|
+
}, 2000);
|
|
113
|
+
};
|
|
130
114
|
|
|
131
115
|
// Native to Provider EMV event listening
|
|
132
116
|
useEffect(() => {
|
|
@@ -158,7 +142,7 @@ const EMVPaymentProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
158
142
|
if (TRANSACTION_RESPONSE_EVENTS.includes(eventName)) {
|
|
159
143
|
setTransactionCurrentlyRunning(false);
|
|
160
144
|
setCancellationRunning(false);
|
|
161
|
-
setDisplayMessage(
|
|
145
|
+
setDisplayMessage("")
|
|
162
146
|
}
|
|
163
147
|
|
|
164
148
|
const callbacks = subscriptionsRef.current.get(eventName);
|
|
@@ -175,7 +159,7 @@ const EMVPaymentProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
175
159
|
// Exposed method to run EMV configuration
|
|
176
160
|
const runConfiguration = (config: EMVConfig) => {
|
|
177
161
|
const title = 'CONFIGURATION DENIED';
|
|
178
|
-
const message = !
|
|
162
|
+
const message = !isDeviceConnected
|
|
179
163
|
? 'IDTECH device is not connected via USB'
|
|
180
164
|
: config.merchantID == ''
|
|
181
165
|
? 'Merchant ID not found'
|
|
@@ -183,8 +167,6 @@ const EMVPaymentProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
183
167
|
? 'Operator ID not Found'
|
|
184
168
|
: config.secureDeviceName == '' || config.posPackageID == ''
|
|
185
169
|
? 'Some configuration parameters are missing'
|
|
186
|
-
: !isLibraryInitialized
|
|
187
|
-
? 'Payment Library not initialized. Call initializePaymentLib() first'
|
|
188
170
|
: '';
|
|
189
171
|
|
|
190
172
|
if (message != '') {
|
|
@@ -193,82 +175,54 @@ const EMVPaymentProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
193
175
|
}
|
|
194
176
|
|
|
195
177
|
setConfigurationInProgress(true);
|
|
196
|
-
|
|
178
|
+
console.log(
|
|
179
|
+
'Initialising::: ConfugurationProgress:',
|
|
180
|
+
isConfigurationInProgress,
|
|
181
|
+
'isDeviceConnected: ',
|
|
182
|
+
isDeviceConnected,
|
|
183
|
+
);
|
|
184
|
+
DsiEMVManagerBridge.clearTransactionListener();
|
|
185
|
+
DsiEMVManagerBridge.initialize(config);
|
|
197
186
|
DsiEMVManagerBridge.configureDevice();
|
|
198
187
|
};
|
|
199
188
|
|
|
200
|
-
const setMerchantDetails = (config: EMVConfig) => {
|
|
201
|
-
DsiEMVManagerBridge.setMerchantDetails(config);
|
|
202
|
-
};
|
|
203
|
-
// Initialize payment library
|
|
204
|
-
const initializePaymentLib = () => {
|
|
205
|
-
if (!isLibraryInitialized) {
|
|
206
|
-
DsiEMVManagerBridge.initializeLib();
|
|
207
|
-
setIsInitialzed(true);
|
|
208
|
-
pushLog('PAYMENT LIBRARY', 'Payment library has been initialised!');
|
|
209
|
-
} else {
|
|
210
|
-
pushLog('PAYMENT LIBRARY', 'Already initialized!');
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
189
|
// Exposed method to run EMV CC Sale
|
|
214
190
|
const creditCardSale = (amount: string) => {
|
|
215
|
-
if (!
|
|
191
|
+
if (!isDeviceConnected || !isConfigured) return;
|
|
216
192
|
|
|
217
193
|
setTransactionCurrentlyRunning(true);
|
|
218
194
|
DsiEMVManagerBridge.runSaleTransaction(amount);
|
|
219
|
-
pushLog('EMV TRANSACTION', 'Credit card sale transaction initiated');
|
|
220
195
|
};
|
|
221
196
|
|
|
222
197
|
// Exposed method to run In House/ Prepaid Card Read
|
|
223
198
|
const prepaidCardRead = () => {
|
|
224
|
-
if (!
|
|
199
|
+
if (!isDeviceConnected || !isConfigured) return;
|
|
225
200
|
|
|
226
201
|
setTransactionCurrentlyRunning(true);
|
|
227
202
|
DsiEMVManagerBridge.collectCardDetails();
|
|
228
|
-
pushLog('PREPAID TRANSACTION', 'Prepaid card read initiated');
|
|
229
203
|
};
|
|
230
204
|
|
|
231
205
|
// Exposed method to run EMV CC Sale for Sale
|
|
232
206
|
const creditCardRecurringSale = (amount: string) => {
|
|
233
|
-
if (!
|
|
207
|
+
if (!isDeviceConnected || !isConfigured) return;
|
|
234
208
|
|
|
235
209
|
setTransactionCurrentlyRunning(true);
|
|
236
210
|
DsiEMVManagerBridge.runRecurringTransaction(amount);
|
|
237
|
-
pushLog(
|
|
238
|
-
'EMV TRANSACTION',
|
|
239
|
-
'Credit card sale transaction for recurring initiated',
|
|
240
|
-
);
|
|
241
211
|
};
|
|
242
212
|
|
|
243
213
|
// Exposed method to run EMV CC Zero Auth
|
|
244
214
|
const zeroAuthTransaction = () => {
|
|
245
|
-
if (!
|
|
215
|
+
if (!isDeviceConnected || !isConfigured) return;
|
|
246
216
|
|
|
247
217
|
setTransactionCurrentlyRunning(true);
|
|
248
218
|
DsiEMVManagerBridge.replaceCardInRecurring();
|
|
249
|
-
pushLog('EMV TRANSACTION', 'Zero auth transaction has been initiated');
|
|
250
219
|
};
|
|
251
220
|
|
|
252
221
|
// Exposed method to fetch device details
|
|
253
|
-
const getDeviceDetails =
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (!deviceSerialNumber?.trim()) {
|
|
258
|
-
const extractedSerialNumber = await DsiEMVManagerBridge.getDeviceDetails();
|
|
259
|
-
|
|
260
|
-
setDeviceSerialNumber(extractedSerialNumber ?? "");
|
|
261
|
-
pushLog('PAYMENT LIBRARY', 'Retrieving IDTECH device details');
|
|
262
|
-
|
|
263
|
-
return extractedSerialNumber;
|
|
264
|
-
}
|
|
265
|
-
return deviceSerialNumber;
|
|
266
|
-
|
|
267
|
-
} catch (error) {
|
|
268
|
-
pushLog('PAYMENT LIBRARY', `Error fetching device details: ${error}`);
|
|
269
|
-
return null;
|
|
270
|
-
}
|
|
271
|
-
};
|
|
222
|
+
const getDeviceDetails = () => {
|
|
223
|
+
if (!isDeviceConnected) return;
|
|
224
|
+
DsiEMVManagerBridge.getDeviceDetails();
|
|
225
|
+
};
|
|
272
226
|
|
|
273
227
|
// Exposed method to cancel transaction
|
|
274
228
|
const cancelOperation = () => {
|
|
@@ -276,7 +230,6 @@ const EMVPaymentProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
276
230
|
setConfigurationInProgress(false);
|
|
277
231
|
setCancellationRunning(true);
|
|
278
232
|
DsiEMVManagerBridge.cancelTransaction();
|
|
279
|
-
pushLog('PAYMENT LIBRARY', 'Current Transaction cancelled by User');
|
|
280
233
|
};
|
|
281
234
|
|
|
282
235
|
// Exposed method to remove all attached listener
|
|
@@ -314,19 +267,25 @@ const EMVPaymentProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
314
267
|
[],
|
|
315
268
|
);
|
|
316
269
|
|
|
270
|
+
// Cleanup on unmount
|
|
271
|
+
useEffect(() => {
|
|
272
|
+
return () => {
|
|
273
|
+
if (unconfigureTimeoutRef.current) {
|
|
274
|
+
clearTimeout(unconfigureTimeoutRef.current);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
}, []);
|
|
278
|
+
|
|
317
279
|
// Context value builder
|
|
318
280
|
const value: EMVPaymentContextType = {
|
|
319
281
|
logs,
|
|
320
|
-
isDeviceConnected
|
|
282
|
+
isDeviceConnected,
|
|
321
283
|
isConfigured,
|
|
322
|
-
deviceSerialNumber,
|
|
323
284
|
isTransactionCurrentlyRunning,
|
|
324
285
|
isConfigurationInProgress,
|
|
325
286
|
isCancellationRunning,
|
|
326
287
|
displayMessage,
|
|
327
|
-
|
|
328
|
-
setMerchantDetails,
|
|
329
|
-
initializePaymentLib,
|
|
288
|
+
unconfigureDevice,
|
|
330
289
|
creditCardSale,
|
|
331
290
|
prepaidCardRead,
|
|
332
291
|
creditCardRecurringSale,
|
|
@@ -24,20 +24,17 @@ export interface CallbackLog {
|
|
|
24
24
|
export interface EMVPaymentHook {
|
|
25
25
|
logs: CallbackLog[];
|
|
26
26
|
isDeviceConnected: boolean;
|
|
27
|
-
deviceSerialNumber: string,
|
|
28
27
|
isConfigured: boolean;
|
|
29
28
|
isTransactionCurrentlyRunning: boolean,
|
|
30
29
|
isConfigurationInProgress: boolean,
|
|
31
30
|
isCancellationRunning: boolean,
|
|
32
31
|
displayMessage: string,
|
|
33
|
-
|
|
34
|
-
setIsConfigured: (isConfigured: boolean) => void,
|
|
35
|
-
initializePaymentLib: () => void,
|
|
32
|
+
unconfigureDevice: (immediate: boolean) => void,
|
|
36
33
|
creditCardSale: (amount: string) => void;
|
|
37
34
|
prepaidCardRead: () => void;
|
|
38
35
|
creditCardRecurringSale: (amount: string) => void;
|
|
39
36
|
zeroAuthTransaction: () => void;
|
|
40
|
-
getDeviceDetails: () =>
|
|
37
|
+
getDeviceDetails: () => void;
|
|
41
38
|
runConfiguration: (config: EMVConfig) => void;
|
|
42
39
|
removeAllListeners: () => void;
|
|
43
40
|
cancelOperation: () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Text,
|
|
@@ -16,14 +16,12 @@ import { USBDeviceProvider } from '../usb/USBDeviceContext';
|
|
|
16
16
|
import { EMVPaymentProvider } from '../emvPaymentProvider/EMVPaymentProvider';
|
|
17
17
|
import { useEMVPayment } from '../emvPaymentProvider/useEMVPayment';
|
|
18
18
|
import { EMVConfig } from '../emvPaymentProvider/types';
|
|
19
|
-
import { getDeviceBySerial } from './helper/deviceStore';
|
|
20
19
|
|
|
21
20
|
type IconCallback = {
|
|
22
21
|
onPress: () => void;
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
type PaymentScreenIconsCallback = {
|
|
26
|
-
config: EMVConfig | null;
|
|
27
25
|
onPressExternalSystem: () => void;
|
|
28
26
|
onPressSettings: () => void;
|
|
29
27
|
};
|
|
@@ -48,8 +46,8 @@ const CrossIcon = () => (
|
|
|
48
46
|
<Text style={{ color: 'red', fontSize: 18, marginRight: 6 }}>❌</Text>
|
|
49
47
|
);
|
|
50
48
|
|
|
51
|
-
const EMVPaymentScreenExample = (
|
|
52
|
-
const [config, setConfig] = useState<EMVConfig | null>(
|
|
49
|
+
const EMVPaymentScreenExample = () => {
|
|
50
|
+
const [config, setConfig] = useState<EMVConfig | null>(null);
|
|
53
51
|
const [showSettingsScreen, setShowSettingsScreen] = useState(false);
|
|
54
52
|
const [showExternalSystemScreen, setShowExternalSystemScreen] =
|
|
55
53
|
useState(false);
|
|
@@ -83,7 +81,6 @@ const EMVPaymentScreenExample = ({ posConfig }: { posConfig: EMVConfig }) => {
|
|
|
83
81
|
|
|
84
82
|
return (
|
|
85
83
|
<ExampleContent
|
|
86
|
-
config={config}
|
|
87
84
|
onPressSettings={toggleSettingsScreen}
|
|
88
85
|
onPressExternalSystem={toggleExternalSystemScreen}
|
|
89
86
|
/>
|
|
@@ -98,77 +95,22 @@ const EMVPaymentScreenExample = ({ posConfig }: { posConfig: EMVConfig }) => {
|
|
|
98
95
|
};
|
|
99
96
|
|
|
100
97
|
const ExampleContent = ({
|
|
101
|
-
config,
|
|
102
98
|
onPressExternalSystem,
|
|
103
99
|
onPressSettings,
|
|
104
100
|
}: PaymentScreenIconsCallback) => {
|
|
105
101
|
const [infoVisible, setInfoVisible] = useState(false);
|
|
106
102
|
const {
|
|
107
103
|
logs,
|
|
108
|
-
isDeviceConnected,
|
|
109
|
-
deviceSerialNumber,
|
|
110
|
-
initializePaymentLib,
|
|
111
|
-
setMerchantDetails,
|
|
112
104
|
isConfigured,
|
|
113
105
|
creditCardSale,
|
|
114
106
|
prepaidCardRead,
|
|
115
107
|
creditCardRecurringSale,
|
|
116
108
|
zeroAuthTransaction,
|
|
117
109
|
cancelOperation,
|
|
118
|
-
setIsConfigured,
|
|
119
110
|
getDeviceDetails,
|
|
120
111
|
isTransactionCurrentlyRunning,
|
|
121
|
-
displayMessage
|
|
112
|
+
displayMessage
|
|
122
113
|
} = useEMVPayment();
|
|
123
|
-
//Device Connected -> Serial Received -> Lookup Local Config -> Auto Configure -> Enable Transactions
|
|
124
|
-
// useEffect(() => {
|
|
125
|
-
// if (deviceSerialNumber) {
|
|
126
|
-
// const matchedDevice = getDeviceBySerial(deviceSerialNumber);
|
|
127
|
-
|
|
128
|
-
// if (matchedDevice?.isConfigured) {
|
|
129
|
-
// setIsConfigured(true);
|
|
130
|
-
// } else {
|
|
131
|
-
// setIsConfigured(false);
|
|
132
|
-
// }
|
|
133
|
-
// } else {
|
|
134
|
-
// setIsConfigured(false);
|
|
135
|
-
// }
|
|
136
|
-
// }, [deviceSerialNumber]);
|
|
137
|
-
|
|
138
|
-
useEffect(() => {
|
|
139
|
-
const fetchDeviceDetails = async () => {
|
|
140
|
-
if (isDeviceConnected) {
|
|
141
|
-
if (!isConfigured) {
|
|
142
|
-
if (!deviceSerialNumber.trim()) {
|
|
143
|
-
const serialNumber = await getDeviceDetails();
|
|
144
|
-
console.log('EXTRACTED SERIAL NUMBER:::: ', serialNumber);
|
|
145
|
-
if (serialNumber) {
|
|
146
|
-
const storedDevice = getDeviceBySerial(serialNumber);
|
|
147
|
-
console.log('STORED DEVICE DETAILS::::', serialNumber);
|
|
148
|
-
|
|
149
|
-
if (storedDevice?.isConfigured) {
|
|
150
|
-
setIsConfigured(true);
|
|
151
|
-
console.log('SERIAL NUMBER ALREADY EXISTS');
|
|
152
|
-
} else {
|
|
153
|
-
setIsConfigured(false);
|
|
154
|
-
console.log("SERIAL NUMBER DOESN'T EXISTS");
|
|
155
|
-
}
|
|
156
|
-
} else {
|
|
157
|
-
setIsConfigured(false);
|
|
158
|
-
console.log('NOT ABLE TO EXTRACT SERIAL NUMBER');
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
fetchDeviceDetails();
|
|
165
|
-
}, [isDeviceConnected]);
|
|
166
|
-
|
|
167
|
-
// Library initialisation and Param sent
|
|
168
|
-
useEffect(() => {
|
|
169
|
-
initializePaymentLib();
|
|
170
|
-
if (config != null) setMerchantDetails(config);
|
|
171
|
-
}, []);
|
|
172
114
|
|
|
173
115
|
const showAlertIfNotConfigured = () => {
|
|
174
116
|
if (isConfigured) return false;
|
|
@@ -198,6 +140,7 @@ const ExampleContent = ({
|
|
|
198
140
|
|
|
199
141
|
{/** Button Row 1 */}
|
|
200
142
|
<View style={styles.buttonRow}>
|
|
143
|
+
|
|
201
144
|
<TouchableOpacity
|
|
202
145
|
style={[
|
|
203
146
|
styles.ctaButton,
|
|
@@ -221,9 +164,10 @@ const ExampleContent = ({
|
|
|
221
164
|
: styles.ctaButtonEnabled,
|
|
222
165
|
]}
|
|
223
166
|
onPress={() => {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
167
|
+
if(!showAlertIfNotConfigured())
|
|
168
|
+
creditCardRecurringSale('1.50')
|
|
169
|
+
}}
|
|
170
|
+
disabled={isTransactionCurrentlyRunning }
|
|
227
171
|
>
|
|
228
172
|
<Text style={styles.ctaButtonText}>CC Sale (Recurring)</Text>
|
|
229
173
|
</TouchableOpacity>
|
|
@@ -238,7 +182,7 @@ const ExampleContent = ({
|
|
|
238
182
|
onPress={() => {
|
|
239
183
|
if (!showAlertIfNotConfigured()) prepaidCardRead();
|
|
240
184
|
}}
|
|
241
|
-
disabled={isTransactionCurrentlyRunning}
|
|
185
|
+
disabled={isTransactionCurrentlyRunning }
|
|
242
186
|
>
|
|
243
187
|
<Text style={styles.ctaButtonText}>Read Prepaid Card</Text>
|
|
244
188
|
</TouchableOpacity>
|
|
@@ -253,10 +197,11 @@ const ExampleContent = ({
|
|
|
253
197
|
? styles.ctaButtonDisabled
|
|
254
198
|
: styles.ctaButtonEnabled,
|
|
255
199
|
]}
|
|
256
|
-
onPress={()
|
|
257
|
-
|
|
200
|
+
onPress={()=> {
|
|
201
|
+
if(!showAlertIfNotConfigured())
|
|
202
|
+
zeroAuthTransaction()
|
|
258
203
|
}}
|
|
259
|
-
disabled={isTransactionCurrentlyRunning}
|
|
204
|
+
disabled={isTransactionCurrentlyRunning }
|
|
260
205
|
>
|
|
261
206
|
<Text style={styles.ctaButtonText}>CC $0 Auth</Text>
|
|
262
207
|
</TouchableOpacity>
|
|
@@ -268,8 +213,8 @@ const ExampleContent = ({
|
|
|
268
213
|
? styles.ctaButtonDisabled
|
|
269
214
|
: styles.ctaButtonEnabled,
|
|
270
215
|
]}
|
|
271
|
-
onPress={()
|
|
272
|
-
|
|
216
|
+
onPress={()=> {
|
|
217
|
+
getDeviceDetails()
|
|
273
218
|
}}
|
|
274
219
|
disabled={isTransactionCurrentlyRunning}
|
|
275
220
|
>
|
|
@@ -287,9 +232,7 @@ const ExampleContent = ({
|
|
|
287
232
|
<View style={styles.modalOverlay}>
|
|
288
233
|
<View style={styles.modalContent}>
|
|
289
234
|
<ActivityIndicator size="large" color="#007AFF" />
|
|
290
|
-
<Text style={styles.modalText}>
|
|
291
|
-
Processing...\n{displayMessage}
|
|
292
|
-
</Text>
|
|
235
|
+
<Text style={styles.modalText}>Processing...\n{displayMessage}</Text>
|
|
293
236
|
<TouchableOpacity
|
|
294
237
|
style={styles.cancelButton}
|
|
295
238
|
onPress={cancelOperation}
|
|
@@ -508,7 +451,7 @@ const styles = StyleSheet.create({
|
|
|
508
451
|
paddingVertical: 8,
|
|
509
452
|
paddingHorizontal: 14,
|
|
510
453
|
borderRadius: 6,
|
|
511
|
-
}
|
|
454
|
+
}
|
|
512
455
|
});
|
|
513
456
|
|
|
514
457
|
export default EMVPaymentScreenExample;
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
TouchableOpacity,
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
|
|
11
|
+
import { useEMVPayment } from '../emvPaymentProvider/useEMVPayment';
|
|
11
12
|
import { EMVConfig } from '../emvPaymentProvider/types';
|
|
12
13
|
|
|
13
14
|
type ConfigUpdateCallback = {
|
|
@@ -16,8 +17,9 @@ type ConfigUpdateCallback = {
|
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
const EMVSettingsScreen = ({ onConfigUpdate, data }: ConfigUpdateCallback) => {
|
|
19
|
-
const
|
|
20
|
-
const [
|
|
20
|
+
const { unconfigureDevice } = useEMVPayment();
|
|
21
|
+
const [paymentMID, setPaymentMID] = useState('');
|
|
22
|
+
const [operatorID, setOperatorID] = useState('');
|
|
21
23
|
const [secureDeviceName] = useState('EMV_VP3350_DATACAP');
|
|
22
24
|
const [isSandbox, setIsSandbox] = useState(true);
|
|
23
25
|
|
|
@@ -29,7 +31,7 @@ const handleApplyChanges = () => {
|
|
|
29
31
|
operatorID,
|
|
30
32
|
posPackageID: 'test.package.id',
|
|
31
33
|
};
|
|
32
|
-
|
|
34
|
+
unconfigureDevice(true);
|
|
33
35
|
onConfigUpdate(config);
|
|
34
36
|
};
|
|
35
37
|
|