@haroldtran/react-native-pax 0.1.8 → 1.0.1
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/.gitignore +4 -0
- package/README.md +118 -160
- package/android/build.gradle +15 -4
- package/android/gradle.properties +8 -5
- package/android/libs/POSLink_Admin_Android_Plugin_V2.00.00_20230828.jar +0 -0
- package/android/libs/POSLink_Core_Android_V2.00.03_20230828.jar +0 -0
- package/android/libs/POSLink_Semi_Android_Plugin_V2.00.00_20230828.jar +0 -0
- package/android/libs/PaxLog_1.0.11_20220921.jar +0 -0
- package/android/src/main/java/com/paxposlink/PaxPosConstant.kt +57 -0
- package/android/src/main/java/com/paxposlink/PaxPosLinkModule.kt +711 -0
- package/android/src/main/java/com/paxposlink/PaxPosLinkPackage.kt +12 -0
- package/android/src/main/java/com/paxposlink/Utils.kt +99 -0
- package/lib/commonjs/index.js +57 -26
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/type.js +13 -0
- package/lib/commonjs/type.js.map +1 -0
- package/lib/module/index.js +54 -20
- package/lib/module/index.js.map +1 -1
- package/lib/module/type.js +9 -0
- package/lib/module/type.js.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +34 -8
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/type.d.ts +37 -0
- package/lib/typescript/commonjs/type.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +34 -8
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/type.d.ts +37 -0
- package/lib/typescript/module/type.d.ts.map +1 -0
- package/package.json +4 -2
- package/src/index.tsx +45 -49
- package/src/type.ts +39 -0
- package/android/libs/POSLink_Core.jar +0 -0
- package/android/src/main/java/com/paxposlink/PaxPoslinkModule.java +0 -355
- package/android/src/main/java/com/paxposlink/PaxPoslinkPackage.java +0 -28
package/.gitignore
CHANGED
package/README.md
CHANGED
|
@@ -9,27 +9,23 @@ React Native library to integrate with PAX payment devices using the POSLink SDK
|
|
|
9
9
|
|
|
10
10
|
## Features
|
|
11
11
|
|
|
12
|
-
- 🔄 Initialize PAX device connection
|
|
13
|
-
- 💳 Process credit card payments (Sale
|
|
14
|
-
- 🔄 Handle
|
|
12
|
+
- 🔄 Initialize PAX device connection via TCP/IP
|
|
13
|
+
- 💳 Process credit and debit card payments (Sale)
|
|
14
|
+
- 🔄 Handle voids (Void Sale)
|
|
15
15
|
- 📊 Batch operations and settlement
|
|
16
|
-
- 🔙 Process
|
|
17
|
-
- 📱
|
|
16
|
+
- 🔙 Process refunds (Return)
|
|
17
|
+
- 📱 Android platform support (iOS implementation pending)
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
20
20
|
|
|
21
|
-
```sh
|
|
22
|
-
npm install @haroldtran/react-native-pax
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
or with yarn:
|
|
26
|
-
|
|
27
21
|
```sh
|
|
28
22
|
yarn add @haroldtran/react-native-pax
|
|
29
23
|
```
|
|
30
24
|
|
|
31
25
|
### iOS Setup
|
|
32
26
|
|
|
27
|
+
⚠️ **Note: iOS implementation is currently not complete. Only Android is fully supported at this time.**
|
|
28
|
+
|
|
33
29
|
1. Navigate to your iOS project directory and install pods:
|
|
34
30
|
```sh
|
|
35
31
|
cd ios && pod install
|
|
@@ -52,12 +48,9 @@ The Android setup is automatic. The library will be linked automatically when yo
|
|
|
52
48
|
import {
|
|
53
49
|
initPOSLink,
|
|
54
50
|
makePayment,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
makeAdjustment,
|
|
59
|
-
voidTransaction,
|
|
60
|
-
closeBatch
|
|
51
|
+
makeRefund,
|
|
52
|
+
makeVoid,
|
|
53
|
+
makeCloseBatch
|
|
61
54
|
} from '@haroldtran/react-native-pax';
|
|
62
55
|
```
|
|
63
56
|
|
|
@@ -67,17 +60,8 @@ First, initialize the connection to your PAX device:
|
|
|
67
60
|
|
|
68
61
|
```js
|
|
69
62
|
try {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
'30000', // Timeout in milliseconds
|
|
73
|
-
false, // Use proxy
|
|
74
|
-
'192.168.1.100', // Device IP (for TCP/IP connections)
|
|
75
|
-
'10009' // Port number
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
if (success) {
|
|
79
|
-
console.log('PAX device initialized successfully');
|
|
80
|
-
}
|
|
63
|
+
const result = await initPOSLink('192.168.1.100'); // Pass the IP address of the POS device
|
|
64
|
+
console.log('PAX device initialized:', result);
|
|
81
65
|
} catch (error) {
|
|
82
66
|
console.error('Failed to initialize PAX device:', error);
|
|
83
67
|
}
|
|
@@ -86,56 +70,47 @@ try {
|
|
|
86
70
|
### Process a Payment
|
|
87
71
|
|
|
88
72
|
```js
|
|
89
|
-
|
|
90
|
-
const result = await makePayment('10.00', '1.50'); // amount, tip
|
|
91
|
-
console.log('Payment result:', result);
|
|
92
|
-
|
|
93
|
-
// Result contains transaction details like:
|
|
94
|
-
// - AuthCode
|
|
95
|
-
// - RefNum
|
|
96
|
-
// - ApprovedAmount
|
|
97
|
-
// - CardType
|
|
98
|
-
// - MaskedPAN
|
|
99
|
-
// etc.
|
|
100
|
-
} catch (error) {
|
|
101
|
-
console.error('Payment failed:', error);
|
|
102
|
-
}
|
|
103
|
-
```
|
|
73
|
+
import { CreditTransactionType } from '@haroldtran/react-native-pax/lib/typescript/module/type';
|
|
104
74
|
|
|
105
|
-
### Authorization Only
|
|
106
|
-
|
|
107
|
-
```js
|
|
108
75
|
try {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
### Post Authorization (Capture)
|
|
117
|
-
|
|
118
|
-
```js
|
|
119
|
-
try {
|
|
120
|
-
const result = await makePostAuth(
|
|
121
|
-
'25.00', // amount
|
|
122
|
-
'REF123456', // original reference number
|
|
123
|
-
'AUTH123' // authorization code
|
|
76
|
+
const paymentResult = await makePayment(
|
|
77
|
+
'txn-123', // id (optional)
|
|
78
|
+
1000, // amount in cents (e.g., 1000 = $10.00)
|
|
79
|
+
150, // tip in cents (optional, e.g., 150 = $1.50)
|
|
80
|
+
CreditTransactionType.Credit, // paymentType (1 = Credit, 2 = Debit)
|
|
81
|
+
'ECR123' // ecrRefNum (optional)
|
|
124
82
|
);
|
|
125
|
-
|
|
83
|
+
|
|
84
|
+
console.log('Payment result:', paymentResult);
|
|
85
|
+
// paymentResult contains:
|
|
86
|
+
// - status: boolean
|
|
87
|
+
// - isPaymentSuccess: boolean
|
|
88
|
+
// - cardHolder: string
|
|
89
|
+
// - cardNumber: string (masked)
|
|
90
|
+
// - refNum: string
|
|
91
|
+
// - transactionId: string
|
|
92
|
+
// - amount: string
|
|
93
|
+
// - tipAmount: string
|
|
94
|
+
// - cardType: string
|
|
95
|
+
// - entryMethod: string
|
|
96
|
+
// - and more transaction details
|
|
126
97
|
} catch (error) {
|
|
127
|
-
console.error('
|
|
98
|
+
console.error('Payment failed:', error);
|
|
128
99
|
}
|
|
129
100
|
```
|
|
130
101
|
|
|
131
|
-
|
|
102
|
+
|
|
103
|
+
### Process a Refund
|
|
132
104
|
|
|
133
105
|
```js
|
|
134
106
|
try {
|
|
135
|
-
const
|
|
136
|
-
|
|
107
|
+
const refundResult = await makeRefund({
|
|
108
|
+
amount: 1500 // amount in cents (e.g., 1500 = $15.00)
|
|
109
|
+
});
|
|
110
|
+
console.log('Refund result:', refundResult);
|
|
111
|
+
// refundResult is a PaxResponseModel object
|
|
137
112
|
} catch (error) {
|
|
138
|
-
console.error('
|
|
113
|
+
console.error('Refund failed:', error);
|
|
139
114
|
}
|
|
140
115
|
```
|
|
141
116
|
|
|
@@ -143,42 +118,24 @@ try {
|
|
|
143
118
|
|
|
144
119
|
```js
|
|
145
120
|
try {
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
);
|
|
150
|
-
|
|
121
|
+
const voidResult = await makeVoid({
|
|
122
|
+
amount: 1500 // amount in cents (e.g., 1500 = $15.00)
|
|
123
|
+
});
|
|
124
|
+
console.log('Void result:', voidResult);
|
|
125
|
+
// voidResult is a PaxResponseModel object
|
|
151
126
|
} catch (error) {
|
|
152
127
|
console.error('Void failed:', error);
|
|
153
128
|
}
|
|
154
129
|
```
|
|
155
130
|
|
|
156
|
-
### Adjust a Transaction
|
|
157
|
-
|
|
158
|
-
```js
|
|
159
|
-
try {
|
|
160
|
-
const result = await makeAdjustment(
|
|
161
|
-
'12.50', // new amount
|
|
162
|
-
'REF123456' // original reference number
|
|
163
|
-
);
|
|
164
|
-
console.log('Adjustment result:', result);
|
|
165
|
-
} catch (error) {
|
|
166
|
-
console.error('Adjustment failed:', error);
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
131
|
|
|
170
132
|
### Close Batch
|
|
171
133
|
|
|
172
134
|
```js
|
|
173
135
|
try {
|
|
174
|
-
const
|
|
175
|
-
console.log('Batch close result:',
|
|
176
|
-
|
|
177
|
-
// Result contains batch summary:
|
|
178
|
-
// - BatchNum
|
|
179
|
-
// - CreditCount, CreditAmount
|
|
180
|
-
// - DebitCount, DebitAmount
|
|
181
|
-
// etc.
|
|
136
|
+
const batchResult = await makeCloseBatch();
|
|
137
|
+
console.log('Batch close result:', batchResult);
|
|
138
|
+
// batchResult is a PaxResponseModel object
|
|
182
139
|
} catch (error) {
|
|
183
140
|
console.error('Batch close failed:', error);
|
|
184
141
|
}
|
|
@@ -186,113 +143,114 @@ try {
|
|
|
186
143
|
|
|
187
144
|
## API Reference
|
|
188
145
|
|
|
189
|
-
|
|
146
|
+
#### initPOSLink(ip)
|
|
190
147
|
|
|
191
148
|
Initializes the connection to the PAX device.
|
|
192
149
|
|
|
193
150
|
**Parameters:**
|
|
194
|
-
- `
|
|
195
|
-
- `timeout` (string): Timeout in milliseconds
|
|
196
|
-
- `proxy` (boolean): Whether to use proxy
|
|
197
|
-
- `ip` (string, optional): Device IP address (for network connections)
|
|
198
|
-
- `port` (string, optional): Port number (for network connections)
|
|
151
|
+
- `ip` (string): Device IP address
|
|
199
152
|
|
|
200
|
-
**Returns:** `Promise<
|
|
153
|
+
**Returns:** `Promise<any>`
|
|
201
154
|
|
|
202
|
-
|
|
155
|
+
#### makePayment(id?, amount, tip?, paymentType?, ecrRefNum?)
|
|
203
156
|
|
|
204
|
-
|
|
157
|
+
Initiates a payment transaction.
|
|
205
158
|
|
|
206
159
|
**Parameters:**
|
|
207
|
-
- `
|
|
208
|
-
- `
|
|
160
|
+
- `id` (string, optional): Transaction ID
|
|
161
|
+
- `amount` (number): Payment amount in cents (e.g., 1000 = $10.00)
|
|
162
|
+
- `tip` (number, optional): Tip amount in cents (e.g., 150 = $1.50)
|
|
163
|
+
- `paymentType` (number, optional): Type of payment (1 = Credit, 2 = Debit, see `CreditTransactionType` enum)
|
|
164
|
+
- `ecrRefNum` (string, optional): ECR reference number
|
|
209
165
|
|
|
210
|
-
**Returns:** `Promise<
|
|
166
|
+
**Returns:** `Promise<PaxResponseModel>`
|
|
211
167
|
|
|
212
|
-
|
|
168
|
+
#### makeRefund(data)
|
|
213
169
|
|
|
214
|
-
|
|
170
|
+
Initiates a refund transaction.
|
|
215
171
|
|
|
216
172
|
**Parameters:**
|
|
217
|
-
- `
|
|
173
|
+
- `data` (object): Object containing:
|
|
174
|
+
- `amount` (number): The amount to refund in cents
|
|
218
175
|
|
|
219
|
-
**Returns:** `Promise<
|
|
176
|
+
**Returns:** `Promise<PaxResponseModel>`
|
|
220
177
|
|
|
221
|
-
|
|
178
|
+
#### makeVoid(data)
|
|
222
179
|
|
|
223
|
-
|
|
180
|
+
Voids a transaction for the given amount.
|
|
224
181
|
|
|
225
182
|
**Parameters:**
|
|
226
|
-
- `
|
|
227
|
-
- `
|
|
228
|
-
- `authCode` (string): Authorization code
|
|
229
|
-
|
|
230
|
-
**Returns:** `Promise<PaymentResponse>`
|
|
183
|
+
- `data` (object): Object containing:
|
|
184
|
+
- `amount` (number): The amount to void in cents
|
|
231
185
|
|
|
232
|
-
|
|
186
|
+
**Returns:** `Promise<PaxResponseModel>`
|
|
233
187
|
|
|
234
|
-
|
|
188
|
+
#### makeCloseBatch()
|
|
235
189
|
|
|
236
|
-
|
|
237
|
-
- `amount` (string): Return amount
|
|
190
|
+
Closes the current batch of transactions.
|
|
238
191
|
|
|
239
|
-
**Returns:** `Promise<
|
|
192
|
+
**Returns:** `Promise<PaxResponseModel>`
|
|
240
193
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
Adjusts a previous transaction amount.
|
|
244
|
-
|
|
245
|
-
**Parameters:**
|
|
246
|
-
- `amount` (string): New amount
|
|
247
|
-
- `refNum` (string): Original reference number
|
|
248
|
-
|
|
249
|
-
**Returns:** `Promise<PaymentResponse>`
|
|
194
|
+
## Response Objects
|
|
250
195
|
|
|
251
|
-
### voidTransaction(refNum, authCode)
|
|
252
196
|
|
|
253
|
-
|
|
197
|
+
### PaxResponseModel
|
|
254
198
|
|
|
255
|
-
|
|
256
|
-
- `refNum` (string): Original reference number
|
|
257
|
-
- `authCode` (string): Authorization code
|
|
199
|
+
The response object returned by all transaction functions. Key fields include:
|
|
258
200
|
|
|
259
|
-
**
|
|
201
|
+
**Status & Result:**
|
|
202
|
+
- `status` (boolean): Overall operation success status
|
|
203
|
+
- `isPaymentSuccess` (boolean): Payment-specific success flag
|
|
204
|
+
- `message` (string): Response message or error description
|
|
260
205
|
|
|
261
|
-
|
|
206
|
+
**Transaction Details:**
|
|
207
|
+
- `id` (string): Transaction ID
|
|
208
|
+
- `transactionId` (string): Global unique transaction identifier
|
|
209
|
+
- `transactionNo` (string): Transaction sequence number
|
|
210
|
+
- `refNum` (string): Reference number
|
|
211
|
+
- `transactionDateTime` (string): Date/time of transaction
|
|
262
212
|
|
|
263
|
-
|
|
213
|
+
**Card & Payment Info:**
|
|
214
|
+
- `cardType` (string): Card type/brand (e.g., VISA, MASTERCARD)
|
|
215
|
+
- `cardNumber` (string): Masked card number
|
|
216
|
+
- `cardHolder` (string): Card holder name
|
|
217
|
+
- `entryMethod` (string): How card was entered (SWIPED_MSD, CONTACT_CHIP, CONTACTLESS_CHIP, etc.)
|
|
264
218
|
|
|
265
|
-
**
|
|
266
|
-
|
|
267
|
-
|
|
219
|
+
**Amount Details:**
|
|
220
|
+
- `amount` (string): Transaction amount
|
|
221
|
+
- `tipAmount` (string): Tip amount
|
|
222
|
+
- `surcharge` (string): Additional fees/surcharge
|
|
268
223
|
|
|
269
|
-
|
|
224
|
+
**Additional Data:**
|
|
225
|
+
- `data` (object): Detailed response data including account info, trace info, AVS info, etc.
|
|
226
|
+
- `sn` (string): Serial number
|
|
270
227
|
|
|
271
|
-
|
|
272
|
-
- `AuthCode`: Authorization code
|
|
273
|
-
- `RefNum`: Reference number
|
|
274
|
-
- `ApprovedAmount`: Approved amount
|
|
275
|
-
- `CardType`: Type of card used
|
|
276
|
-
- `MaskedPAN`: Masked card number
|
|
277
|
-
- `ResultCode`: Transaction result code
|
|
278
|
-
- `ResultTxt`: Result description
|
|
279
|
-
- And many more fields...
|
|
228
|
+
### CreditTransactionType Enum
|
|
280
229
|
|
|
281
|
-
|
|
230
|
+
Available payment types:
|
|
231
|
+
- `CreditTransactionType.Credit` (1): Credit card transaction
|
|
232
|
+
- `CreditTransactionType.Debit` (2): Debit card transaction
|
|
233
|
+
- `CreditTransactionType.Empty` (0): Not set/default
|
|
282
234
|
|
|
283
|
-
|
|
284
|
-
- `BatchNum`: Batch number
|
|
285
|
-
- `CreditCount` / `CreditAmount`: Credit transaction totals
|
|
286
|
-
- `DebitCount` / `DebitAmount`: Debit transaction totals
|
|
287
|
-
- `ResultCode`: Batch result code
|
|
288
|
-
- And more batch summary fields...
|
|
235
|
+
See `src/type.ts` for the complete interface definition.
|
|
289
236
|
|
|
290
237
|
## Requirements
|
|
291
238
|
|
|
292
239
|
- React Native 0.63+
|
|
293
|
-
-
|
|
294
|
-
-
|
|
240
|
+
- **Android API level 21+ (Full support)**
|
|
241
|
+
- **iOS 11.0+ (Limited support - implementation pending)**
|
|
295
242
|
- PAX payment terminal with POSLink SDK support
|
|
243
|
+
- TCP/IP network connection to PAX terminal
|
|
244
|
+
|
|
245
|
+
## Current Platform Support
|
|
246
|
+
|
|
247
|
+
| Feature | Android | iOS |
|
|
248
|
+
| --------------------- | ------- | --- |
|
|
249
|
+
| Initialize Connection | ✅ | ❌ |
|
|
250
|
+
| Payment Processing | ✅ | ❌ |
|
|
251
|
+
| Refunds | ❌ | ❌ |
|
|
252
|
+
| Voids | ❌ | ❌ |
|
|
253
|
+
| Batch Operations | ❌ | ❌ |
|
|
296
254
|
|
|
297
255
|
## Contributing
|
|
298
256
|
|
package/android/build.gradle
CHANGED
|
@@ -5,7 +5,8 @@ buildscript {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
dependencies {
|
|
8
|
-
classpath
|
|
8
|
+
classpath("com.android.tools.build:gradle:8.3.2")
|
|
9
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24")
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -14,6 +15,7 @@ def isNewArchitectureEnabled() {
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
apply plugin: "com.android.library"
|
|
18
|
+
apply plugin: 'org.jetbrains.kotlin.android'
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
|
@@ -23,15 +25,19 @@ if (isNewArchitectureEnabled()) {
|
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
def getExtOrDefault(name) {
|
|
26
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["
|
|
28
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["Default_" + name]
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
def getExtOrIntegerDefault(name) {
|
|
30
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["
|
|
32
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Default_" + name]).toInteger()
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
android {
|
|
34
36
|
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
37
|
+
namespace 'com.paxposlink'
|
|
38
|
+
buildFeatures {
|
|
39
|
+
buildConfig true
|
|
40
|
+
}
|
|
35
41
|
|
|
36
42
|
defaultConfig {
|
|
37
43
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
@@ -52,6 +58,9 @@ android {
|
|
|
52
58
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
53
59
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
54
60
|
}
|
|
61
|
+
kotlinOptions {
|
|
62
|
+
jvmTarget = '17'
|
|
63
|
+
}
|
|
55
64
|
|
|
56
65
|
}
|
|
57
66
|
|
|
@@ -70,7 +79,9 @@ dependencies {
|
|
|
70
79
|
//! https://developer.pax.us/resources/section/250038301709316096?sectionName=POSLink%202&articleId=352771637260593152
|
|
71
80
|
//! POSLink_Core_Android_V2.00.07_20240914
|
|
72
81
|
//! https://developer.pax.us/api/v1/files/314390436447793152/download/private#POSLink_Semi_Integration_Java_Android_V2.01.00_20240914.zip
|
|
73
|
-
implementation
|
|
82
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
83
|
+
implementation 'androidx.core:core-ktx:1.16.0'
|
|
84
|
+
implementation 'com.google.code.gson:gson:2.11.0'
|
|
74
85
|
}
|
|
75
86
|
|
|
76
87
|
if (isNewArchitectureEnabled()) {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
Default_kotlinVersion=1.9.24
|
|
2
|
+
Default_minSdkVersion=21
|
|
3
|
+
Default_targetSdkVersion=31
|
|
4
|
+
Default_compileSdkVersion=31
|
|
5
|
+
Default_ndkversion=21.4.7075529
|
|
6
|
+
Default_kotlin-gradle-plugin=1.9.24
|
|
7
|
+
|
|
8
|
+
android.useAndroidX=true
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
package com.paxposlink
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.WritableMap
|
|
4
|
+
|
|
5
|
+
object PaxPosConstant {
|
|
6
|
+
const val DEFAULT_ID: String = ""
|
|
7
|
+
const val PORT: String = "10009"
|
|
8
|
+
const val TIMEOUT: Int = 300000
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Data holder for PAX request parameters
|
|
12
|
+
data class PaxRequestModel(
|
|
13
|
+
var id: String? = "",
|
|
14
|
+
var amount: Int = 0,
|
|
15
|
+
var tip: Int? = null,
|
|
16
|
+
var paymentType: Int? = null,
|
|
17
|
+
var ecrRefNum: String = "",
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
data class PaxResponseModel(
|
|
21
|
+
var status: Boolean = false,
|
|
22
|
+
var data: WritableMap? = null,
|
|
23
|
+
var message: String = "",
|
|
24
|
+
var isPaymentSuccess: Boolean = false,
|
|
25
|
+
var id: String = "",
|
|
26
|
+
var transactionId: String = "",
|
|
27
|
+
var transactionNo: String = "",
|
|
28
|
+
var refNum: String = "",
|
|
29
|
+
var transactionDateTime: String = "",
|
|
30
|
+
var cardType: String = "",
|
|
31
|
+
var cardNumber: String = "",
|
|
32
|
+
var cardHolder: String = "",
|
|
33
|
+
var amount: String = "",
|
|
34
|
+
var tipAmount: String = "",
|
|
35
|
+
var surcharge: String = "",
|
|
36
|
+
var entryMethod: String = "",
|
|
37
|
+
var sn: String = "0",
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
data class PaxTerminalInfoModel(
|
|
41
|
+
var serialNumber: String = "",
|
|
42
|
+
var modelName: String = "",
|
|
43
|
+
var appName: String = "",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
enum class CreditTransactionType(
|
|
47
|
+
val code: Int,
|
|
48
|
+
) {
|
|
49
|
+
Credit(1),
|
|
50
|
+
Debit(2),
|
|
51
|
+
Empty(0),
|
|
52
|
+
;
|
|
53
|
+
|
|
54
|
+
companion object {
|
|
55
|
+
fun fromCode(code: Int): CreditTransactionType = entries.find { it.code == code } ?: Empty
|
|
56
|
+
}
|
|
57
|
+
}
|