react-native-mesmart 2.1.1 → 3.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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +20 -6
  3. package/android/gradle.properties +2 -2
  4. package/android/src/main/java/com/gertec/GertecImpl.kt +2 -2
  5. package/android/src/main/java/com/mesmart/Packages.kt +3 -1
  6. package/android/src/main/java/com/mesmart/Utils.kt +6 -1
  7. package/android/src/main/java/com/paystore/PaystoreImpl.kt +1 -1
  8. package/android/src/main/java/com/plugpag/PlugpagImpl.kt +33 -0
  9. package/android/src/main/java/com/plugpag/PlugpagModule.kt +22 -0
  10. package/android/src/main/java/com/plugpag/utils/PlugpagUtils.kt +10 -0
  11. package/android/src/main/java/com/tectoy/TectoyImpl.kt +93 -0
  12. package/android/src/main/java/com/tectoy/TectoyModule.kt +112 -0
  13. package/android/src/main/java/com/tectoy/utils/MifareT8.kt +84 -0
  14. package/android/src/main/java/com/tectoy/utils/PrinterT8.kt +141 -0
  15. package/lib/commonjs/@types/index.js +11 -0
  16. package/lib/commonjs/@types/index.js.map +1 -1
  17. package/lib/commonjs/@types/plugpag.js.map +1 -1
  18. package/lib/commonjs/@types/tectoy.js +6 -0
  19. package/lib/commonjs/@types/tectoy.js.map +1 -0
  20. package/lib/commonjs/index.js +15 -2
  21. package/lib/commonjs/index.js.map +1 -1
  22. package/lib/module/@types/index.js +1 -0
  23. package/lib/module/@types/index.js.map +1 -1
  24. package/lib/module/@types/plugpag.js.map +1 -1
  25. package/lib/module/@types/tectoy.js +2 -0
  26. package/lib/module/@types/tectoy.js.map +1 -0
  27. package/lib/module/index.js +13 -1
  28. package/lib/module/index.js.map +1 -1
  29. package/lib/typescript/src/@types/index.d.ts +1 -0
  30. package/lib/typescript/src/@types/index.d.ts.map +1 -1
  31. package/lib/typescript/src/@types/plugpag.d.ts +8 -0
  32. package/lib/typescript/src/@types/plugpag.d.ts.map +1 -1
  33. package/lib/typescript/src/@types/tectoy.d.ts +7 -0
  34. package/lib/typescript/src/@types/tectoy.d.ts.map +1 -0
  35. package/lib/typescript/src/index.d.ts +12 -1
  36. package/lib/typescript/src/index.d.ts.map +1 -1
  37. package/package.json +2 -2
  38. package/src/@types/index.ts +1 -0
  39. package/src/@types/plugpag.ts +12 -0
  40. package/src/@types/tectoy.ts +7 -0
  41. package/src/index.ts +19 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # react-native-mesmart
2
2
 
3
- Métodos nativos para integrar com POS Sunmi P2, Pax A910/A920, SDK de pagamento Plugpag da Pagbank, SDK de pagamento da Stone e SDK de pagamento da Paystore.
3
+ Métodos nativos para integrar com POS Sunmi P2-B/P2-A11, Pax A910/A920, SDK de pagamento Plugpag da Pagbank, SDK de pagamento da Stone e SDK de pagamento da Paystore.
4
4
 
