@haroldtran/react-native-pax 1.0.15 → 1.0.17
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.
|
@@ -70,38 +70,43 @@ class PaxPosLinkModule(
|
|
|
70
70
|
timeout: Int?,
|
|
71
71
|
promise: Promise,
|
|
72
72
|
) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
73
|
+
Thread {
|
|
74
|
+
try {
|
|
75
|
+
val tcpSetting =
|
|
76
|
+
TcpSetting().apply {
|
|
77
|
+
this.ip = ip
|
|
78
|
+
this.port = port ?: PaxPosConstant.PORT
|
|
79
|
+
this.timeout = timeout ?: PaxPosConstant.TIMEOUT
|
|
80
|
+
}
|
|
81
|
+
val tcpSettingInfo = "=>: ip=$ip, port=${tcpSetting.port}, timeout=${tcpSetting.timeout}"
|
|
82
|
+
Log.i("TcpSetting", tcpSettingInfo)
|
|
83
|
+
val map = Arguments.createMap()
|
|
84
|
+
terminal = posLink?.getTerminal(reactContext, tcpSetting)
|
|
85
|
+
Log.e("terminal", terminal.toString())
|
|
86
|
+
if (terminal != null) {
|
|
87
|
+
val info = getTerminalInfo()
|
|
88
|
+
val serialNumber = info.getString("serialNumber") ?: ""
|
|
89
|
+
if (serialNumber.isEmpty()) {
|
|
90
|
+
Log.d("Failed Init", "Create terminal failed!")
|
|
91
|
+
promise.reject(
|
|
92
|
+
"Create terminal failed!",
|
|
93
|
+
tcpSettingInfo,
|
|
94
|
+
)
|
|
95
|
+
} else {
|
|
96
|
+
Log.d("Success Init", "Create terminal success")
|
|
97
|
+
map.putString("message", "Create terminal success! $tcpSettingInfo")
|
|
98
|
+
map.putBoolean("status", true)
|
|
99
|
+
map.putMap("serialNumber", info)
|
|
100
|
+
promise.resolve(map)
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
Log.d("Failed Init", "Create terminal failed!")
|
|
104
|
+
promise.reject("Create terminal failed!", tcpSettingInfo)
|
|
105
|
+
}
|
|
106
|
+
} catch (e: Exception) {
|
|
107
|
+
promise.reject("INIT_ERROR", e)
|
|
100
108
|
}
|
|
101
|
-
}
|
|
102
|
-
Log.d("Failed Init", "Create terminal failed!")
|
|
103
|
-
promise.reject("Create terminal failed!", tcpSettingInfo)
|
|
104
|
-
}
|
|
109
|
+
}.start()
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
@ReactMethod
|
|
@@ -708,9 +713,18 @@ class PaxPosLinkModule(
|
|
|
708
713
|
private fun getTransactionBehaviorReq() =
|
|
709
714
|
TransactionBehavior().apply {
|
|
710
715
|
val tip = salesRequest?.tip
|
|
716
|
+
val showTip = salesRequest?.showTip
|
|
711
717
|
signatureCaptureFlag = null
|
|
712
718
|
tipRequestFlag =
|
|
713
|
-
if (
|
|
719
|
+
if (showTip) {
|
|
720
|
+
if (tip != null && tip > 0) {
|
|
721
|
+
TipRequestFlag.NOT_NEED_ENTER_TIP_ON_TERMINAL
|
|
722
|
+
} else {
|
|
723
|
+
TipRequestFlag.NEED_ENTER_TIP_ON_TERMINAL
|
|
724
|
+
}
|
|
725
|
+
} else {
|
|
726
|
+
TipRequestFlag.NOT_NEED_ENTER_TIP_ON_TERMINAL
|
|
727
|
+
}
|
|
714
728
|
signatureUploadFlag = null
|
|
715
729
|
statusReportFlag = null
|
|
716
730
|
acceptedCardType = null
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -64,9 +64,17 @@ export function makePayment(
|
|
|
64
64
|
amount: number = 0,
|
|
65
65
|
tip?: number,
|
|
66
66
|
paymentType?: number,
|
|
67
|
-
ecrRefNum?: string
|
|
67
|
+
ecrRefNum?: string,
|
|
68
|
+
showTip?: boolean
|
|
68
69
|
): Promise<PaxResponseModel> {
|
|
69
|
-
return PaxPosLink.payment({
|
|
70
|
+
return PaxPosLink.payment({
|
|
71
|
+
id,
|
|
72
|
+
amount,
|
|
73
|
+
tip,
|
|
74
|
+
paymentType,
|
|
75
|
+
ecrRefNum,
|
|
76
|
+
showTip,
|
|
77
|
+
});
|
|
70
78
|
}
|
|
71
79
|
|
|
72
80
|
/**
|