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

Commit

Permalink
fix: Only consider the Purchased Products
Browse files Browse the repository at this point in the history
Fixes: LEARNER-9818
  • Loading branch information
HamzaIsrar12 committed Mar 5, 2024
1 parent f8c22ec commit a49428d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.android.billingclient.api.ConsumeParams
import com.android.billingclient.api.ProductDetails
import com.android.billingclient.api.ProductDetailsResult
import com.android.billingclient.api.Purchase
import com.android.billingclient.api.Purchase.PurchaseState
import com.android.billingclient.api.PurchasesUpdatedListener
import com.android.billingclient.api.QueryProductDetailsParams
import com.android.billingclient.api.QueryPurchasesParams
Expand Down Expand Up @@ -242,7 +243,7 @@ class BillingProcessor @Inject constructor(
QueryPurchasesParams.newBuilder()
.setProductType(BillingClient.ProductType.INAPP)
.build()
).purchasesList
).purchasesList.filter { it.purchaseState == PurchaseState.PURCHASED }
}

suspend fun consumePurchase(purchaseToken: String): BillingResult {
Expand Down

0 comments on commit a49428d

Please sign in to comment.