5
5
  - [Plugpag](https://developer.pagbank.com.br/v1.0/reference/smart-pos-introducao)
6
6
  - [Stone](https://sdkandroid.stone.com.br/reference/overview-da-sdk)
@@ -10,7 +10,7 @@ buildscript {
10
10
  }
11
11
 
12
12
  dependencies {
13
- classpath "com.android.tools.build:gradle:7.4.2"
13
+ classpath "com.android.tools.build:gradle:8.6.1"
14
14
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15
15
  }
16
16
  }
@@ -72,8 +72,12 @@ android {
72
72
  }
73
73
 
74
74
  compileOptions {
75
- sourceCompatibility JavaVersion.VERSION_11
76
- targetCompatibility JavaVersion.VERSION_11
75
+ sourceCompatibility JavaVersion.VERSION_17
76
+ targetCompatibility JavaVersion.VERSION_17
77
+ }
78
+
79
+ kotlinOptions {
80
+ jvmTarget = "17"
77
81
  }
78
82
 
79
83
  repositories {
@@ -91,21 +95,31 @@ repositories {
91
95
 
92
96
  mavenCentral()
93
97
  google()
94
- maven { url 'https://github.com/pagseguro/PlugPagServiceWrapper/raw/master' }
98
+ // So o PlugPag mora aqui; o GitHub responde 504 pra artefatos ausentes e o Gradle aborta.
99
+ maven {
100
+ url 'https://github.com/pagseguro/PlugPagServiceWrapper/raw/master'
101
+ content { includeGroupByRegex 'br\\.com\\.uol\\.pagseguro.*' }
102
+ }
95
103
  maven { url "https://packagecloud.io/priv/${stoneToken}/stone/pos-android/maven2" }
96
104
  }
97
105
 
98
106
  def kotlin_version = getExtOrDefault("kotlinVersion")
107
+ // O app pode fixar a mesma versao em rootProject.ext.stone_sdk_version pros HALs dos flavors.
108
+ def stone_sdk_version = getExtOrDefault("stone_sdk_version")
99
109
 
100
110
  dependencies {
101
111
  implementation fileTree(dir: 'libs', include: ['*.jar'])
102
112
  implementation "com.facebook.react:react-android:0.75.0-rc.5"
103
113
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
104
- implementation "br.com.uol.pagseguro.plugpagservice.wrapper:wrapper:1.30.51"
114
+ implementation "br.com.uol.pagseguro.plugpagservice.wrapper:wrapper:1.35.0"
105
115
  implementation "com.google.code.gson:gson:2.10.1"
106
116
  implementation "br.com.stone:stone-sdk:$stone_sdk_version"
107
117
  implementation "br.com.stone:stone-sdk-posandroid:$stone_sdk_version"
108
- implementation "br.com.stone:stone-sdk-posandroid-sunmi:$stone_sdk_version"
118
+ // HAL do fabricante (stone-sdk-posandroid-sunmi, -tectoy...) fica no app, um flavor por POS:
119
+ // na 4.20 os HALs Sunmi e Tectoy usam versoes incompativeis da lib Inovare e nao cabem no mesmo APK.
120
+ // SDK da Sunmi direto (antes vinha de carona no HAL Sunmi da Stone), pro modulo Sunmi rodar em qualquer flavor.
121
+ implementation "com.sunmi:paylib:1.4.121"
122
+ implementation "com.sunmi:library:1.0.24"
109
123
  compileOnly(
110
124
  name: "paystore-api-v2.11.7.31",
111
125
  ext: "aar",
@@ -12,9 +12,9 @@
12
12
  # org.gradle.parallel=true
13
13
  #Fri Jul 19 11:34:20 BRT 2024
14
14
  compileSdkVersion=android-31
15
- kotlinVersion=1.9.24
15
+ kotlinVersion=2.1.21
16
16
  minSdkVersion=23
17
17
  ndkversion=21.4.7075529
18
18
  targetSdkVersion=31
19
- stone_sdk_version=4.12.0
19
+ stone_sdk_version=4.20.16
20
20
  android.useAndroidX=true
@@ -23,14 +23,14 @@ class GertecImpl(
23
23
 
24
24
  @Synchronized
25
25
  private fun ensureMifare(): MifareGPOS780 {
26
- if (!isSupported) throw Exception("Unsupported device (Supported model GPOS780).")
26
+ if (!isSupported) throw Exception("Unsupported device (Supported models GPOS780, GPOS780S).")
27
27
  if (mifare == null) mifare = MifareGPOS780()
28
28
  return mifare!!
29
29
  }
30
30
 
31
31
  @Synchronized
32
32
  private fun ensurePrinter(): PrinterGPOS780 {
33
- if (!isSupported) throw Exception("Unsupported device (Supported model GPOS780).")
33
+ if (!isSupported) throw Exception("Unsupported device (Supported models GPOS780, GPOS780S).")
34
34
  if (printer == null) printer = PrinterGPOS780(reactContext)
35
35
  return printer!!
36
36
  }
@@ -10,6 +10,7 @@ import com.paystore.PaystoreModule
10
10
  import com.plugpag.PlugpagModule
11
11
  import com.stone.StoneModule
12
12
  import com.sunmi.SunmiModule
13
+ import com.tectoy.TectoyModule
13
14
 
14
15
  class Packages : ReactPackage {
15
16
  override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
@@ -19,7 +20,8 @@ class Packages : ReactPackage {
19
20
  PaxModule(reactContext),
20
21
  PaystoreModule(reactContext),
21
22
  StoneModule(reactContext),
22
- GertecModule(reactContext)
23
+ GertecModule(reactContext),
24
+ TectoyModule(reactContext)
23
25
  )
24
26
  }
25
27
 
@@ -18,8 +18,13 @@ object Utils {
18
18
  return Build.MODEL.equals("A910", true)
19
19
  }
20
20
 
21
+ /** Cobre GPOS780 e GPOS780S (mesma familia Gertec, mesmo SDK). */
21
22
  fun isGPOS780(): Boolean {
22
- return Build.MODEL.equals("GPOS780", true)
23
+ return Build.MODEL.startsWith("GPOS780", true)
24
+ }
25
+
26
+ fun isT8(): Boolean {
27
+ return Build.MODEL.equals("T8", true)
23
28
  }
24
29
 
25
30
  fun resolveRFID(value: String): String {
@@ -34,7 +34,7 @@ class PaystoreImpl(
34
34
 
35
35
  val paymentTypes: MutableList<PaymentType> = LinkedList()
36
36
  for (i in 0 until paymentTypeArrayString.size()) {
37
- val paymentTypeString = paymentTypeArrayString.getString(i)
37
+ val paymentTypeString = paymentTypeArrayString.getString(i) ?: continue
38
38
  if (PaymentType.valueOf(paymentTypeString) != null) {
39
39
  paymentTypes.add(PaymentType.valueOf(paymentTypeString))
40
40
  }
@@ -7,6 +7,7 @@ import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagCustomPrinterLayout
7
7
  import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagEventData
8
8
  import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagEventListener
9
9
  import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPaymentData
10
+ import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagVoidData
10
11
  import com.facebook.react.bridge.Arguments
11
12
  import com.facebook.react.bridge.Promise
12
13
  import com.facebook.react.bridge.ReactApplicationContext
@@ -142,4 +143,36 @@ class PlugpagImpl(
142
143
  }
143
144
  }.start()
144
145
  }
146
+
147
+ fun voidPayment(
148
+ transactionCode: String,
149
+ transactionId: String,
150
+ printReceipt: Boolean,
151
+ voidType: String?,
152
+ promise: Promise
153
+ ) {
154
+ Thread {
155
+ try {
156
+ checkPlugpag()
157
+
158
+ if (transactionCode.isBlank())
159
+ throw Exception("transactionCode cannot be empty.")
160
+ if (transactionId.isBlank())
161
+ throw Exception("transactionId cannot be empty.")
162
+
163
+ val voidData = PlugPagVoidData(
164
+ transactionCode,
165
+ transactionId,
166
+ printReceipt,
167
+ PlugpagUtils.resolveVoidType(voidType)
168
+ )
169
+
170
+ val voidResult = plugPag.voidPayment(voidData)
171
+ promise.resolve(com.plugpag.utils.TransactionObjectMapper.toWritableMap(voidResult))
172
+ } catch (e: Exception) {
173
+ e.printStackTrace()
174
+ promise.reject(e)
175
+ }
176
+ }.start()
177
+ }
145
178
  }
@@ -4,6 +4,7 @@ import com.facebook.react.bridge.Promise
4
4
  import com.facebook.react.bridge.ReactApplicationContext
5
5
  import com.facebook.react.bridge.ReactContextBaseJavaModule
6
6
  import com.facebook.react.bridge.ReactMethod
7
+ import com.facebook.react.bridge.ReadableMap
7
8
 
8
9
  class PlugpagModule(
9
10
  reactContext: ReactApplicationContext
@@ -58,6 +59,27 @@ class PlugpagModule(
58
59
  }
59
60
  }
60
61
 
62
+ @ReactMethod
63
+ fun voidPayment(data: ReadableMap, promise: Promise) {
64
+ try {
65
+ val transactionCode = data.getString("transactionCode").orEmpty()
66
+ val transactionId = data.getString("transactionId").orEmpty()
67
+ val printReceipt = if (data.hasKey("printReceipt")) data.getBoolean("printReceipt") else false
68
+ val voidType = if (data.hasKey("voidType")) data.getString("voidType") else null
69
+
70
+ plugpag.voidPayment(
71
+ transactionCode,
72
+ transactionId,
73
+ printReceipt,
74
+ voidType,
75
+ promise
76
+ )
77
+ } catch (e: Exception) {
78
+ e.printStackTrace()
79
+ promise.reject(e)
80
+ }
81
+ }
82
+
61
83
  @ReactMethod
62
84
  fun isActivated(promise: Promise) {
63
85
  try {
@@ -21,6 +21,16 @@ object PlugpagUtils {
21
21
  }
22
22
  }
23
23
 
24
+ fun resolveVoidType(voidType: String?): Int {
25
+ return when (voidType?.lowercase()) {
26
+ null, "", "payment" -> PlugPag.VOID_PAYMENT
27
+ "qrcode", "pix" -> PlugPag.VOID_QRCODE
28
+ else -> throw IllegalArgumentException(
29
+ "Invalid voidType: '$voidType'. Use 'payment' or 'qrcode'."
30
+ )
31
+ }
32
+ }
33
+
24
34
  fun resolveEvent(data : PlugPagEventData): String {
25
35
  return when(data.eventCode) {
26
36
  EVENT_CODE_WAITING_CARD -> "Aproxime ou insira o cartão de pagamento"
@@ -0,0 +1,93 @@
1
+ package com.tectoy
2
+
3
+ import android.graphics.Bitmap
4
+ import android.graphics.BitmapFactory
5
+ import com.facebook.react.bridge.Promise
6
+ import com.facebook.react.bridge.ReactApplicationContext
7
+ import com.mesmart.R
8
+ import com.mesmart.Utils
9
+ import com.tectoy.utils.MifareT8
10
+ import com.tectoy.utils.PrinterT8
11
+ import stone.application.StoneStart
12
+
13
+ class TectoyImpl(
14
+ private val reactContext: ReactApplicationContext
15
+ ) {
16
+ private val isSupported = Utils.isT8()
17
+
18
+ @Volatile private var mifare: MifareT8? = null
19
+ @Volatile private var printer: PrinterT8? = null
20
+
21
+ /** Os providers da Stone precisam do SDK iniciado (nao ativado); o modulo Stone pode ja ter iniciado. */
22
+ @Synchronized
23
+ private fun ensureStoneSdk() {
24
+ if (!isSupported) throw Exception("Unsupported device (Supported model Tectoy T8).")
25
+ if (!StoneStart.SDKInitialized) StoneStart.init(reactContext, emptyMap())
26
+ }
27
+
28
+ @Synchronized
29
+ private fun ensureMifare(): MifareT8 {
30
+ ensureStoneSdk()
31
+ if (mifare == null) mifare = MifareT8(reactContext)
32
+ return mifare!!
33
+ }
34
+
35
+ @Synchronized
36
+ private fun ensurePrinter(): PrinterT8 {
37
+ ensureStoneSdk()
38
+ if (printer == null) printer = PrinterT8(reactContext)
39
+ return printer!!
40
+ }
41
+
42
+ fun scanRfid(promise: Promise) {
43
+ try {
44
+ ensureMifare().scanRfid(promise)
45
+ } catch (t: Throwable) {
46
+ promise.reject(t)
47
+ }
48
+ }
49
+
50
+ fun cancelScan(promise: Promise) {
51
+ try {
52
+ ensureMifare().cancelScan(promise)
53
+ } catch (t: Throwable) {
54
+ promise.reject(t)
55
+ }
56
+ }
57
+
58
+ fun printText(
59
+ str: String,
60
+ fontSize: Int,
61
+ isBold: Boolean,
62
+ isUnderline: Boolean
63
+ ) {
64
+ ensurePrinter().printText(str, fontSize, isBold, isUnderline)
65
+ }
66
+
67
+ fun printEmptyLine() {
68
+ ensurePrinter().printEmptyLine()
69
+ }
70
+
71
+ fun printBitmap(bitmapStr: String, width: Int, height: Int) {
72
+ val bitmap = Utils.convertStringToBitmap(bitmapStr)
73
+ ?: throw Exception("Error decoding bitmap. Check if the uploaded bitmap is base64.")
74
+ ensurePrinter().printBitmap(Bitmap.createScaledBitmap(bitmap, width, height, true))
75
+ }
76
+
77
+ fun printBpLogo() {
78
+ val options = BitmapFactory.Options().apply {
79
+ inTargetDensity = 160
80
+ inDensity = 160
81
+ }
82
+ val bitmap = BitmapFactory.decodeResource(reactContext.resources, R.drawable.logo_black, options)
83
+ ensurePrinter().printBitmap(Bitmap.createScaledBitmap(bitmap, 375, 100, true))
84
+ }
85
+
86
+ fun setPrinterAlign(align: String) {
87
+ ensurePrinter().setPrinterAlign(align)
88
+ }
89
+
90
+ fun commitPrint(promise: Promise) {
91
+ ensurePrinter().commitPrint(promise)
92
+ }
93
+ }
@@ -0,0 +1,112 @@
1
+ package com.tectoy
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 TectoyModule(
9
+ reactContext: ReactApplicationContext
10
+ ) : ReactContextBaseJavaModule(reactContext) {
11
+ private var tectoy: TectoyImpl = TectoyImpl(reactContext)
12
+
13
+ override fun getName(): String {
14
+ return "Tectoy"
15
+ }
16
+
17
+ @ReactMethod
18
+ fun scanRfid(promise: Promise) {
19
+ try {
20
+ tectoy.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
+ tectoy.cancelScan(promise)
31
+ } catch (e: Exception) {
32
+ e.printStackTrace()
33
+ promise.reject(e)
34
+ }
35
+ }
36
+
37
+ @ReactMethod
38
+ fun printText(
39
+ str: String,
40
+ fontSize: Int,
41
+ isBold: Boolean,
42
+ isUnderline: Boolean,
43
+ promise: Promise
44
+ ) {
45
+ try {
46
+ tectoy.printText(str, fontSize, isBold, isUnderline)
47
+ promise.resolve(null)
48
+ } catch (e: Exception) {
49
+ e.printStackTrace()
50
+ promise.reject(e)
51
+ }
52
+ }
53
+
54
+ @ReactMethod
55
+ fun printEmptyLine(promise: Promise) {
56
+ try {
57
+ tectoy.printEmptyLine()
58
+ promise.resolve(null)
59
+ } catch (e: Exception) {
60
+ e.printStackTrace()
61
+ promise.reject(e)
62
+ }
63
+ }
64
+
65
+ @ReactMethod
66
+ fun printBitmap(
67
+ bitmapStr: String,
68
+ width: Int,
69
+ height: Int,
70
+ promise: Promise
71
+ ) {
72
+ try {
73
+ tectoy.printBitmap(bitmapStr, width, height)
74
+ promise.resolve(null)
75
+ } catch (e: Exception) {
76
+ e.printStackTrace()
77
+ promise.reject(e)
78
+ }
79
+ }
80
+
81
+ @ReactMethod
82
+ fun printBpLogo(promise: Promise) {
83
+ try {
84
+ tectoy.printBpLogo()
85
+ promise.resolve(null)
86
+ } catch (e: Exception) {
87
+ e.printStackTrace()
88
+ promise.reject(e)
89
+ }
90
+ }
91
+
92
+ @ReactMethod
93
+ fun setPrinterAlign(align: String, promise: Promise) {
94
+ try {
95
+ tectoy.setPrinterAlign(align)
96
+ promise.resolve(null)
97
+ } catch (e: Exception) {
98
+ e.printStackTrace()
99
+ promise.reject(e)
100
+ }
101
+ }
102
+
103
+ @ReactMethod
104
+ fun commitPrint(promise: Promise) {
105
+ try {
106
+ tectoy.commitPrint(promise)
107
+ } catch (e: Exception) {
108
+ e.printStackTrace()
109
+ promise.reject(e)
110
+ }
111
+ }
112
+ }
@@ -0,0 +1,84 @@
1
+ package com.tectoy.utils
2
+
3
+ import android.os.Handler
4
+ import android.os.Looper
5
+ import br.com.stone.posandroid.providers.PosMifareProvider
6
+ import com.facebook.react.bridge.Promise
7
+ import com.facebook.react.bridge.ReactApplicationContext
8
+ import com.mesmart.Utils
9
+ import com.stone.utils.StoneUtils
10
+ import stone.application.interfaces.StoneCallbackInterface
11
+
12
+ class MifareT8(
13
+ private val reactContext: ReactApplicationContext
14
+ ) {
15
+ private val mainHandler = Handler(Looper.getMainLooper())
16
+
17
+ @Volatile private var provider: PosMifareProvider? = null
18
+ @Volatile private var timedOut = false
19
+
20
+ // O HAL da Tectoy encerra o polling apos 60s sem chamar callback nenhum, o que deixaria o
21
+ // PosMifareProvider (e a promise) pendurados; cancelar antes forca o onError.
22
+ private val timeout = Runnable {
23
+ timedOut = true
24
+ provider?.cancelDetection()
25
+ }
26
+
27
+ fun scanRfid(promise: Promise) {
28
+ if (provider != null) {
29
+ promise.reject("Service is busy, try again later.")
30
+ return
31
+ }
32
+
33
+ val mifare = PosMifareProvider(reactContext)
34
+ provider = mifare
35
+ timedOut = false
36
+ mifare.connectionCallback = object : StoneCallbackInterface {
37
+ override fun onSuccess() {
38
+ mainHandler.removeCallbacks(timeout)
39
+ provider = null
40
+ try {
41
+ promise.resolve(
42
+ Utils.resolveRFID(Utils.byteArrayToHexString(mifare.cardUUID))
43
+ )
44
+ } catch (e: Exception) {
45
+ e.printStackTrace()
46
+ promise.reject(e)
47
+ } finally {
48
+ try { mifare.powerOff() } catch (_: Exception) {}
49
+ }
50
+ }
51
+
52
+ override fun onError() {
53
+ mainHandler.removeCallbacks(timeout)
54
+ provider = null
55
+ if (timedOut) {
56
+ promise.reject("Timeout to read RFID card!")
57
+ return
58
+ }
59
+ promise.reject(
60
+ "listOfErrors: ${
61
+ StoneUtils.convertErrorsEnumToReadableArray(mifare.listOfErrors, true)
62
+ }\n" +
63
+ "listOfErrorsEnum: ${mifare.listOfErrors}"
64
+ )
65
+ }
66
+ }
67
+ mainHandler.postDelayed(timeout, TIMEOUT_MS)
68
+ mifare.execute()
69
+ }
70
+
71
+ fun cancelScan(promise: Promise) {
72
+ try {
73
+ provider?.cancelDetection()
74
+ promise.resolve(true)
75
+ } catch (e: Exception) {
76
+ e.printStackTrace()
77
+ promise.reject(e)
78
+ }
79
+ }
80
+
81
+ companion object {
82
+ private const val TIMEOUT_MS = 30000L
83
+ }
84
+ }
@@ -0,0 +1,141 @@
1
+ package com.tectoy.utils
2
+
3
+ import android.graphics.Bitmap
4
+ import android.graphics.Canvas
5
+ import android.graphics.Color
6
+ import android.graphics.Paint
7
+ import android.graphics.RectF
8
+ import android.graphics.Typeface
9
+ import android.text.Layout
10
+ import android.text.StaticLayout
11
+ import android.text.TextPaint
12
+ import br.com.stone.posandroid.providers.PosPrintProvider
13
+ import com.facebook.react.bridge.Promise
14
+ import com.facebook.react.bridge.ReactApplicationContext
15
+ import com.stone.utils.StoneUtils
16
+ import stone.application.interfaces.StoneCallbackInterface
17
+
18
+ /**
19
+ * Mesmas primitivas da Sunmi, mas acumuladas: o HAL da Tectoy avanca o papel pra corte no fim de
20
+ * cada job da Stone, entao o cupom inteiro vai num job so em commitPrint(). O texto e desenhado
21
+ * aqui porque a T8 (firmware Stone) bloqueia o processo da WebView, entao HTML nao renderiza.
22
+ */
23
+ class PrinterT8(
24
+ private val reactContext: ReactApplicationContext
25
+ ) {
26
+ private val blocks = mutableListOf<Bitmap>()
27
+ private var align = Layout.Alignment.ALIGN_NORMAL
28
+
29
+ @Synchronized
30
+ fun setPrinterAlign(value: String) {
31
+ align = when (value) {
32
+ "left" -> Layout.Alignment.ALIGN_NORMAL
33
+ "center" -> Layout.Alignment.ALIGN_CENTER
34
+ "right" -> Layout.Alignment.ALIGN_OPPOSITE
35
+ else -> throw Exception("'$value' not recognized! Use only one of these: ['left', 'center', 'right']")
36
+ }
37
+ }
38
+
39
+ @Synchronized
40
+ fun printText(
41
+ str: String,
42
+ fontSize: Int,
43
+ isBold: Boolean,
44
+ isUnderline: Boolean
45
+ ) {
46
+ blocks += textBlock(str.removeSuffix("\n"), fontSize, isBold, isUnderline)
47
+ }
48
+
49
+ @Synchronized
50
+ fun printEmptyLine() {
51
+ blocks += textBlock("", DEFAULT_FONT_SIZE, false, false)
52
+ }
53
+
54
+ @Synchronized
55
+ fun printBitmap(bitmap: Bitmap) {
56
+ blocks += imageBlock(bitmap)
57
+ // Igual a Sunmi, que manda "\n\n" depois da imagem.
58
+ printEmptyLine()
59
+ printEmptyLine()
60
+ }
61
+
62
+ @Synchronized
63
+ fun commitPrint(promise: Promise) {
64
+ val job = blocks.toList()
65
+ blocks.clear()
66
+ if (job.isEmpty()) {
67
+ promise.resolve(true)
68
+ return
69
+ }
70
+
71
+ val provider = PosPrintProvider(reactContext)
72
+ job.forEach { provider.addBitmap(it) }
73
+ provider.connectionCallback = object : StoneCallbackInterface {
74
+ override fun onSuccess() {
75
+ promise.resolve(true)
76
+ }
77
+
78
+ override fun onError() {
79
+ promise.reject(
80
+ "listOfErrors: ${
81
+ StoneUtils.convertErrorsEnumToReadableArray(provider.listOfErrors, true)
82
+ }\n" +
83
+ "listOfErrorsEnum: ${provider.listOfErrors}"
84
+ )
85
+ }
86
+ }
87
+ provider.execute()
88
+ }
89
+
90
+ private fun textBlock(
91
+ text: String,
92
+ fontSize: Int,
93
+ isBold: Boolean,
94
+ isUnderline: Boolean
95
+ ): Bitmap {
96
+ val paint = TextPaint(Paint.ANTI_ALIAS_FLAG).apply {
97
+ color = Color.BLACK
98
+ textSize = fontSize.toFloat()
99
+ typeface = Typeface.MONOSPACE
100
+ isFakeBoldText = isBold
101
+ isUnderlineText = isUnderline
102
+ }
103
+ // A fonte da Sunmi tem caractere de meio corpo (24 -> 32 colunas em 384 pontos). Calibra medindo o
104
+ // layout real, porque o negrito sintetico alarga o avanco e o measureText nao pega; 1% de folga pra
105
+ // linha de 32 colunas nao quebrar por arredondamento.
106
+ val target = fontSize / 2f * CALIBRATION_CHARS * 0.99f
107
+ repeat(2) { paint.textScaleX *= target / Layout.getDesiredWidth(CALIBRATION_SAMPLE, paint) }
108
+
109
+ val layout = StaticLayout.Builder
110
+ .obtain(text, 0, text.length, paint, PRINT_WIDTH)
111
+ .setAlignment(align)
112
+ .build()
113
+
114
+ return whiteBitmap(layout.height).also { layout.draw(Canvas(it)) }
115
+ }
116
+
117
+ private fun imageBlock(image: Bitmap): Bitmap {
118
+ val scaled =
119
+ if (image.width <= PRINT_WIDTH) image
120
+ else Bitmap.createScaledBitmap(image, PRINT_WIDTH, image.height * PRINT_WIDTH / image.width, true)
121
+ val left = when (align) {
122
+ Layout.Alignment.ALIGN_CENTER -> (PRINT_WIDTH - scaled.width) / 2f
123
+ Layout.Alignment.ALIGN_OPPOSITE -> (PRINT_WIDTH - scaled.width).toFloat()
124
+ else -> 0f
125
+ }
126
+ // Retangulo de destino explicito: drawBitmap(x, y) escalaria pela densidade (logo decodificado a 160dpi).
127
+ val dst = RectF(left, 0f, left + scaled.width, scaled.height.toFloat())
128
+ return whiteBitmap(scaled.height).also { Canvas(it).drawBitmap(scaled, null, dst, null) }
129
+ }
130
+
131
+ private fun whiteBitmap(height: Int): Bitmap =
132
+ Bitmap.createBitmap(PRINT_WIDTH, height.coerceAtLeast(1), Bitmap.Config.ARGB_8888)
133
+ .apply { eraseColor(Color.WHITE) }
134
+
135
+ companion object {
136
+ private const val PRINT_WIDTH = 384
137
+ private const val DEFAULT_FONT_SIZE = 24
138
+ private const val CALIBRATION_CHARS = 32
139
+ private val CALIBRATION_SAMPLE = "=".repeat(CALIBRATION_CHARS)
140
+ }
141
+ }
@@ -69,4 +69,15 @@ Object.keys(_gertec).forEach(function (key) {
69
69
  }
70
70
  });
71
71
  });
72
+ var _tectoy = require("./tectoy");
73
+ Object.keys(_tectoy).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _tectoy[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function () {
79
+ return _tectoy[key];
80
+ }
81
+ });
82
+ });
72
83
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugpag","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_paystore","_sunmi","_pax","_stone","_gertec"],"sourceRoot":"../../../src","sources":["@types/index.ts"],"mappings":";;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA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A,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":[]}
1
+ {"version":3,"names":["_plugpag","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_paystore","_sunmi","_pax","_stone","_gertec","_tectoy"],"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,CAAA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;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA;AAAA,IAuEZE,aAAa,GAAAD,OAAA,CAAAC,aAAA,0BAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=tectoy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/tectoy.ts"],"mappings":"","ignoreList":[]}
@@ -10,9 +10,10 @@ var _exportNames = {
10
10
  Pax: true,
11
11
  Paystore: true,
12
12
  Stone: true,
13
- Gertec: true
13
+ Gertec: true,
14
+ Tectoy: true
14
15
  };
