Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluchu committed Aug 26, 2023
2 parents 12aaf03 + 5da5fb2 commit 24439e7
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,21 @@ data class SubscriptionsHelper(private val context: Context, val subscripttions:
val acknowledgePurchaseParams = AcknowledgePurchaseParams
.newBuilder()
.setPurchaseToken(purchase.purchaseToken)
billingClient.acknowledgePurchase(acknowledgePurchaseParams.build()) { p0 ->
if (p0.responseCode == BillingClient.BillingResponseCode.OK) {
if (purchase.products.contains(productId)) {
onSubscriptionSuccess(purchase)
} else onSubscriptionFailure(p0.debugMessage)
} else onSubscriptionFailure(p0.debugMessage)
billingClient.acknowledgePurchase(
acknowledgePurchaseParams.build()
) { billingResult ->
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK &&
purchase.purchaseState == Purchase.PurchaseState.PURCHASED
) {
if (purchase.products.contains(productId)) onSubscriptionSuccess(purchase)
else onSubscriptionFailure(billingResult.debugMessage)
}
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK &&
purchase.purchaseState == Purchase.PurchaseState.PENDING
) onSubscriptionFailure(billingResult.debugMessage)
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK &&
purchase.purchaseState == Purchase.PurchaseState.UNSPECIFIED_STATE
) onSubscriptionFailure(billingResult.debugMessage)
}
}
}
Expand Down

0 comments on commit 24439e7

Please sign in to comment.