payme-mini-app 0.1.2 → 0.1.3

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.
@@ -33,7 +33,7 @@ class RNPayMEMiniAppModule(reactContext: ReactApplicationContext) :
33
33
  val transactionId = data?.getString("transactionId")
34
34
  val note = data?.getString("note")
35
35
  val ipnUrl = data?.getString("ipnUrl")
36
- val env = data?.getString("env")
36
+ val env = data?.getString("env") ?: ""
37
37
  var paymentData: PaymentData? = null
38
38
  if (amount != null && transactionId != null) {
39
39
  paymentData = PaymentData(transactionId, amount, note, ipnUrl)
@@ -42,7 +42,7 @@ class RNPayMEMiniAppModule(reactContext: ReactApplicationContext) :
42
42
  OpenMiniAppData(
43
43
  getActionOpenMiniApp(action),
44
44
  phone,
45
- env = ENV.LOCAL,
45
+ env = getEnv(env),
46
46
  paymentData = paymentData
47
47
  )
48
48
  payMEMiniApp?.openMiniApp(
@@ -75,23 +75,20 @@ class RNPayMEMiniAppModule(reactContext: ReactApplicationContext) :
75
75
  )
76
76
  }
77
77
 
78
- private var listenerCount = 0
79
-
80
- @ReactMethod
81
- fun addListener(eventName: String) {
82
- if (listenerCount == 0) {
83
- // Set up any upstream listeners or background tasks as necessary
78
+ private fun getEnv(env: String): ENV {
79
+ if (env == ENV.LOCAL.toString()) {
80
+ return ENV.LOCAL
84
81
  }
85
-
86
- listenerCount += 1
87
- }
88
-
89
- @ReactMethod
90
- fun removeListeners(count: Int) {
91
- listenerCount -= count
92
- if (listenerCount == 0) {
93
- // Remove upstream listeners, stop unnecessary background tasks
82
+ if (env == ENV.DEV.toString()) {
83
+ return ENV.DEV
84
+ }
85
+ if (env == ENV.SANDBOX.toString()) {
86
+ return ENV.SANDBOX
87
+ }
88
+ if (env == ENV.PRODUCTION.toString()) {
89
+ return ENV.PRODUCTION
94
90
  }
91
+ return ENV.PRODUCTION
95
92
  }
96
93
 
97
94
  private fun getTypeOpenMiniApp(type: String): OpenMiniAppType {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payme-mini-app",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "test",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",