15
- exports.Sunmi = exports.Stone = exports.Plugpag = exports.Paystore = exports.Pax = exports.IOS_ERROR = exports.Gertec = void 0;
16
+ exports.Tectoy = exports.Sunmi = exports.Stone = exports.Plugpag = exports.Paystore = exports.Pax = exports.IOS_ERROR = exports.Gertec = void 0;
16
17
  var _reactNative = require("react-native");
17
18
  var _sunmi = require("./sunmi");
18
19
  var _pax = require("./pax");
@@ -35,6 +36,7 @@ const Plugpag = exports.Plugpag = {
35
36
  init: _reactNative.NativeModules.Plugpag.init,
36
37
  destroy: _reactNative.NativeModules.Plugpag.destroy,
37
38
  pay: _reactNative.NativeModules.Plugpag.pay,
39
+ voidPayment: _reactNative.NativeModules.Plugpag.voidPayment,
38
40
  abortPayment: _reactNative.NativeModules.Plugpag.abortPayment,
39
41
  resolveEvent: _reactNative.NativeModules.Plugpag.resolveEvent,
40
42
  isActivated: _reactNative.NativeModules.Plugpag.isActivated
@@ -79,4 +81,15 @@ const Gertec = exports.Gertec = {
79
81
  scrollPrinterPaper: _reactNative.NativeModules.Gertec.scrollPrinterPaper,
80
82
  printHtml: html => _reactNative.NativeModules.Gertec.printHtml(html)
81
83
  };
84
+ // Mesmas primitivas da Sunmi; a T8 acumula o cupom e so imprime em commitPrint().
85
+ const Tectoy = exports.Tectoy = {
86
+ scanRfid: _reactNative.NativeModules.Tectoy.scanRfid,
87
+ cancelScan: _reactNative.NativeModules.Tectoy.cancelScan,
88
+ printText: (str, fontSize = 24, isBold = false, isUnderline = false) => _reactNative.NativeModules.Tectoy.printText(str, fontSize, isBold, isUnderline),
89
+ printEmptyLine: _reactNative.NativeModules.Tectoy.printEmptyLine,
90
+ printBitmap: (bitmapStr, width = 200, height = 200) => _reactNative.NativeModules.Tectoy.printBitmap(bitmapStr, width, height),
91
+ printBpLogo: _reactNative.NativeModules.Tectoy.printBpLogo,
92
+ setPrinterAlign: _reactNative.NativeModules.Tectoy.setPrinterAlign,
93
+ commitPrint: _reactNative.NativeModules.Tectoy.commitPrint
94
+ };
82
95
  //# 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","Gertec","scrollPrinterPaper","printHtml","html"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,G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,WAAW,EAAEL,0BAAa,CAAC6B,QAAQ,CAACxB;AACtC,CAAC;AACD,MAAM0B,KAAK,GAAAzC,OAAA,CAAAyC,KAAA,GAAG;EACZhC,IAAI,EAAEC,0BAAa,CAAC+B,KAAK,CAAChC,IAAI;EAC9BM,WAAW,EAAEL,0BAAa,CAAC+B,KAAK,CAAC1B,WAAW;EAC5C2B,YAAY,EAAEhC,0BAAa,CAAC+B,KAAK,CAACC,YAAY;EAC9C9B,GAAG,EAAEA,CAAC+B,KAAa,EAAEC,WAA0B,EAAEC,SAAkB,GAAG,IAAI,KACxEnC,0BAAa,CAAC+B,KAAK,CAAC7B,GAAG,CAAC+B,KAAK,EAAEC,WAAW,EAAEC,SAAS,CAAC;EACxDhC,YAAY,EAAEH,0BAAa,CAAC+B,KAAK,CAAC5B,YAAY;EAC9CiC,QAAQ,EAAEpC,0BAAa,CAAC+B,KAAK,CAACK,QAAQ;EACtCC,kBAAkB,EAAErC,0BAAa,CAAC+B,KAAK,CAACM,kBAAkB;EAC1DC,iBAAiB,EAAEtC,0BAAa,CAAC+B,KAAK,CAACO;AACzC,CAAC;AACD,MAAMC,MAAM,GAAAjD,OAAA,CAAAiD,MAAA,GAAG;EACbhC,QAAQ,EAAEP,0BAAa,CAACuC,MAAM,CAAChC,QAAQ;EACvCC,UAAU,EAAER,0BAAa,CAACuC,MAAM,CAAC/B,UAAU;EAC3CgC,kBAAkB,EAAExC,0BAAa,CAACuC,MAAM,CAACC,kBAAkB;EAC3DC,SAAS,EAAGC,IAAY,IAAK1C,0BAAa,CAACuC,MAAM,CAACE,SAAS,CAACC,IAAI;AAClE,CAAC","ignoreList":[]}
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","voidPayment","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","Tectoy","commitPrint"],"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;AAmFA,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;AAjFO,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,OAAO,CAACG,OAAO;EACtCC,GAAG,EAAEF,0BAAa,CAACF,OAAO,CAACI,G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B,EAAEzC,0BAAa,CAACwC,MAAM,CAACC,kBAAkB;EAC3DC,SAAS,EAAGC,IAAY,IAAK3C,0BAAa,CAACwC,MAAM,CAACE,SAAS,CAACC,IAAI;AAClE,CAAC;AACD;AACA,MAAMC,MAAM,GAAAtD,OAAA,CAAAsD,MAAA,GAAG;EACbpC,QAAQ,EAAER,0BAAa,CAAC4C,MAAM,CAACpC,QAAQ;EACvCC,UAAU,EAAET,0BAAa,CAAC4C,MAAM,CAACnC,UAAU;EAC3CG,SAAS,EAAEA,CACTC,GAAW,EACXC,QAAgB,GAAG,EAAE,EACrBC,MAAe,GAAG,KAAK,EACvBC,WAAoB,GAAG,KAAK,KACzBhB,0BAAa,CAAC4C,MAAM,CAAChC,SAAS,CAACC,GAAG,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,WAAW,CAAC;EACvEC,cAAc,EAAEjB,0BAAa,CAAC4C,MAAM,CAAC3B,cAAc;EACnDC,WAAW,EAAEA,CAACC,SAAiB,EAAEC,KAAa,GAAG,GAAG,EAAEC,MAAc,GAAG,GAAG,KACxErB,0BAAa,CAAC4C,MAAM,CAAC1B,WAAW,CAACC,SAAS,EAAEC,KAAK,EAAEC,MAAM,CAAC;EAC5DC,WAAW,EAAEtB,0BAAa,CAAC4C,MAAM,CAACtB,WAAW;EAC7CC,eAAe,EAAEvB,0BAAa,CAAC4C,MAAM,CAACrB,eAAe;EACrDsB,WAAW,EAAE7C,0BAAa,CAAC4C,MAAM,CAACC;AACpC,CAAC","ignoreList":[]}
@@ -4,4 +4,5 @@ export * from './sunmi';
4
4
  export * from './pax';
5
5
  export * from './stone';
6
6
  export * from './gertec';
7
+ export * from './tectoy';
7
8
  //# sourceMappingURL=index.js.map
@@ -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;AACvB,cAAc,UAAU","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;AACxB,cAAc,UAAU","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["PlugpagEvent","PlugpagResult"],"sourceRoot":"../../../src","sources":["@types/plugpag.ts"],"mappings":"AAmBA,WAAYA,YAAY,0BAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA;AAuExB,WAAYC,aAAa,0BAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["PlugpagEvent","PlugpagResult"],"sourceRoot":"../../../src","sources":["@types/plugpag.ts"],"mappings":"AA+BA,WAAYA,YAAY,0BAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA;AAuExB,WAAYC,aAAa,0BAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tectoy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/tectoy.ts"],"mappings":"","ignoreList":[]}
@@ -8,6 +8,7 @@ const Plugpag = {
8
8
  init: NativeModules.Plugpag.init,
9
9
  destroy: NativeModules.Plugpag.destroy,
10
10
  pay: NativeModules.Plugpag.pay,
11
+ voidPayment: NativeModules.Plugpag.voidPayment,
11
12
  abortPayment: NativeModules.Plugpag.abortPayment,
12
13
  resolveEvent: NativeModules.Plugpag.resolveEvent,
13
14
  isActivated: NativeModules.Plugpag.isActivated
@@ -52,6 +53,17 @@ const Gertec = {
52
53
  scrollPrinterPaper: NativeModules.Gertec.scrollPrinterPaper,
53
54
  printHtml: html => NativeModules.Gertec.printHtml(html)
54
55
  };
55
- export { Plugpag, Sunmi, Pax, Paystore, Stone, Gertec };
56
+ // Mesmas primitivas da Sunmi; a T8 acumula o cupom e so imprime em commitPrint().
57
+ const Tectoy = {
58
+ scanRfid: NativeModules.Tectoy.scanRfid,
59
+ cancelScan: NativeModules.Tectoy.cancelScan,
60
+ printText: (str, fontSize = 24, isBold = false, isUnderline = false) => NativeModules.Tectoy.printText(str, fontSize, isBold, isUnderline),
61
+ printEmptyLine: NativeModules.Tectoy.printEmptyLine,
62
+ printBitmap: (bitmapStr, width = 200, height = 200) => NativeModules.Tectoy.printBitmap(bitmapStr, width, height),
63
+ printBpLogo: NativeModules.Tectoy.printBpLogo,
64
+ setPrinterAlign: NativeModules.Tectoy.setPrinterAlign,
65
+ commitPrint: NativeModules.Tectoy.commitPrint
66
+ };
67
+ export { Plugpag, Sunmi, Pax, Paystore, Stone, Gertec, Tectoy };
56
68
  export * from './@types';
57
69
  //# sourceMappingURL=index.js.map
@@ -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","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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C,IAAY,IAAKhD,aAAa,CAAC6C,MAAM,CAACE,SAAS,CAACC,IAAI;AAClE,CAAC;AAED,SAASxC,OAAO,EAAEO,KAAK,EAAEgB,GAAG,EAAEK,QAAQ,EAAEC,KAAK,EAAEQ,MAAM;AACrD,cAAc,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","Platform","printClientReceiptInSunmi","printClientReceiptInPax","payWithPaystore","IOS_ERROR","OS","Error","Plugpag","init","destroy","pay","voidPayment","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","Tectoy","commitPrint"],"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,WAAW,EAAEZ,aAAa,CAACQ,OAAO,CAACI,WAAW;EAC9CC,YAAY,EAAEb,aAAa,CAACQ,OAAO,CAACK,YAAY;EAChDC,YAAY,EAAEd,aAAa,CAACQ,OAAO,CAACM,YAAY;EAChDC,WAAW,EAAEf,aAAa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e,GAAG,KAAK,EACvBC,WAAoB,GAAG,KAAK,KACzBxB,aAAa,CAACkD,MAAM,CAAC9B,SAAS,CAACC,GAAG,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,WAAW,CAAC;EACvEC,cAAc,EAAEzB,aAAa,CAACkD,MAAM,CAACzB,cAAc;EACnDC,WAAW,EAAEA,CAACC,SAAiB,EAAEC,KAAa,GAAG,GAAG,EAAEC,MAAc,GAAG,GAAG,KACxE7B,aAAa,CAACkD,MAAM,CAACxB,WAAW,CAACC,SAAS,EAAEC,KAAK,EAAEC,MAAM,CAAC;EAC5DC,WAAW,EAAE9B,aAAa,CAACkD,MAAM,CAACpB,WAAW;EAC7CC,eAAe,EAAE/B,aAAa,CAACkD,MAAM,CAACnB,eAAe;EACrDoB,WAAW,EAAEnD,aAAa,CAACkD,MAAM,CAACC;AACpC,CAAC;AAED,SAAS3C,OAAO,EAAEQ,KAAK,EAAEgB,GAAG,EAAEK,QAAQ,EAAEC,KAAK,EAAEQ,MAAM,EAAEI,MAAM;AAC7D,cAAc,UAAU","ignoreList":[]}
@@ -5,4 +5,5 @@ export * from './sunmi';
5
5
  export * from './pax';
6
6
  export * from './stone';
7
7
  export * from './gertec';
8
+ export * from './tectoy';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -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;AACxB,cAAc,UAAU,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;AACzB,cAAc,UAAU,CAAC"}
@@ -1,8 +1,16 @@
1
1
  import type { PaymentMethod } from '.';
2
+ export type PlugpagVoidType = 'payment' | 'qrcode' | 'pix';
3
+ export type PlugpagVoidPaymentData = {
4
+ transactionCode: string;
5
+ transactionId: string;
6
+ printReceipt?: boolean;
7
+ voidType?: PlugpagVoidType;
8
+ };
2
9
  export interface PlugpagAPI {
3
10
  init: (code: string) => Promise<null>;
4
11
  destroy: () => Promise<null>;
5
12
  pay: (value: string, paymentMethod: PaymentMethod) => Promise<PlugpagTransactionResult>;
13
+ voidPayment: (data: PlugpagVoidPaymentData) => Promise<PlugpagTransactionResult>;
6
14
  abortPayment: () => Promise<null>;
7
15
  resolveEvent: (data: PlugpagEventData) => Promise<string>;
8
16
  isActivated: () => Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"plugpag.d.ts","sourceRoot":"","sources":["../../../../src/@types/plugpag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAEvC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,GAAG,EAAE,CACH,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,aAAa,KACzB,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACvC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,YAAY,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,OAAO,CA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iAPI, 'cancelScan'> {
3
+ cancelScan: () => Promise<true>;
4
+ /** Imprime tudo que foi acumulado desde o ultimo commit num job so. */
5
+ commitPrint: () => Promise<true>;
6
+ }
7
+ //# sourceMappingURL=tectoy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tectoy.d.ts","sourceRoot":"","sources":["../../../../src/@types/tectoy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC;IAC7D,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,uEAAuE;IACvE,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC"}
@@ -4,6 +4,7 @@ declare const Plugpag: {
4
4
  init: (code: string) => Promise<null>;
5
5
  destroy: () => Promise<null>;
6
6
  pay: (value: string, paymentMethod: PaymentMethod) => Promise<import("./@types").PlugpagTransactionResult>;
7
+ voidPayment: (data: import("./@types").PlugpagVoidPaymentData) => Promise<import("./@types").PlugpagTransactionResult>;
7
8
  abortPayment: () => Promise<null>;
8
9
  resolveEvent: (data: import("./@types").PlugpagEventData) => Promise<string>;
9
10
  isActivated: () => Promise<boolean>;
@@ -48,6 +49,16 @@ declare const Gertec: {
48
49
  scrollPrinterPaper: (lines: number) => Promise<true>;
49
50
  printHtml: (html: string) => Promise<true>;
50
51
  };
51
- export { Plugpag, Sunmi, Pax, Paystore, Stone, Gertec };
52
+ declare const Tectoy: {
53
+ scanRfid: any;
54
+ cancelScan: any;
55
+ printText: (str: string, fontSize?: number, isBold?: boolean, isUnderline?: boolean) => any;
56
+ printEmptyLine: any;
57
+ printBitmap: (bitmapStr: string, width?: number, height?: number) => any;
58
+ printBpLogo: any;
59
+ setPrinterAlign: any;
60
+ commitPrint: any;
61
+ };
62
+ export { Plugpag, Sunmi, Pax, Paystore, Stone, Gertec, Tectoy };
52
63
  export * from './@types';
53
64
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
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;;;;;;;;CAQZ,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,QAAA,MAAM,MAAM;;;qBAIH,MAAM,aACD,MAAM,WACR,OAAO,gBACF,OAAO;;6BAGG,MAAM,UAAS,MAAM,WAAgB,MAAM;;;;CAKrE,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAChE,cAAc,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-mesmart",
3
- "version": "2.1.1",
4
- "description": "Sunmi P2 utilities and Plugpag wrapper for React Native",
3
+ "version": "3.0.0",
4
+ "description": "Native methods for integrating with Sunmi P2-B/P2-A11 POS, Pax A910/A920, Pagbank's Plugpag payment SDK, Stone's payment SDK, and Paystore's payment SDK.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
7
7
  "types": "lib/typescript/src/index.d.ts",
@@ -12,3 +12,4 @@ export * from './sunmi';
12
12
  export * from './pax';
13
13
  export * from './stone';
14
14
  export * from './gertec';
15
+ export * from './tectoy';
@@ -1,5 +1,14 @@
1
1
  import type { PaymentMethod } from '.';
2
2
 
3
+ export type PlugpagVoidType = 'payment' | 'qrcode' | 'pix';
4
+
5
+ export type PlugpagVoidPaymentData = {
6
+ transactionCode: string;
7
+ transactionId: string;
8
+ printReceipt?: boolean;
9
+ voidType?: PlugpagVoidType;
10
+ };
11
+
3
12
  export interface PlugpagAPI {
4
13
  init: (code: string) => Promise<null>;
5
14
  destroy: () => Promise<null>;
@@ -7,6 +16,9 @@ export interface PlugpagAPI {
7
16
  value: string,
8
17
  paymentMethod: PaymentMethod
9
18
  ) => Promise<PlugpagTransactionResult>;
19
+ voidPayment: (
20
+ data: PlugpagVoidPaymentData
21
+ ) => Promise<PlugpagTransactionResult>;
10
22
  abortPayment: () => Promise<null>;
11
23
  resolveEvent: (data: PlugpagEventData) => Promise<string>;
12
24
  isActivated: () => Promise<boolean>;
@@ -0,0 +1,7 @@
1
+ import type { SunmiAPI } from './sunmi';
2
+
3
+ export interface TectoyAPI extends Omit<SunmiAPI, 'cancelScan'> {
4
+ cancelScan: () => Promise<true>;
5
+ /** Imprime tudo que foi acumulado desde o ultimo commit num job so. */
6
+ commitPrint: () => Promise<true>;
7
+ }
package/src/index.ts CHANGED
@@ -14,6 +14,7 @@ const Plugpag = {
14
14
  init: NativeModules.Plugpag.init,
15
15
  destroy: NativeModules.Plugpag.destroy,
16
16
  pay: NativeModules.Plugpag.pay,
17
+ voidPayment: NativeModules.Plugpag.voidPayment,
17
18
  abortPayment: NativeModules.Plugpag.abortPayment,
18
19
  resolveEvent: NativeModules.Plugpag.resolveEvent,
19
20
  isActivated: NativeModules.Plugpag.isActivated,
@@ -66,6 +67,23 @@ const Gertec = {
66
67
  scrollPrinterPaper: NativeModules.Gertec.scrollPrinterPaper,
67
68
  printHtml: (html: string) => NativeModules.Gertec.printHtml(html),
68
69
  };
70
+ // Mesmas primitivas da Sunmi; a T8 acumula o cupom e so imprime em commitPrint().
71
+ const Tectoy = {
72
+ scanRfid: NativeModules.Tectoy.scanRfid,
73
+ cancelScan: NativeModules.Tectoy.cancelScan,
74
+ printText: (
75
+ str: string,
76
+ fontSize: number = 24,
77
+ isBold: boolean = false,
78
+ isUnderline: boolean = false
79
+ ) => NativeModules.Tectoy.printText(str, fontSize, isBold, isUnderline),
80
+ printEmptyLine: NativeModules.Tectoy.printEmptyLine,
81
+ printBitmap: (bitmapStr: string, width: number = 200, height: number = 200) =>
82
+ NativeModules.Tectoy.printBitmap(bitmapStr, width, height),
83
+ printBpLogo: NativeModules.Tectoy.printBpLogo,
84
+ setPrinterAlign: NativeModules.Tectoy.setPrinterAlign,
85
+ commitPrint: NativeModules.Tectoy.commitPrint,
86
+ };
69
87
 
70
- export { Plugpag, Sunmi, Pax, Paystore, Stone, Gertec };
88
+ export { Plugpag, Sunmi, Pax, Paystore, Stone, Gertec, Tectoy };
71
89
  export * from './@types';