@haroldtran/react-native-pax 1.0.7 → 1.0.11
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 +5 -0
- package/README.md +12 -7
- package/android/src/android.iml +11 -0
- package/android/src/main/java/com/paxposlink/PaxPosConstant.kt +4 -3
- package/android/src/main/java/com/paxposlink/PaxPosLinkModule.kt +96 -14
- package/package.json +7 -48
- package/src/{index.tsx → index.ts} +24 -8
- package/src/type.ts +1 -0
- package/lib/commonjs/index.js +0 -83
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/package.json +0 -1
- package/lib/commonjs/type.js +0 -13
- package/lib/commonjs/type.js.map +0 -1
- package/lib/module/index.js +0 -75
- package/lib/module/index.js.map +0 -1
- package/lib/module/package.json +0 -1
- package/lib/module/type.js +0 -9
- package/lib/module/type.js.map +0 -1
- package/lib/typescript/commonjs/index.d.ts +0 -35
- package/lib/typescript/commonjs/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/package.json +0 -1
- package/lib/typescript/commonjs/type.d.ts +0 -37
- package/lib/typescript/commonjs/type.d.ts.map +0 -1
- package/lib/typescript/module/index.d.ts +0 -35
- package/lib/typescript/module/index.d.ts.map +0 -1
- package/lib/typescript/module/package.json +0 -1
- package/lib/typescript/module/type.d.ts +0 -37
- package/lib/typescript/module/type.d.ts.map +0 -1
package/.gitignore
CHANGED
|
@@ -42,3 +42,8 @@ android/.idea/*
|
|
|
42
42
|
android/.gradle/*
|
|
43
43
|
android/gradle/wrapper/gradle-wrapper.jar
|
|
44
44
|
android/local.properties
|
|
45
|
+
android/src/.idea/.gitignore
|
|
46
|
+
android/src/.idea/misc.xml
|
|
47
|
+
android/src/.idea/modules.xml
|
|
48
|
+
android/src/.idea/vcs.xml
|
|
49
|
+
android/src/.idea/caches/deviceStreaming.xml
|
package/README.md
CHANGED
|
@@ -27,11 +27,13 @@ yarn add @haroldtran/react-native-pax
|
|
|
27
27
|
⚠️ **Note: iOS implementation is currently not complete. Only Android is fully supported at this time.**
|
|
28
28
|
|
|
29
29
|
1. Navigate to your iOS project directory and install pods:
|
|
30
|
+
|
|
30
31
|
```sh
|
|
31
32
|
cd ios && pod install
|
|
32
33
|
```
|
|
33
34
|
|
|
34
35
|
2. Make sure your iOS deployment target is 11.0 or higher in your `Podfile`:
|
|
36
|
+
|
|
35
37
|
```ruby
|
|
36
38
|
platform :ios, '11.0'
|
|
37
39
|
```
|
|
@@ -99,7 +101,6 @@ try {
|
|
|
99
101
|
}
|
|
100
102
|
```
|
|
101
103
|
|
|
102
|
-
|
|
103
104
|
### Process a Refund
|
|
104
105
|
|
|
105
106
|
```js
|
|
@@ -128,7 +129,6 @@ try {
|
|
|
128
129
|
}
|
|
129
130
|
```
|
|
130
131
|
|
|
131
|
-
|
|
132
132
|
### Close Batch
|
|
133
133
|
|
|
134
134
|
```js
|
|
@@ -148,6 +148,7 @@ try {
|
|
|
148
148
|
Initializes the connection to the PAX device.
|
|
149
149
|
|
|
150
150
|
**Parameters:**
|
|
151
|
+
|
|
151
152
|
- `ip` (string): Device IP address
|
|
152
153
|
|
|
153
154
|
**Returns:** `Promise<any>`
|
|
@@ -157,6 +158,7 @@ Initializes the connection to the PAX device.
|
|
|
157
158
|
Initiates a payment transaction.
|
|
158
159
|
|
|
159
160
|
**Parameters:**
|
|
161
|
+
|
|
160
162
|
- `id` (string, optional): Transaction ID
|
|
161
163
|
- `amount` (number): Payment amount in cents (e.g., 1000 = $10.00)
|
|
162
164
|
- `tip` (number, optional): Tip amount in cents (e.g., 150 = $1.50)
|
|
@@ -170,6 +172,7 @@ Initiates a payment transaction.
|
|
|
170
172
|
Initiates a refund transaction.
|
|
171
173
|
|
|
172
174
|
**Parameters:**
|
|
175
|
+
|
|
173
176
|
- `data` (object): Object containing:
|
|
174
177
|
- `amount` (number): The amount to refund in cents
|
|
175
178
|
|
|
@@ -180,6 +183,7 @@ Initiates a refund transaction.
|
|
|
180
183
|
Voids a transaction for the given amount.
|
|
181
184
|
|
|
182
185
|
**Parameters:**
|
|
186
|
+
|
|
183
187
|
- `data` (object): Object containing:
|
|
184
188
|
- `amount` (number): The amount to void in cents
|
|
185
189
|
|
|
@@ -193,17 +197,18 @@ Closes the current batch of transactions.
|
|
|
193
197
|
|
|
194
198
|
## Response Objects
|
|
195
199
|
|
|
196
|
-
|
|
197
200
|
### PaxResponseModel
|
|
198
201
|
|
|
199
202
|
The response object returned by all transaction functions. Key fields include:
|
|
200
203
|
|
|
201
204
|
**Status & Result:**
|
|
205
|
+
|
|
202
206
|
- `status` (boolean): Overall operation success status
|
|
203
207
|
- `isPaymentSuccess` (boolean): Payment-specific success flag
|
|
204
208
|
- `message` (string): Response message or error description
|
|
205
209
|
|
|
206
210
|
**Transaction Details:**
|
|
211
|
+
|
|
207
212
|
- `id` (string): Transaction ID
|
|
208
213
|
- `transactionId` (string): Global unique transaction identifier
|
|
209
214
|
- `transactionNo` (string): Transaction sequence number
|
|
@@ -211,23 +216,27 @@ The response object returned by all transaction functions. Key fields include:
|
|
|
211
216
|
- `transactionDateTime` (string): Date/time of transaction
|
|
212
217
|
|
|
213
218
|
**Card & Payment Info:**
|
|
219
|
+
|
|
214
220
|
- `cardType` (string): Card type/brand (e.g., VISA, MASTERCARD)
|
|
215
221
|
- `cardNumber` (string): Masked card number
|
|
216
222
|
- `cardHolder` (string): Card holder name
|
|
217
223
|
- `entryMethod` (string): How card was entered (SWIPED_MSD, CONTACT_CHIP, CONTACTLESS_CHIP, etc.)
|
|
218
224
|
|
|
219
225
|
**Amount Details:**
|
|
226
|
+
|
|
220
227
|
- `amount` (string): Transaction amount
|
|
221
228
|
- `tipAmount` (string): Tip amount
|
|
222
229
|
- `surcharge` (string): Additional fees/surcharge
|
|
223
230
|
|
|
224
231
|
**Additional Data:**
|
|
232
|
+
|
|
225
233
|
- `data` (object): Detailed response data including account info, trace info, AVS info, etc.
|
|
226
234
|
- `sn` (string): Serial number
|
|
227
235
|
|
|
228
236
|
### CreditTransactionType Enum
|
|
229
237
|
|
|
230
238
|
Available payment types:
|
|
239
|
+
|
|
231
240
|
- `CreditTransactionType.Credit` (1): Credit card transaction
|
|
232
241
|
- `CreditTransactionType.Debit` (2): Debit card transaction
|
|
233
242
|
- `CreditTransactionType.Empty` (0): Not set/default
|
|
@@ -263,7 +272,3 @@ MIT
|
|
|
263
272
|
## Support
|
|
264
273
|
|
|
265
274
|
For PAX device documentation and support, visit [PAX Developer Portal](https://developer.pax.us).
|
|
266
|
-
|
|
267
|
-
---
|
|
268
|
-
|
|
269
|
-
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$">
|
|
6
|
+
<sourceFolder url="file://$MODULE_DIR$/main/java" isTestSource="false" />
|
|
7
|
+
</content>
|
|
8
|
+
<orderEntry type="inheritedJdk" />
|
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
+
</component>
|
|
11
|
+
</module>
|
|
@@ -11,10 +11,10 @@ object PaxPosConstant {
|
|
|
11
11
|
// Data holder for PAX request parameters
|
|
12
12
|
data class PaxRequestModel(
|
|
13
13
|
var id: String? = "",
|
|
14
|
-
var amount: Int = 0,
|
|
14
|
+
var amount: Int? = 0,
|
|
15
15
|
var tip: Int? = null,
|
|
16
16
|
var paymentType: Int? = null,
|
|
17
|
-
var ecrRefNum: String = "",
|
|
17
|
+
var ecrRefNum: String? = "",
|
|
18
18
|
)
|
|
19
19
|
|
|
20
20
|
data class PaxResponseModel(
|
|
@@ -26,6 +26,7 @@ data class PaxResponseModel(
|
|
|
26
26
|
var transactionId: String = "",
|
|
27
27
|
var transactionNo: String = "",
|
|
28
28
|
var refNum: String = "",
|
|
29
|
+
var ecrRefNum: String = "",
|
|
29
30
|
var transactionDateTime: String = "",
|
|
30
31
|
var cardType: String = "",
|
|
31
32
|
var cardNumber: String = "",
|
|
@@ -34,7 +35,7 @@ data class PaxResponseModel(
|
|
|
34
35
|
var tipAmount: String = "",
|
|
35
36
|
var surcharge: String = "",
|
|
36
37
|
var entryMethod: String = "",
|
|
37
|
-
var sn:
|
|
38
|
+
var sn: WritableMap? = null,
|
|
38
39
|
)
|
|
39
40
|
|
|
40
41
|
data class PaxTerminalInfoModel(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
package com.paxposlink
|
|
2
2
|
|
|
3
|
+
import android.os.Build
|
|
3
4
|
import android.util.Log
|
|
5
|
+
import androidx.annotation.RequiresApi
|
|
4
6
|
import com.facebook.react.bridge.Arguments
|
|
5
7
|
import com.facebook.react.bridge.Promise
|
|
6
8
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
@@ -12,6 +14,7 @@ import com.pax.poscore.commsetting.TcpSetting
|
|
|
12
14
|
import com.pax.poscore.internal.ExecutionCode
|
|
13
15
|
import com.pax.poslinkadmin.ExecutionResult
|
|
14
16
|
import com.pax.poslinkadmin.constant.ContinuousScreen
|
|
17
|
+
import com.pax.poslinkadmin.constant.EdcType
|
|
15
18
|
import com.pax.poslinkadmin.constant.EntryMode
|
|
16
19
|
import com.pax.poslinkadmin.constant.ReceiptPrintFlag
|
|
17
20
|
import com.pax.poslinkadmin.constant.TransactionType
|
|
@@ -24,6 +27,7 @@ import com.pax.poslinksemiintegration.batch.BatchCloseResponse
|
|
|
24
27
|
import com.pax.poslinksemiintegration.constant.CardPresentIndicator
|
|
25
28
|
import com.pax.poslinksemiintegration.constant.TipRequestFlag
|
|
26
29
|
import com.pax.poslinksemiintegration.constant.VehicleClassId
|
|
30
|
+
import com.pax.poslinksemiintegration.report.LocalDetailReportRequest
|
|
27
31
|
import com.pax.poslinksemiintegration.transaction.DoCreditRequest
|
|
28
32
|
import com.pax.poslinksemiintegration.transaction.DoCreditResponse
|
|
29
33
|
import com.pax.poslinksemiintegration.util.AccountRequest
|
|
@@ -43,6 +47,7 @@ import com.pax.poslinksemiintegration.util.Restaurant
|
|
|
43
47
|
import com.pax.poslinksemiintegration.util.TraceRequest
|
|
44
48
|
import com.pax.poslinksemiintegration.util.TransactionBehavior
|
|
45
49
|
import com.paxposlink.Utils
|
|
50
|
+
import java.time.Instant
|
|
46
51
|
|
|
47
52
|
class PaxPosLinkModule(
|
|
48
53
|
reactApplicationContext: ReactApplicationContext,
|
|
@@ -79,6 +84,7 @@ class PaxPosLinkModule(
|
|
|
79
84
|
Log.d("Success Init", "Create terminal success")
|
|
80
85
|
map.putString("message", "Create terminal success")
|
|
81
86
|
map.putBoolean("status", true)
|
|
87
|
+
map.putString("serialNumber", getTerminalInfo().toString())
|
|
82
88
|
promise.resolve(map)
|
|
83
89
|
} else {
|
|
84
90
|
Log.d("Failed Init", "Create terminal failed!")
|
|
@@ -137,6 +143,7 @@ class PaxPosLinkModule(
|
|
|
137
143
|
map.putString("cardHolder", this.cardHolder)
|
|
138
144
|
map.putString("cardNumber", this.cardNumber)
|
|
139
145
|
map.putString("refNum", this.refNum)
|
|
146
|
+
map.putString("ecrRefNum", this.ecrRefNum)
|
|
140
147
|
map.putString("transactionId", this.transactionId)
|
|
141
148
|
map.putString("transactionDateTime", this.transactionDateTime)
|
|
142
149
|
map.putString("entryMethod", this.entryMethod)
|
|
@@ -144,6 +151,15 @@ class PaxPosLinkModule(
|
|
|
144
151
|
map.putString("tipAmount", this.tipAmount)
|
|
145
152
|
map.putString("surcharge", this.surcharge)
|
|
146
153
|
map.putString("cardType", this.cardType)
|
|
154
|
+
map.putString("sn", this.sn.toString())
|
|
155
|
+
return map
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
private fun PaxTerminalInfoModel.toWritableMap(): WritableMap {
|
|
159
|
+
val map = Arguments.createMap()
|
|
160
|
+
map.putString("serialNumber", this.serialNumber)
|
|
161
|
+
map.putString("appName", this.appName)
|
|
162
|
+
map.putString("modelName", this.modelName)
|
|
147
163
|
return map
|
|
148
164
|
}
|
|
149
165
|
|
|
@@ -163,11 +179,32 @@ class PaxPosLinkModule(
|
|
|
163
179
|
return buildTransactionResponse(rsp, result)
|
|
164
180
|
}
|
|
165
181
|
|
|
182
|
+
@RequiresApi(Build.VERSION_CODES.O)
|
|
183
|
+
@ReactMethod
|
|
184
|
+
fun checkVoidOrRefundTransaction(ercRefNum: String?, promise: Promise) {
|
|
185
|
+
try {
|
|
186
|
+
val transaction = LocalDetailReportRequest().apply {
|
|
187
|
+
this.ecrReferenceNumber = ercRefNum
|
|
188
|
+
this.edcType = EdcType.ALL
|
|
189
|
+
}
|
|
190
|
+
val result = terminal?.report?.localDetailReport(transaction);
|
|
191
|
+
val map: WritableMap = Arguments.createMap()
|
|
192
|
+
map.putString("code",result?.code().toString() )
|
|
193
|
+
map.putString("message", result?.message().toString())
|
|
194
|
+
map.putString("status", result?.response()?.responseMessage())
|
|
195
|
+
map.putString("serialNumber", getTerminalInfo().toString())
|
|
196
|
+
promise.resolve(map)
|
|
197
|
+
} catch (e: Exception) {
|
|
198
|
+
return promise.resolve("Error to check void or refund")
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
166
202
|
@ReactMethod
|
|
167
203
|
fun void(
|
|
168
204
|
data: ReadableMap,
|
|
169
205
|
promise: Promise,
|
|
170
206
|
) {
|
|
207
|
+
println("Received data void1: ${data.toHashMap()}")
|
|
171
208
|
try {
|
|
172
209
|
val salesRequest =
|
|
173
210
|
PaxRequestModel(
|
|
@@ -182,7 +219,34 @@ class PaxPosLinkModule(
|
|
|
182
219
|
val rsp = DoCreditResponse()
|
|
183
220
|
val result = terminal?.transaction?.doCredit(req)
|
|
184
221
|
val data = buildTransactionResponse(rsp, result)
|
|
185
|
-
promise.resolve(data)
|
|
222
|
+
promise.resolve(data.toWritableMap())
|
|
223
|
+
} catch (e: Exception) {
|
|
224
|
+
return promise.resolve("Error to void transaction")
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
@ReactMethod
|
|
229
|
+
fun voidRefund(
|
|
230
|
+
data: ReadableMap,
|
|
231
|
+
promise: Promise,
|
|
232
|
+
) {
|
|
233
|
+
println("Received data voidRefund1: ${data.toHashMap()}")
|
|
234
|
+
|
|
235
|
+
try {
|
|
236
|
+
val salesRequest =
|
|
237
|
+
PaxRequestModel(
|
|
238
|
+
id = data.getString("id"),
|
|
239
|
+
amount = data.takeIf { it.hasKey("amount") && !it.isNull("amount") }?.getInt("amount") ?: 0,
|
|
240
|
+
tip = data.takeIf { it.hasKey("tip") && !it.isNull("tip") }?.getInt("tip"),
|
|
241
|
+
paymentType = data.takeIf { it.hasKey("paymentType") && !it.isNull("paymentType") }?.getInt("paymentType"),
|
|
242
|
+
ecrRefNum = data.getString("ecrRefNum") ?: "",
|
|
243
|
+
)
|
|
244
|
+
this.salesRequest = salesRequest
|
|
245
|
+
val req = setCreditRequest(TransactionType.VOID_SALE)
|
|
246
|
+
val rsp = DoCreditResponse()
|
|
247
|
+
val result = terminal?.transaction?.doCredit(req)
|
|
248
|
+
val data = buildTransactionResponse(rsp, result)
|
|
249
|
+
promise.resolve(data.toWritableMap())
|
|
186
250
|
} catch (e: Exception) {
|
|
187
251
|
return promise.resolve("Error to void transaction")
|
|
188
252
|
}
|
|
@@ -193,6 +257,7 @@ class PaxPosLinkModule(
|
|
|
193
257
|
data: ReadableMap,
|
|
194
258
|
promise: Promise,
|
|
195
259
|
) {
|
|
260
|
+
println("Received data refund1: ${data.toHashMap()}")
|
|
196
261
|
try {
|
|
197
262
|
val salesRequest =
|
|
198
263
|
PaxRequestModel(
|
|
@@ -207,7 +272,7 @@ class PaxPosLinkModule(
|
|
|
207
272
|
val rsp = DoCreditResponse()
|
|
208
273
|
val result = terminal?.transaction?.doCredit(req)
|
|
209
274
|
val data = buildTransactionResponse(rsp, result)
|
|
210
|
-
promise.resolve(data)
|
|
275
|
+
promise.resolve(data.toWritableMap())
|
|
211
276
|
} catch (e: Exception) {
|
|
212
277
|
return promise.resolve("Error to return transaction")
|
|
213
278
|
}
|
|
@@ -220,13 +285,27 @@ class PaxPosLinkModule(
|
|
|
220
285
|
val batchCloseRsp = BatchCloseResponse()
|
|
221
286
|
val result = terminal?.batch?.batchClose(batchCloseReq)
|
|
222
287
|
if (result?.code() == ExecutionCode.OK) {
|
|
223
|
-
|
|
288
|
+
val map: WritableMap = Arguments.createMap()
|
|
289
|
+
map.putString("message", "Batch close successfully")
|
|
290
|
+
map.putString("data", result.response()?.responseMessage())
|
|
291
|
+
promise.resolve(map)
|
|
224
292
|
}
|
|
225
293
|
} catch (e: Exception) {
|
|
226
294
|
promise.reject("Failed", "Batch close error")
|
|
227
295
|
}
|
|
228
296
|
}
|
|
229
297
|
|
|
298
|
+
@ReactMethod
|
|
299
|
+
fun cancelInit(promise: Promise) {
|
|
300
|
+
try {
|
|
301
|
+
terminal?.cancel();
|
|
302
|
+
promise.resolve("Cancel Init Success" )
|
|
303
|
+
} catch (e: Exception) {
|
|
304
|
+
promise.reject("Failed", "Batch close error")
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
|
|
230
309
|
// fun voidOrRefundTransaction(startDate: Int, serialNumber: String): String {
|
|
231
310
|
// if (startDate == 0) return ""
|
|
232
311
|
// val batchStartDate = getBatchStartDate()
|
|
@@ -284,6 +363,7 @@ class PaxPosLinkModule(
|
|
|
284
363
|
val traceMap =
|
|
285
364
|
Arguments.createMap().apply {
|
|
286
365
|
putString("referenceNumber", trace?.referenceNumber())
|
|
366
|
+
putString("ecrReferenceNumber", trace?.ecrReferenceNumber())
|
|
287
367
|
putString("timeStamp", trace?.timeStamp())
|
|
288
368
|
putString("authorizationCode", trace?.authorizationResponse())
|
|
289
369
|
}
|
|
@@ -386,6 +466,7 @@ class PaxPosLinkModule(
|
|
|
386
466
|
.toString()
|
|
387
467
|
.uppercase()
|
|
388
468
|
refNum = rsp?.traceInformation()?.referenceNumber().toString()
|
|
469
|
+
ecrRefNum = rsp?.traceInformation()?.ecrReferenceNumber().toString();
|
|
389
470
|
transactionId = rsp?.paymentTransactionInformation()?.globalUid().toString()
|
|
390
471
|
transactionDateTime = rsp?.traceInformation()?.timeStamp().toString()
|
|
391
472
|
entryMethod =
|
|
@@ -397,6 +478,7 @@ class PaxPosLinkModule(
|
|
|
397
478
|
amount = salesRequest?.amount.toString()
|
|
398
479
|
id = salesRequest?.id.toString()
|
|
399
480
|
surcharge = rsp?.amountInformation()?.merchantFee().toString()
|
|
481
|
+
sn = getTerminalInfo()
|
|
400
482
|
}
|
|
401
483
|
} else {
|
|
402
484
|
PaxResponseModel().apply {
|
|
@@ -465,16 +547,16 @@ class PaxPosLinkModule(
|
|
|
465
547
|
// } else 0
|
|
466
548
|
// }
|
|
467
549
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
550
|
+
private fun getTerminalInfo(): WritableMap {
|
|
551
|
+
val rs = terminal?.manage?.init()?.let {
|
|
552
|
+
PaxTerminalInfoModel(
|
|
553
|
+
serialNumber = it.response().sn(),
|
|
554
|
+
modelName = it.response().modelName(),
|
|
555
|
+
appName = it.response().appName(),
|
|
556
|
+
)
|
|
557
|
+
}
|
|
558
|
+
return rs!!.toWritableMap();
|
|
559
|
+
}
|
|
478
560
|
|
|
479
561
|
private fun getAmountReq(transType: TransactionType?): AmountRequest =
|
|
480
562
|
AmountRequest().apply {
|
|
@@ -521,7 +603,7 @@ class PaxPosLinkModule(
|
|
|
521
603
|
|
|
522
604
|
private fun getTraceReq(transType: TransactionType): TraceRequest =
|
|
523
605
|
TraceRequest().apply {
|
|
524
|
-
val ecrRefNum = salesRequest?.ecrRefNum
|
|
606
|
+
val ecrRefNum = salesRequest?.ecrRefNum
|
|
525
607
|
ecrRefNum?.let {
|
|
526
608
|
this.ecrReferenceNumber =
|
|
527
609
|
if (transType in listOf(TransactionType.SALE, TransactionType.VOID_SALE, TransactionType.RETURN)) it else null
|
package/package.json
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haroldtran/react-native-pax",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "React Native native module for PAX devices",
|
|
5
|
-
"main": "./
|
|
6
|
-
"module": "./lib/module/index.js",
|
|
7
|
-
"types": "./lib/typescript/commonjs/index.d.ts",
|
|
8
|
-
"source": "src/index",
|
|
5
|
+
"main": "./src/index.ts",
|
|
9
6
|
"files": [
|
|
10
7
|
"src",
|
|
11
|
-
"lib",
|
|
12
8
|
"*.ts",
|
|
13
9
|
"*.js",
|
|
14
10
|
"android",
|
|
15
11
|
"cpp",
|
|
16
12
|
"android/gradlew/wrapper/gradle-wrapper.properties",
|
|
17
|
-
"!lib/typescript/example",
|
|
18
13
|
"!android/build",
|
|
19
14
|
"!android/gradle",
|
|
20
15
|
"!android/gradlew",
|
|
@@ -36,14 +31,12 @@
|
|
|
36
31
|
"react-native.config.mjs"
|
|
37
32
|
],
|
|
38
33
|
"scripts": {
|
|
39
|
-
"prebuild": "yarn && yarn typecheck && yarn lint
|
|
34
|
+
"prebuild": "yarn && yarn typecheck && yarn lint",
|
|
40
35
|
"test": "jest",
|
|
41
36
|
"typecheck": "tsc --noEmit",
|
|
42
37
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
43
|
-
"prepack": "bob build",
|
|
44
38
|
"release": "yarn prebuild && release-it",
|
|
45
|
-
"example": "yarn --cwd example"
|
|
46
|
-
"prepare": "bob build"
|
|
39
|
+
"example": "yarn --cwd example"
|
|
47
40
|
},
|
|
48
41
|
"keywords": [
|
|
49
42
|
"react-native",
|
|
@@ -105,7 +98,7 @@
|
|
|
105
98
|
"preset": "react-native",
|
|
106
99
|
"modulePathIgnorePatterns": [
|
|
107
100
|
"<rootDir>/example/node_modules",
|
|
108
|
-
"<rootDir>/
|
|
101
|
+
"<rootDir>/src/"
|
|
109
102
|
]
|
|
110
103
|
},
|
|
111
104
|
"commitlint": {
|
|
@@ -133,8 +126,7 @@
|
|
|
133
126
|
}
|
|
134
127
|
},
|
|
135
128
|
"eslintIgnore": [
|
|
136
|
-
"node_modules/"
|
|
137
|
-
"lib/"
|
|
129
|
+
"node_modules/"
|
|
138
130
|
],
|
|
139
131
|
"prettier": {
|
|
140
132
|
"quoteProps": "consistent",
|
|
@@ -143,38 +135,5 @@
|
|
|
143
135
|
"trailingComma": "es5",
|
|
144
136
|
"useTabs": false
|
|
145
137
|
},
|
|
146
|
-
"
|
|
147
|
-
"source": "src",
|
|
148
|
-
"output": "lib",
|
|
149
|
-
"targets": [
|
|
150
|
-
[
|
|
151
|
-
"module",
|
|
152
|
-
{
|
|
153
|
-
"esm": true
|
|
154
|
-
}
|
|
155
|
-
],
|
|
156
|
-
[
|
|
157
|
-
"commonjs",
|
|
158
|
-
{
|
|
159
|
-
"esm": true
|
|
160
|
-
}
|
|
161
|
-
],
|
|
162
|
-
"typescript"
|
|
163
|
-
]
|
|
164
|
-
},
|
|
165
|
-
"packageManager": "yarn@4.9.2",
|
|
166
|
-
"exports": {
|
|
167
|
-
".": {
|
|
168
|
-
"source": "./src/index.tsx",
|
|
169
|
-
"import": {
|
|
170
|
-
"types": "./lib/typescript/module/index.d.ts",
|
|
171
|
-
"default": "./lib/module/index.js"
|
|
172
|
-
},
|
|
173
|
-
"require": {
|
|
174
|
-
"types": "./lib/typescript/commonjs/index.d.ts",
|
|
175
|
-
"default": "./lib/commonjs/index.js"
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
"./package.json": "./package.json"
|
|
179
|
-
}
|
|
138
|
+
"packageManager": "yarn@4.10.3"
|
|
180
139
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NativeModules, Platform } from 'react-native';
|
|
2
2
|
import { PaxResponseModel } from './type';
|
|
3
|
-
|
|
3
|
+
export * from './type';
|
|
4
4
|
// This package is Android-only. Provide clear errors on non-Android platforms
|
|
5
5
|
const ANDROID_ONLY_ERROR =
|
|
6
6
|
"The package '@haroldtran/react-native-pax' only supports Android.";
|
|
@@ -18,7 +18,9 @@ const PaxPosLink = isAndroid
|
|
|
18
18
|
{},
|
|
19
19
|
{
|
|
20
20
|
get() {
|
|
21
|
-
|
|
21
|
+
const err = new Error(LINKING_ERROR);
|
|
22
|
+
err.stack = '';
|
|
23
|
+
throw err;
|
|
22
24
|
},
|
|
23
25
|
}
|
|
24
26
|
)
|
|
@@ -26,7 +28,9 @@ const PaxPosLink = isAndroid
|
|
|
26
28
|
{},
|
|
27
29
|
{
|
|
28
30
|
get() {
|
|
29
|
-
|
|
31
|
+
const err = new Error(ANDROID_ONLY_ERROR);
|
|
32
|
+
err.stack = '';
|
|
33
|
+
throw err;
|
|
30
34
|
},
|
|
31
35
|
}
|
|
32
36
|
);
|
|
@@ -62,25 +66,37 @@ export function makePayment(
|
|
|
62
66
|
/**
|
|
63
67
|
* Initiates a refund transaction.
|
|
64
68
|
* @param {string} amount - The amount to refund.
|
|
69
|
+
* @param {string} ecrRefNum - The ECR reference number.
|
|
65
70
|
* @returns {Promise<PaxResponseModel>} A promise resolving to the refund result.
|
|
66
71
|
*/
|
|
67
|
-
export function makeRefund(
|
|
68
|
-
|
|
72
|
+
export function makeRefund(
|
|
73
|
+
amount: number,
|
|
74
|
+
ecrRefNum: string
|
|
75
|
+
): Promise<PaxResponseModel> {
|
|
76
|
+
return PaxPosLink.refund({ amount, ecrRefNum });
|
|
69
77
|
}
|
|
70
78
|
|
|
71
79
|
/**
|
|
72
80
|
* Voids a transaction for the given amount.
|
|
73
|
-
* @param {string}
|
|
81
|
+
* @param {string} ecrRefNum - The ECR reference number.
|
|
74
82
|
* @returns {Promise<PaxResponseModel>} A promise resolving to the void result.
|
|
75
83
|
*/
|
|
76
|
-
export function makeVoid(
|
|
77
|
-
return PaxPosLink.void({
|
|
84
|
+
export function makeVoid(ecrRefNum: string): Promise<PaxResponseModel> {
|
|
85
|
+
return PaxPosLink.void({ ecrRefNum });
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
/**
|
|
81
89
|
* Closes the current batch of transactions.
|
|
82
90
|
* @returns {Promise<PaxResponseModel>} A promise resolving to the batch closeout result.
|
|
83
91
|
*/
|
|
92
|
+
|
|
84
93
|
export function makeCloseBatch(): Promise<PaxResponseModel> {
|
|
85
94
|
return PaxPosLink.batchCloseout();
|
|
86
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Voids a transaction for the given amount.
|
|
98
|
+
* @param {string} ecrRefNum - The ECR reference number.
|
|
99
|
+
*/
|
|
100
|
+
export function checkVoidOrRefundTransaction(ecrRefNum: string) {
|
|
101
|
+
return PaxPosLink.checkVoidOrRefundTransaction(ecrRefNum);
|
|
102
|
+
}
|
package/src/type.ts
CHANGED
package/lib/commonjs/index.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.initPOSLink = initPOSLink;
|
|
7
|
-
exports.makeCloseBatch = makeCloseBatch;
|
|
8
|
-
exports.makePayment = makePayment;
|
|
9
|
-
exports.makeRefund = makeRefund;
|
|
10
|
-
exports.makeVoid = makeVoid;
|
|
11
|
-
var _reactNative = require("react-native");
|
|
12
|
-
// This package is Android-only. Provide clear errors on non-Android platforms
|
|
13
|
-
const ANDROID_ONLY_ERROR = "The package '@haroldtran/react-native-pax' only supports Android.";
|
|
14
|
-
const LINKING_ERROR = `The package '@haroldtran/react-native-pax' doesn't seem to be linked. Make sure:\n\n` + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
15
|
-
const isAndroid = _reactNative.Platform.OS === 'android';
|
|
16
|
-
const PaxPosLink = isAndroid ? _reactNative.NativeModules.PaxPoslink ?? new Proxy({}, {
|
|
17
|
-
get() {
|
|
18
|
-
throw new Error(LINKING_ERROR);
|
|
19
|
-
}
|
|
20
|
-
}) : new Proxy({}, {
|
|
21
|
-
get() {
|
|
22
|
-
throw new Error(ANDROID_ONLY_ERROR);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Initializes the POSLink connection.
|
|
28
|
-
* @param {string} [ip] - The IP address of the POS device.
|
|
29
|
-
* @returns {*} The result of the native initPOSLink call.
|
|
30
|
-
*/
|
|
31
|
-
function initPOSLink(ip) {
|
|
32
|
-
return PaxPosLink.initPOSLink(ip);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Initiates a payment transaction.
|
|
37
|
-
* @param {string} [id] - Transaction ID (optional).
|
|
38
|
-
* @param {number} [amount] - Payment amount
|
|
39
|
-
* @param {number} [tip] - Tip amount (optional).
|
|
40
|
-
* @param {number} [paymentType] - Type of payment (optional).
|
|
41
|
-
* @param {string} [ecrRefNum] - ECR reference number (optional).
|
|
42
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the payment result.
|
|
43
|
-
*/
|
|
44
|
-
function makePayment(id, amount = 0, tip, paymentType, ecrRefNum) {
|
|
45
|
-
return PaxPosLink.payment({
|
|
46
|
-
id,
|
|
47
|
-
amount,
|
|
48
|
-
tip,
|
|
49
|
-
paymentType,
|
|
50
|
-
ecrRefNum
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Initiates a refund transaction.
|
|
56
|
-
* @param {string} amount - The amount to refund.
|
|
57
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the refund result.
|
|
58
|
-
*/
|
|
59
|
-
function makeRefund(amount) {
|
|
60
|
-
return PaxPosLink.refund({
|
|
61
|
-
amount
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Voids a transaction for the given amount.
|
|
67
|
-
* @param {string} amount - The amount to void.
|
|
68
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the void result.
|
|
69
|
-
*/
|
|
70
|
-
function makeVoid(amount) {
|
|
71
|
-
return PaxPosLink.void({
|
|
72
|
-
amount
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Closes the current batch of transactions.
|
|
78
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the batch closeout result.
|
|
79
|
-
*/
|
|
80
|
-
function makeCloseBatch() {
|
|
81
|
-
return PaxPosLink.batchCloseout();
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","ANDROID_ONLY_ERROR","LINKING_ERROR","isAndroid","Platform","OS","PaxPosLink","NativeModules","PaxPoslink","Proxy","get","Error","initPOSLink","ip","makePayment","id","amount","tip","paymentType","ecrRefNum","payment","makeRefund","refund","makeVoid","void","makeCloseBatch","batchCloseout"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA;AACA,MAAMC,kBAAkB,GACtB,mEAAmE;AAErE,MAAMC,aAAa,GACjB,sFAAsF,GACtF,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,SAAS,GAAGC,qBAAQ,CAACC,EAAE,KAAK,SAAS;AAE3C,MAAMC,UAAU,GAAGH,SAAS,GACxBI,0BAAa,CAACC,UAAU,IACxB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC,GACD,IAAIO,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,kBAAkB,CAAC;EACrC;AACF,CACF,CAAC;;AAEL;AACA;AACA;AACA;AACA;AACO,SAASW,WAAWA,CAACC,EAAU,EAAE;EACtC,OAAOP,UAAU,CAACM,WAAW,CAACC,EAAE,CAAC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CACzBC,EAAW,EACXC,MAAc,GAAG,CAAC,EAClBC,GAAY,EACZC,WAAoB,EACpBC,SAAkB,EACS;EAC3B,OAAOb,UAAU,CAACc,OAAO,CAAC;IAAEL,EAAE;IAAEC,MAAM;IAAEC,GAAG;IAAEC,WAAW;IAAEC;EAAU,CAAC,CAAC;AACxE;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASE,UAAUA,CAACL,MAAc,EAA6B;EACpE,OAAOV,UAAU,CAACgB,MAAM,CAAC;IAAEN;EAAO,CAAC,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASO,QAAQA,CAACP,MAAc,EAA6B;EAClE,OAAOV,UAAU,CAACkB,IAAI,CAAC;IAAER;EAAO,CAAC,CAAC;AACpC;;AAEA;AACA;AACA;AACA;AACO,SAASS,cAAcA,CAAA,EAA8B;EAC1D,OAAOnB,UAAU,CAACoB,aAAa,CAAC,CAAC;AACnC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
package/lib/commonjs/type.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.CreditTransactionType = void 0;
|
|
7
|
-
let CreditTransactionType = exports.CreditTransactionType = /*#__PURE__*/function (CreditTransactionType) {
|
|
8
|
-
CreditTransactionType[CreditTransactionType["Credit"] = 1] = "Credit";
|
|
9
|
-
CreditTransactionType[CreditTransactionType["Debit"] = 2] = "Debit";
|
|
10
|
-
CreditTransactionType[CreditTransactionType["Empty"] = 0] = "Empty";
|
|
11
|
-
return CreditTransactionType;
|
|
12
|
-
}({});
|
|
13
|
-
//# sourceMappingURL=type.js.map
|
package/lib/commonjs/type.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["CreditTransactionType","exports"],"sourceRoot":"../../src","sources":["type.ts"],"mappings":";;;;;;IAkCYA,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA","ignoreList":[]}
|
package/lib/module/index.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { NativeModules, Platform } from 'react-native';
|
|
4
|
-
// This package is Android-only. Provide clear errors on non-Android platforms
|
|
5
|
-
const ANDROID_ONLY_ERROR = "The package '@haroldtran/react-native-pax' only supports Android.";
|
|
6
|
-
const LINKING_ERROR = `The package '@haroldtran/react-native-pax' doesn't seem to be linked. Make sure:\n\n` + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
7
|
-
const isAndroid = Platform.OS === 'android';
|
|
8
|
-
const PaxPosLink = isAndroid ? NativeModules.PaxPoslink ?? new Proxy({}, {
|
|
9
|
-
get() {
|
|
10
|
-
throw new Error(LINKING_ERROR);
|
|
11
|
-
}
|
|
12
|
-
}) : new Proxy({}, {
|
|
13
|
-
get() {
|
|
14
|
-
throw new Error(ANDROID_ONLY_ERROR);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Initializes the POSLink connection.
|
|
20
|
-
* @param {string} [ip] - The IP address of the POS device.
|
|
21
|
-
* @returns {*} The result of the native initPOSLink call.
|
|
22
|
-
*/
|
|
23
|
-
export function initPOSLink(ip) {
|
|
24
|
-
return PaxPosLink.initPOSLink(ip);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Initiates a payment transaction.
|
|
29
|
-
* @param {string} [id] - Transaction ID (optional).
|
|
30
|
-
* @param {number} [amount] - Payment amount
|
|
31
|
-
* @param {number} [tip] - Tip amount (optional).
|
|
32
|
-
* @param {number} [paymentType] - Type of payment (optional).
|
|
33
|
-
* @param {string} [ecrRefNum] - ECR reference number (optional).
|
|
34
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the payment result.
|
|
35
|
-
*/
|
|
36
|
-
export function makePayment(id, amount = 0, tip, paymentType, ecrRefNum) {
|
|
37
|
-
return PaxPosLink.payment({
|
|
38
|
-
id,
|
|
39
|
-
amount,
|
|
40
|
-
tip,
|
|
41
|
-
paymentType,
|
|
42
|
-
ecrRefNum
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Initiates a refund transaction.
|
|
48
|
-
* @param {string} amount - The amount to refund.
|
|
49
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the refund result.
|
|
50
|
-
*/
|
|
51
|
-
export function makeRefund(amount) {
|
|
52
|
-
return PaxPosLink.refund({
|
|
53
|
-
amount
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Voids a transaction for the given amount.
|
|
59
|
-
* @param {string} amount - The amount to void.
|
|
60
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the void result.
|
|
61
|
-
*/
|
|
62
|
-
export function makeVoid(amount) {
|
|
63
|
-
return PaxPosLink.void({
|
|
64
|
-
amount
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Closes the current batch of transactions.
|
|
70
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the batch closeout result.
|
|
71
|
-
*/
|
|
72
|
-
export function makeCloseBatch() {
|
|
73
|
-
return PaxPosLink.batchCloseout();
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","ANDROID_ONLY_ERROR","LINKING_ERROR","isAndroid","OS","PaxPosLink","PaxPoslink","Proxy","get","Error","initPOSLink","ip","makePayment","id","amount","tip","paymentType","ecrRefNum","payment","makeRefund","refund","makeVoid","void","makeCloseBatch","batchCloseout"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAGtD;AACA,MAAMC,kBAAkB,GACtB,mEAAmE;AAErE,MAAMC,aAAa,GACjB,sFAAsF,GACtF,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,SAAS,GAAGH,QAAQ,CAACI,EAAE,KAAK,SAAS;AAE3C,MAAMC,UAAU,GAAGF,SAAS,GACxBJ,aAAa,CAACO,UAAU,IACxB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC,GACD,IAAIK,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,kBAAkB,CAAC;EACrC;AACF,CACF,CAAC;;AAEL;AACA;AACA;AACA;AACA;AACA,OAAO,SAASS,WAAWA,CAACC,EAAU,EAAE;EACtC,OAAON,UAAU,CAACK,WAAW,CAACC,EAAE,CAAC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CACzBC,EAAW,EACXC,MAAc,GAAG,CAAC,EAClBC,GAAY,EACZC,WAAoB,EACpBC,SAAkB,EACS;EAC3B,OAAOZ,UAAU,CAACa,OAAO,CAAC;IAAEL,EAAE;IAAEC,MAAM;IAAEC,GAAG;IAAEC,WAAW;IAAEC;EAAU,CAAC,CAAC;AACxE;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,UAAUA,CAACL,MAAc,EAA6B;EACpE,OAAOT,UAAU,CAACe,MAAM,CAAC;IAAEN;EAAO,CAAC,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,QAAQA,CAACP,MAAc,EAA6B;EAClE,OAAOT,UAAU,CAACiB,IAAI,CAAC;IAAER;EAAO,CAAC,CAAC;AACpC;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASS,cAAcA,CAAA,EAA8B;EAC1D,OAAOlB,UAAU,CAACmB,aAAa,CAAC,CAAC;AACnC","ignoreList":[]}
|
package/lib/module/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module"}
|
package/lib/module/type.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export let CreditTransactionType = /*#__PURE__*/function (CreditTransactionType) {
|
|
4
|
-
CreditTransactionType[CreditTransactionType["Credit"] = 1] = "Credit";
|
|
5
|
-
CreditTransactionType[CreditTransactionType["Debit"] = 2] = "Debit";
|
|
6
|
-
CreditTransactionType[CreditTransactionType["Empty"] = 0] = "Empty";
|
|
7
|
-
return CreditTransactionType;
|
|
8
|
-
}({});
|
|
9
|
-
//# sourceMappingURL=type.js.map
|
package/lib/module/type.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["CreditTransactionType"],"sourceRoot":"../../src","sources":["type.ts"],"mappings":";;AAkCA,WAAYA,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA","ignoreList":[]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { PaxResponseModel } from './type';
|
|
2
|
-
/**
|
|
3
|
-
* Initializes the POSLink connection.
|
|
4
|
-
* @param {string} [ip] - The IP address of the POS device.
|
|
5
|
-
* @returns {*} The result of the native initPOSLink call.
|
|
6
|
-
*/
|
|
7
|
-
export declare function initPOSLink(ip: string): any;
|
|
8
|
-
/**
|
|
9
|
-
* Initiates a payment transaction.
|
|
10
|
-
* @param {string} [id] - Transaction ID (optional).
|
|
11
|
-
* @param {number} [amount] - Payment amount
|
|
12
|
-
* @param {number} [tip] - Tip amount (optional).
|
|
13
|
-
* @param {number} [paymentType] - Type of payment (optional).
|
|
14
|
-
* @param {string} [ecrRefNum] - ECR reference number (optional).
|
|
15
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the payment result.
|
|
16
|
-
*/
|
|
17
|
-
export declare function makePayment(id?: string, amount?: number, tip?: number, paymentType?: number, ecrRefNum?: string): Promise<PaxResponseModel>;
|
|
18
|
-
/**
|
|
19
|
-
* Initiates a refund transaction.
|
|
20
|
-
* @param {string} amount - The amount to refund.
|
|
21
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the refund result.
|
|
22
|
-
*/
|
|
23
|
-
export declare function makeRefund(amount: string): Promise<PaxResponseModel>;
|
|
24
|
-
/**
|
|
25
|
-
* Voids a transaction for the given amount.
|
|
26
|
-
* @param {string} amount - The amount to void.
|
|
27
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the void result.
|
|
28
|
-
*/
|
|
29
|
-
export declare function makeVoid(amount: string): Promise<PaxResponseModel>;
|
|
30
|
-
/**
|
|
31
|
-
* Closes the current batch of transactions.
|
|
32
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the batch closeout result.
|
|
33
|
-
*/
|
|
34
|
-
export declare function makeCloseBatch(): Promise<PaxResponseModel>;
|
|
35
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAgC1C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,OAErC;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,EAAE,CAAC,EAAE,MAAM,EACX,MAAM,GAAE,MAAU,EAClB,GAAG,CAAC,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAElE;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAE1D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export interface PaxRequestModel {
|
|
2
|
-
id?: string;
|
|
3
|
-
amount?: number;
|
|
4
|
-
tip?: number;
|
|
5
|
-
paymentType?: number;
|
|
6
|
-
ecrRefNum?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface PaxResponseModel {
|
|
9
|
-
status?: boolean;
|
|
10
|
-
data?: any;
|
|
11
|
-
message?: string;
|
|
12
|
-
isPaymentSuccess?: boolean;
|
|
13
|
-
id?: string;
|
|
14
|
-
transactionId?: string;
|
|
15
|
-
transactionNo?: string;
|
|
16
|
-
refNum?: string;
|
|
17
|
-
transactionDateTime?: string;
|
|
18
|
-
cardType?: string;
|
|
19
|
-
cardNumber?: string;
|
|
20
|
-
cardHolder?: string;
|
|
21
|
-
amount?: string;
|
|
22
|
-
tipAmount?: string;
|
|
23
|
-
surcharge?: string;
|
|
24
|
-
entryMethod?: string;
|
|
25
|
-
sn?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface PaxTerminalInfoModel {
|
|
28
|
-
serialNumber?: string;
|
|
29
|
-
modelName?: string;
|
|
30
|
-
appName?: string;
|
|
31
|
-
}
|
|
32
|
-
export declare enum CreditTransactionType {
|
|
33
|
-
Credit = 1,
|
|
34
|
-
Debit = 2,
|
|
35
|
-
Empty = 0
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,qBAAqB;IAC/B,MAAM,IAAI;IACV,KAAK,IAAI;IACT,KAAK,IAAI;CACV"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { PaxResponseModel } from './type';
|
|
2
|
-
/**
|
|
3
|
-
* Initializes the POSLink connection.
|
|
4
|
-
* @param {string} [ip] - The IP address of the POS device.
|
|
5
|
-
* @returns {*} The result of the native initPOSLink call.
|
|
6
|
-
*/
|
|
7
|
-
export declare function initPOSLink(ip: string): any;
|
|
8
|
-
/**
|
|
9
|
-
* Initiates a payment transaction.
|
|
10
|
-
* @param {string} [id] - Transaction ID (optional).
|
|
11
|
-
* @param {number} [amount] - Payment amount
|
|
12
|
-
* @param {number} [tip] - Tip amount (optional).
|
|
13
|
-
* @param {number} [paymentType] - Type of payment (optional).
|
|
14
|
-
* @param {string} [ecrRefNum] - ECR reference number (optional).
|
|
15
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the payment result.
|
|
16
|
-
*/
|
|
17
|
-
export declare function makePayment(id?: string, amount?: number, tip?: number, paymentType?: number, ecrRefNum?: string): Promise<PaxResponseModel>;
|
|
18
|
-
/**
|
|
19
|
-
* Initiates a refund transaction.
|
|
20
|
-
* @param {string} amount - The amount to refund.
|
|
21
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the refund result.
|
|
22
|
-
*/
|
|
23
|
-
export declare function makeRefund(amount: string): Promise<PaxResponseModel>;
|
|
24
|
-
/**
|
|
25
|
-
* Voids a transaction for the given amount.
|
|
26
|
-
* @param {string} amount - The amount to void.
|
|
27
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the void result.
|
|
28
|
-
*/
|
|
29
|
-
export declare function makeVoid(amount: string): Promise<PaxResponseModel>;
|
|
30
|
-
/**
|
|
31
|
-
* Closes the current batch of transactions.
|
|
32
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the batch closeout result.
|
|
33
|
-
*/
|
|
34
|
-
export declare function makeCloseBatch(): Promise<PaxResponseModel>;
|
|
35
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAgC1C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,OAErC;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,EAAE,CAAC,EAAE,MAAM,EACX,MAAM,GAAE,MAAU,EAClB,GAAG,CAAC,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAElE;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAE1D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export interface PaxRequestModel {
|
|
2
|
-
id?: string;
|
|
3
|
-
amount?: number;
|
|
4
|
-
tip?: number;
|
|
5
|
-
paymentType?: number;
|
|
6
|
-
ecrRefNum?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface PaxResponseModel {
|
|
9
|
-
status?: boolean;
|
|
10
|
-
data?: any;
|
|
11
|
-
message?: string;
|
|
12
|
-
isPaymentSuccess?: boolean;
|
|
13
|
-
id?: string;
|
|
14
|
-
transactionId?: string;
|
|
15
|
-
transactionNo?: string;
|
|
16
|
-
refNum?: string;
|
|
17
|
-
transactionDateTime?: string;
|
|
18
|
-
cardType?: string;
|
|
19
|
-
cardNumber?: string;
|
|
20
|
-
cardHolder?: string;
|
|
21
|
-
amount?: string;
|
|
22
|
-
tipAmount?: string;
|
|
23
|
-
surcharge?: string;
|
|
24
|
-
entryMethod?: string;
|
|
25
|
-
sn?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface PaxTerminalInfoModel {
|
|
28
|
-
serialNumber?: string;
|
|
29
|
-
modelName?: string;
|
|
30
|
-
appName?: string;
|
|
31
|
-
}
|
|
32
|
-
export declare enum CreditTransactionType {
|
|
33
|
-
Credit = 1,
|
|
34
|
-
Debit = 2,
|
|
35
|
-
Empty = 0
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,qBAAqB;IAC/B,MAAM,IAAI;IACV,KAAK,IAAI;IACT,KAAK,IAAI;CACV"}
|