react-native-mesmart 0.6.0 → 0.7.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/README.md +9 -11
- package/android/build.gradle +1 -1
- package/android/libs/paystore-api-v2.11.3.24.aar +0 -0
- package/android/src/main/java/com/mesmart/Packages.kt +3 -1
- package/android/src/main/java/com/paystore/PaystoreModule.kt +60 -0
- package/android/src/main/java/com/paystore/services/DoConfirmPaymentService.kt +49 -0
- package/android/src/main/java/com/paystore/services/DoPaymentService.kt +93 -0
- package/android/src/main/java/com/paystore/services/OnBindConnectedPaymentService.kt +5 -0
- package/android/src/main/java/com/paystore/services/PaymentService.kt +68 -0
- package/android/src/main/java/com/paystore/utils/Constants.kt +13 -0
- package/android/src/main/java/com/paystore/utils/CredentialsUtils.kt +27 -0
- package/android/src/main/java/com/paystore/utils/DataTypeUtils.kt +9 -0
- package/android/src/main/java/com/paystore/utils/PaymentV2Mapper.kt +43 -0
- package/lib/commonjs/@types/index.js +11 -0
- package/lib/commonjs/@types/index.js.map +1 -1
- package/lib/commonjs/@types/paystore.js +2 -0
- package/lib/commonjs/@types/paystore.js.map +1 -0
- package/lib/commonjs/index.js +29 -20
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/@types/index.js +1 -0
- package/lib/module/@types/index.js.map +1 -1
- package/lib/module/@types/paystore.js +2 -0
- package/lib/module/@types/paystore.js.map +1 -0
- package/lib/module/index.js +25 -16
- package/lib/module/index.js.map +1 -1
- 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/@types/paystore.d.ts +34 -0
- package/lib/typescript/src/@types/paystore.d.ts.map +1 -0
- package/lib/typescript/src/@types/plugpag.d.ts +2 -2
- package/lib/typescript/src/@types/plugpag.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +9 -4
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/index.ts +1 -0
- package/src/@types/paystore.ts +74 -0
- package/src/@types/plugpag.ts +2 -2
- package/src/index.ts +57 -21
- package/lib/commonjs/errorMessages.js +0 -9
- package/lib/commonjs/errorMessages.js.map +0 -1
- package/lib/module/errorMessages.js +0 -3
- package/lib/module/errorMessages.js.map +0 -1
- package/lib/typescript/src/errorMessages.d.ts +0 -3
- package/lib/typescript/src/errorMessages.d.ts.map +0 -1
- package/src/errorMessages.ts +0 -7
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# react-native-mesmart
|
|
2
2
|
|
|
3
|
-
Native methods to integrate with Sunmi P2, Pax A910 and
|
|
3
|
+
Native methods to integrate with Sunmi P2, Pax A910, Plugpag payment SDK and Paystore payment SDK.
|
|
4
|
+
|
|
5
|
+
- [Plugpag](https://developer.pagbank.com.br/v1.0/reference/smart-pos-introducao)
|
|
6
|
+
- [Paystore](https://backendphoebus.paystore.com.br/portal/api/docs/sdk/android/index.html)
|
|
4
7
|
|
|
5
8
|
## Installation
|
|
6
9
|
|
|
@@ -58,17 +61,18 @@ Add those permissions in your AndroidManifest.xml
|
|
|
58
61
|
<uses-permission android:name="br.com.uol.pagseguro.permission.MANAGE_PAYMENTS" />
|
|
59
62
|
<uses-permission android:name="com.pax.permission.PICC" />
|
|
60
63
|
<uses-permission android:name="com.pax.permission.PRINTER" />
|
|
64
|
+
<uses-permission android:name="br.com.phoebus.android.payments.provider.READ_PERMISSION" />
|
|
61
65
|
```
|
|
62
66
|
|
|
63
67
|
## Usage
|
|
64
68
|
|
|
65
69
|
```ts
|
|
66
|
-
import {
|
|
70
|
+
import { DeviceEventEmitter } from 'react-native';
|
|
71
|
+
import { Sunmi, Plugpag, Pax, Paystore } from 'react-native-mesmart';
|
|
67
72
|
|
|
68
73
|
// Register event listener to catch onPlugPagEventData
|
|
69
74
|
useEffect(() => {
|
|
70
|
-
const
|
|
71
|
-
let eventListener = eventEmitter.addListener(
|
|
75
|
+
const subscribe = DeviceEventEmitter.addListener(
|
|
72
76
|
'onPlugPagEventData',
|
|
73
77
|
(plugpagEvent: PlugPagEventData) => {
|
|
74
78
|
console.log(plugpagEvent);
|
|
@@ -76,19 +80,13 @@ useEffect(() => {
|
|
|
76
80
|
);
|
|
77
81
|
|
|
78
82
|
return () => {
|
|
79
|
-
|
|
83
|
+
subscribe.remove();
|
|
80
84
|
};
|
|
81
85
|
}, []);
|
|
82
86
|
```
|
|
83
87
|
|
|
84
|
-
## Contributing
|
|
85
|
-
|
|
86
|
-
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
87
|
-
|
|
88
88
|
## License
|
|
89
89
|
|
|
90
90
|
MIT
|
|
91
91
|
|
|
92
92
|
---
|
|
93
|
-
|
|
94
|
-
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
package/android/build.gradle
CHANGED
|
@@ -88,7 +88,7 @@ repositories {
|
|
|
88
88
|
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
89
89
|
|
|
90
90
|
dependencies {
|
|
91
|
-
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
91
|
+
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
|
92
92
|
implementation "com.facebook.react:react-android:0.75.0-rc.5"
|
|
93
93
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
94
94
|
implementation "com.sunmi:PayLib-release:2.0.07"
|
|
Binary file
|
|
@@ -5,6 +5,7 @@ import com.facebook.react.bridge.NativeModule
|
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.uimanager.ViewManager
|
|
7
7
|
import com.pax.PaxModule
|
|
8
|
+
import com.paystore.PaystoreModule
|
|
8
9
|
import com.plugpag.PlugpagModule
|
|
9
10
|
import com.sunmi.SunmiModule
|
|
10
11
|
|
|
@@ -13,7 +14,8 @@ class Packages : ReactPackage {
|
|
|
13
14
|
return listOf(
|
|
14
15
|
PlugpagModule(reactContext),
|
|
15
16
|
SunmiModule(reactContext),
|
|
16
|
-
PaxModule(reactContext)
|
|
17
|
+
PaxModule(reactContext),
|
|
18
|
+
PaystoreModule(reactContext)
|
|
17
19
|
)
|
|
18
20
|
}
|
|
19
21
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
package com.paystore
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import br.com.phoebus.android.payments.api.PaymentType
|
|
5
|
+
import br.com.phoebus.android.payments.api.provider.PaymentProviderApi
|
|
6
|
+
import com.facebook.react.bridge.Promise
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
9
|
+
import com.facebook.react.bridge.ReactMethod
|
|
10
|
+
import com.facebook.react.bridge.ReadableArray
|
|
11
|
+
import com.mesmart.utils.Utils
|
|
12
|
+
import com.paystore.services.PaymentService
|
|
13
|
+
import java.util.LinkedList
|
|
14
|
+
|
|
15
|
+
class PaystoreModule(
|
|
16
|
+
reactContext: ReactApplicationContext
|
|
17
|
+
) : ReactContextBaseJavaModule(reactContext) {
|
|
18
|
+
init {
|
|
19
|
+
if (Utils.isA910()) {
|
|
20
|
+
PaymentProviderApi.create(reactApplicationContext)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
override fun getName(): String {
|
|
25
|
+
return "Paystore"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@ReactMethod
|
|
29
|
+
fun pay(
|
|
30
|
+
value: String?,
|
|
31
|
+
transactionId: String?,
|
|
32
|
+
showReceiptView: Boolean,
|
|
33
|
+
paymentTypeArrayString: ReadableArray,
|
|
34
|
+
installments: Int?,
|
|
35
|
+
promise: Promise
|
|
36
|
+
) {
|
|
37
|
+
val paymentTypes: MutableList<PaymentType> = LinkedList()
|
|
38
|
+
for (i in 0 until paymentTypeArrayString.size()) {
|
|
39
|
+
val paymentTypeString = paymentTypeArrayString.getString(i)
|
|
40
|
+
if (PaymentType.valueOf(paymentTypeString) != null) {
|
|
41
|
+
paymentTypes.add(PaymentType.valueOf(paymentTypeString))
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
val paymentService = PaymentService(reactApplicationContext, promise)
|
|
47
|
+
paymentService.doPayment(
|
|
48
|
+
value,
|
|
49
|
+
transactionId,
|
|
50
|
+
showReceiptView,
|
|
51
|
+
paymentTypes,
|
|
52
|
+
installments,
|
|
53
|
+
true
|
|
54
|
+
)
|
|
55
|
+
} catch (e: Exception) {
|
|
56
|
+
Log.e("errorPayment", e.toString())
|
|
57
|
+
promise.reject("ERROR", e.message)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
package com.paystore.services
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import br.com.phoebus.android.payments.api.ErrorData
|
|
5
|
+
import br.com.phoebus.android.payments.api.PaymentClient
|
|
6
|
+
import br.com.phoebus.android.payments.api.PaymentClient.PaymentCallback
|
|
7
|
+
import br.com.phoebus.android.payments.api.PaymentStatus
|
|
8
|
+
import br.com.phoebus.android.payments.api.PaymentV2
|
|
9
|
+
import com.facebook.react.bridge.Promise
|
|
10
|
+
import com.facebook.react.bridge.ReactContext
|
|
11
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
12
|
+
import com.paystore.utils.Constants
|
|
13
|
+
import com.paystore.utils.PaymentV2Mapper
|
|
14
|
+
|
|
15
|
+
class DoConfirmPaymentService(
|
|
16
|
+
private val mContext: ReactContext,
|
|
17
|
+
private val mPaymentClient: PaymentClient,
|
|
18
|
+
var paymentV2: PaymentV2,
|
|
19
|
+
private val promise: Promise
|
|
20
|
+
) : OnBindConnectedPaymentService {
|
|
21
|
+
override fun execute() {
|
|
22
|
+
try {
|
|
23
|
+
mPaymentClient.confirmPayment(paymentV2.paymentId, object : PaymentCallback<Any?> {
|
|
24
|
+
override fun onSuccess(o: Any?) {
|
|
25
|
+
Log.e("sendEvent", "ConfirmPayment")
|
|
26
|
+
paymentV2.paymentStatus = PaymentStatus.CONFIRMED
|
|
27
|
+
mContext
|
|
28
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
29
|
+
.emit("onPayment", PaymentV2Mapper.toWritableMap(paymentV2))
|
|
30
|
+
unBind()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
override fun onError(errorData: ErrorData) {
|
|
34
|
+
promise.reject(Constants.ERROR, errorData?.responseMessage ?: "-")
|
|
35
|
+
unBind()
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
} catch (e: Exception) {
|
|
39
|
+
Log.e("Payment fail", e.message!!)
|
|
40
|
+
unBind()
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private fun unBind() {
|
|
45
|
+
if (mPaymentClient.isBound) {
|
|
46
|
+
mPaymentClient.unbind(mContext)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
package com.paystore.services
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import br.com.phoebus.android.payments.api.ErrorData
|
|
5
|
+
import br.com.phoebus.android.payments.api.PaymentClient
|
|
6
|
+
import br.com.phoebus.android.payments.api.PaymentClient.PaymentCallback
|
|
7
|
+
import br.com.phoebus.android.payments.api.PaymentRequestV2
|
|
8
|
+
import br.com.phoebus.android.payments.api.PaymentType
|
|
9
|
+
import br.com.phoebus.android.payments.api.PaymentV2
|
|
10
|
+
import com.facebook.react.bridge.Promise
|
|
11
|
+
import com.facebook.react.bridge.ReactContext
|
|
12
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
13
|
+
import com.paystore.utils.Constants
|
|
14
|
+
import com.paystore.utils.CredentialsUtils
|
|
15
|
+
import com.paystore.utils.DataTypeUtils
|
|
16
|
+
import com.paystore.utils.PaymentV2Mapper
|
|
17
|
+
|
|
18
|
+
class DoPaymentService(
|
|
19
|
+
private val mContext: ReactContext,
|
|
20
|
+
private val mPaymentClient: PaymentClient,
|
|
21
|
+
private val value: String,
|
|
22
|
+
private val transactionId: String,
|
|
23
|
+
private val showReceiptView: Boolean,
|
|
24
|
+
private val payments: List<PaymentType>,
|
|
25
|
+
private val installments: Int,
|
|
26
|
+
private val confirmPayment: Boolean,
|
|
27
|
+
private val promise: Promise
|
|
28
|
+
) : OnBindConnectedPaymentService {
|
|
29
|
+
override fun execute() {
|
|
30
|
+
Log.e("Pagamentos", "------------")
|
|
31
|
+
Log.e("Valor", value)
|
|
32
|
+
Log.e("transactionId", transactionId)
|
|
33
|
+
|
|
34
|
+
val paymentRequest = PaymentRequestV2()
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
paymentRequest.withValue(DataTypeUtils.getValueFromString(value))
|
|
38
|
+
.withAppTransactionId(transactionId)
|
|
39
|
+
.withApplicationInfo(CredentialsUtils.myAppInfo)
|
|
40
|
+
.withShowReceiptView(showReceiptView)
|
|
41
|
+
.withPaymentTypes(payments)
|
|
42
|
+
paymentRequest.tokenizeCard = false
|
|
43
|
+
paymentRequest.printMerchantReceipt = true
|
|
44
|
+
paymentRequest.printCustomerReceipt = true
|
|
45
|
+
if (this.installments != 0) {
|
|
46
|
+
paymentRequest.installments = installments
|
|
47
|
+
}
|
|
48
|
+
} catch (e: Exception) {
|
|
49
|
+
Log.e("Error", e.message!!)
|
|
50
|
+
promise.reject(
|
|
51
|
+
"ERRORS" + "REQUEST",
|
|
52
|
+
"ERROR NAME :" + e.message + ", ERROR_CODE : " + e.toString()
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
mPaymentClient.startPaymentV2(paymentRequest, object : PaymentCallback<PaymentV2?> {
|
|
58
|
+
override fun onSuccess(paymentV2: PaymentV2?) {
|
|
59
|
+
if (confirmPayment) {
|
|
60
|
+
val paymentService = PaymentService(mContext, promise)
|
|
61
|
+
paymentService.confirmPayment(paymentV2)
|
|
62
|
+
} else {
|
|
63
|
+
mContext
|
|
64
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
65
|
+
.emit("onPayment", paymentV2?.let { PaymentV2Mapper.toWritableMap(it) })
|
|
66
|
+
}
|
|
67
|
+
unBind()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
override fun onError(errorData: ErrorData) {
|
|
71
|
+
Log.e(
|
|
72
|
+
"Error",
|
|
73
|
+
if (errorData != null) errorData.paymentsResponseCode + " - " + errorData.responseMessage else "-"
|
|
74
|
+
)
|
|
75
|
+
promise.reject(
|
|
76
|
+
Constants.ERROR,
|
|
77
|
+
if (errorData != null) errorData.paymentsResponseCode + " - " + errorData.responseMessage else ""
|
|
78
|
+
)
|
|
79
|
+
unBind()
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
} catch (e: Exception) {
|
|
83
|
+
promise.reject("ERROR", e.message)
|
|
84
|
+
unBind()
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private fun unBind() {
|
|
89
|
+
if (mPaymentClient.isBound) {
|
|
90
|
+
mPaymentClient.unbind(mContext)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
package com.paystore.services
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import br.com.phoebus.android.payments.api.PaymentClient
|
|
5
|
+
import br.com.phoebus.android.payments.api.PaymentType
|
|
6
|
+
import br.com.phoebus.android.payments.api.PaymentV2
|
|
7
|
+
import br.com.phoebus.android.payments.api.client.Client.OnConnectionCallback
|
|
8
|
+
import com.facebook.react.bridge.Promise
|
|
9
|
+
import com.facebook.react.bridge.ReactContext
|
|
10
|
+
|
|
11
|
+
class PaymentService(
|
|
12
|
+
private val context: ReactContext,
|
|
13
|
+
private val promise: Promise
|
|
14
|
+
) {
|
|
15
|
+
private val paymentClient = PaymentClient()
|
|
16
|
+
private var onBindConnectedPaymentService: OnBindConnectedPaymentService? = null
|
|
17
|
+
|
|
18
|
+
private fun doBind() {
|
|
19
|
+
paymentClient.bind(context.applicationContext, object : OnConnectionCallback {
|
|
20
|
+
override fun onConnected() {
|
|
21
|
+
Log.i("OnConnected", "Conectado")
|
|
22
|
+
onBindConnectedPaymentService?.execute()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override fun onDisconnected(b: Boolean) {
|
|
26
|
+
Log.i("onDisconnected", "Desconectado")
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
fun doPayment(
|
|
32
|
+
value: String?,
|
|
33
|
+
transactionId: String?,
|
|
34
|
+
showReceiptView: Boolean,
|
|
35
|
+
paymentType: List<PaymentType>?,
|
|
36
|
+
installments: Int?,
|
|
37
|
+
confirmPayment: Boolean
|
|
38
|
+
) {
|
|
39
|
+
val doPayment: OnBindConnectedPaymentService = DoPaymentService(
|
|
40
|
+
context,
|
|
41
|
+
paymentClient,
|
|
42
|
+
value!!,
|
|
43
|
+
transactionId!!,
|
|
44
|
+
showReceiptView,
|
|
45
|
+
paymentType!!,
|
|
46
|
+
installments!!,
|
|
47
|
+
confirmPayment,
|
|
48
|
+
promise
|
|
49
|
+
)
|
|
50
|
+
setOnBindConnectedPaymentService(doPayment)
|
|
51
|
+
doBind()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
fun confirmPayment(paymentV2: PaymentV2?) {
|
|
55
|
+
val doConfirmPaymentService: OnBindConnectedPaymentService = DoConfirmPaymentService(
|
|
56
|
+
context,
|
|
57
|
+
paymentClient,
|
|
58
|
+
paymentV2!!,
|
|
59
|
+
promise
|
|
60
|
+
)
|
|
61
|
+
setOnBindConnectedPaymentService(doConfirmPaymentService)
|
|
62
|
+
doBind()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private fun setOnBindConnectedPaymentService(onBindConnectedPaymentService: OnBindConnectedPaymentService?) {
|
|
66
|
+
this.onBindConnectedPaymentService = onBindConnectedPaymentService
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
package com.paystore.utils
|
|
2
|
+
|
|
3
|
+
object Constants {
|
|
4
|
+
const val PREFS_DATA_PAYMENT: String = "prefs_data_payment"
|
|
5
|
+
const val PREFS_DATA_REVERSE_PAYMENT: String = "prefs_data_reverse_payment"
|
|
6
|
+
const val ERROR: String = "ERROR_PAYMENT"
|
|
7
|
+
const val ON_PAYMENT_EVENT: String = "onPayment"
|
|
8
|
+
const val CANCEL_SIGNATURE: String = "CANCEL_SIGNATURE"
|
|
9
|
+
const val CANCEL_SIGNATURE_ERROR: String = "CANCEL_SIGNATURE_ERROR"
|
|
10
|
+
const val NEW_SIGNATURE: String = "NEW_SIGNATURE"
|
|
11
|
+
const val APPLICATION_ID: String = "application_id"
|
|
12
|
+
const val SECRET_TOKEN: String = "secret_token"
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
package com.paystore.utils
|
|
2
|
+
|
|
3
|
+
import br.com.phoebus.android.payments.api.ApplicationInfo
|
|
4
|
+
import br.com.phoebus.android.payments.api.Credentials
|
|
5
|
+
|
|
6
|
+
object CredentialsUtils {
|
|
7
|
+
const val TEST_APPLICATION_ID: String = "3247"
|
|
8
|
+
const val TEST_SECRET_TOKEN: String = "1TreIFPr4eM4Ul20RSlOw9AUaMiUtmiaGryzrwdLcFpDrc9UYxGo26eRNXlEU2vR"
|
|
9
|
+
|
|
10
|
+
val myCredentials: Credentials
|
|
11
|
+
get() {
|
|
12
|
+
val credentials = Credentials()
|
|
13
|
+
credentials.applicationId = TEST_APPLICATION_ID
|
|
14
|
+
credentials.secretToken = TEST_SECRET_TOKEN
|
|
15
|
+
return credentials
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
val myAppInfo: ApplicationInfo
|
|
19
|
+
get() {
|
|
20
|
+
val applicationInfo = ApplicationInfo()
|
|
21
|
+
applicationInfo.credentials = myCredentials
|
|
22
|
+
applicationInfo.softwareVersion = "1.0"
|
|
23
|
+
|
|
24
|
+
return applicationInfo
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
package com.paystore.utils
|
|
2
|
+
|
|
3
|
+
import br.com.phoebus.android.payments.api.PaymentV2
|
|
4
|
+
import com.facebook.react.bridge.Arguments
|
|
5
|
+
import com.facebook.react.bridge.WritableMap
|
|
6
|
+
|
|
7
|
+
object PaymentV2Mapper {
|
|
8
|
+
fun toWritableMap(paymentV2: PaymentV2): WritableMap {
|
|
9
|
+
val map = Arguments.createMap()
|
|
10
|
+
|
|
11
|
+
map.putString("cardToken", paymentV2.cardToken)
|
|
12
|
+
map.putString("acquirerAdditionalMessage", paymentV2.acquirerAdditionalMessage)
|
|
13
|
+
map.putString("note", paymentV2.note)
|
|
14
|
+
map.putString("dni", paymentV2.dni)
|
|
15
|
+
map.putString("qrId", paymentV2.qrId)
|
|
16
|
+
map.putString("accountTypeId", paymentV2.accountTypeId)
|
|
17
|
+
map.putString("planId", paymentV2.planId)
|
|
18
|
+
map.putString("productShortName", paymentV2.productShortName)
|
|
19
|
+
map.putString("batchNumber", paymentV2.batchNumber)
|
|
20
|
+
map.putString("nsuTerminal", paymentV2.nsuTerminal)
|
|
21
|
+
map.putBoolean("lastTrx", paymentV2.isLastTrx)
|
|
22
|
+
map.putString("ticketNumber", paymentV2.ticketNumber)
|
|
23
|
+
map.putString("cardHolderName", paymentV2.cardHolderName)
|
|
24
|
+
map.putString("terminalId", paymentV2.terminalId)
|
|
25
|
+
map.putString("appTransactionId", paymentV2.appTransactionId)
|
|
26
|
+
map.putString("acquirerNsu", paymentV2.acquirerNsu)
|
|
27
|
+
map.putString(
|
|
28
|
+
"originalValue",
|
|
29
|
+
if (paymentV2.originalValue != null) paymentV2.originalValue.toString() else null
|
|
30
|
+
)
|
|
31
|
+
map.putString(
|
|
32
|
+
"additionalValue",
|
|
33
|
+
if (paymentV2.additionalValue != null) paymentV2.additionalValue.toString() else null
|
|
34
|
+
)
|
|
35
|
+
map.putString(
|
|
36
|
+
"additionalValueType",
|
|
37
|
+
if (paymentV2.additionalValueType != null) paymentV2.additionalValueType.name else null
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
return map
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
@@ -36,4 +36,15 @@ Object.keys(_pax).forEach(function (key) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
+
var _paystore = require("./paystore");
|
|
40
|
+
Object.keys(_paystore).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _paystore[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _paystore[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
39
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugpag","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_sunmi","_pax"],"sourceRoot":"../../../src","sources":["@types/index.ts"],"mappings":";;;;;AAAA,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,MAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,IAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,IAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,IAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,IAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_plugpag","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_sunmi","_pax","_paystore"],"sourceRoot":"../../../src","sources":["@types/index.ts"],"mappings":";;;;;AAAA,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,MAAA,GA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3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.Pax = void 0;
|
|
6
|
+
exports.Paystore = exports.Pax = exports.LINKING_ERROR = exports.IOS_ERROR = void 0;
|
|
7
7
|
Object.defineProperty(exports, "PlugPagEvent", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function () {
|
|
@@ -19,29 +19,35 @@ Object.defineProperty(exports, "PlugPagResult", {
|
|
|
19
19
|
exports.Sunmi = exports.Plugpag = void 0;
|
|
20
20
|
var _reactNative = require("react-native");
|
|
21
21
|
var _types = require("./@types");
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const IOS_ERROR = exports.IOS_ERROR = "⚠️ The package 'react-native-mesmart' doesn't work in iOS environment!";
|
|
23
|
+
const LINKING_ERROR = exports.LINKING_ERROR = `⚠️ The package 'react-native-mesmart' doesn't seem to be linked. Make sure: \n\n` + ' - You rebuilt the app after installing the package\n' + ' - You are not using Expo Go\n';
|
|
24
|
+
if (_reactNative.Platform.OS === 'ios') throw new Error(IOS_ERROR);
|
|
24
25
|
const plugpagApi = _reactNative.NativeModules.Plugpag ? _reactNative.NativeModules.Plugpag : new Proxy({}, {
|
|
25
26
|
get() {
|
|
26
|
-
throw new Error(
|
|
27
|
+
throw new Error(LINKING_ERROR);
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
30
|
const sunmiApi = _reactNative.NativeModules.Sunmi ? _reactNative.NativeModules.Sunmi : new Proxy({}, {
|
|
30
31
|
get() {
|
|
31
|
-
throw new Error(
|
|
32
|
+
throw new Error(LINKING_ERROR);
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
35
|
const paxApi = _reactNative.NativeModules.Pax ? _reactNative.NativeModules.Pax : new Proxy({}, {
|
|
35
36
|
get() {
|
|
36
|
-
throw new Error(
|
|
37
|
+
throw new Error(LINKING_ERROR);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const paystoreApi = _reactNative.NativeModules.Paystore ? _reactNative.NativeModules.Paystore : new Proxy({}, {
|
|
41
|
+
get() {
|
|
42
|
+
throw new Error(LINKING_ERROR);
|
|
37
43
|
}
|
|
38
44
|
});
|
|
39
45
|
const Sunmi = exports.Sunmi = {
|
|
40
|
-
searchRfid:
|
|
41
|
-
cancelCardSearch:
|
|
46
|
+
searchRfid: sunmiApi.searchRfid,
|
|
47
|
+
cancelCardSearch: sunmiApi.cancelCardSearch,
|
|
42
48
|
printText: (str, fontSize = 24, isBold = false, isUnderline = false) => sunmiApi.printText(str, fontSize, isBold, isUnderline),
|
|
43
|
-
printEmptyLine:
|
|
44
|
-
printBpLogo:
|
|
49
|
+
printEmptyLine: sunmiApi.printEmptyLine,
|
|
50
|
+
printBpLogo: sunmiApi.printBpLogo,
|
|
45
51
|
setPrinterAlign: align => {
|
|
46
52
|
if (align === 'left') sunmiApi.setPrinterAlign(0);
|
|
47
53
|
if (align === 'center') sunmiApi.setPrinterAlign(1);
|
|
@@ -49,18 +55,21 @@ const Sunmi = exports.Sunmi = {
|
|
|
49
55
|
}
|
|
50
56
|
};
|
|
51
57
|
const Plugpag = exports.Plugpag = {
|
|
52
|
-
init:
|
|
53
|
-
abortPayment:
|
|
54
|
-
printEstablishmentReceipt:
|
|
55
|
-
printClientReceipt:
|
|
56
|
-
customDialogClientViaPrinter:
|
|
57
|
-
pay:
|
|
58
|
-
resolveTransactionEvent:
|
|
58
|
+
init: plugpagApi.init,
|
|
59
|
+
abortPayment: plugpagApi.abortPayment,
|
|
60
|
+
printEstablishmentReceipt: plugpagApi.printEstablishmentReceipt,
|
|
61
|
+
printClientReceipt: plugpagApi.printClientReceipt,
|
|
62
|
+
customDialogClientViaPrinter: plugpagApi.customDialogClientViaPrinter,
|
|
63
|
+
pay: plugpagApi.pay,
|
|
64
|
+
resolveTransactionEvent: plugpagApi.resolveTransactionEvent
|
|
59
65
|
};
|
|
60
66
|
const Pax = exports.Pax = {
|
|
61
|
-
searchRfid:
|
|
62
|
-
cancelCardSearch:
|
|
67
|
+
searchRfid: paxApi.searchRfid,
|
|
68
|
+
cancelCardSearch: paxApi.cancelCardSearch,
|
|
63
69
|
printText: (str, fontSize = 24) => paxApi.printText(str, fontSize),
|
|
64
|
-
printBpLogo:
|
|
70
|
+
printBpLogo: paxApi.printBpLogo
|
|
71
|
+
};
|
|
72
|
+
const Paystore = exports.Paystore = {
|
|
73
|
+
pay: paystoreApi.pay
|
|
65
74
|
};
|
|
66
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_types","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_types","IOS_ERROR","exports","LINKING_ERROR","Platform","OS","Error","plugpagApi","NativeModules","Plugpag","Proxy","get","sunmiApi","Sunmi","paxApi","Pax","paystoreApi","Paystore","searchRfid","cancelCardSearch","printText","str","fontSize","isBold","isUnderline","printEmptyLine","printBpLogo","setPrinterAlign","align","init","abortPayment","printEstablishmentReceipt","printClientReceipt","customDialogClientViaPrinter","pay","resolveTransactionEvent"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAkBO,MAAME,SAAS,GAAAC,OAAA,CAAAD,SAAA,GACpB,wEAAwE;AAEnE,MAAME,aAAa,GAAAD,OAAA,CAAAC,aAAA,GACvB,kFAAiF,GAClF,uDAAuD,GACvD,gCAAgC;AAElC,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE,MAAM,IAAIC,KAAK,CAACL,SAAS,CAAC;AAErD,MAAMM,UAAsB,GAAGC,0BAAa,CAACC,OAAO,GAChDD,0BAAa,CAACC,OAAO,GACrB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIL,KAAK,CAACH,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAM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AK,OAAO,EAAEhB,QAAQ,CAACe,eAAe,CAAC,CAAC,CAAC;EACpD;AACF,CAAC;AAED,MAAMlB,OAAO,GAAAP,OAAA,CAAAO,OAAA,GAAG;EACdoB,IAAI,EAAEtB,UAAU,CAACsB,IAAI;EACrBC,YAAY,EAAEvB,UAAU,CAACuB,YAAY;EACrCC,yBAAyB,EAAExB,UAAU,CAACwB,yBAAyB;EAC/DC,kBAAkB,EAAEzB,UAAU,CAACyB,kBAAkB;EACjDC,4BAA4B,EAAE1B,UAAU,CAAC0B,4BAA4B;EACrEC,GAAG,EAAE3B,UAAU,CAAC2B,GAAG;EACnBC,uBAAuB,EAAE5B,UAAU,CAAC4B;AACtC,CAAC;AAED,MAAMpB,GAAG,GAAAb,OAAA,CAAAa,GAAA,GAAG;EACVG,UAAU,EAAEJ,MAAM,CAACI,UAAU;EAC7BC,gBAAgB,EAAEL,MAAM,CAACK,gBAAgB;EACzCC,SAAS,EAAEA,CAACC,GAAW,EAAEC,QAAgB,GAAG,EAAE,KAC5CR,MAAM,CAACM,SAAS,CAACC,GAAG,EAAEC,QAAQ,CAAC;EACjCI,WAAW,EAAEZ,MAAM,CAACY;AACtB,CAAC;AAED,MAAMT,QAAQ,GAAAf,OAAA,CAAAe,QAAA,GAAG;EACfiB,GAAG,EAAElB,WAAW,CAACkB;AACnB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/index.ts"],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,OAAO","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/index.ts"],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,OAAO;AACrB,cAAc,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/paystore.ts"],"mappings":"","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NativeModules, Platform } from 'react-native';
|
|
2
2
|
import { PlugPagEvent, PlugPagResult } from './@types';
|
|
3
|
-
|
|
3
|
+
export const IOS_ERROR = "⚠️ The package 'react-native-mesmart' doesn't work in iOS environment!";
|
|
4
|
+
export const LINKING_ERROR = `⚠️ The package 'react-native-mesmart' doesn't seem to be linked. Make sure: \n\n` + ' - You rebuilt the app after installing the package\n' + ' - You are not using Expo Go\n';
|
|
4
5
|
if (Platform.OS === 'ios') throw new Error(IOS_ERROR);
|
|
5
6
|
const plugpagApi = NativeModules.Plugpag ? NativeModules.Plugpag : new Proxy({}, {
|
|
6
7
|
get() {
|
|
@@ -17,12 +18,17 @@ const paxApi = NativeModules.Pax ? NativeModules.Pax : new Proxy({}, {
|
|
|
17
18
|
throw new Error(LINKING_ERROR);
|
|
18
19
|
}
|
|
19
20
|
});
|
|
21
|
+
const paystoreApi = NativeModules.Paystore ? NativeModules.Paystore : new Proxy({}, {
|
|
22
|
+
get() {
|
|
23
|
+
throw new Error(LINKING_ERROR);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
20
26
|
const Sunmi = {
|
|
21
|
-
searchRfid:
|
|
22
|
-
cancelCardSearch:
|
|
27
|
+
searchRfid: sunmiApi.searchRfid,
|
|
28
|
+
cancelCardSearch: sunmiApi.cancelCardSearch,
|
|
23
29
|
printText: (str, fontSize = 24, isBold = false, isUnderline = false) => sunmiApi.printText(str, fontSize, isBold, isUnderline),
|
|
24
|
-
printEmptyLine:
|
|
25
|
-
printBpLogo:
|
|
30
|
+
printEmptyLine: sunmiApi.printEmptyLine,
|
|
31
|
+
printBpLogo: sunmiApi.printBpLogo,
|
|
26
32
|
setPrinterAlign: align => {
|
|
27
33
|
if (align === 'left') sunmiApi.setPrinterAlign(0);
|
|
28
34
|
if (align === 'center') sunmiApi.setPrinterAlign(1);
|
|
@@ -30,19 +36,22 @@ const Sunmi = {
|
|
|
30
36
|
}
|
|
31
37
|
};
|
|
32
38
|
const Plugpag = {
|
|
33
|
-
init:
|
|
34
|
-
abortPayment:
|
|
35
|
-
printEstablishmentReceipt:
|
|
36
|
-
printClientReceipt:
|
|
37
|
-
customDialogClientViaPrinter:
|
|
38
|
-
pay:
|
|
39
|
-
resolveTransactionEvent:
|
|
39
|
+
init: plugpagApi.init,
|
|
40
|
+
abortPayment: plugpagApi.abortPayment,
|
|
41
|
+
printEstablishmentReceipt: plugpagApi.printEstablishmentReceipt,
|
|
42
|
+
printClientReceipt: plugpagApi.printClientReceipt,
|
|
43
|
+
customDialogClientViaPrinter: plugpagApi.customDialogClientViaPrinter,
|
|
44
|
+
pay: plugpagApi.pay,
|
|
45
|
+
resolveTransactionEvent: plugpagApi.resolveTransactionEvent
|
|
40
46
|
};
|
|
41
47
|
const Pax = {
|
|
42
|
-
searchRfid:
|
|
43
|
-
cancelCardSearch:
|
|
48
|
+
searchRfid: paxApi.searchRfid,
|
|
49
|
+
cancelCardSearch: paxApi.cancelCardSearch,
|
|
44
50
|
printText: (str, fontSize = 24) => paxApi.printText(str, fontSize),
|
|
45
|
-
printBpLogo:
|
|
51
|
+
printBpLogo: paxApi.printBpLogo
|
|
52
|
+
};
|
|
53
|
+
const Paystore = {
|
|
54
|
+
pay: paystoreApi.pay
|
|
46
55
|
};
|
|
47
|
-
export { Sunmi, Plugpag, Pax, PlugPagEvent, PlugPagResult };
|
|
56
|
+
export { Sunmi, Plugpag, Pax, Paystore, PlugPagEvent, PlugPagResult };
|
|
48
57
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","PlugPagEvent","PlugPagResult","IOS_ERROR","LINKING_ERROR","OS","Error","plugpagApi","Plugpag","Proxy","get","sunmiApi","Sunmi","paxApi","Pax","searchRfid","cancelCardSearch","printText","str","fontSize","isBold","isUnderline","printEmptyLine","printBpLogo","setPrinterAlign","align","init","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","PlugPagEvent","PlugPagResult","IOS_ERROR","LINKING_ERROR","OS","Error","plugpagApi","Plugpag","Proxy","get","sunmiApi","Sunmi","paxApi","Pax","paystoreApi","Paystore","searchRfid","cancelCardSearch","printText","str","fontSize","isBold","isUnderline","printEmptyLine","printBpLogo","setPrinterAlign","align","init","abortPayment","printEstablishmentReceipt","printClientReceipt","customDialogClientViaPrinter","pay","resolveTransactionEvent"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,SAcEC,YAAY,EACZC,aAAa,QACR,UAAU;AAEjB,OAAO,MAAMC,SAAS,GACpB,wEAAwE;AAE1E,OAAO,MAAMC,aAAa,GACvB,kFAAiF,GAClF,uDAAuD,GACvD,gCAAgC;AAElC,IAAIJ,QAAQ,CAACK,EAAE,KAAK,KAAK,EAAE,MAAM,IAAIC,KAAK,CAACH,SAAS,CAAC;AAErD,MAAMI,UAAsB,GAAGR,aAAa,CAACS,OAAO,GAChDT,aAAa,CAACS,OAAO,GACrB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIJ,KAAK,CAACF,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMO,QAAkB,GAAGZ,aAAa,CAACa,KAAK,GAC1Cb,aAAa,CAACa,KAAK,GACnB,IAAIH,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIJ,KAAK,CAACF,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMS,MAAc,GAAGd,aAAa,CAACe,GAAG,GACpCf,aAAa,CAACe,GAAG,GACjB,IAAIL,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIJ,KAAK,CAACF,aAAa,CAAC;EAChC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AC;AAED,MAAMpB,GAAG,GAAG;EACVG,UAAU,EAAEJ,MAAM,CAACI,UAAU;EAC7BC,gBAAgB,EAAEL,MAAM,CAACK,gBAAgB;EACzCC,SAAS,EAAEA,CAACC,GAAW,EAAEC,QAAgB,GAAG,EAAE,KAC5CR,MAAM,CAACM,SAAS,CAACC,GAAG,EAAEC,QAAQ,CAAC;EACjCI,WAAW,EAAEZ,MAAM,CAACY;AACtB,CAAC;AAED,MAAMT,QAAQ,GAAG;EACfiB,GAAG,EAAElB,WAAW,CAACkB;AACnB,CAAC;AAED,SAASrB,KAAK,EAAEJ,OAAO,EAAEM,GAAG,EAAEE,QAAQ,EAAEf,YAAY,EAAEC,aAAa","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/@types/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/@types/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type PaystorePaymentTypes = 'CREDIT' | 'DEBIT' | 'CREDIT_STORE' | 'ADMIN' | 'CREDIT_ADMIN' | 'VOUCHER' | 'DEBIT' | 'PRE_AUTHORIZATION' | 'PRE_AUTHORIZATION_CONFIRMATION';
|
|
2
|
+
export type PaystorePaymentStatus = 'PENDING' | 'CONFIRMED' | 'CANCELLED' | 'REVERSED' | 'PROCESSING' | 'DENIED' | 'UNREACHABLE' | 'WAITING_VALIDATION' | 'WAITING_CAPTURE' | 'REFUNDED_DEVOLUTION' | 'REFUNDED' | 'APPROVED';
|
|
3
|
+
export type PaystoreCaptureType = 'MANUAL' | 'MAGNETIC_STRIP' | 'CHIP' | 'FALLBACK_MANUAL' | 'FALLBACK_MAGNETIC_STRIP' | 'CHIP_CONTACTLESS' | 'MAGNETIC_STRIP_CONTACTLESS' | 'QR_CODE';
|
|
4
|
+
export type PaystoreCard = {
|
|
5
|
+
bin: string;
|
|
6
|
+
brand: string;
|
|
7
|
+
panLast4Digits: string;
|
|
8
|
+
};
|
|
9
|
+
export type PaystoreReceipts = {
|
|
10
|
+
clientVia: string;
|
|
11
|
+
merchantVia: string;
|
|
12
|
+
};
|
|
13
|
+
export interface PaystorePaymentResult {
|
|
14
|
+
acquirer: string;
|
|
15
|
+
acquirerAuthorizationNumber: string;
|
|
16
|
+
acquirerId: string;
|
|
17
|
+
acquirerNsu: string;
|
|
18
|
+
acquirerResponseCode: string;
|
|
19
|
+
acquirerResponseDate: string;
|
|
20
|
+
captureType: PaystoreCaptureType;
|
|
21
|
+
card: PaystoreCard;
|
|
22
|
+
installments: number;
|
|
23
|
+
paymentDate: string;
|
|
24
|
+
paymentId: string;
|
|
25
|
+
paymentStatus: PaystorePaymentStatus;
|
|
26
|
+
appTransactionId: string;
|
|
27
|
+
paymentType: PaystorePaymentTypes;
|
|
28
|
+
receipt: PaystoreReceipts;
|
|
29
|
+
value: number;
|
|
30
|
+
}
|
|
31
|
+
export interface PaystoreAPI {
|
|
32
|
+
pay: (value: String, transactionId: String, showReceipt: Boolean, paymentType: PaystorePaymentTypes[], installments: number) => Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=paystore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paystore.d.ts","sourceRoot":"","sources":["../../../../src/@types/paystore.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAC5B,QAAQ,GACR,OAAO,GACP,cAAc,GACd,OAAO,GACP,cAAc,GACd,SAAS,GACT,OAAO,GACP,mBAAmB,GACnB,gCAAgC,CAAC;AAErC,MAAM,MAAM,qBAAqB,GAC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KACjB,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export interface PlugpagAPI {
|
|
2
2
|
init: (activationCode: string) => void;
|
|
3
|
-
pay: (rechargeValue: string, transactionType:
|
|
3
|
+
pay: (rechargeValue: string, transactionType: PlugPagTransactionTypes) => Promise<PlugPagTransactionResult>;
|
|
4
4
|
abortPayment: () => void;
|
|
5
5
|
printEstablishmentReceipt: () => void;
|
|
6
6
|
printClientReceipt: () => void;
|
|
7
7
|
customDialogClientViaPrinter: (color: string) => void;
|
|
8
8
|
resolveTransactionEvent: (data: PlugPagEventData) => string;
|
|
9
9
|
}
|
|
10
|
-
export type
|
|
10
|
+
export type PlugPagTransactionTypes = 'debitCard' | 'creditCard' | 'pix' | 'voucher' | 'money' | 'bonus';
|
|
11
11
|
export interface PlugPagEventData {
|
|
12
12
|
customMessage?: string;
|
|
13
13
|
eventCode: PlugPagEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugpag.d.ts","sourceRoot":"","sources":["../../../../src/@types/plugpag.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,GAAG,EAAE,CACH,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"plugpag.d.ts","sourceRoot":"","sources":["../../../../src/@types/plugpag.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,GAAG,EAAE,CACH,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,uBAAuB,KACrC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACvC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,yBAAyB,EAAE,MAAM,IAAI,CAAC;IACtC,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,4BAA4B,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,uBAAuB,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,MAAM,CAAC;CAC7D;AAED,MAAM,MAAM,uBAAuB,GAC/B,WAAW,GACX,YAAY,GACZ,KAAK,GACL,SAAS,GACT,OAAO,GACP,OAAO,CAAC;AAEZ,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,YAAY,CAAC;CACzB;AAED,oBAAY,YAAY;IACtB,yBAAyB,KAAK;IAC9B,kBAAkB,KAAK;IACvB,uBAAuB,IAAI;IAC3B,wBAAwB,IAAI;IAC5B,wBAAwB,IAAI;IAC5B,iBAAiB,IAAI;IACrB,mBAAmB,IAAI;IACvB,sBAAsB,IAAI;IAC1B,uBAAuB,IAAI;IAC3B,8BAA8B,IAAI;IAClC,uBAAuB,IAAI;IAC3B,wBAAwB,IAAI;IAC5B,iBAAiB,KAAK;IACtB,4BAA4B,KAAK;IACjC,qBAAqB,KAAK;IAC1B,+BAA+B,KAAK;IACpC,wBAAwB,KAAK;IAC7B,6BAA6B,KAAK;IAClC,yBAAyB,KAAK;IAC9B,sBAAsB,KAAK;IAC3B,wBAAwB,KAAK;IAC7B,4BAA4B,KAAK;CAClC;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,oBAAY,aAAa;IACvB,MAAM,IAAI;CACX"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PlugPagTransactionTypes, type PlugPagEventData, type PlugPagTransactionResult, type PaystorePaymentTypes, type PaystorePaymentStatus, type PaystoreCaptureType, type PaystoreCard, type PaystoreReceipts, type PaystorePaymentResult, PlugPagEvent, PlugPagResult } from './@types';
|
|
2
|
+
export declare const IOS_ERROR = "\u26A0\uFE0F The package 'react-native-mesmart' doesn't work in iOS environment!";
|
|
3
|
+
export declare const LINKING_ERROR: string;
|
|
2
4
|
declare const Sunmi: {
|
|
3
5
|
searchRfid: () => Promise<string>;
|
|
4
6
|
cancelCardSearch: () => void;
|
|
@@ -13,7 +15,7 @@ declare const Plugpag: {
|
|
|
13
15
|
printEstablishmentReceipt: () => void;
|
|
14
16
|
printClientReceipt: () => void;
|
|
15
17
|
customDialogClientViaPrinter: (color: string) => void;
|
|
16
|
-
pay: (rechargeValue: string, transactionType:
|
|
18
|
+
pay: (rechargeValue: string, transactionType: PlugPagTransactionTypes) => Promise<PlugPagTransactionResult>;
|
|
17
19
|
resolveTransactionEvent: (data: PlugPagEventData) => string;
|
|
18
20
|
};
|
|
19
21
|
declare const Pax: {
|
|
@@ -22,6 +24,9 @@ declare const Pax: {
|
|
|
22
24
|
printText: (str: string, fontSize?: number) => void;
|
|
23
25
|
printBpLogo: () => void;
|
|
24
26
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
declare const Paystore: {
|
|
28
|
+
pay: (value: String, transactionId: String, showReceipt: Boolean, paymentType: PaystorePaymentTypes[], installments: number) => Promise<void>;
|
|
29
|
+
};
|
|
30
|
+
export { Sunmi, Plugpag, Pax, Paystore, PlugPagEvent, PlugPagResult };
|
|
31
|
+
export type { PlugPagEventData, PlugPagTransactionResult, PlugPagTransactionTypes, PaystorePaymentTypes, PaystorePaymentStatus, PaystoreCaptureType, PaystoreCard, PaystoreReceipts, PaystorePaymentResult, };
|
|
27
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names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12
|
+
export type PaystorePaymentStatus =
|
|
13
|
+
| 'PENDING'
|
|
14
|
+
| 'CONFIRMED'
|
|
15
|
+
| 'CANCELLED'
|
|
16
|
+
| 'REVERSED'
|
|
17
|
+
| 'PROCESSING'
|
|
18
|
+
| 'DENIED'
|
|
19
|
+
| 'UNREACHABLE'
|
|
20
|
+
| 'WAITING_VALIDATION'
|
|
21
|
+
| 'WAITING_CAPTURE'
|
|
22
|
+
| 'REFUNDED_DEVOLUTION'
|
|
23
|
+
| 'REFUNDED'
|
|
24
|
+
| 'APPROVED';
|
|
25
|
+
|
|
26
|
+
export type PaystoreCaptureType =
|
|
27
|
+
| 'MANUAL'
|
|
28
|
+
| 'MAGNETIC_STRIP'
|
|
29
|
+
| 'CHIP'
|
|
30
|
+
| 'FALLBACK_MANUAL'
|
|
31
|
+
| 'FALLBACK_MAGNETIC_STRIP'
|
|
32
|
+
| 'CHIP_CONTACTLESS'
|
|
33
|
+
| 'MAGNETIC_STRIP_CONTACTLESS'
|
|
34
|
+
| 'QR_CODE';
|
|
35
|
+
|
|
36
|
+
export type PaystoreCard = {
|
|
37
|
+
bin: string;
|
|
38
|
+
brand: string;
|
|
39
|
+
panLast4Digits: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type PaystoreReceipts = {
|
|
43
|
+
clientVia: string;
|
|
44
|
+
merchantVia: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export interface PaystorePaymentResult {
|
|
48
|
+
acquirer: string;
|
|
49
|
+
acquirerAuthorizationNumber: string;
|
|
50
|
+
acquirerId: string;
|
|
51
|
+
acquirerNsu: string;
|
|
52
|
+
acquirerResponseCode: string;
|
|
53
|
+
acquirerResponseDate: string;
|
|
54
|
+
captureType: PaystoreCaptureType;
|
|
55
|
+
card: PaystoreCard;
|
|
56
|
+
installments: number;
|
|
57
|
+
paymentDate: string;
|
|
58
|
+
paymentId: string;
|
|
59
|
+
paymentStatus: PaystorePaymentStatus;
|
|
60
|
+
appTransactionId: string;
|
|
61
|
+
paymentType: PaystorePaymentTypes;
|
|
62
|
+
receipt: PaystoreReceipts;
|
|
63
|
+
value: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface PaystoreAPI {
|
|
67
|
+
pay: (
|
|
68
|
+
value: String,
|
|
69
|
+
transactionId: String,
|
|
70
|
+
showReceipt: Boolean,
|
|
71
|
+
paymentType: PaystorePaymentTypes[],
|
|
72
|
+
installments: number
|
|
73
|
+
) => Promise<void>;
|
|
74
|
+
}
|
package/src/@types/plugpag.ts
CHANGED
|
@@ -2,7 +2,7 @@ export interface PlugpagAPI {
|
|
|
2
2
|
init: (activationCode: string) => void;
|
|
3
3
|
pay: (
|
|
4
4
|
rechargeValue: string,
|
|
5
|
-
transactionType:
|
|
5
|
+
transactionType: PlugPagTransactionTypes
|
|
6
6
|
) => Promise<PlugPagTransactionResult>;
|
|
7
7
|
abortPayment: () => void;
|
|
8
8
|
printEstablishmentReceipt: () => void;
|
|
@@ -11,7 +11,7 @@ export interface PlugpagAPI {
|
|
|
11
11
|
resolveTransactionEvent: (data: PlugPagEventData) => string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type PlugPagTransactionTypes =
|
|
15
15
|
| 'debitCard'
|
|
16
16
|
| 'creditCard'
|
|
17
17
|
| 'pix'
|
package/src/index.ts
CHANGED
|
@@ -3,13 +3,27 @@ import {
|
|
|
3
3
|
type SunmiAPI,
|
|
4
4
|
type PlugpagAPI,
|
|
5
5
|
type PaxAPI,
|
|
6
|
-
type
|
|
6
|
+
type PlugPagTransactionTypes,
|
|
7
7
|
type PlugPagEventData,
|
|
8
8
|
type PlugPagTransactionResult,
|
|
9
|
+
type PaystoreAPI,
|
|
10
|
+
type PaystorePaymentTypes,
|
|
11
|
+
type PaystorePaymentStatus,
|
|
12
|
+
type PaystoreCaptureType,
|
|
13
|
+
type PaystoreCard,
|
|
14
|
+
type PaystoreReceipts,
|
|
15
|
+
type PaystorePaymentResult,
|
|
9
16
|
PlugPagEvent,
|
|
10
17
|
PlugPagResult,
|
|
11
18
|
} from './@types';
|
|
12
|
-
|
|
19
|
+
|
|
20
|
+
export const IOS_ERROR =
|
|
21
|
+
"⚠️ The package 'react-native-mesmart' doesn't work in iOS environment!";
|
|
22
|
+
|
|
23
|
+
export const LINKING_ERROR =
|
|
24
|
+
`⚠️ The package 'react-native-mesmart' doesn't seem to be linked. Make sure: \n\n` +
|
|
25
|
+
' - You rebuilt the app after installing the package\n' +
|
|
26
|
+
' - You are not using Expo Go\n';
|
|
13
27
|
|
|
14
28
|
if (Platform.OS === 'ios') throw new Error(IOS_ERROR);
|
|
15
29
|
|
|
@@ -46,17 +60,28 @@ const paxApi: PaxAPI = NativeModules.Pax
|
|
|
46
60
|
}
|
|
47
61
|
);
|
|
48
62
|
|
|
63
|
+
const paystoreApi: PaystoreAPI = NativeModules.Paystore
|
|
64
|
+
? NativeModules.Paystore
|
|
65
|
+
: new Proxy(
|
|
66
|
+
{},
|
|
67
|
+
{
|
|
68
|
+
get() {
|
|
69
|
+
throw new Error(LINKING_ERROR);
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
|
|
49
74
|
const Sunmi = {
|
|
50
|
-
searchRfid:
|
|
51
|
-
cancelCardSearch:
|
|
75
|
+
searchRfid: sunmiApi.searchRfid,
|
|
76
|
+
cancelCardSearch: sunmiApi.cancelCardSearch,
|
|
52
77
|
printText: (
|
|
53
78
|
str: string,
|
|
54
79
|
fontSize: number = 24,
|
|
55
80
|
isBold: boolean = false,
|
|
56
81
|
isUnderline: boolean = false
|
|
57
82
|
) => sunmiApi.printText(str, fontSize, isBold, isUnderline),
|
|
58
|
-
printEmptyLine:
|
|
59
|
-
printBpLogo:
|
|
83
|
+
printEmptyLine: sunmiApi.printEmptyLine,
|
|
84
|
+
printBpLogo: sunmiApi.printBpLogo,
|
|
60
85
|
setPrinterAlign: (align: 'left' | 'center' | 'right') => {
|
|
61
86
|
if (align === 'left') sunmiApi.setPrinterAlign(0);
|
|
62
87
|
if (align === 'center') sunmiApi.setPrinterAlign(1);
|
|
@@ -65,26 +90,37 @@ const Sunmi = {
|
|
|
65
90
|
};
|
|
66
91
|
|
|
67
92
|
const Plugpag = {
|
|
68
|
-
init:
|
|
69
|
-
abortPayment:
|
|
70
|
-
printEstablishmentReceipt:
|
|
71
|
-
printClientReceipt:
|
|
72
|
-
customDialogClientViaPrinter:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
plugpagApi.pay(rechargeValue, transactionType),
|
|
76
|
-
resolveTransactionEvent: (data: PlugPagEventData): string =>
|
|
77
|
-
plugpagApi.resolveTransactionEvent(data),
|
|
93
|
+
init: plugpagApi.init,
|
|
94
|
+
abortPayment: plugpagApi.abortPayment,
|
|
95
|
+
printEstablishmentReceipt: plugpagApi.printEstablishmentReceipt,
|
|
96
|
+
printClientReceipt: plugpagApi.printClientReceipt,
|
|
97
|
+
customDialogClientViaPrinter: plugpagApi.customDialogClientViaPrinter,
|
|
98
|
+
pay: plugpagApi.pay,
|
|
99
|
+
resolveTransactionEvent: plugpagApi.resolveTransactionEvent,
|
|
78
100
|
};
|
|
79
101
|
|
|
80
102
|
const Pax = {
|
|
81
|
-
searchRfid:
|
|
82
|
-
cancelCardSearch:
|
|
103
|
+
searchRfid: paxApi.searchRfid,
|
|
104
|
+
cancelCardSearch: paxApi.cancelCardSearch,
|
|
83
105
|
printText: (str: string, fontSize: number = 24) =>
|
|
84
106
|
paxApi.printText(str, fontSize),
|
|
85
|
-
printBpLogo:
|
|
107
|
+
printBpLogo: paxApi.printBpLogo,
|
|
86
108
|
};
|
|
87
109
|
|
|
88
|
-
|
|
110
|
+
const Paystore = {
|
|
111
|
+
pay: paystoreApi.pay,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export { Sunmi, Plugpag, Pax, Paystore, PlugPagEvent, PlugPagResult };
|
|
89
115
|
|
|
90
|
-
export type {
|
|
116
|
+
export type {
|
|
117
|
+
PlugPagEventData,
|
|
118
|
+
PlugPagTransactionResult,
|
|
119
|
+
PlugPagTransactionTypes,
|
|
120
|
+
PaystorePaymentTypes,
|
|
121
|
+
PaystorePaymentStatus,
|
|
122
|
+
PaystoreCaptureType,
|
|
123
|
+
PaystoreCard,
|
|
124
|
+
PaystoreReceipts,
|
|
125
|
+
PaystorePaymentResult,
|
|
126
|
+
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.LINKING_ERROR = exports.IOS_ERROR = void 0;
|
|
7
|
-
const IOS_ERROR = exports.IOS_ERROR = "⚠️ The package 'react-native-mesmart' doesn't work in iOS environment!";
|
|
8
|
-
const LINKING_ERROR = exports.LINKING_ERROR = `⚠️ The package 'react-native-mesmart' doesn't seem to be linked. Make sure: \n\n` + ' - You rebuilt the app after installing the package\n' + ' - You are not using Expo Go\n';
|
|
9
|
-
//# sourceMappingURL=errorMessages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["IOS_ERROR","exports","LINKING_ERROR"],"sourceRoot":"../../src","sources":["errorMessages.ts"],"mappings":";;;;;;AAAO,MAAMA,SAAS,GAAAC,OAAA,CAAAD,SAAA,GACpB,wEAAwE;AAEnE,MAAME,aAAa,GAAAD,OAAA,CAAAC,aAAA,GACvB,kFAAiF,GAClF,uDAAuD,GACvD,gCAAgC","ignoreList":[]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export const IOS_ERROR = "⚠️ The package 'react-native-mesmart' doesn't work in iOS environment!";
|
|
2
|
-
export const LINKING_ERROR = `⚠️ The package 'react-native-mesmart' doesn't seem to be linked. Make sure: \n\n` + ' - You rebuilt the app after installing the package\n' + ' - You are not using Expo Go\n';
|
|
3
|
-
//# sourceMappingURL=errorMessages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["IOS_ERROR","LINKING_ERROR"],"sourceRoot":"../../src","sources":["errorMessages.ts"],"mappings":"AAAA,OAAO,MAAMA,SAAS,GACpB,wEAAwE;AAE1E,OAAO,MAAMC,aAAa,GACvB,kFAAiF,GAClF,uDAAuD,GACvD,gCAAgC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorMessages.d.ts","sourceRoot":"","sources":["../../../src/errorMessages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,qFACoD,CAAC;AAE3E,eAAO,MAAM,aAAa,QAGQ,CAAC"}
|
package/src/errorMessages.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export const IOS_ERROR =
|
|
2
|
-
"⚠️ The package 'react-native-mesmart' doesn't work in iOS environment!";
|
|
3
|
-
|
|
4
|
-
export const LINKING_ERROR =
|
|
5
|
-
`⚠️ The package 'react-native-mesmart' doesn't seem to be linked. Make sure: \n\n` +
|
|
6
|
-
' - You rebuilt the app after installing the package\n' +
|
|
7
|
-
' - You are not using Expo Go\n';
|