react-native-mesmart 1.3.3 → 2.0.0
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/android/build.gradle +4 -0
- package/android/gradle.properties +1 -1
- package/android/libs/android-easy-layer-gpos780-2.1.4-debug.aar +0 -0
- package/android/libs/libgedi-1.16.21-gpos780-payment-release.aar +0 -0
- package/android/src/main/java/com/gertec/GertecImpl.kt +67 -0
- package/android/src/main/java/com/gertec/GertecModule.kt +62 -0
- package/android/src/main/java/com/gertec/utils/MifareGPOS780.kt +72 -0
- package/android/src/main/java/com/gertec/utils/PrinterGPOS780.kt +38 -0
- package/android/src/main/java/com/mesmart/Packages.kt +3 -1
- package/android/src/main/java/com/mesmart/Utils.kt +13 -0
- package/android/src/main/java/com/plugpag/PlugpagImpl.kt +85 -68
- package/android/src/main/java/com/plugpag/PlugpagModule.kt +3 -20
- package/android/src/main/java/com/stone/StoneImpl.kt +5 -4
- package/android/src/main/java/com/stone/StoneModule.kt +3 -4
- package/android/src/main/java/com/sunmi/SunmiImpl.kt +20 -18
- package/android/src/main/java/com/sunmi/{helpers/SunmiRfidHelper.kt → utils/MifareSunmiP2.kt} +2 -2
- package/android/src/main/java/com/sunmi/{helpers/SunmiPrintHelper.kt → utils/PrinterSunmiP2.kt} +6 -7
- package/lib/commonjs/@types/gertec.js +2 -0
- package/lib/commonjs/@types/gertec.js.map +1 -0
- package/lib/commonjs/@types/index.js +11 -0
- package/lib/commonjs/@types/index.js.map +1 -1
- package/lib/commonjs/index.js +9 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/@types/gertec.js +2 -0
- package/lib/module/@types/gertec.js.map +1 -0
- package/lib/module/@types/index.js +1 -0
- package/lib/module/@types/index.js.map +1 -1
- package/lib/module/index.js +7 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/@types/gertec.d.ts +7 -0
- package/lib/typescript/src/@types/gertec.d.ts.map +1 -0
- package/lib/typescript/src/@types/index.d.ts +1 -0
- package/lib/typescript/src/@types/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +7 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/gertec.ts +6 -0
- package/src/@types/index.ts +1 -0
- package/src/@types/react-native.d.ts +2 -0
- package/src/index.ts +9 -2
package/android/build.gradle
CHANGED
|
@@ -112,4 +112,8 @@ dependencies {
|
|
|
112
112
|
version: "v2.11.7.31",
|
|
113
113
|
group: "paystore"
|
|
114
114
|
)
|
|
115
|
+
implementation files('libs/android-easy-layer-gpos780-2.1.4-debug.aar')
|
|
116
|
+
implementation files('libs/libgedi-1.16.21-gpos780-payment-release.aar')
|
|
117
|
+
// implementation files('libs/libppcomp-001.32-240506-gpos780-logs.aar')
|
|
118
|
+
// implementation files('libs/hal-gertec-debug760.aar')
|
|
115
119
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
package com.gertec
|
|
2
|
+
|
|
3
|
+
import br.com.gertec.gedi.GEDI
|
|
4
|
+
import com.facebook.react.bridge.Promise
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.gertec.utils.MifareGPOS780
|
|
7
|
+
import com.gertec.utils.PrinterGPOS780
|
|
8
|
+
import com.mesmart.Utils
|
|
9
|
+
|
|
10
|
+
class GertecImpl(
|
|
11
|
+
private val reactContext: ReactApplicationContext
|
|
12
|
+
) {
|
|
13
|
+
private val isSupported = Utils.isGPOS780()
|
|
14
|
+
|
|
15
|
+
@Volatile private var mifare: MifareGPOS780? = null
|
|
16
|
+
@Volatile private var printer: PrinterGPOS780? = null
|
|
17
|
+
|
|
18
|
+
init {
|
|
19
|
+
if (isSupported) {
|
|
20
|
+
GEDI.init(reactContext.applicationContext)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Synchronized
|
|
25
|
+
private fun ensureMifare(): MifareGPOS780 {
|
|
26
|
+
if (!isSupported) throw Exception("Unsupported device (Supported model GPOS780).")
|
|
27
|
+
if (mifare == null) mifare = MifareGPOS780()
|
|
28
|
+
return mifare!!
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Synchronized
|
|
32
|
+
private fun ensurePrinter(): PrinterGPOS780 {
|
|
33
|
+
if (!isSupported) throw Exception("Unsupported device (Supported model GPOS780).")
|
|
34
|
+
if (printer == null) printer = PrinterGPOS780(reactContext)
|
|
35
|
+
return printer!!
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
fun scanRfid(promise: Promise) {
|
|
39
|
+
try {
|
|
40
|
+
ensureMifare().scanRfid(promise)
|
|
41
|
+
} catch (t: Throwable) {
|
|
42
|
+
promise.reject(t)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
fun cancelScan(promise: Promise) {
|
|
47
|
+
try {
|
|
48
|
+
ensureMifare().cancelScan(promise)
|
|
49
|
+
} catch (t: Throwable) {
|
|
50
|
+
promise.reject(t)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
fun scrollPrinterPaper(
|
|
55
|
+
lines: Int,
|
|
56
|
+
promise: Promise
|
|
57
|
+
) {
|
|
58
|
+
ensurePrinter().scrollPaper(lines, promise)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
fun printHtml(
|
|
62
|
+
html: String,
|
|
63
|
+
promise: Promise
|
|
64
|
+
) {
|
|
65
|
+
ensurePrinter().printHtml(html, promise)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
package com.gertec
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
6
|
+
import com.facebook.react.bridge.ReactMethod
|
|
7
|
+
|
|
8
|
+
class GertecModule(
|
|
9
|
+
reactContext: ReactApplicationContext
|
|
10
|
+
) : ReactContextBaseJavaModule(reactContext) {
|
|
11
|
+
private var gertec: GertecImpl = GertecImpl(reactContext)
|
|
12
|
+
|
|
13
|
+
override fun getName(): String {
|
|
14
|
+
return "Gertec"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@ReactMethod
|
|
18
|
+
fun scanRfid(promise: Promise) {
|
|
19
|
+
try {
|
|
20
|
+
gertec.scanRfid(promise)
|
|
21
|
+
} catch (e: Exception) {
|
|
22
|
+
e.printStackTrace()
|
|
23
|
+
promise.reject(e)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@ReactMethod
|
|
28
|
+
fun cancelScan(promise: Promise) {
|
|
29
|
+
try {
|
|
30
|
+
gertec.cancelScan(promise)
|
|
31
|
+
} catch (e: Exception) {
|
|
32
|
+
e.printStackTrace()
|
|
33
|
+
promise.reject(e)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@ReactMethod
|
|
38
|
+
fun scrollPrinterPaper(
|
|
39
|
+
lines: Int,
|
|
40
|
+
promise: Promise
|
|
41
|
+
) {
|
|
42
|
+
try {
|
|
43
|
+
gertec.scrollPrinterPaper(lines, promise)
|
|
44
|
+
} catch (e: Exception) {
|
|
45
|
+
e.printStackTrace()
|
|
46
|
+
promise.reject(e)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@ReactMethod
|
|
51
|
+
fun printHtml(
|
|
52
|
+
html: String,
|
|
53
|
+
promise: Promise
|
|
54
|
+
) {
|
|
55
|
+
try {
|
|
56
|
+
gertec.printHtml(html, promise)
|
|
57
|
+
} catch (e: Exception) {
|
|
58
|
+
e.printStackTrace()
|
|
59
|
+
promise.reject(e)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
package com.gertec.utils
|
|
2
|
+
|
|
3
|
+
import br.com.gertec.easylayer.contactless.MifareClassic
|
|
4
|
+
import com.facebook.react.bridge.Promise
|
|
5
|
+
import com.mesmart.Utils
|
|
6
|
+
|
|
7
|
+
class MifareGPOS780 {
|
|
8
|
+
@Volatile private var canceled = false
|
|
9
|
+
@Volatile private var scanning = false
|
|
10
|
+
@Volatile private var worker: Thread? = null
|
|
11
|
+
|
|
12
|
+
private var mifare: MifareClassic = MifareClassic()
|
|
13
|
+
|
|
14
|
+
fun scanRfid(promise: Promise) {
|
|
15
|
+
if (scanning) {
|
|
16
|
+
promise.reject("Service is busy, try again later.")
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
scanning = true
|
|
20
|
+
canceled = false
|
|
21
|
+
|
|
22
|
+
worker = Thread {
|
|
23
|
+
try {
|
|
24
|
+
val totalTimeoutMs = 30000
|
|
25
|
+
val sliceMs = 500
|
|
26
|
+
val deadline = System.currentTimeMillis() + totalTimeoutMs
|
|
27
|
+
var uid: ByteArray? = null
|
|
28
|
+
|
|
29
|
+
while (!canceled && System.currentTimeMillis() < deadline) {
|
|
30
|
+
try {
|
|
31
|
+
uid = mifare.connect(sliceMs)
|
|
32
|
+
break
|
|
33
|
+
} catch (e: Exception) {
|
|
34
|
+
val msg = e.message?.lowercase().orEmpty()
|
|
35
|
+
val isTimeoutLike = msg.contains("timeout") || msg.contains("polling")
|
|
36
|
+
if (!isTimeoutLike) throw e
|
|
37
|
+
} finally {
|
|
38
|
+
try { mifare.close() } catch (_: Exception) {}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
when {
|
|
43
|
+
canceled -> promise.reject("Operation canceled!")
|
|
44
|
+
uid != null -> promise.resolve(
|
|
45
|
+
Utils.resolveRFID(Utils.byteArrayToHexString(uid))
|
|
46
|
+
)
|
|
47
|
+
else -> promise.reject("Timeout to read RFID card!")
|
|
48
|
+
}
|
|
49
|
+
} catch (e: Exception) {
|
|
50
|
+
e.printStackTrace()
|
|
51
|
+
promise.reject(e)
|
|
52
|
+
} finally {
|
|
53
|
+
try { mifare.close() } catch (_: Exception) {}
|
|
54
|
+
mifare = MifareClassic()
|
|
55
|
+
scanning = false
|
|
56
|
+
worker = null
|
|
57
|
+
}
|
|
58
|
+
}.also { it.start() }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
fun cancelScan(promise: Promise) {
|
|
62
|
+
try {
|
|
63
|
+
canceled = true
|
|
64
|
+
try { mifare.close() } catch (_: Exception) {}
|
|
65
|
+
worker?.interrupt()
|
|
66
|
+
promise.resolve(true)
|
|
67
|
+
} catch (e: Exception) {
|
|
68
|
+
e.printStackTrace()
|
|
69
|
+
promise.reject(e)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
package com.gertec.utils
|
|
2
|
+
|
|
3
|
+
import br.com.gertec.easylayer.printer.Printer
|
|
4
|
+
import br.com.gertec.easylayer.printer.PrinterError
|
|
5
|
+
import com.facebook.react.bridge.Promise
|
|
6
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
|
+
|
|
8
|
+
class PrinterGPOS780(
|
|
9
|
+
private val reactContext: ReactApplicationContext
|
|
10
|
+
) {
|
|
11
|
+
fun scrollPaper(
|
|
12
|
+
lines: Int,
|
|
13
|
+
promise: Promise
|
|
14
|
+
) {
|
|
15
|
+
Printer.getInstance(reactContext.applicationContext, object: Printer.Listener {
|
|
16
|
+
override fun onPrinterError(printerError: PrinterError?) {
|
|
17
|
+
promise.reject("Cause: ${printerError?.cause}\\nError code: ${printerError?.code}\\nRequest ID: ${printerError?.requestId}\"")
|
|
18
|
+
}
|
|
19
|
+
override fun onPrinterSuccessful(var1: Int) {
|
|
20
|
+
promise.resolve(true)
|
|
21
|
+
}
|
|
22
|
+
}).scrollPaper(lines)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
fun printHtml(
|
|
26
|
+
html: String,
|
|
27
|
+
promise: Promise
|
|
28
|
+
) {
|
|
29
|
+
Printer.getInstance(reactContext.applicationContext, object: Printer.Listener {
|
|
30
|
+
override fun onPrinterError(printerError: PrinterError?) {
|
|
31
|
+
promise.reject("Cause: ${printerError?.cause}\\nError code: ${printerError?.code}\\nRequest ID: ${printerError?.requestId}\"")
|
|
32
|
+
}
|
|
33
|
+
override fun onPrinterSuccessful(var1: Int) {
|
|
34
|
+
promise.resolve(true)
|
|
35
|
+
}
|
|
36
|
+
}).printHtml(reactContext.applicationContext, html)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -4,6 +4,7 @@ import com.facebook.react.ReactPackage
|
|
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.uimanager.ViewManager
|
|
7
|
+
import com.gertec.GertecModule
|
|
7
8
|
import com.pax.PaxModule
|
|
8
9
|
import com.paystore.PaystoreModule
|
|
9
10
|
import com.plugpag.PlugpagModule
|
|
@@ -17,7 +18,8 @@ class Packages : ReactPackage {
|
|
|
17
18
|
PlugpagModule(reactContext),
|
|
18
19
|
PaxModule(reactContext),
|
|
19
20
|
PaystoreModule(reactContext),
|
|
20
|
-
StoneModule(reactContext)
|
|
21
|
+
StoneModule(reactContext),
|
|
22
|
+
GertecModule(reactContext)
|
|
21
23
|
)
|
|
22
24
|
}
|
|
23
25
|
|
|
@@ -4,6 +4,7 @@ import android.graphics.Bitmap
|
|
|
4
4
|
import android.graphics.BitmapFactory
|
|
5
5
|
import android.os.Build
|
|
6
6
|
import android.util.Base64
|
|
7
|
+
import java.math.BigInteger
|
|
7
8
|
import java.text.SimpleDateFormat
|
|
8
9
|
import java.util.Date
|
|
9
10
|
import java.util.Locale
|
|
@@ -17,6 +18,10 @@ object Utils {
|
|
|
17
18
|
return Build.MODEL.equals("A910", true)
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
fun isGPOS780(): Boolean {
|
|
22
|
+
return Build.MODEL.equals("GPOS780", true)
|
|
23
|
+
}
|
|
24
|
+
|
|
20
25
|
fun resolveRFID(value: String): String {
|
|
21
26
|
val length = value.length
|
|
22
27
|
|
|
@@ -104,4 +109,12 @@ object Utils {
|
|
|
104
109
|
format.format(it)
|
|
105
110
|
}
|
|
106
111
|
}
|
|
112
|
+
|
|
113
|
+
fun byteArrayToHexString(input: ByteArray): String {
|
|
114
|
+
val builder = StringBuilder()
|
|
115
|
+
for (b in input) {
|
|
116
|
+
builder.append(String.format("%02X", b))
|
|
117
|
+
}
|
|
118
|
+
return builder.toString()
|
|
119
|
+
}
|
|
107
120
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.plugpag
|
|
2
2
|
|
|
3
|
+
import android.content.pm.PackageManager
|
|
3
4
|
import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPag
|
|
4
5
|
import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagActivationData
|
|
5
6
|
import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagCustomPrinterLayout
|
|
@@ -9,86 +10,96 @@ import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPaymentData
|
|
|
9
10
|
import com.facebook.react.bridge.Arguments
|
|
10
11
|
import com.facebook.react.bridge.Promise
|
|
11
12
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
12
|
-
import com.facebook.react.bridge.ReactContext
|
|
13
|
-
import com.facebook.react.bridge.WritableMap
|
|
14
13
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
15
14
|
import com.plugpag.utils.PlugpagUtils
|
|
16
15
|
|
|
17
16
|
class PlugpagImpl(
|
|
18
17
|
private val reactContext: ReactApplicationContext
|
|
19
18
|
) {
|
|
19
|
+
private val SERVICE_PKG = "br.com.uol.pagseguro.plugpagservice"
|
|
20
20
|
private val plugPag = PlugPag(reactContext)
|
|
21
21
|
private var activationCode = ""
|
|
22
22
|
var isActivated = false
|
|
23
23
|
|
|
24
24
|
init {
|
|
25
|
-
setEventListener()
|
|
26
|
-
customDialogClientViaPrinter()
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
private fun setEventListener() {
|
|
30
25
|
plugPag.setEventListener(object : PlugPagEventListener {
|
|
31
26
|
override fun onEvent(data: PlugPagEventData) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Arguments.createMap().apply {
|
|
27
|
+
reactContext
|
|
28
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
29
|
+
.emit("onPlugpagEventData", Arguments.createMap().apply {
|
|
35
30
|
putInt("eventCode", data.eventCode)
|
|
36
31
|
putString("customMessage", data.customMessage)
|
|
37
|
-
}
|
|
38
|
-
)
|
|
32
|
+
})
|
|
39
33
|
}
|
|
40
34
|
})
|
|
41
|
-
}
|
|
42
35
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
reactContext
|
|
48
|
-
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
49
|
-
.emit("onPlugpagEventData", params)
|
|
36
|
+
plugPag.setPlugPagCustomPrinterLayout(PlugPagCustomPrinterLayout().apply {
|
|
37
|
+
buttonBackgroundColor = "#F8BB12"
|
|
38
|
+
maxTimeShowPopup = 1
|
|
39
|
+
})
|
|
50
40
|
}
|
|
51
41
|
|
|
52
|
-
private fun
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
42
|
+
private fun isServiceAvailable(): Boolean {
|
|
43
|
+
return try {
|
|
44
|
+
reactContext.packageManager.getPackageInfo(SERVICE_PKG, 0)
|
|
45
|
+
true
|
|
46
|
+
} catch (_: PackageManager.NameNotFoundException) {
|
|
47
|
+
false
|
|
48
|
+
}
|
|
57
49
|
}
|
|
58
50
|
|
|
59
51
|
private fun checkPlugpag() {
|
|
52
|
+
if (!isServiceAvailable()) throw Exception("Plugpag SDK is not available in this device.")
|
|
60
53
|
if (!isActivated)
|
|
61
|
-
throw Exception("Plugpag
|
|
54
|
+
throw Exception("Plugpag SDK has not been activated.")
|
|
62
55
|
}
|
|
63
56
|
|
|
64
|
-
fun activate(code: String) {
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
fun activate(code: String, promise: Promise) {
|
|
58
|
+
Thread {
|
|
59
|
+
try {
|
|
60
|
+
if (!isServiceAvailable()) throw Exception("Plugpag SDK is not available in this device.")
|
|
61
|
+
if (isActivated)
|
|
62
|
+
throw Exception("Plugpag SDK has already been activated with the code: '${activationCode}'.")
|
|
63
|
+
|
|
64
|
+
val terminalResult = plugPag.initializeAndActivatePinpad(
|
|
65
|
+
PlugPagActivationData(code)
|
|
66
|
+
)
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
)
|
|
68
|
+
if (terminalResult.result != PlugPag.RET_OK)
|
|
69
|
+
throw Exception(terminalResult.errorMessage)
|
|
71
70
|
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
activationCode = code
|
|
72
|
+
isActivated = true
|
|
74
73
|
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
promise.resolve(null)
|
|
75
|
+
} catch (e: Exception) {
|
|
76
|
+
e.printStackTrace()
|
|
77
|
+
promise.reject(e)
|
|
78
|
+
}
|
|
79
|
+
}.start()
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
fun deactivate() {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
fun deactivate(promise: Promise) {
|
|
83
|
+
Thread {
|
|
84
|
+
try {
|
|
85
|
+
checkPlugpag()
|
|
86
|
+
|
|
87
|
+
val terminalResult = plugPag.deactivate(
|
|
88
|
+
PlugPagActivationData(activationCode)
|
|
89
|
+
)
|
|
82
90
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
)
|
|
91
|
+
if (terminalResult.result != PlugPag.RET_OK)
|
|
92
|
+
throw Exception(terminalResult.errorMessage)
|
|
86
93
|
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
activationCode = ""
|
|
95
|
+
isActivated = false
|
|
89
96
|
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
promise.resolve(null)
|
|
98
|
+
} catch (e: Exception) {
|
|
99
|
+
e.printStackTrace()
|
|
100
|
+
promise.reject(e)
|
|
101
|
+
}
|
|
102
|
+
}.start()
|
|
92
103
|
}
|
|
93
104
|
|
|
94
105
|
fun pay(
|
|
@@ -97,32 +108,38 @@ class PlugpagImpl(
|
|
|
97
108
|
promise: Promise
|
|
98
109
|
) {
|
|
99
110
|
Thread {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
val paymentResult = paymentData?.let { plugPag.doPayment(it) }
|
|
115
|
-
promise.resolve(com.plugpag.utils.TransactionObjectMapper.toWritableMap(paymentResult))
|
|
116
|
-
} catch (e: Exception) {
|
|
117
|
-
e.printStackTrace()
|
|
118
|
-
promise.reject(e)
|
|
111
|
+
try {
|
|
112
|
+
checkPlugpag()
|
|
113
|
+
|
|
114
|
+
val paymentData = PlugpagUtils.resolvePaymentMethod(paymentMethod)?.let {
|
|
115
|
+
PlugPagPaymentData(
|
|
116
|
+
it,
|
|
117
|
+
value.toInt(),
|
|
118
|
+
PlugPag.INSTALLMENT_TYPE_A_VISTA,
|
|
119
|
+
1,
|
|
120
|
+
null
|
|
121
|
+
)
|
|
119
122
|
}
|
|
123
|
+
|
|
124
|
+
val paymentResult = paymentData?.let { plugPag.doPayment(it) }
|
|
125
|
+
promise.resolve(com.plugpag.utils.TransactionObjectMapper.toWritableMap(paymentResult))
|
|
126
|
+
} catch (e: Exception) {
|
|
127
|
+
e.printStackTrace()
|
|
128
|
+
promise.reject(e)
|
|
120
129
|
}
|
|
121
130
|
}.start()
|
|
122
131
|
}
|
|
123
132
|
|
|
124
|
-
fun abortPayment() {
|
|
125
|
-
|
|
126
|
-
|
|
133
|
+
fun abortPayment(promise: Promise) {
|
|
134
|
+
Thread {
|
|
135
|
+
try {
|
|
136
|
+
checkPlugpag()
|
|
137
|
+
plugPag.abort()
|
|
138
|
+
promise.resolve(null)
|
|
139
|
+
} catch (e: Exception) {
|
|
140
|
+
e.printStackTrace()
|
|
141
|
+
promise.reject(e)
|
|
142
|
+
}
|
|
143
|
+
}.start()
|
|
127
144
|
}
|
|
128
145
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
package com.plugpag
|
|
2
2
|
|
|
3
|
-
import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagEventData
|
|
4
3
|
import com.facebook.react.bridge.Promise
|
|
5
4
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
5
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
7
6
|
import com.facebook.react.bridge.ReactMethod
|
|
8
|
-
import com.facebook.react.bridge.ReadableMap
|
|
9
|
-
import com.plugpag.utils.PlugpagUtils
|
|
10
7
|
|
|
11
8
|
class PlugpagModule(
|
|
12
9
|
reactContext: ReactApplicationContext
|
|
@@ -20,8 +17,7 @@ class PlugpagModule(
|
|
|
20
17
|
@ReactMethod
|
|
21
18
|
fun init(code: String, promise: Promise) {
|
|
22
19
|
try {
|
|
23
|
-
plugpag.activate(code)
|
|
24
|
-
promise.resolve(null)
|
|
20
|
+
plugpag.activate(code, promise)
|
|
25
21
|
} catch (e: Exception) {
|
|
26
22
|
e.printStackTrace()
|
|
27
23
|
promise.reject(e)
|
|
@@ -31,8 +27,7 @@ class PlugpagModule(
|
|
|
31
27
|
@ReactMethod
|
|
32
28
|
fun destroy(promise: Promise) {
|
|
33
29
|
try {
|
|
34
|
-
plugpag.deactivate()
|
|
35
|
-
promise.resolve(null)
|
|
30
|
+
plugpag.deactivate(promise)
|
|
36
31
|
} catch (e: Exception) {
|
|
37
32
|
e.printStackTrace()
|
|
38
33
|
promise.reject(e)
|
|
@@ -56,19 +51,7 @@ class PlugpagModule(
|
|
|
56
51
|
@ReactMethod
|
|
57
52
|
fun abortPayment(promise: Promise) {
|
|
58
53
|
try {
|
|
59
|
-
plugpag.abortPayment()
|
|
60
|
-
promise.resolve(null)
|
|
61
|
-
} catch (e: Exception) {
|
|
62
|
-
e.printStackTrace()
|
|
63
|
-
promise.reject(e)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@ReactMethod
|
|
68
|
-
fun resolveEvent(data: ReadableMap, promise: Promise) {
|
|
69
|
-
try {
|
|
70
|
-
val plugPagEventData = PlugPagEventData(data.getInt("eventCode").toString())
|
|
71
|
-
promise.resolve(PlugpagUtils.resolveEvent(plugPagEventData))
|
|
54
|
+
plugpag.abortPayment(promise)
|
|
72
55
|
} catch (e: Exception) {
|
|
73
56
|
e.printStackTrace()
|
|
74
57
|
promise.reject(e)
|
|
@@ -43,12 +43,12 @@ class StoneImpl(
|
|
|
43
43
|
|
|
44
44
|
private fun checkStone() {
|
|
45
45
|
if (!isActivated)
|
|
46
|
-
throw Exception("Stone
|
|
46
|
+
throw Exception("Stone SDK was not activated.")
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
fun activate(providerId: String, authorization: String, appName: String) {
|
|
50
50
|
if (isActivated)
|
|
51
|
-
throw Exception("Stone
|
|
51
|
+
throw Exception("Stone has already been activated.")
|
|
52
52
|
|
|
53
53
|
val userList = StoneStart.init(reactContext, mapOf(
|
|
54
54
|
StoneKeyType.QRCODE_PROVIDERID to providerId,
|
|
@@ -152,6 +152,7 @@ class StoneImpl(
|
|
|
152
152
|
checkStone()
|
|
153
153
|
if (paymentProvider == null) return promise.resolve(false)
|
|
154
154
|
paymentProvider?.abortPayment()
|
|
155
|
+
promise.resolve(true)
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
fun printVia(transaction: TransactionObject, type: ReceiptType, promise: Promise) {
|
|
@@ -200,7 +201,7 @@ class StoneImpl(
|
|
|
200
201
|
|
|
201
202
|
override fun onError() {
|
|
202
203
|
promise.reject(
|
|
203
|
-
"
|
|
204
|
+
"Failed to capture transaction.\n" +
|
|
204
205
|
"responseCode: ${
|
|
205
206
|
try {
|
|
206
207
|
provider.responseCodeEnum
|
|
@@ -243,7 +244,7 @@ class StoneImpl(
|
|
|
243
244
|
|
|
244
245
|
override fun onError() {
|
|
245
246
|
promise.reject(
|
|
246
|
-
"
|
|
247
|
+
"Failed to cancel transaction.\n" +
|
|
247
248
|
"action: ${StoneUtils.resolveActionCode(provider.Cancellation().actionCode)}\n" +
|
|
248
249
|
"actionCode: ${provider.Cancellation().actionCode}\n" +
|
|
249
250
|
"responseCode: ${
|
|
@@ -24,11 +24,11 @@ class StoneModule(
|
|
|
24
24
|
val authorization = keys.getString("authorization").orEmpty()
|
|
25
25
|
|
|
26
26
|
if (providerId.isEmpty())
|
|
27
|
-
throw Exception("providerId
|
|
27
|
+
throw Exception("providerId cannot be empty.")
|
|
28
28
|
if (authorization.isEmpty())
|
|
29
|
-
throw Exception("authorization
|
|
29
|
+
throw Exception("authorization cannot be empty.")
|
|
30
30
|
if (appName.isEmpty())
|
|
31
|
-
throw Exception("appName
|
|
31
|
+
throw Exception("appName cannot be empty.")
|
|
32
32
|
|
|
33
33
|
stone.activate(providerId, authorization, appName)
|
|
34
34
|
promise.resolve(null)
|
|
@@ -72,7 +72,6 @@ class StoneModule(
|
|
|
72
72
|
fun abortPayment(promise: Promise) {
|
|
73
73
|
try {
|
|
74
74
|
stone.abortPayment(promise)
|
|
75
|
-
promise.resolve(true)
|
|
76
75
|
} catch (e: Exception) {
|
|
77
76
|
e.printStackTrace()
|
|
78
77
|
promise.reject(e)
|
|
@@ -7,8 +7,8 @@ import com.facebook.react.bridge.Promise
|
|
|
7
7
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
8
|
import com.mesmart.R
|
|
9
9
|
import com.mesmart.Utils
|
|
10
|
-
import com.sunmi.
|
|
11
|
-
import com.sunmi.
|
|
10
|
+
import com.sunmi.utils.PrinterSunmiP2
|
|
11
|
+
import com.sunmi.utils.MifareSunmiP2
|
|
12
12
|
import sunmi.paylib.SunmiPayKernel
|
|
13
13
|
import sunmi.paylib.SunmiPayKernel.ConnectCallback
|
|
14
14
|
import java.io.ByteArrayInputStream
|
|
@@ -16,12 +16,13 @@ import java.io.ByteArrayInputStream
|
|
|
16
16
|
class SunmiImpl(
|
|
17
17
|
private val reactContext: ReactApplicationContext
|
|
18
18
|
) {
|
|
19
|
+
private val isSupported = Utils.isSunmiP2()
|
|
19
20
|
private var payKernel: SunmiPayKernel? = null
|
|
20
|
-
private var
|
|
21
|
-
private var
|
|
21
|
+
private var mifareSunmiP2: MifareSunmiP2? = null
|
|
22
|
+
private var printerSunmiP2: PrinterSunmiP2 = PrinterSunmiP2(reactContext)
|
|
22
23
|
|
|
23
24
|
init {
|
|
24
|
-
if (
|
|
25
|
+
if (isSupported) {
|
|
25
26
|
payKernel = SunmiPayKernel.getInstance()
|
|
26
27
|
|
|
27
28
|
payKernel?.initPaySDK(reactContext, object : ConnectCallback {
|
|
@@ -29,23 +30,24 @@ class SunmiImpl(
|
|
|
29
30
|
override fun onDisconnectPaySDK() {}
|
|
30
31
|
})
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
mifareSunmiP2 = payKernel?.let { MifareSunmiP2(it) }
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
private fun checkKernel() {
|
|
38
|
+
if (!isSupported) throw Exception("Unsupported device (Supported model Sunmi P2).")
|
|
37
39
|
if (payKernel == null)
|
|
38
|
-
throw Exception("
|
|
40
|
+
throw Exception("")
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
fun scanRfid(promise: Promise) {
|
|
42
44
|
checkKernel()
|
|
43
|
-
|
|
45
|
+
mifareSunmiP2?.scanRfid(promise)
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
fun cancelScan() {
|
|
47
49
|
checkKernel()
|
|
48
|
-
|
|
50
|
+
mifareSunmiP2?.cancelScan()
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
fun printText(
|
|
@@ -55,7 +57,7 @@ class SunmiImpl(
|
|
|
55
57
|
isUnderline: Boolean
|
|
56
58
|
) {
|
|
57
59
|
checkKernel()
|
|
58
|
-
|
|
60
|
+
printerSunmiP2.printText(
|
|
59
61
|
str,
|
|
60
62
|
fontSize.toFloat(),
|
|
61
63
|
isBold,
|
|
@@ -65,7 +67,7 @@ class SunmiImpl(
|
|
|
65
67
|
|
|
66
68
|
fun printEmptyLine() {
|
|
67
69
|
checkKernel()
|
|
68
|
-
|
|
70
|
+
printerSunmiP2.printEmptyLine()
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
fun printBpLogo() {
|
|
@@ -77,7 +79,7 @@ class SunmiImpl(
|
|
|
77
79
|
}
|
|
78
80
|
val bitmap = BitmapFactory.decodeResource(reactContext.resources, R.drawable.logo_black, options)
|
|
79
81
|
|
|
80
|
-
|
|
82
|
+
printerSunmiP2.printBitmap(
|
|
81
83
|
Bitmap.createScaledBitmap(bitmap, 375, 100, true),
|
|
82
84
|
1
|
|
83
85
|
)
|
|
@@ -86,10 +88,10 @@ class SunmiImpl(
|
|
|
86
88
|
fun setPrinterAlign(align: String) {
|
|
87
89
|
checkKernel()
|
|
88
90
|
when (align) {
|
|
89
|
-
"left" ->
|
|
90
|
-
"center" ->
|
|
91
|
-
"right" ->
|
|
92
|
-
else -> throw Exception("'$align'
|
|
91
|
+
"left" -> printerSunmiP2.setPrinterAlign(0)
|
|
92
|
+
"center" -> printerSunmiP2.setPrinterAlign(1)
|
|
93
|
+
"right" -> printerSunmiP2.setPrinterAlign(2)
|
|
94
|
+
else -> throw Exception("'$align' '' not recognized! Use only one of these: ['left', 'center', 'right']")
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
|
|
@@ -100,9 +102,9 @@ class SunmiImpl(
|
|
|
100
102
|
}
|
|
101
103
|
val decodedBytes = Base64.decode(bitmapStr, Base64.DEFAULT)
|
|
102
104
|
val bitmap = BitmapFactory.decodeStream(ByteArrayInputStream(decodedBytes), null, options)
|
|
103
|
-
?: throw Exception("
|
|
105
|
+
?: throw Exception("Error decoding bitmap. Check if the uploaded bitmap is base64.")
|
|
104
106
|
|
|
105
|
-
|
|
107
|
+
printerSunmiP2.printBitmap(
|
|
106
108
|
Bitmap.createScaledBitmap(
|
|
107
109
|
bitmap,
|
|
108
110
|
width,
|
package/android/src/main/java/com/sunmi/{helpers/SunmiRfidHelper.kt → utils/MifareSunmiP2.kt}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.sunmi.
|
|
1
|
+
package com.sunmi.utils
|
|
2
2
|
|
|
3
3
|
import android.os.Bundle
|
|
4
4
|
import com.facebook.react.bridge.Promise
|
|
@@ -7,7 +7,7 @@ import com.sunmi.pay.hardware.aidl.AidlConstants
|
|
|
7
7
|
import com.sunmi.pay.hardware.aidlv2.readcard.CheckCardCallbackV2
|
|
8
8
|
import sunmi.paylib.SunmiPayKernel
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class MifareSunmiP2(private val payKernel: SunmiPayKernel) {
|
|
11
11
|
private var attempt: Int = 0
|
|
12
12
|
|
|
13
13
|
fun scanRfid(promise: Promise) {
|
package/android/src/main/java/com/sunmi/{helpers/SunmiPrintHelper.kt → utils/PrinterSunmiP2.kt}
RENAMED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
package com.sunmi.
|
|
1
|
+
package com.sunmi.utils
|
|
2
2
|
|
|
3
3
|
import android.graphics.Bitmap
|
|
4
4
|
import android.os.RemoteException
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
-
import com.sunmi.utils.ESCUtil
|
|
7
6
|
import com.sunmi.peripheral.printer.InnerPrinterCallback
|
|
8
7
|
import com.sunmi.peripheral.printer.InnerPrinterException
|
|
9
8
|
import com.sunmi.peripheral.printer.InnerPrinterManager
|
|
10
9
|
import com.sunmi.peripheral.printer.SunmiPrinterService
|
|
11
10
|
import com.sunmi.peripheral.printer.WoyouConsts
|
|
12
11
|
|
|
13
|
-
class
|
|
12
|
+
class PrinterSunmiP2(
|
|
14
13
|
private val reactContext: ReactApplicationContext
|
|
15
14
|
) {
|
|
16
15
|
var NoSunmiPrinter: Int = 0x00000000
|
|
@@ -71,7 +70,7 @@ class SunmiPrintHelper(
|
|
|
71
70
|
typeface: String?
|
|
72
71
|
) {
|
|
73
72
|
if (sunmiPrinterService == null)
|
|
74
|
-
throw Exception("
|
|
73
|
+
throw Exception("Sunmi P2 InnerPrinter Service is null.")
|
|
75
74
|
|
|
76
75
|
try {
|
|
77
76
|
try {
|
|
@@ -106,7 +105,7 @@ class SunmiPrintHelper(
|
|
|
106
105
|
|
|
107
106
|
fun printEmptyLine() {
|
|
108
107
|
if (sunmiPrinterService == null)
|
|
109
|
-
throw Exception("
|
|
108
|
+
throw Exception("Sunmi P2 InnerPrinter Service is null.")
|
|
110
109
|
|
|
111
110
|
try {
|
|
112
111
|
sunmiPrinterService!!.lineWrap(1, null)
|
|
@@ -117,7 +116,7 @@ class SunmiPrintHelper(
|
|
|
117
116
|
|
|
118
117
|
fun printBitmap(bitmap: Bitmap?, orientation: Int) {
|
|
119
118
|
if (sunmiPrinterService == null)
|
|
120
|
-
throw Exception("
|
|
119
|
+
throw Exception("Sunmi P2 InnerPrinter Service is null.")
|
|
121
120
|
|
|
122
121
|
try {
|
|
123
122
|
if (orientation == 0) {
|
|
@@ -134,7 +133,7 @@ class SunmiPrintHelper(
|
|
|
134
133
|
|
|
135
134
|
fun setPrinterAlign(align: Int) {
|
|
136
135
|
if (sunmiPrinterService == null)
|
|
137
|
-
throw Exception("
|
|
136
|
+
throw Exception("Sunmi P2 InnerPrinter Service is null.")
|
|
138
137
|
|
|
139
138
|
try {
|
|
140
139
|
sunmiPrinterService!!.setAlignment(align, null)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/gertec.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -58,4 +58,15 @@ Object.keys(_stone).forEach(function (key) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
+
var _gertec = require("./gertec");
|
|
62
|
+
Object.keys(_gertec).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _gertec[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _gertec[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
61
72
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugpag","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_paystore","_sunmi","_pax","_stone"],"sourceRoot":"../../../src","sources":["@types/index.ts"],"mappings":";;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,QAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,QAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,SAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,SAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,SAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,SAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,MAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,MAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,MAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,MAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,IAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,IAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,IAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,IAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,MAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,MAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,MAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,MAAA,CAAAR,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_plugpag","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_paystore","_sunmi","_pax","_stone","_gertec"],"sourceRoot":"../../../src","sources":["@types/index.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A,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,IAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,IAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,MAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,MAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,MAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,MAAA,CAAAR,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,OAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,OAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,OAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAK,OAAA,CAAAT,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -9,9 +9,10 @@ var _exportNames = {
|
|
|
9
9
|
Sunmi: true,
|
|
10
10
|
Pax: true,
|
|
11
11
|
Paystore: true,
|
|
12
|
-
Stone: true
|
|
12
|
+
Stone: true,
|
|
13
|
+
Gertec: true
|
|
13
14
|
};
|
|
14
|
-
exports.Sunmi = exports.Stone = exports.Plugpag = exports.Paystore = exports.Pax = exports.IOS_ERROR = void 0;
|
|
15
|
+
exports.Sunmi = exports.Stone = exports.Plugpag = exports.Paystore = exports.Pax = exports.IOS_ERROR = exports.Gertec = void 0;
|
|
15
16
|
var _reactNative = require("react-native");
|
|
16
17
|
var _sunmi = require("./sunmi");
|
|
17
18
|
var _pax = require("./pax");
|
|
@@ -72,4 +73,10 @@ const Stone = exports.Stone = {
|
|
|
72
73
|
captureTransaction: _reactNative.NativeModules.Stone.captureTransaction,
|
|
73
74
|
cancelTransaction: _reactNative.NativeModules.Stone.cancelTransaction
|
|
74
75
|
};
|
|
76
|
+
const Gertec = exports.Gertec = {
|
|
77
|
+
scanRfid: _reactNative.NativeModules.Gertec.scanRfid,
|
|
78
|
+
cancelScan: _reactNative.NativeModules.Gertec.cancelScan,
|
|
79
|
+
scrollPrinterPaper: _reactNative.NativeModules.Gertec.scrollPrinterPaper,
|
|
80
|
+
printHtml: html => _reactNative.NativeModules.Gertec.printHtml(html)
|
|
81
|
+
};
|
|
75
82
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_sunmi","_pax","_paystore","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","IOS_ERROR","Platform","OS","Error","Plugpag","init","NativeModules","destroy","pay","abortPayment","resolveEvent","isActivated","Sunmi","scanRfid","cancelScan","printClientReceipt","printClientReceiptInSunmi","printText","str","fontSize","isBold","isUnderline","printEmptyLine","printBitmap","bitmapStr","width","height","printBpLogo","setPrinterAlign","Pax","printClientReceiptInPax","printerInit","printerStart","addText","addBpLogo","Paystore","payWithPaystore","Stone","getStoneCode","value","paymentType","isCapture","printVia","captureTransaction","cancelTransaction"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_sunmi","_pax","_paystore","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","IOS_ERROR","Platform","OS","Error","Plugpag","init","NativeModules","destroy","pay","abortPayment","resolveEvent","isActivated","Sunmi","scanRfid","cancelScan","printClientReceipt","printClientReceiptInSunmi","printText","str","fontSize","isBold","isUnderline","printEmptyLine","printBitmap","bitmapStr","width","height","printBpLogo","setPrinterAlign","Pax","printClientReceiptInPax","printerInit","printerStart","addText","addBpLogo","Paystore","payWithPaystore","Stone","getStoneCode","value","paymentType","isCapture","printVia","captureTransaction","cancelTransaction","Gertec","scrollPrinterPaper","printHtml","html"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAiEA,IAAAI,MAAA,GAAAJ,OAAA;AAAAK,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,MAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AA/DO,MAAMS,SAAS,GAAAJ,OAAA,CAAAI,SAAA,GACpB,wEAAwE;AAE1E,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE,MAAM,IAAIC,KAAK,CAACH,SAAS,CAAC;AAErD,MAAMI,OAAO,GAAAR,OAAA,CAAAQ,OAAA,GAAG;EACdC,IAAI,EAAEC,0BAAa,CAACF,OAAO,CAACC,IAAI;EAChCE,OAAO,EAAED,0BAAa,CAACF,O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,UAAU;EAC3CgC,kBAAkB,EAAExC,0BAAa,CAACuC,MAAM,CAACC,kBAAkB;EAC3DC,SAAS,EAAGC,IAAY,IAAK1C,0BAAa,CAACuC,MAAM,CAACE,SAAS,CAACC,IAAI;AAClE,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/gertec.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/index.ts"],"mappings":"AAQA,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,OAAO;AACrB,cAAc,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/index.ts"],"mappings":"AAQA,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,OAAO;AACrB,cAAc,SAAS;AACvB,cAAc,UAAU","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -46,6 +46,12 @@ const Stone = {
|
|
|
46
46
|
captureTransaction: NativeModules.Stone.captureTransaction,
|
|
47
47
|
cancelTransaction: NativeModules.Stone.cancelTransaction
|
|
48
48
|
};
|
|
49
|
-
|
|
49
|
+
const Gertec = {
|
|
50
|
+
scanRfid: NativeModules.Gertec.scanRfid,
|
|
51
|
+
cancelScan: NativeModules.Gertec.cancelScan,
|
|
52
|
+
scrollPrinterPaper: NativeModules.Gertec.scrollPrinterPaper,
|
|
53
|
+
printHtml: html => NativeModules.Gertec.printHtml(html)
|
|
54
|
+
};
|
|
55
|
+
export { Plugpag, Sunmi, Pax, Paystore, Stone, Gertec };
|
|
50
56
|
export * from './@types';
|
|
51
57
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","printClientReceiptInSunmi","printClientReceiptInPax","payWithPaystore","IOS_ERROR","OS","Error","Plugpag","init","destroy","pay","abortPayment","resolveEvent","isActivated","Sunmi","scanRfid","cancelScan","printClientReceipt","printText","str","fontSize","isBold","isUnderline","printEmptyLine","printBitmap","bitmapStr","width","height","printBpLogo","setPrinterAlign","Pax","printerInit","printerStart","addText","addBpLogo","Paystore","Stone","getStoneCode","value","paymentType","isCapture","printVia","captureTransaction","cancelTransaction"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","printClientReceiptInSunmi","printClientReceiptInPax","payWithPaystore","IOS_ERROR","OS","Error","Plugpag","init","destroy","pay","abortPayment","resolveEvent","isActivated","Sunmi","scanRfid","cancelScan","printClientReceipt","printText","str","fontSize","isBold","isUnderline","printEmptyLine","printBitmap","bitmapStr","width","height","printBpLogo","setPrinterAlign","Pax","printerInit","printerStart","addText","addBpLogo","Paystore","Stone","getStoneCode","value","paymentType","isCapture","printVia","captureTransaction","cancelTransaction","Gertec","scrollPrinterPaper","printHtml","html"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAGtD,SAASC,yBAAyB,QAAQ,SAAS;AACnD,SAASC,uBAAuB,QAAQ,OAAO;AAC/C,SAASC,eAAe,QAAQ,YAAY;AAE5C,OAAO,MAAMC,SAAS,GACpB,wEAAwE;AAE1E,IAAIJ,QAAQ,CAACK,EAAE,KAAK,KAAK,EAAE,MAAM,IAAIC,KAAK,CAACF,SAAS,CAAC;AAErD,MAAMG,OAAO,GAAG;EACdC,IAAI,EAAET,aAAa,CAACQ,OAAO,CAACC,IAAI;EAChCC,OAAO,EAAEV,aAAa,CAACQ,OAAO,CAACE,OAAO;EACtCC,GAAG,EAAEX,aAAa,CAACQ,OAAO,CAACG,GAAG;EAC9BC,YAAY,EAAEZ,aAAa,CA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ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gertec.d.ts","sourceRoot":"","sources":["../../../../src/@types/gertec.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/@types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,YAAY,GACZ,KAAK,GACL,SAAS,GACT,OAAO,GACP,OAAO,CAAC;AAEZ,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/@types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,YAAY,GACZ,KAAK,GACL,SAAS,GACT,OAAO,GACP,OAAO,CAAC;AAEZ,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
|
|
@@ -42,6 +42,12 @@ declare const Stone: {
|
|
|
42
42
|
captureTransaction: (transaction: import("./@types").StoneTransaction) => Promise<import("./@types").StoneCaptureResponse>;
|
|
43
43
|
cancelTransaction: (transaction: import("./@types").StoneTransaction) => Promise<import("./@types").StoneCancelResponse>;
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
declare const Gertec: {
|
|
46
|
+
scanRfid: () => Promise<string>;
|
|
47
|
+
cancelScan: () => Promise<true>;
|
|
48
|
+
scrollPrinterPaper: (lines: number) => Promise<true>;
|
|
49
|
+
printHtml: (html: string) => Promise<true>;
|
|
50
|
+
};
|
|
51
|
+
export { Plugpag, Sunmi, Pax, Paystore, Stone, Gertec };
|
|
46
52
|
export * from './@types';
|
|
47
53
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAK9C,eAAO,MAAM,SAAS,qFACoD,CAAC;AAI3E,QAAA,MAAM,OAAO;;;;;;;CAOZ,CAAC;AACF,QAAA,MAAM,KAAK;;;;qBAKF,MAAM,aACD,MAAM,WACR,OAAO,gBACF,OAAO;;6BAGG,MAAM,UAAS,MAAM,WAAgB,MAAM;;;CAIrE,CAAC;AACF,QAAA,MAAM,GAAG;;;;;;mBAMQ,MAAM,aAAY,MAAM;;CAGxC,CAAC;AACF,QAAA,MAAM,QAAQ;;;;CAIb,CAAC;AACF,QAAA,MAAM,KAAK;;;;iBAII,MAAM,eAAe,aAAa,cAAa,OAAO;;;;;CAMpE,CAAC;AACF,QAAA,MAAM,MAAM;;;;sBAIQ,MAAM;CACzB,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACxD,cAAc,UAAU,CAAC"}
|
package/package.json
CHANGED
package/src/@types/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { SunmiAPI } from './sunmi';
|
|
|
3
3
|
import type { PaxAPI } from './pax';
|
|
4
4
|
import type { PaystoreAPI } from './paystore';
|
|
5
5
|
import type { StoneAPI } from './stone';
|
|
6
|
+
import type { GertecAPI } from './gertec';
|
|
6
7
|
|
|
7
8
|
declare module 'react-native' {
|
|
8
9
|
interface NativeModulesStatic {
|
|
@@ -11,5 +12,6 @@ declare module 'react-native' {
|
|
|
11
12
|
Pax: PaxAPI;
|
|
12
13
|
Paystore: PaystoreAPI;
|
|
13
14
|
Stone: StoneAPI;
|
|
15
|
+
Gertec: GertecAPI;
|
|
14
16
|
}
|
|
15
17
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { PaymentMethod } from './@types';
|
|
2
4
|
import { printClientReceiptInSunmi } from './sunmi';
|
|
3
5
|
import { printClientReceiptInPax } from './pax';
|
|
4
6
|
import { payWithPaystore } from './paystore';
|
|
5
|
-
import type { PaymentMethod } from './@types';
|
|
6
7
|
|
|
7
8
|
export const IOS_ERROR =
|
|
8
9
|
"⚠️ The package 'react-native-mesmart' doesn't work in iOS environment!";
|
|
@@ -59,6 +60,12 @@ const Stone = {
|
|
|
59
60
|
captureTransaction: NativeModules.Stone.captureTransaction,
|
|
60
61
|
cancelTransaction: NativeModules.Stone.cancelTransaction,
|
|
61
62
|
};
|
|
63
|
+
const Gertec = {
|
|
64
|
+
scanRfid: NativeModules.Gertec.scanRfid,
|
|
65
|
+
cancelScan: NativeModules.Gertec.cancelScan,
|
|
66
|
+
scrollPrinterPaper: NativeModules.Gertec.scrollPrinterPaper,
|
|
67
|
+
printHtml: (html: string) => NativeModules.Gertec.printHtml(html),
|
|
68
|
+
};
|
|
62
69
|
|
|
63
|
-
export { Plugpag, Sunmi, Pax, Paystore, Stone };
|
|
70
|
+
export { Plugpag, Sunmi, Pax, Paystore, Stone, Gertec };
|
|
64
71
|
export * from './@types';
|