@haroldtran/react-native-pax 0.1.8 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitignore +4 -0
- package/README.md +118 -160
- package/android/build.gradle +15 -4
- package/android/gradle.properties +8 -5
- package/android/libs/POSLink_Admin_Android_Plugin_V2.00.00_20230828.jar +0 -0
- package/android/libs/POSLink_Core_Android_V2.00.03_20230828.jar +0 -0
- package/android/libs/POSLink_Semi_Android_Plugin_V2.00.00_20230828.jar +0 -0
- package/android/libs/PaxLog_1.0.11_20220921.jar +0 -0
- package/android/src/main/java/com/paxposlink/PaxPosConstant.kt +57 -0
- package/android/src/main/java/com/paxposlink/PaxPosLinkModule.kt +711 -0
- package/android/src/main/java/com/paxposlink/PaxPosLinkPackage.kt +12 -0
- package/android/src/main/java/com/paxposlink/Utils.kt +99 -0
- package/lib/commonjs/index.js +57 -26
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/type.js +13 -0
- package/lib/commonjs/type.js.map +1 -0
- package/lib/module/index.js +54 -20
- package/lib/module/index.js.map +1 -1
- package/lib/module/type.js +9 -0
- package/lib/module/type.js.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +34 -8
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/type.d.ts +37 -0
- package/lib/typescript/commonjs/type.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +34 -8
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/type.d.ts +37 -0
- package/lib/typescript/module/type.d.ts.map +1 -0
- package/package.json +4 -2
- package/src/index.tsx +45 -49
- package/src/type.ts +39 -0
- package/android/libs/POSLink_Core.jar +0 -0
- package/android/src/main/java/com/paxposlink/PaxPoslinkModule.java +0 -355
- package/android/src/main/java/com/paxposlink/PaxPoslinkPackage.java +0 -28
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package com.paxposlink
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewManager
|
|
7
|
+
|
|
8
|
+
class PaxPoslinkPackage : ReactPackage {
|
|
9
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> = listOf(PaxPosLinkModule(reactContext))
|
|
10
|
+
|
|
11
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> = emptyList()
|
|
12
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
package com.paxposlink
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.*
|
|
4
|
+
import com.google.gson.Gson
|
|
5
|
+
import org.json.*
|
|
6
|
+
|
|
7
|
+
object Utils {
|
|
8
|
+
private val gson = Gson()
|
|
9
|
+
|
|
10
|
+
@JvmStatic
|
|
11
|
+
fun toWritableMap(data: Any?): WritableMap {
|
|
12
|
+
if (data == null) return Arguments.createMap()
|
|
13
|
+
return try {
|
|
14
|
+
val jsonObject = JSONObject(gson.toJson(data))
|
|
15
|
+
convertJsonToMap(jsonObject)
|
|
16
|
+
} catch (e: JSONException) {
|
|
17
|
+
e.printStackTrace()
|
|
18
|
+
Arguments.createMap()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@JvmStatic
|
|
23
|
+
fun toWritableArray(data: Any?): WritableArray {
|
|
24
|
+
if (data == null) return Arguments.createArray()
|
|
25
|
+
return try {
|
|
26
|
+
val jsonArray = JSONArray(gson.toJson(data))
|
|
27
|
+
convertJsonToArray(jsonArray)
|
|
28
|
+
} catch (e: JSONException) {
|
|
29
|
+
e.printStackTrace()
|
|
30
|
+
Arguments.createArray()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@JvmStatic
|
|
35
|
+
fun convertJsonToMap(jsonObject: JSONObject?): WritableMap {
|
|
36
|
+
val map = Arguments.createMap()
|
|
37
|
+
if (jsonObject == null) return map
|
|
38
|
+
try {
|
|
39
|
+
val keys = jsonObject.names() ?: return map
|
|
40
|
+
for (i in 0 until keys.length()) {
|
|
41
|
+
val key = keys.optString(i)
|
|
42
|
+
val value = jsonObject.opt(key)
|
|
43
|
+
putValueToMap(map, key, value)
|
|
44
|
+
}
|
|
45
|
+
} catch (e: Exception) {
|
|
46
|
+
e.printStackTrace()
|
|
47
|
+
}
|
|
48
|
+
return map
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@JvmStatic
|
|
52
|
+
fun convertJsonToArray(jsonArray: JSONArray?): WritableArray {
|
|
53
|
+
val array = Arguments.createArray()
|
|
54
|
+
if (jsonArray == null) return array
|
|
55
|
+
try {
|
|
56
|
+
for (i in 0 until jsonArray.length()) {
|
|
57
|
+
val value = jsonArray.opt(i)
|
|
58
|
+
pushValueToArray(array, value)
|
|
59
|
+
}
|
|
60
|
+
} catch (e: Exception) {
|
|
61
|
+
e.printStackTrace()
|
|
62
|
+
}
|
|
63
|
+
return array
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private fun putValueToMap(map: WritableMap, key: String, value: Any?) {
|
|
67
|
+
try {
|
|
68
|
+
when (value) {
|
|
69
|
+
is JSONObject -> map.putMap(key, convertJsonToMap(value))
|
|
70
|
+
is JSONArray -> map.putArray(key, convertJsonToArray(value))
|
|
71
|
+
is Boolean -> map.putBoolean(key, value)
|
|
72
|
+
is Int -> map.putInt(key, value)
|
|
73
|
+
is Long -> map.putDouble(key, value.toDouble()) // RN does not have putLong
|
|
74
|
+
is Float, is Double -> map.putDouble(key, (value as Number).toDouble())
|
|
75
|
+
JSONObject.NULL, null -> map.putNull(key)
|
|
76
|
+
else -> map.putString(key, value.toString())
|
|
77
|
+
}
|
|
78
|
+
} catch (e: Exception) {
|
|
79
|
+
e.printStackTrace()
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private fun pushValueToArray(array: WritableArray, value: Any?) {
|
|
84
|
+
try {
|
|
85
|
+
when (value) {
|
|
86
|
+
is JSONObject -> array.pushMap(convertJsonToMap(value))
|
|
87
|
+
is JSONArray -> array.pushArray(convertJsonToArray(value))
|
|
88
|
+
is Boolean -> array.pushBoolean(value)
|
|
89
|
+
is Int -> array.pushInt(value)
|
|
90
|
+
is Long -> array.pushDouble(value.toDouble())
|
|
91
|
+
is Float, is Double -> array.pushDouble((value as Number).toDouble())
|
|
92
|
+
JSONObject.NULL, null -> array.pushNull()
|
|
93
|
+
else -> array.pushString(value.toString())
|
|
94
|
+
}
|
|
95
|
+
} catch (e: Exception) {
|
|
96
|
+
e.printStackTrace()
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,46 +3,77 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.closeBatch = closeBatch;
|
|
7
6
|
exports.initPOSLink = initPOSLink;
|
|
8
|
-
exports.
|
|
9
|
-
exports.makeAuth = makeAuth;
|
|
7
|
+
exports.makeCloseBatch = makeCloseBatch;
|
|
10
8
|
exports.makePayment = makePayment;
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.voidTransaction = voidTransaction;
|
|
9
|
+
exports.makeRefund = makeRefund;
|
|
10
|
+
exports.makeVoid = makeVoid;
|
|
14
11
|
var _reactNative = require("react-native");
|
|
15
12
|
const LINKING_ERROR = `The package '@haroldtran/react-native-pax' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
16
13
|
ios: "- You have run 'pod install'\n",
|
|
17
14
|
default: ''
|
|
18
15
|
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
19
|
-
const
|
|
16
|
+
const PaxPosLink = _reactNative.NativeModules.PaxPoslink ? _reactNative.NativeModules.PaxPoslink : new Proxy({}, {
|
|
20
17
|
get() {
|
|
21
18
|
throw new Error(LINKING_ERROR);
|
|
22
19
|
}
|
|
23
20
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
function makeAdjustment(amount, refNum) {
|
|
34
|
-
return PaxPoslink.runAdjustment(amount, refNum);
|
|
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
|
+
function initPOSLink(ip) {
|
|
28
|
+
return PaxPosLink.initPOSLink(ip);
|
|
35
29
|
}
|
|
36
|
-
|
|
37
|
-
|
|
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
|
+
function makePayment(id, amount = 0, tip, paymentType, ecrRefNum) {
|
|
41
|
+
return PaxPosLink.payment({
|
|
42
|
+
id,
|
|
43
|
+
amount,
|
|
44
|
+
tip,
|
|
45
|
+
paymentType,
|
|
46
|
+
ecrRefNum
|
|
47
|
+
});
|
|
38
48
|
}
|
|
39
|
-
|
|
40
|
-
|
|
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
|
+
function makeRefund(amount) {
|
|
56
|
+
return PaxPosLink.refund({
|
|
57
|
+
amount
|
|
58
|
+
});
|
|
41
59
|
}
|
|
42
|
-
|
|
43
|
-
|
|
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
|
+
function makeVoid(amount) {
|
|
67
|
+
return PaxPosLink.void({
|
|
68
|
+
amount
|
|
69
|
+
});
|
|
44
70
|
}
|
|
45
|
-
|
|
46
|
-
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Closes the current batch of transactions.
|
|
74
|
+
* @returns {Promise<PaxResponseModel>} A promise resolving to the batch closeout result.
|
|
75
|
+
*/
|
|
76
|
+
function makeCloseBatch() {
|
|
77
|
+
return PaxPosLink.batchCloseout();
|
|
47
78
|
}
|
|
48
79
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","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,MAAMC,aAAa,GACjB,uFAAuF,GACvFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,UAAU,GAAGC,0BAAa,CAACC,UAAU,GACvCD,0BAAa,CAACC,UAAU,GACxB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;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":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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
CHANGED
|
@@ -5,33 +5,67 @@ const LINKING_ERROR = `The package '@haroldtran/react-native-pax' doesn't seem t
|
|
|
5
5
|
ios: "- You have run 'pod install'\n",
|
|
6
6
|
default: ''
|
|
7
7
|
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
8
|
-
const
|
|
8
|
+
const PaxPosLink = NativeModules.PaxPoslink ? NativeModules.PaxPoslink : new Proxy({}, {
|
|
9
9
|
get() {
|
|
10
10
|
throw new Error(LINKING_ERROR);
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export function
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
export function makeAdjustment(amount, refNum) {
|
|
23
|
-
return PaxPoslink.runAdjustment(amount, refNum);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Initializes the POSLink connection.
|
|
16
|
+
* @param {string} [ip] - The IP address of the POS device.
|
|
17
|
+
* @returns {*} The result of the native initPOSLink call.
|
|
18
|
+
*/
|
|
19
|
+
export function initPOSLink(ip) {
|
|
20
|
+
return PaxPosLink.initPOSLink(ip);
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Initiates a payment transaction.
|
|
25
|
+
* @param {string} [id] - Transaction ID (optional).
|
|
26
|
+
* @param {number} [amount] - Payment amount
|
|
27
|
+
* @param {number} [tip] - Tip amount (optional).
|
|
28
|
+
* @param {number} [paymentType] - Type of payment (optional).
|
|
29
|
+
* @param {string} [ecrRefNum] - ECR reference number (optional).
|
|
30
|
+
* @returns {Promise<PaxResponseModel>} A promise resolving to the payment result.
|
|
31
|
+
*/
|
|
32
|
+
export function makePayment(id, amount = 0, tip, paymentType, ecrRefNum) {
|
|
33
|
+
return PaxPosLink.payment({
|
|
34
|
+
id,
|
|
35
|
+
amount,
|
|
36
|
+
tip,
|
|
37
|
+
paymentType,
|
|
38
|
+
ecrRefNum
|
|
39
|
+
});
|
|
27
40
|
}
|
|
28
|
-
|
|
29
|
-
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Initiates a refund transaction.
|
|
44
|
+
* @param {string} amount - The amount to refund.
|
|
45
|
+
* @returns {Promise<PaxResponseModel>} A promise resolving to the refund result.
|
|
46
|
+
*/
|
|
47
|
+
export function makeRefund(amount) {
|
|
48
|
+
return PaxPosLink.refund({
|
|
49
|
+
amount
|
|
50
|
+
});
|
|
30
51
|
}
|
|
31
|
-
|
|
32
|
-
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Voids a transaction for the given amount.
|
|
55
|
+
* @param {string} amount - The amount to void.
|
|
56
|
+
* @returns {Promise<PaxResponseModel>} A promise resolving to the void result.
|
|
57
|
+
*/
|
|
58
|
+
export function makeVoid(amount) {
|
|
59
|
+
return PaxPosLink.void({
|
|
60
|
+
amount
|
|
61
|
+
});
|
|
33
62
|
}
|
|
34
|
-
|
|
35
|
-
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Closes the current batch of transactions.
|
|
66
|
+
* @returns {Promise<PaxResponseModel>} A promise resolving to the batch closeout result.
|
|
67
|
+
*/
|
|
68
|
+
export function makeCloseBatch() {
|
|
69
|
+
return PaxPosLink.batchCloseout();
|
|
36
70
|
}
|
|
37
71
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","PaxPoslink","Proxy","get","Error","initPOSLink","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","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,MAAMC,aAAa,GACjB,uFAAuF,GACvFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,UAAU,GAAGN,aAAa,CAACO,UAAU,GACvCP,aAAa,CAACO,UAAU,GACxB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;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":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,9 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare function
|
|
8
|
-
|
|
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>;
|
|
9
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAmB1C;;;;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"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,9 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare function
|
|
8
|
-
|
|
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>;
|
|
9
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAmB1C;;;;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"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haroldtran/react-native-pax",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "React Native native module for PAX devices",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"android",
|
|
13
13
|
"ios",
|
|
14
14
|
"cpp",
|
|
15
|
+
"android/gradlew/wrapper/gradle-wrapper.properties",
|
|
15
16
|
"*.podspec",
|
|
16
17
|
"!lib/typescript/example",
|
|
17
18
|
"!ios/build",
|
|
@@ -36,11 +37,12 @@
|
|
|
36
37
|
"tsconfig.json"
|
|
37
38
|
],
|
|
38
39
|
"scripts": {
|
|
40
|
+
"prebuild": "yarn && yarn typecheck && yarn lint && yarn prepack",
|
|
39
41
|
"test": "jest",
|
|
40
42
|
"typecheck": "tsc --noEmit",
|
|
41
43
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
42
44
|
"prepack": "bob build",
|
|
43
|
-
"release": "release-it",
|
|
45
|
+
"release": "yarn prebuild && release-it",
|
|
44
46
|
"example": "yarn --cwd example",
|
|
45
47
|
"prepare": "bob build"
|
|
46
48
|
},
|