react-native-mesmart 1.0.6 → 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,12 @@ class StoneImpl(
93
96
  }
94
97
  )
95
98
 
96
- if (paymentProvider != null && transaction != null)
99
+ if (paymentProvider != null && transaction != null && !wasPaymentPromiseResolved) {
97
100
  promise.resolve(
98
101
  TransactionObjectMapper.toWritableMap(transaction!!)
99
102
  )
103
+ wasPaymentPromiseResolved = true
104
+ }
100
105
 
101
106
  paymentProvider = null
102
107
  transaction = null
@@ -126,10 +131,12 @@ class StoneImpl(
126
131
  }
127
132
  )
128
133
 
129
- if (paymentProvider != null && transaction != null)
134
+ if (paymentProvider != null && transaction != null && !wasPaymentPromiseResolved) {
130
135
  promise.resolve(
131
136
  TransactionObjectMapper.toWritableMap(transaction!!)
132
137
  )
138
+ wasPaymentPromiseResolved = true
139
+ }
133
140
 
134
141
  paymentProvider = null
135
142
  transaction = null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mesmart",
3
- "version": "1.0.6",
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",