2024-10-03 19:47:39 +03:00
|
|
|
package org.amnezia.vpn
|
|
|
|
|
|
|
|
|
|
import android.app.Activity
|
|
|
|
|
import android.content.Context
|
|
|
|
|
import BillingProvider.Companion.withBillingProvider
|
|
|
|
|
|
|
|
|
|
class BillingPaymentRepository(private val context: Context) : BillingRepository {
|
|
|
|
|
|
|
|
|
|
override suspend fun getCountryCode(): String = withBillingProvider(context) {
|
|
|
|
|
getCustomerCountryCode()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override suspend fun getSubscriptionPlans(): String = withBillingProvider(context) {
|
|
|
|
|
getSubscriptionPlans()
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-30 17:35:33 +03:00
|
|
|
override suspend fun purchaseSubscription(activity: Activity, offerToken: String): String =
|
|
|
|
|
withBillingProvider(context) {
|
|
|
|
|
purchaseSubscription(activity, offerToken)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override suspend fun upgradeSubscription(activity: Activity, offerToken: String, oldPurchaseToken: String): String =
|
|
|
|
|
withBillingProvider(context) {
|
|
|
|
|
purchaseSubscription(activity, offerToken, oldPurchaseToken)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override suspend fun acknowledge(purchaseToken: String): String = withBillingProvider(context) {
|
|
|
|
|
acknowledge(purchaseToken)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override suspend fun queryPurchases(): String = withBillingProvider(context) {
|
|
|
|
|
getPurchases()
|
2024-10-03 19:47:39 +03:00
|
|
|
}
|
|
|
|
|
}
|