Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

Commit d74b621

Browse files
committed
fix: Consider the Purchased Products Only
The billing SDK's queryPurchases returns a list of purchases that are currently in a purchased, pending, or unspecified state. For the unfulfilled purchase flow, we only need to consider the 'purchased' state. Fixes: LEARNER-9878
1 parent 53be9ca commit d74b621

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

OpenEdXMobile/src/main/java/org/edx/mobile/inapppurchases/BillingProcessor.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import com.android.billingclient.api.ConsumeParams
1515
import com.android.billingclient.api.ProductDetails
1616
import com.android.billingclient.api.ProductDetailsResult
1717
import com.android.billingclient.api.Purchase
18+
import com.android.billingclient.api.Purchase.PurchaseState
1819
import com.android.billingclient.api.PurchasesUpdatedListener
1920
import com.android.billingclient.api.QueryProductDetailsParams
2021
import com.android.billingclient.api.QueryPurchasesParams
@@ -242,7 +243,7 @@ class BillingProcessor @Inject constructor(
242243
QueryPurchasesParams.newBuilder()
243244
.setProductType(BillingClient.ProductType.INAPP)
244245
.build()
245-
).purchasesList
246+
).purchasesList.filter { it.purchaseState == PurchaseState.PURCHASED }
246247
}
247248

248249
suspend fun consumePurchase(purchaseToken: String): BillingResult {

0 commit comments

Comments
 (0)