@haroldtran/react-native-pax 1.0.8 → 1.0.12
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/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} +21 -9
- package/src/type.ts +10 -0
- package/.yarnrc.yml +0 -1
- package/lib/commonjs/index.js +0 -87
- 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 -79
- 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
|
|
@@ -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.12",
|
|
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
|
-
import { PaxResponseModel } from './type';
|
|
3
|
-
|
|
2
|
+
import { PaxInitModel, PaxResponseModel } from './type';
|
|
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.";
|
|
@@ -38,9 +38,9 @@ const PaxPosLink = isAndroid
|
|
|
38
38
|
/**
|
|
39
39
|
* Initializes the POSLink connection.
|
|
40
40
|
* @param {string} [ip] - The IP address of the POS device.
|
|
41
|
-
* @returns {
|
|
41
|
+
* @returns {Promise<PaxInitModel>} A promise resolving to the initPOSLink result.
|
|
42
42
|
*/
|
|
43
|
-
export function initPOSLink(ip: string) {
|
|
43
|
+
export function initPOSLink(ip: string): Promise<PaxInitModel> {
|
|
44
44
|
return PaxPosLink.initPOSLink(ip);
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -66,25 +66,37 @@ export function makePayment(
|
|
|
66
66
|
/**
|
|
67
67
|
* Initiates a refund transaction.
|
|
68
68
|
* @param {string} amount - The amount to refund.
|
|
69
|
+
* @param {string} ecrRefNum - The ECR reference number.
|
|
69
70
|
* @returns {Promise<PaxResponseModel>} A promise resolving to the refund result.
|
|
70
71
|
*/
|
|
71
|
-
export function makeRefund(
|
|
72
|
-
|
|
72
|
+
export function makeRefund(
|
|
73
|
+
amount: number,
|
|
74
|
+
ecrRefNum: string
|
|
75
|
+
): Promise<PaxResponseModel> {
|
|
76
|
+
return PaxPosLink.refund({ amount, ecrRefNum });
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
/**
|
|
76
80
|
* Voids a transaction for the given amount.
|
|
77
|
-
* @param {string}
|
|
81
|
+
* @param {string} ecrRefNum - The ECR reference number.
|
|
78
82
|
* @returns {Promise<PaxResponseModel>} A promise resolving to the void result.
|
|
79
83
|
*/
|
|
80
|
-
export function makeVoid(
|
|
81
|
-
return PaxPosLink.void({
|
|
84
|
+
export function makeVoid(ecrRefNum: string): Promise<PaxResponseModel> {
|
|
85
|
+
return PaxPosLink.void({ ecrRefNum });
|
|
82
86
|
}
|
|
83
87
|
|
|
84
88
|
/**
|
|
85
89
|
* Closes the current batch of transactions.
|
|
86
90
|
* @returns {Promise<PaxResponseModel>} A promise resolving to the batch closeout result.
|
|
87
91
|
*/
|
|
92
|
+
|
|
88
93
|
export function makeCloseBatch(): Promise<PaxResponseModel> {
|
|
89
94
|
return PaxPosLink.batchCloseout();
|
|
90
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
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
export interface PaxInitModel {
|
|
2
|
+
serialNumber?: {
|
|
3
|
+
modelName: string;
|
|
4
|
+
appName: string;
|
|
5
|
+
serialNumber: string;
|
|
6
|
+
};
|
|
7
|
+
status: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
1
10
|
export interface PaxRequestModel {
|
|
2
11
|
id?: string;
|
|
3
12
|
amount?: number;
|
|
@@ -14,6 +23,7 @@ export interface PaxResponseModel {
|
|
|
14
23
|
id?: string;
|
|
15
24
|
transactionId?: string;
|
|
16
25
|
transactionNo?: string;
|
|
26
|
+
ecrRefNum?: string;
|
|
17
27
|
refNum?: string;
|
|
18
28
|
transactionDateTime?: string;
|
|
19
29
|
cardType?: string;
|
package/.yarnrc.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
nodeLinker: node-modules
|
package/lib/commonjs/index.js
DELETED
|
@@ -1,87 +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
|
-
const err = new Error(LINKING_ERROR);
|
|
19
|
-
err.stack = '';
|
|
20
|
-
throw err;
|
|
21
|
-
}
|
|
22
|
-
}) : new Proxy({}, {
|
|
23
|
-
get() {
|
|
24
|
-
const err = new Error(ANDROID_ONLY_ERROR);
|
|
25
|
-
err.stack = '';
|
|
26
|
-
throw err;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Initializes the POSLink connection.
|
|
32
|
-
* @param {string} [ip] - The IP address of the POS device.
|
|
33
|
-
* @returns {*} The result of the native initPOSLink call.
|
|
34
|
-
*/
|
|
35
|
-
function initPOSLink(ip) {
|
|
36
|
-
return PaxPosLink.initPOSLink(ip);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Initiates a payment transaction.
|
|
41
|
-
* @param {string} [id] - Transaction ID (optional).
|
|
42
|
-
* @param {number} [amount] - Payment amount
|
|
43
|
-
* @param {number} [tip] - Tip amount (optional).
|
|
44
|
-
* @param {number} [paymentType] - Type of payment (optional).
|
|
45
|
-
* @param {string} [ecrRefNum] - ECR reference number (optional).
|
|
46
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the payment result.
|
|
47
|
-
*/
|
|
48
|
-
function makePayment(id, amount = 0, tip, paymentType, ecrRefNum) {
|
|
49
|
-
return PaxPosLink.payment({
|
|
50
|
-
id,
|
|
51
|
-
amount,
|
|
52
|
-
tip,
|
|
53
|
-
paymentType,
|
|
54
|
-
ecrRefNum
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Initiates a refund transaction.
|
|
60
|
-
* @param {string} amount - The amount to refund.
|
|
61
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the refund result.
|
|
62
|
-
*/
|
|
63
|
-
function makeRefund(amount) {
|
|
64
|
-
return PaxPosLink.refund({
|
|
65
|
-
amount
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Voids a transaction for the given amount.
|
|
71
|
-
* @param {string} amount - The amount to void.
|
|
72
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the void result.
|
|
73
|
-
*/
|
|
74
|
-
function makeVoid(amount) {
|
|
75
|
-
return PaxPosLink.void({
|
|
76
|
-
amount
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Closes the current batch of transactions.
|
|
82
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the batch closeout result.
|
|
83
|
-
*/
|
|
84
|
-
function makeCloseBatch() {
|
|
85
|
-
return PaxPosLink.batchCloseout();
|
|
86
|
-
}
|
|
87
|
-
//# 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","err","Error","stack","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,MAAMC,GAAG,GAAG,IAAIC,KAAK,CAACV,aAAa,CAAC;IACpCS,GAAG,CAACE,KAAK,GAAG,EAAE;IACd,MAAMF,GAAG;EACX;AACF,CACF,CAAC,GACD,IAAIF,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAMC,GAAG,GAAG,IAAIC,KAAK,CAACX,kBAAkB,CAAC;IACzCU,GAAG,CAACE,KAAK,GAAG,EAAE;IACd,MAAMF,GAAG;EACX;AACF,CACF,CAAC;;AAEL;AACA;AACA;AACA;AACA;AACO,SAASG,WAAWA,CAACC,EAAU,EAAE;EACtC,OAAOT,UAAU,CAACQ,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,OAAOf,UAAU,CAACgB,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,OAAOZ,UAAU,CAACkB,MAAM,CAAC;IAAEN;EAAO,CAAC,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASO,QAAQA,CAACP,MAAc,EAA6B;EAClE,OAAOZ,UAAU,CAACoB,IAAI,CAAC;IAAER;EAAO,CAAC,CAAC;AACpC;;AAEA;AACA;AACA;AACA;AACO,SAASS,cAAcA,CAAA,EAA8B;EAC1D,OAAOrB,UAAU,CAACsB,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,79 +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
|
-
const err = new Error(LINKING_ERROR);
|
|
11
|
-
err.stack = '';
|
|
12
|
-
throw err;
|
|
13
|
-
}
|
|
14
|
-
}) : new Proxy({}, {
|
|
15
|
-
get() {
|
|
16
|
-
const err = new Error(ANDROID_ONLY_ERROR);
|
|
17
|
-
err.stack = '';
|
|
18
|
-
throw err;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Initializes the POSLink connection.
|
|
24
|
-
* @param {string} [ip] - The IP address of the POS device.
|
|
25
|
-
* @returns {*} The result of the native initPOSLink call.
|
|
26
|
-
*/
|
|
27
|
-
export function initPOSLink(ip) {
|
|
28
|
-
return PaxPosLink.initPOSLink(ip);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Initiates a payment transaction.
|
|
33
|
-
* @param {string} [id] - Transaction ID (optional).
|
|
34
|
-
* @param {number} [amount] - Payment amount
|
|
35
|
-
* @param {number} [tip] - Tip amount (optional).
|
|
36
|
-
* @param {number} [paymentType] - Type of payment (optional).
|
|
37
|
-
* @param {string} [ecrRefNum] - ECR reference number (optional).
|
|
38
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the payment result.
|
|
39
|
-
*/
|
|
40
|
-
export function makePayment(id, amount = 0, tip, paymentType, ecrRefNum) {
|
|
41
|
-
return PaxPosLink.payment({
|
|
42
|
-
id,
|
|
43
|
-
amount,
|
|
44
|
-
tip,
|
|
45
|
-
paymentType,
|
|
46
|
-
ecrRefNum
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Initiates a refund transaction.
|
|
52
|
-
* @param {string} amount - The amount to refund.
|
|
53
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the refund result.
|
|
54
|
-
*/
|
|
55
|
-
export function makeRefund(amount) {
|
|
56
|
-
return PaxPosLink.refund({
|
|
57
|
-
amount
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Voids a transaction for the given amount.
|
|
63
|
-
* @param {string} amount - The amount to void.
|
|
64
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the void result.
|
|
65
|
-
*/
|
|
66
|
-
export function makeVoid(amount) {
|
|
67
|
-
return PaxPosLink.void({
|
|
68
|
-
amount
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Closes the current batch of transactions.
|
|
74
|
-
* @returns {Promise<PaxResponseModel>} A promise resolving to the batch closeout result.
|
|
75
|
-
*/
|
|
76
|
-
export function makeCloseBatch() {
|
|
77
|
-
return PaxPosLink.batchCloseout();
|
|
78
|
-
}
|
|
79
|
-
//# 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","err","Error","stack","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,MAAMC,GAAG,GAAG,IAAIC,KAAK,CAACR,aAAa,CAAC;IACpCO,GAAG,CAACE,KAAK,GAAG,EAAE;IACd,MAAMF,GAAG;EACX;AACF,CACF,CAAC,GACD,IAAIF,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAMC,GAAG,GAAG,IAAIC,KAAK,CAACT,kBAAkB,CAAC;IACzCQ,GAAG,CAACE,KAAK,GAAG,EAAE;IACd,MAAMF,GAAG;EACX;AACF,CACF,CAAC;;AAEL;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,WAAWA,CAACC,EAAU,EAAE;EACtC,OAAOR,UAAU,CAACO,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,OAAOd,UAAU,CAACe,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,OAAOX,UAAU,CAACiB,MAAM,CAAC;IAAEN;EAAO,CAAC,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,QAAQA,CAACP,MAAc,EAA6B;EAClE,OAAOX,UAAU,CAACmB,IAAI,CAAC;IAAER;EAAO,CAAC,CAAC;AACpC;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASS,cAAcA,CAAA,EAA8B;EAC1D,OAAOpB,UAAU,CAACqB,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;AAoC1C;;;;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;AAoC1C;;;;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"}
|