react-native-mesmart 1.0.5 → 1.0.7

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.
@@ -29,6 +29,7 @@ class StoneImpl(
29
29
  ) {
30
30
  private var transaction: TransactionObject? = null
31
31
  private var paymentProvider: BaseTransactionProvider? = null
32
+ private var wasPaymentPromiseResolved = false
32
33
  var stoneCode = ""
33
34
  var isActivated = false
34
35
 
@@ -66,6 +67,8 @@ class StoneImpl(
66
67
  fun pay(value: String, paymentMethod: String, isCapture: Boolean, promise: Promise) {
67
68
  checkStone()
68
69
 
70
+ wasPaymentPromiseResolved = false
71
+
69
72
  transaction = TransactionObject()
70
73
  transaction!!.amount = value
71
74
  transaction!!.instalmentTransaction = InstalmentTransactionEnum.getAt(0)
@@ -93,10 +96,11 @@ class StoneImpl(
93
96
  }
94
97
  )
95
98
 
96
- transaction?.let {
99
+ if (paymentProvider != null && transaction != null && !wasPaymentPromiseResolved) {
97
100
  promise.resolve(
98
- TransactionObjectMapper.toWritableMap(it)
101
+ TransactionObjectMapper.toWritableMap(transaction!!)
99
102
  )
103
+ wasPaymentPromiseResolved = true
100
104
  }
101
105
 
102
106
  paymentProvider = null
@@ -127,10 +131,11 @@ class StoneImpl(
127
131
  }
128
132
  )
129
133
 
130
- transaction?.let {
134
+ if (paymentProvider != null && transaction != null && !wasPaymentPromiseResolved) {
131
135
  promise.resolve(
132
- TransactionObjectMapper.toWritableMap(it)
136
+ TransactionObjectMapper.toWritableMap(transaction!!)
133
137
  )
138
+ wasPaymentPromiseResolved = true
134
139
  }
135
140
 
136
141
  paymentProvider = null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mesmart",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Sunmi P2 utilities and Plugpag wrapper for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",