Skip to content

Commit 9da638b

Browse files
committed
Prevent overlapping tokenization calls from overwriting pendingPushTokenizePromise
(cherry picked from commit 070a548d5c4f80f7ff8ee88f2dc534eda6b8c2ae)
1 parent a17cde7 commit 9da638b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

android/src/main/java/com/expensify/wallet/WalletModule.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ class WalletModule internal constructor(context: ReactApplicationContext) :
184184
override fun addCardToGoogleWallet(
185185
data: ReadableMap, promise: Promise
186186
) {
187+
if (pendingPushTokenizePromise != null) {
188+
return promise.reject(E_OPERATION_FAILED, "A tokenization request is already in progress")
189+
}
187190
try {
188191
val cardData = data.toCardData() ?: return promise.reject(E_INVALID_DATA, "Insufficient data")
189192
val cardNetwork = getCardNetwork(cardData.network)
@@ -210,6 +213,9 @@ class WalletModule internal constructor(context: ReactApplicationContext) :
210213

211214
@ReactMethod
212215
override fun resumeAddCardToGoogleWallet(data: ReadableMap, promise: Promise) {
216+
if (pendingPushTokenizePromise != null) {
217+
return promise.reject(E_OPERATION_FAILED, "A tokenization request is already in progress")
218+
}
213219
try {
214220
val tokenReferenceID = data.getString("tokenReferenceID")
215221
?: return promise.reject(E_INVALID_DATA, "Missing tokenReferenceID")

0 commit comments

Comments
 (0)