feat(payment-iap): Add Google IAP happy flow.

This commit is contained in:
dkadrikj
2022-08-23 11:46:46 +02:00
committed by Neil Marietta
parent 07fc895bc3
commit 078898285f
155 changed files with 2864 additions and 2732 deletions
-5
View File
@@ -157,11 +157,6 @@ Core libraries coordinates can be found under [coordinates section](#coordinates
|me.proton.core:payment-iap|
|me.proton.core:payment-iap-dagger|
|me.proton.core:payment-iap-presentation|
|me.proton.core:payment-common|
|me.proton.core:payment-common-dagger|
|me.proton.core:payment-common-data|
|me.proton.core:payment-common-domain|
|me.proton.core:payment-common-presentation|
|me.proton.core:plan|
|me.proton.core:plan-dagger|
|me.proton.core:plan-data|
+10 -8
View File
@@ -46,19 +46,21 @@ public final class me/proton/core/auth/domain/entity/AuthInfo {
}
public final class me/proton/core/auth/domain/entity/BillingDetails {
public fun <init> (JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/String;Ljava/lang/String;)V
public fun <init> (JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Ljava/lang/String;Ljava/lang/String;Lme/proton/core/payment/domain/entity/SubscriptionManagement;)V
public final fun component1 ()J
public final fun component2 ()Lme/proton/core/paymentcommon/domain/entity/Currency;
public final fun component3 ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun component2 ()Lme/proton/core/payment/domain/entity/Currency;
public final fun component3 ()Lme/proton/core/payment/domain/entity/SubscriptionCycle;
public final fun component4 ()Ljava/lang/String;
public final fun component5 ()Ljava/lang/String;
public final fun copy (JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/String;Ljava/lang/String;)Lme/proton/core/auth/domain/entity/BillingDetails;
public static synthetic fun copy$default (Lme/proton/core/auth/domain/entity/BillingDetails;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/auth/domain/entity/BillingDetails;
public final fun component6 ()Lme/proton/core/payment/domain/entity/SubscriptionManagement;
public final fun copy (JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Ljava/lang/String;Ljava/lang/String;Lme/proton/core/payment/domain/entity/SubscriptionManagement;)Lme/proton/core/auth/domain/entity/BillingDetails;
public static synthetic fun copy$default (Lme/proton/core/auth/domain/entity/BillingDetails;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Ljava/lang/String;Ljava/lang/String;Lme/proton/core/payment/domain/entity/SubscriptionManagement;ILjava/lang/Object;)Lme/proton/core/auth/domain/entity/BillingDetails;
public fun equals (Ljava/lang/Object;)Z
public final fun getAmount ()J
public final fun getCurrency ()Lme/proton/core/paymentcommon/domain/entity/Currency;
public final fun getCycle ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun getCurrency ()Lme/proton/core/payment/domain/entity/Currency;
public final fun getCycle ()Lme/proton/core/payment/domain/entity/SubscriptionCycle;
public final fun getPlanName ()Ljava/lang/String;
public final fun getSubscriptionManagement ()Lme/proton/core/payment/domain/entity/SubscriptionManagement;
public final fun getToken ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
@@ -267,7 +269,7 @@ public final class me/proton/core/auth/domain/usecase/PerformSecondFactor {
}
public final class me/proton/core/auth/domain/usecase/PostLoginAccountSetup {
public fun <init> (Lme/proton/core/auth/domain/AccountWorkflowHandler;Lme/proton/core/paymentcommon/domain/usecase/PerformSubscribe;Lme/proton/core/auth/domain/usecase/SetupAccountCheck;Lme/proton/core/auth/domain/usecase/SetupInternalAddress;Lme/proton/core/auth/domain/usecase/SetupPrimaryKeys;Lme/proton/core/auth/domain/usecase/UnlockUserPrimaryKey;Lme/proton/core/auth/domain/usecase/PostLoginAccountSetup$UserCheck;Lme/proton/core/user/domain/UserManager;Lme/proton/core/accountmanager/domain/SessionManager;)V
public fun <init> (Lme/proton/core/auth/domain/AccountWorkflowHandler;Lme/proton/core/payment/domain/usecase/PerformSubscribe;Lme/proton/core/auth/domain/usecase/SetupAccountCheck;Lme/proton/core/auth/domain/usecase/SetupInternalAddress;Lme/proton/core/auth/domain/usecase/SetupPrimaryKeys;Lme/proton/core/auth/domain/usecase/UnlockUserPrimaryKey;Lme/proton/core/auth/domain/usecase/PostLoginAccountSetup$UserCheck;Lme/proton/core/user/domain/UserManager;Lme/proton/core/accountmanager/domain/SessionManager;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;Ljava/lang/String;Lme/proton/core/account/domain/entity/AccountType;ZZZLkotlin/jvm/functions/Function1;Lme/proton/core/auth/domain/entity/BillingDetails;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun invoke$default (Lme/proton/core/auth/domain/usecase/PostLoginAccountSetup;Lme/proton/core/domain/entity/UserId;Ljava/lang/String;Lme/proton/core/account/domain/entity/AccountType;ZZZLkotlin/jvm/functions/Function1;Lme/proton/core/auth/domain/entity/BillingDetails;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
@@ -18,13 +18,15 @@
package me.proton.core.auth.domain.entity
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.SubscriptionCycle
import me.proton.core.payment.domain.entity.SubscriptionManagement
data class BillingDetails(
val amount: Long,
val currency: Currency,
val cycle: SubscriptionCycle,
val planName: String,
val token: String?
val token: String?,
val subscriptionManagement: SubscriptionManagement
)
@@ -24,7 +24,7 @@ import me.proton.core.auth.domain.AccountWorkflowHandler
import me.proton.core.auth.domain.entity.BillingDetails
import me.proton.core.crypto.common.keystore.EncryptedString
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.usecase.PerformSubscribe
import me.proton.core.payment.domain.usecase.PerformSubscribe
import me.proton.core.user.domain.UserManager
import me.proton.core.user.domain.entity.User
import javax.inject.Inject
@@ -91,7 +91,8 @@ class PostLoginAccountSetup @Inject constructor(
currency = billingDetails.currency,
cycle = billingDetails.cycle,
planNames = listOf(billingDetails.planName),
paymentToken = billingDetails.token
paymentToken = billingDetails.token,
subscriptionManagement = billingDetails.subscriptionManagement
)
}
}
@@ -32,9 +32,10 @@ import me.proton.core.auth.domain.entity.BillingDetails
import me.proton.core.auth.domain.entity.SessionInfo
import me.proton.core.domain.entity.UserId
import me.proton.core.network.domain.session.SessionId
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
import me.proton.core.paymentcommon.domain.usecase.PerformSubscribe
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.SubscriptionCycle
import me.proton.core.payment.domain.entity.SubscriptionManagement
import me.proton.core.payment.domain.usecase.PerformSubscribe
import me.proton.core.user.domain.UserManager
import me.proton.core.user.domain.entity.User
import org.junit.Assert.assertEquals
@@ -191,11 +192,12 @@ class PostLoginAccountSetupTest {
currency = Currency.EUR,
cycle = SubscriptionCycle.YEARLY,
planName = "test-plan-name",
token = "test-token"
token = "test-token",
subscriptionManagement = SubscriptionManagement.PROTON_MANAGED
)
coJustRun { accountWorkflowHandler.handleAccountReady(any()) }
coJustRun { performSubscribe.invoke(any(), any(), any(), any(), any(), any(), any()) }
coJustRun { performSubscribe.invoke(any(), any(), any(), any(), any(), any(), any(), any()) }
coEvery { setupAccountCheck.invoke(any(), any(), any(), any()) } returns SetupAccountCheck.Result.NoSetupNeeded
coEvery { unlockUserPrimaryKey.invoke(any(), any()) } returns UserManager.UnlockResult.Success
@@ -227,7 +229,8 @@ class PostLoginAccountSetupTest {
capture(cycle),
capture(planNames),
codes = null,
paymentToken = capture(paymentToken)
paymentToken = capture(paymentToken),
subscriptionManagement = SubscriptionManagement.PROTON_MANAGED
)
}
assertEquals(testUserId, userId.captured)
+6 -6
View File
@@ -1070,17 +1070,17 @@ public final class me/proton/core/auth/presentation/entity/signup/SignUpResult :
public final class me/proton/core/auth/presentation/entity/signup/SubscriptionDetails : android/os/Parcelable {
public static final field CREATOR Landroid/os/Parcelable$Creator;
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lme/proton/core/payment/presentation/entity/BillingResult;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Lme/proton/core/payment/presentation/entity/BillingResult;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun component3 ()Lme/proton/core/payment/domain/entity/SubscriptionCycle;
public final fun component4 ()Lme/proton/core/payment/presentation/entity/BillingResult;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lme/proton/core/payment/presentation/entity/BillingResult;)Lme/proton/core/auth/presentation/entity/signup/SubscriptionDetails;
public static synthetic fun copy$default (Lme/proton/core/auth/presentation/entity/signup/SubscriptionDetails;Ljava/lang/String;Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lme/proton/core/payment/presentation/entity/BillingResult;ILjava/lang/Object;)Lme/proton/core/auth/presentation/entity/signup/SubscriptionDetails;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Lme/proton/core/payment/presentation/entity/BillingResult;)Lme/proton/core/auth/presentation/entity/signup/SubscriptionDetails;
public static synthetic fun copy$default (Lme/proton/core/auth/presentation/entity/signup/SubscriptionDetails;Ljava/lang/String;Ljava/lang/String;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Lme/proton/core/payment/presentation/entity/BillingResult;ILjava/lang/Object;)Lme/proton/core/auth/presentation/entity/signup/SubscriptionDetails;
public fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public final fun getBillingResult ()Lme/proton/core/payment/presentation/entity/BillingResult;
public final fun getCycle ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun getCycle ()Lme/proton/core/payment/domain/entity/SubscriptionCycle;
public final fun getPlanDisplayName ()Ljava/lang/String;
public final fun getPlanName ()Ljava/lang/String;
public fun hashCode ()I
@@ -1089,7 +1089,7 @@ public final class me/proton/core/auth/presentation/entity/signup/SubscriptionDe
}
public abstract interface class me/proton/core/auth/presentation/testing/ProtonTestEntryPoint {
public abstract fun getGetAvailablePaymentProviders ()Lme/proton/core/paymentcommon/domain/usecase/GetAvailablePaymentProviders;
public abstract fun getGetAvailablePaymentProviders ()Lme/proton/core/payment/domain/usecase/GetAvailablePaymentProviders;
public abstract fun getLoginTestHelper ()Lme/proton/core/auth/domain/testing/LoginTestHelper;
}
+1 -2
View File
@@ -45,8 +45,7 @@ dependencies {
project(Module.humanVerificationDomain),
project(Module.humanVerificationPresentation),
project(Module.networkDomain),
// project(Module.paymentDomain),
project(Module.paymentCommonDomain),
project(Module.paymentDomain),
project(Module.paymentPresentation),
project(Module.planPresentation),
project(Module.presentation),
@@ -21,7 +21,7 @@ package me.proton.core.auth.presentation.entity.signup
import android.os.Parcelable
import kotlinx.parcelize.Parcelize
import me.proton.core.payment.presentation.entity.BillingResult
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
import me.proton.core.payment.domain.entity.SubscriptionCycle
@Parcelize
data class SubscriptionDetails(
@@ -23,7 +23,7 @@ import dagger.hilt.EntryPoint
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import me.proton.core.auth.domain.testing.LoginTestHelper
import me.proton.core.paymentcommon.domain.usecase.GetAvailablePaymentProviders
import me.proton.core.payment.domain.usecase.GetAvailablePaymentProviders
@EntryPoint
@InstallIn(SingletonComponent::class)
@@ -178,7 +178,8 @@ class SignupActivity : AuthActivity<ActivitySignupBinding>(ActivitySignupBinding
currency = it.currency,
cycle = it.cycle,
planName = subscriptionDetails.planName,
token = it.token
token = it.token,
subscriptionManagement = it.subscriptionManagement
)
}
-1
View File
@@ -172,7 +172,6 @@ dependencies {
project(Module.label),
project(Module.mailMessage),
project(Module.mailSettings),
project(Module.paymentCommon),
project(Module.payment),
project(Module.paymentIap),
project(Module.plan),
@@ -18,7 +18,7 @@
package me.proton.core.test.android
import me.proton.core.paymentcommon.data.ProtonIAPBillingLibraryImpl
import me.proton.core.payment.data.ProtonIAPBillingLibraryImpl
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertTrue
@@ -27,7 +27,7 @@ import me.proton.android.core.coreexample.BuildConfig
import me.proton.android.core.coreexample.Constants
import me.proton.android.core.coreexample.MainActivity
import me.proton.core.auth.presentation.testing.ProtonTestEntryPoint
import me.proton.core.paymentcommon.domain.usecase.PaymentProvider
import me.proton.core.payment.domain.usecase.PaymentProvider
import me.proton.core.test.android.instrumented.ProtonTest
import me.proton.core.test.android.instrumented.utils.Shell.setupDeviceForAutomation
import me.proton.core.test.android.plugins.Quark
@@ -0,0 +1,94 @@
/*
* Copyright (c) 2021 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.test.android.uitests.tests.medium.auth.signup
import me.proton.core.domain.entity.AppStore
import me.proton.core.test.android.plugins.data.Plan.Dev
import me.proton.core.test.android.plugins.data.Plan.Free
import me.proton.core.test.android.plugins.data.User
import me.proton.core.test.android.robots.auth.AddAccountRobot
import me.proton.core.test.android.robots.auth.ChooseUsernameRobot
import me.proton.core.test.android.robots.auth.signup.RecoveryMethodsRobot
import me.proton.core.test.android.robots.humanverification.HumanVerificationRobot
import me.proton.core.test.android.robots.payments.AddCreditCardRobot
import me.proton.core.test.android.robots.payments.GoogleIAPRobot
import me.proton.core.test.android.robots.plans.SelectPlanRobot
import me.proton.core.test.android.uitests.tests.BaseTest
import me.proton.core.test.android.uitests.tests.SmokeTest
import org.junit.After
import org.junit.Before
import org.junit.Test
class SelectPlanForIAPTests : BaseTest() {
private var humanVerificationRobot: HumanVerificationRobot? = null
private var selectPlanRobot: SelectPlanRobot? = null
@After
fun setDefaults() {
quark.setDefaultPaymentMethods()
}
@Before
fun goToPlanSelection() {
quark.jailUnban()
quark.setPaymentMethods(AppStore.GooglePlay, card = false, paypal = false, inApp = false)
val user = User()
AddAccountRobot()
.createAccount()
.verify { domainInputDisplayed() }
val skipRecoveryRobot = ChooseUsernameRobot()
.username(user.name)
.next()
.setAndConfirmPassword<RecoveryMethodsRobot>(user.password)
.skip()
if (paymentProvidersForSignup().isNotEmpty()) {
selectPlanRobot = skipRecoveryRobot.skipConfirm<SelectPlanRobot>()
} else {
humanVerificationRobot = skipRecoveryRobot.skipConfirm<HumanVerificationRobot>()
}
}
@Test
fun verifyInitialState() {
humanVerificationRobot?.let {
it.verify { hvElementsDisplayed() }
}
selectPlanRobot?.let {
it
.toggleExpandPlan(Free)
.verify { planDetailsDisplayedInsideRecyclerView(Free) }
it
.toggleExpandPlan(Dev)
.verify { canSelectPlan(Dev) }
}
}
@Test
@SmokeTest
fun selectPlusNoPaymentProvidersAvailable() {
quark.setPaymentMethods(AppStore.GooglePlay, card = false, paypal = false, inApp = false)
humanVerificationRobot?.let {
it.verify { hvElementsDisplayed() }
}
}
}
@@ -18,6 +18,7 @@
package me.proton.core.test.android.uitests.tests.medium.auth.signup
import me.proton.core.domain.entity.AppStore
import me.proton.core.test.android.plugins.data.Plan.Dev
import me.proton.core.test.android.plugins.data.Plan.Free
import me.proton.core.test.android.plugins.data.User
@@ -26,9 +27,11 @@ import me.proton.core.test.android.robots.auth.ChooseUsernameRobot
import me.proton.core.test.android.robots.auth.signup.RecoveryMethodsRobot
import me.proton.core.test.android.robots.humanverification.HumanVerificationRobot
import me.proton.core.test.android.robots.payments.AddCreditCardRobot
import me.proton.core.test.android.robots.payments.GoogleIAPRobot
import me.proton.core.test.android.robots.plans.SelectPlanRobot
import me.proton.core.test.android.uitests.tests.BaseTest
import me.proton.core.test.android.uitests.tests.SmokeTest
import org.junit.After
import org.junit.Before
import org.junit.Test
@@ -37,6 +40,11 @@ class SelectPlanTests : BaseTest() {
private var humanVerificationRobot: HumanVerificationRobot? = null
private var selectPlanRobot: SelectPlanRobot? = null
@After
fun setDefaults() {
quark.setDefaultPaymentMethods()
}
@Before
fun goToPlanSelection() {
quark.jailUnban()
@@ -60,6 +68,7 @@ class SelectPlanTests : BaseTest() {
@Test
fun verifyInitialState() {
quark.setPaymentMethods(AppStore.GooglePlay, card = true, paypal = false, inApp = false)
humanVerificationRobot?.let {
it.verify { hvElementsDisplayed() }
}
@@ -76,6 +85,7 @@ class SelectPlanTests : BaseTest() {
@Test
fun selectFreeAndCancelHumanVerification() {
quark.setPaymentMethods(AppStore.GooglePlay, card = true, paypal = false, inApp = false)
humanVerificationRobot?.let {
it.verify { hvElementsDisplayed() }
}
@@ -100,6 +110,7 @@ class SelectPlanTests : BaseTest() {
@Test
@SmokeTest
fun selectPlusAndCancelPayment() {
quark.setPaymentMethods(AppStore.GooglePlay, card = true, paypal = false, inApp = false)
humanVerificationRobot?.let {
it.verify { hvElementsDisplayed() }
}
@@ -115,4 +126,53 @@ class SelectPlanTests : BaseTest() {
.verify { planDetailsDisplayedInsideRecyclerView(Free) }
}
}
@Test
@SmokeTest
fun selectPlusAndCancelPaymentIAPOnly() {
quark.setPaymentMethods(AppStore.GooglePlay, card = false, paypal = false, inApp = true)
humanVerificationRobot?.let {
it.verify { hvElementsDisplayed() }
}
selectPlanRobot?.let {
it.toggleExpandPlan(Dev)
.selectPlan<GoogleIAPRobot>(Dev)
.verify { googleIAPElementsDisplayed() }
GoogleIAPRobot()
.close<SelectPlanRobot>()
.toggleExpandPlan(Free)
.verify { planDetailsDisplayedInsideRecyclerView(Free) }
}
}
@Test
@SmokeTest
fun selectPlusAndCancelPaymentIAPAndCard() {
quark.setPaymentMethods(AppStore.GooglePlay, card = true, paypal = false, inApp = true)
humanVerificationRobot?.let {
it.verify { hvElementsDisplayed() }
}
selectPlanRobot?.let {
it.toggleExpandPlan(Dev)
.selectPlan<GoogleIAPRobot>(Dev)
.verify { googleIAPElementsDisplayed() }
GoogleIAPRobot()
.close<SelectPlanRobot>()
.toggleExpandPlan(Free)
.verify { planDetailsDisplayedInsideRecyclerView(Free) }
}
}
@Test
@SmokeTest
fun selectPlusNoPaymentProvidersAvailable() {
quark.setPaymentMethods(AppStore.GooglePlay, card = false, paypal = false, inApp = false)
humanVerificationRobot?.let {
it.verify { hvElementsDisplayed() }
}
}
}
@@ -18,11 +18,13 @@
package me.proton.core.test.android.uitests.tests.medium.plans
import me.proton.core.domain.entity.AppStore
import me.proton.core.test.android.plugins.data.Plan
import me.proton.core.test.android.robots.plans.SelectPlanRobot
import me.proton.core.test.android.uitests.CoreexampleRobot
import me.proton.core.test.android.uitests.tests.BaseTest
import me.proton.core.test.android.uitests.tests.SmokeTest
import org.junit.After
import org.junit.Test
class UpgradePlanTests : BaseTest() {
@@ -32,10 +34,16 @@ class UpgradePlanTests : BaseTest() {
private val freeUser = quark.userCreate()
private val paidUser = users.getUser { it.isPaid }
@After
fun setDefaults() {
quark.setDefaultPaymentMethods()
}
@Test
@SmokeTest
fun userWithFreePlan() {
quark.jailUnban()
quark.setPaymentMethods(AppStore.GooglePlay, card = true, paypal = false, inApp = false)
login(freeUser)
coreExampleRobot
@@ -53,8 +61,18 @@ class UpgradePlanTests : BaseTest() {
}
@Test
fun userWithPaidPlan() {
fun userWithPaidPlanCardPayment() {
quark.setPaymentMethods(AppStore.GooglePlay, card = true, paypal = false, inApp = false)
login(paidUser)
coreExampleRobot
.plansUpgrade()
.verify { planDetailsNotDisplayed(paidUser.plan) }
}
@Test
fun userWithPaidPlanCardAndIAPPayment() {
quark.setPaymentMethods(AppStore.GooglePlay, card = true, paypal = false, inApp = true)
login(paidUser)
coreExampleRobot
@@ -33,9 +33,9 @@ import me.proton.android.core.coreexample.PLAN_VISIONARY_ID
import me.proton.core.accountmanager.domain.AccountManager
import me.proton.core.payment.presentation.PaymentsOrchestrator
import me.proton.core.payment.presentation.onPaymentResult
import me.proton.core.paymentcommon.domain.PaymentManager
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
import me.proton.core.paymentcommon.presentation.entity.PlanShortDetails
import me.proton.core.payment.domain.PaymentManager
import me.proton.core.payment.domain.entity.SubscriptionCycle
import me.proton.core.payment.presentation.entity.PlanShortDetails
import me.proton.core.plan.domain.entity.MASK_MAIL
import me.proton.core.plan.domain.entity.MASK_VPN
import me.proton.core.plan.domain.entity.PLAN_PRODUCT
@@ -1,17 +0,0 @@
public class hilt_aggregated_deps/_me_proton_core_paymentcommon_dagger_CorePaymentModule {
public fun <init> ()V
}
public final class me/proton/core/paymentcommon/dagger/BuildConfig {
public static final field BUILD_TYPE Ljava/lang/String;
public static final field DEBUG Z
public static final field LIBRARY_PACKAGE_NAME Ljava/lang/String;
public fun <init> ()V
}
public abstract interface class me/proton/core/paymentcommon/dagger/CorePaymentModule {
public abstract fun provideActivePaymentProvider (Lme/proton/core/paymentcommon/presentation/viewmodel/ActivePaymentProviderImpl;)Lme/proton/core/paymentcommon/presentation/ActivePaymentProvider;
public abstract fun provideGooglePlayBillingLibrary (Lme/proton/core/paymentcommon/data/ProtonIAPBillingLibraryImpl;)Lme/proton/core/paymentcommon/domain/usecase/ProtonIAPBillingLibrary;
public abstract fun providePaymentManager (Lme/proton/core/paymentcommon/data/PaymentManagerImpl;)Lme/proton/core/paymentcommon/domain/PaymentManager;
}
@@ -1,20 +0,0 @@
<!--
~ Copyright (c) 2022 Proton Technologies AG
~ This file is part of Proton AG and ProtonCore.
~
~ ProtonCore is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ ProtonCore is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="me.proton.core.paymentcommon.dagger" />
@@ -1,44 +0,0 @@
/*
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.dagger
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import me.proton.core.paymentcommon.data.PaymentManagerImpl
import me.proton.core.paymentcommon.data.ProtonIAPBillingLibraryImpl
import me.proton.core.paymentcommon.domain.PaymentManager
import me.proton.core.paymentcommon.domain.usecase.ProtonIAPBillingLibrary
import me.proton.core.paymentcommon.presentation.ActivePaymentProvider
import me.proton.core.paymentcommon.presentation.viewmodel.ActivePaymentProviderImpl
@Module
@InstallIn(SingletonComponent::class)
public interface CorePaymentModule {
@Binds
public fun provideGooglePlayBillingLibrary(impl: ProtonIAPBillingLibraryImpl): ProtonIAPBillingLibrary
@Binds
public fun provideActivePaymentProvider(impl: ActivePaymentProviderImpl): ActivePaymentProvider
@Binds
public fun providePaymentManager(impl: PaymentManagerImpl): PaymentManager
}
@@ -1,19 +0,0 @@
public final class me/proton/core/paymentcommon/data/BuildConfig {
public static final field BUILD_TYPE Ljava/lang/String;
public static final field DEBUG Z
public static final field LIBRARY_PACKAGE_NAME Ljava/lang/String;
public fun <init> ()V
}
public final class me/proton/core/paymentcommon/data/PaymentManagerImpl : me/proton/core/paymentcommon/domain/PaymentManager {
public fun <init> (Lme/proton/core/user/domain/UserManager;Lme/proton/core/paymentcommon/domain/usecase/GetAvailablePaymentProviders;)V
public fun getPaymentProviders (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun isSubscriptionAvailable (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun isUpgradeAvailable (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/paymentcommon/data/ProtonIAPBillingLibraryImpl : me/proton/core/paymentcommon/domain/usecase/ProtonIAPBillingLibrary {
public fun <init> ()V
public fun isAvailable ()Z
}
-56
View File
@@ -1,56 +0,0 @@
/*
* Copyright (c) 2021 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
import studio.forface.easygradle.dsl.*
import studio.forface.easygradle.dsl.android.*
plugins {
protonAndroidLibrary
kotlin("plugin.serialization")
}
publishOption.shouldBePublishedAsLib = true
dependencies {
api(
project(Module.domain),
project(Module.networkData),
project(Module.paymentCommonDomain),
`javax-inject`,
`serialization-core`
)
implementation(
project(Module.kotlinUtil),
project(Module.networkDomain),
project(Module.userDomain),
project(Module.planDomain),
retrofit,
)
testImplementation(
project(Module.kotlinTest),
`coroutines-test`,
junit,
`kotlin-test`,
mockk
)
androidTestImplementation(
`kotlin-test-junit`
)
}
@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~ This file is part of Proton Technologies AG and ProtonCore.
~
~ ProtonCore is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ ProtonCore is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
-->
<manifest package="me.proton.core.paymentcommon.data" />
@@ -1,405 +0,0 @@
public final class me/proton/core/paymentcommon/domain/ConstKt {
public static final field MAX_PLAN_QUANTITY I
}
public abstract interface class me/proton/core/paymentcommon/domain/PaymentManager {
public abstract fun getPaymentProviders (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun isSubscriptionAvailable (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun isUpgradeAvailable (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/paymentcommon/domain/PaymentManager$DefaultImpls {
public static synthetic fun getPaymentProviders$default (Lme/proton/core/paymentcommon/domain/PaymentManager;Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun isSubscriptionAvailable$default (Lme/proton/core/paymentcommon/domain/PaymentManager;Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun isUpgradeAvailable$default (Lme/proton/core/paymentcommon/domain/PaymentManager;Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
public abstract class me/proton/core/paymentcommon/domain/entity/Card {
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun getCountry ()Ljava/lang/String;
public fun getExpirationMonth ()Ljava/lang/String;
public fun getExpirationYear ()Ljava/lang/String;
public fun getName ()Ljava/lang/String;
public fun getZip ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/Card$CardReadOnly : me/proton/core/paymentcommon/domain/entity/Card {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Ljava/lang/String;
public final fun component5 ()Ljava/lang/String;
public final fun component6 ()Ljava/lang/String;
public final fun component7 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lme/proton/core/paymentcommon/domain/entity/Card$CardReadOnly;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/Card$CardReadOnly;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/Card$CardReadOnly;
public fun equals (Ljava/lang/Object;)Z
public final fun getBrand ()Ljava/lang/String;
public fun getCountry ()Ljava/lang/String;
public fun getExpirationMonth ()Ljava/lang/String;
public fun getExpirationYear ()Ljava/lang/String;
public final fun getLast4 ()Ljava/lang/String;
public fun getName ()Ljava/lang/String;
public fun getZip ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/Card$CardWithPaymentDetails : me/proton/core/paymentcommon/domain/entity/Card {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Ljava/lang/String;
public final fun component5 ()Ljava/lang/String;
public final fun component6 ()Ljava/lang/String;
public final fun component7 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lme/proton/core/paymentcommon/domain/entity/Card$CardWithPaymentDetails;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/Card$CardWithPaymentDetails;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/Card$CardWithPaymentDetails;
public fun equals (Ljava/lang/Object;)Z
public fun getCountry ()Ljava/lang/String;
public final fun getCvc ()Ljava/lang/String;
public fun getExpirationMonth ()Ljava/lang/String;
public fun getExpirationYear ()Ljava/lang/String;
public fun getName ()Ljava/lang/String;
public final fun getNumber ()Ljava/lang/String;
public fun getZip ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/Coupon {
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/lang/String;)Lme/proton/core/paymentcommon/domain/entity/Coupon;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/Coupon;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/Coupon;
public fun equals (Ljava/lang/Object;)Z
public final fun getCode ()Ljava/lang/String;
public final fun getDescription ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/Currency : java/lang/Enum {
public static final field CHF Lme/proton/core/paymentcommon/domain/entity/Currency;
public static final field EUR Lme/proton/core/paymentcommon/domain/entity/Currency;
public static final field USD Lme/proton/core/paymentcommon/domain/entity/Currency;
public static fun valueOf (Ljava/lang/String;)Lme/proton/core/paymentcommon/domain/entity/Currency;
public static fun values ()[Lme/proton/core/paymentcommon/domain/entity/Currency;
}
public abstract class me/proton/core/paymentcommon/domain/entity/Details {
}
public final class me/proton/core/paymentcommon/domain/entity/Details$CardDetails : me/proton/core/paymentcommon/domain/entity/Details {
public fun <init> (Lme/proton/core/paymentcommon/domain/entity/Card$CardReadOnly;)V
public final fun component1 ()Lme/proton/core/paymentcommon/domain/entity/Card$CardReadOnly;
public final fun copy (Lme/proton/core/paymentcommon/domain/entity/Card$CardReadOnly;)Lme/proton/core/paymentcommon/domain/entity/Details$CardDetails;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/Details$CardDetails;Lme/proton/core/paymentcommon/domain/entity/Card$CardReadOnly;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/Details$CardDetails;
public fun equals (Ljava/lang/Object;)Z
public final fun getCardDetails ()Lme/proton/core/paymentcommon/domain/entity/Card$CardReadOnly;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/Details$PayPalDetails : me/proton/core/paymentcommon/domain/entity/Details {
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/lang/String;)Lme/proton/core/paymentcommon/domain/entity/Details$PayPalDetails;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/Details$PayPalDetails;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/Details$PayPalDetails;
public fun equals (Ljava/lang/Object;)Z
public final fun getBillingAgreementId ()Ljava/lang/String;
public final fun getPayer ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public abstract class me/proton/core/paymentcommon/domain/entity/PaymentBody {
public synthetic fun <init> (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getType ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/PaymentBody$TokenPaymentBody : me/proton/core/paymentcommon/domain/entity/PaymentBody {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lme/proton/core/paymentcommon/domain/entity/PaymentBody$TokenPaymentBody;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/PaymentBody$TokenPaymentBody;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/PaymentBody$TokenPaymentBody;
public fun equals (Ljava/lang/Object;)Z
public final fun getToken ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/PaymentMethod {
public fun <init> (Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/PaymentMethodType;Lme/proton/core/paymentcommon/domain/entity/Details;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Lme/proton/core/paymentcommon/domain/entity/PaymentMethodType;
public final fun component3 ()Lme/proton/core/paymentcommon/domain/entity/Details;
public final fun copy (Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/PaymentMethodType;Lme/proton/core/paymentcommon/domain/entity/Details;)Lme/proton/core/paymentcommon/domain/entity/PaymentMethod;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/PaymentMethod;Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/PaymentMethodType;Lme/proton/core/paymentcommon/domain/entity/Details;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/PaymentMethod;
public fun equals (Ljava/lang/Object;)Z
public final fun getDetails ()Lme/proton/core/paymentcommon/domain/entity/Details;
public final fun getId ()Ljava/lang/String;
public final fun getType ()Lme/proton/core/paymentcommon/domain/entity/PaymentMethodType;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/PaymentMethodType : java/lang/Enum {
public static final field CARD Lme/proton/core/paymentcommon/domain/entity/PaymentMethodType;
public static final field Companion Lme/proton/core/paymentcommon/domain/entity/PaymentMethodType$Companion;
public static final field PAYPAL Lme/proton/core/paymentcommon/domain/entity/PaymentMethodType;
public final fun getValue ()Ljava/lang/String;
public static fun valueOf (Ljava/lang/String;)Lme/proton/core/paymentcommon/domain/entity/PaymentMethodType;
public static fun values ()[Lme/proton/core/paymentcommon/domain/entity/PaymentMethodType;
}
public final class me/proton/core/paymentcommon/domain/entity/PaymentMethodType$Companion {
public final fun getMap ()Ljava/util/Map;
}
public final class me/proton/core/paymentcommon/domain/entity/PaymentStatus {
public fun <init> (Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)V
public final fun component1 ()Ljava/lang/Boolean;
public final fun component2 ()Ljava/lang/Boolean;
public final fun component3 ()Ljava/lang/Boolean;
public final fun copy (Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lme/proton/core/paymentcommon/domain/entity/PaymentStatus;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/PaymentStatus;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/PaymentStatus;
public fun equals (Ljava/lang/Object;)Z
public final fun getCard ()Ljava/lang/Boolean;
public final fun getInApp ()Ljava/lang/Boolean;
public final fun getPaypal ()Ljava/lang/Boolean;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public abstract class me/proton/core/paymentcommon/domain/entity/PaymentToken {
public synthetic fun <init> (Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun getStatus ()Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;
}
public final class me/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult : me/proton/core/paymentcommon/domain/entity/PaymentToken {
public fun <init> (Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public final fun component1 ()Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Ljava/lang/String;
public final fun copy (Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lme/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult;Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult;
public fun equals (Ljava/lang/Object;)Z
public final fun getApprovalUrl ()Ljava/lang/String;
public final fun getReturnHost ()Ljava/lang/String;
public fun getStatus ()Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;
public final fun getToken ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/PaymentToken$PaymentTokenStatusResult : me/proton/core/paymentcommon/domain/entity/PaymentToken {
public fun <init> (Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;)V
public final fun component1 ()Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;
public final fun copy (Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;)Lme/proton/core/paymentcommon/domain/entity/PaymentToken$PaymentTokenStatusResult;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/PaymentToken$PaymentTokenStatusResult;Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/PaymentToken$PaymentTokenStatusResult;
public fun equals (Ljava/lang/Object;)Z
public fun getStatus ()Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/PaymentTokenStatus : java/lang/Enum {
public static final field CHARGEABLE Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;
public static final field CONSUMED Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;
public static final field Companion Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus$Companion;
public static final field FAILED Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;
public static final field NOT_SUPPORTED Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;
public static final field PENDING Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;
public static fun valueOf (Ljava/lang/String;)Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;
public static fun values ()[Lme/proton/core/paymentcommon/domain/entity/PaymentTokenStatus;
}
public final class me/proton/core/paymentcommon/domain/entity/PaymentTokenStatus$Companion {
public final fun getMap ()Ljava/util/Map;
}
public abstract class me/proton/core/paymentcommon/domain/entity/PaymentType {
public synthetic fun <init> (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getType ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/PaymentType$CreditCard : me/proton/core/paymentcommon/domain/entity/PaymentType {
public fun <init> (Lme/proton/core/paymentcommon/domain/entity/Card;)V
public final fun component1 ()Lme/proton/core/paymentcommon/domain/entity/Card;
public final fun copy (Lme/proton/core/paymentcommon/domain/entity/Card;)Lme/proton/core/paymentcommon/domain/entity/PaymentType$CreditCard;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/PaymentType$CreditCard;Lme/proton/core/paymentcommon/domain/entity/Card;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/PaymentType$CreditCard;
public fun equals (Ljava/lang/Object;)Z
public final fun getCard ()Lme/proton/core/paymentcommon/domain/entity/Card;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/PaymentType$PayPal : me/proton/core/paymentcommon/domain/entity/PaymentType {
public static final field INSTANCE Lme/proton/core/paymentcommon/domain/entity/PaymentType$PayPal;
}
public final class me/proton/core/paymentcommon/domain/entity/PaymentType$PaymentMethod : me/proton/core/paymentcommon/domain/entity/PaymentType {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lme/proton/core/paymentcommon/domain/entity/PaymentType$PaymentMethod;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/PaymentType$PaymentMethod;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/PaymentType$PaymentMethod;
public fun equals (Ljava/lang/Object;)Z
public final fun getPaymentMethodId ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/Subscription {
public fun <init> (Ljava/lang/String;Ljava/lang/String;IJJLjava/lang/String;Ljava/lang/String;JLme/proton/core/paymentcommon/domain/entity/SubscriptionManagement;Ljava/util/List;)V
public final fun component1 ()Ljava/lang/String;
public final fun component10 ()Ljava/util/List;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()I
public final fun component4 ()J
public final fun component5 ()J
public final fun component6 ()Ljava/lang/String;
public final fun component7 ()Ljava/lang/String;
public final fun component8 ()J
public final fun component9 ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionManagement;
public final fun copy (Ljava/lang/String;Ljava/lang/String;IJJLjava/lang/String;Ljava/lang/String;JLme/proton/core/paymentcommon/domain/entity/SubscriptionManagement;Ljava/util/List;)Lme/proton/core/paymentcommon/domain/entity/Subscription;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/Subscription;Ljava/lang/String;Ljava/lang/String;IJJLjava/lang/String;Ljava/lang/String;JLme/proton/core/paymentcommon/domain/entity/SubscriptionManagement;Ljava/util/List;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/Subscription;
public fun equals (Ljava/lang/Object;)Z
public final fun getAmount ()J
public final fun getCouponCode ()Ljava/lang/String;
public final fun getCurrency ()Ljava/lang/String;
public final fun getCycle ()I
public final fun getExternal ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionManagement;
public final fun getId ()Ljava/lang/String;
public final fun getInvoiceId ()Ljava/lang/String;
public final fun getPeriodEnd ()J
public final fun getPeriodStart ()J
public final fun getPlans ()Ljava/util/List;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/domain/entity/SubscriptionCycle : java/lang/Enum {
public static final field Companion Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle$Companion;
public static final field FREE Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public static final field MONTHLY Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public static final field TWO_YEARS Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public static final field YEARLY Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun getValue ()I
public static fun valueOf (Ljava/lang/String;)Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public static fun values ()[Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
}
public final class me/proton/core/paymentcommon/domain/entity/SubscriptionCycle$Companion {
public final fun getMap ()Ljava/util/Map;
}
public final class me/proton/core/paymentcommon/domain/entity/SubscriptionManagement : java/lang/Enum {
public static final field Companion Lme/proton/core/paymentcommon/domain/entity/SubscriptionManagement$Companion;
public static final field GOOGLE_MANAGED Lme/proton/core/paymentcommon/domain/entity/SubscriptionManagement;
public static final field PROTON_MANAGED Lme/proton/core/paymentcommon/domain/entity/SubscriptionManagement;
public final fun getValue ()I
public static fun valueOf (Ljava/lang/String;)Lme/proton/core/paymentcommon/domain/entity/SubscriptionManagement;
public static fun values ()[Lme/proton/core/paymentcommon/domain/entity/SubscriptionManagement;
}
public final class me/proton/core/paymentcommon/domain/entity/SubscriptionManagement$Companion {
public final fun getMap ()Ljava/util/Map;
}
public final class me/proton/core/paymentcommon/domain/entity/SubscriptionStatus {
public fun <init> (JJIJLme/proton/core/paymentcommon/domain/entity/Coupon;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/Long;)V
public final fun component1 ()J
public final fun component2 ()J
public final fun component3 ()I
public final fun component4 ()J
public final fun component5 ()Lme/proton/core/paymentcommon/domain/entity/Coupon;
public final fun component6 ()J
public final fun component7 ()Lme/proton/core/paymentcommon/domain/entity/Currency;
public final fun component8 ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun component9 ()Ljava/lang/Long;
public final fun copy (JJIJLme/proton/core/paymentcommon/domain/entity/Coupon;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/Long;)Lme/proton/core/paymentcommon/domain/entity/SubscriptionStatus;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/domain/entity/SubscriptionStatus;JJIJLme/proton/core/paymentcommon/domain/entity/Coupon;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/Long;ILjava/lang/Object;)Lme/proton/core/paymentcommon/domain/entity/SubscriptionStatus;
public fun equals (Ljava/lang/Object;)Z
public final fun getAmount ()J
public final fun getAmountDue ()J
public final fun getCoupon ()Lme/proton/core/paymentcommon/domain/entity/Coupon;
public final fun getCouponDiscount ()J
public final fun getCredit ()J
public final fun getCurrency ()Lme/proton/core/paymentcommon/domain/entity/Currency;
public final fun getCycle ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun getGift ()Ljava/lang/Long;
public final fun getProration ()I
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public abstract interface class me/proton/core/paymentcommon/domain/repository/PaymentsRepository {
public abstract fun createOrUpdateSubscription (Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/PaymentBody;Ljava/util/List;Ljava/util/Map;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun createPaymentTokenExistingPaymentMethod (Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun createPaymentTokenNewCreditCard (Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/PaymentType$CreditCard;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun createPaymentTokenNewPayPal (Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/PaymentType$PayPal;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun getAvailablePaymentMethods (Lme/proton/core/domain/entity/UserId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun getPaymentStatus (Lme/proton/core/domain/entity/UserId;Lme/proton/core/domain/entity/AppStore;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun getPaymentTokenStatus (Lme/proton/core/domain/entity/UserId;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun getSubscription (Lme/proton/core/domain/entity/UserId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun validateSubscription (Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/Map;Lme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/paymentcommon/domain/repository/PaymentsRepository$DefaultImpls {
public static synthetic fun createOrUpdateSubscription$default (Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/PaymentBody;Ljava/util/List;Ljava/util/Map;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun createPaymentTokenExistingPaymentMethod$default (Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun createPaymentTokenNewCreditCard$default (Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/PaymentType$CreditCard;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun createPaymentTokenNewPayPal$default (Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/PaymentType$PayPal;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun validateSubscription$default (Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/Map;Lme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
public final class me/proton/core/paymentcommon/domain/usecase/CreatePaymentTokenWithExistingPaymentMethod {
public fun <init> (Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/paymentcommon/domain/usecase/CreatePaymentTokenWithNewCreditCard {
public fun <init> (Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/PaymentType$CreditCard;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/paymentcommon/domain/usecase/CreatePaymentTokenWithNewPayPal {
public fun <init> (Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/PaymentType$PayPal;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/paymentcommon/domain/usecase/GetAvailablePaymentProviders {
public final fun invoke (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun invoke$default (Lme/proton/core/paymentcommon/domain/usecase/GetAvailablePaymentProviders;Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
public final class me/proton/core/paymentcommon/domain/usecase/PaymentProvider : java/lang/Enum {
public static final field CardPayment Lme/proton/core/paymentcommon/domain/usecase/PaymentProvider;
public static final field GoogleInAppPurchase Lme/proton/core/paymentcommon/domain/usecase/PaymentProvider;
public static final field PayPal Lme/proton/core/paymentcommon/domain/usecase/PaymentProvider;
public static fun valueOf (Ljava/lang/String;)Lme/proton/core/paymentcommon/domain/usecase/PaymentProvider;
public static fun values ()[Lme/proton/core/paymentcommon/domain/usecase/PaymentProvider;
}
public final class me/proton/core/paymentcommon/domain/usecase/PerformSubscribe {
public fun <init> (Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;Lme/proton/core/humanverification/domain/HumanVerificationManager;Lme/proton/core/network/domain/client/ClientIdProvider;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/util/List;Ljava/util/List;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun invoke$default (Lme/proton/core/paymentcommon/domain/usecase/PerformSubscribe;Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/util/List;Ljava/util/List;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
public abstract interface class me/proton/core/paymentcommon/domain/usecase/ProtonIAPBillingLibrary {
public abstract fun isAvailable ()Z
}
public final class me/proton/core/paymentcommon/domain/usecase/ValidateSubscriptionPlan {
public fun <init> (Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;Lme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun invoke$default (Lme/proton/core/paymentcommon/domain/usecase/ValidateSubscriptionPlan;Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;Lme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
@@ -1,431 +0,0 @@
public class hilt_aggregated_deps/_me_proton_core_paymentcommon_presentation_viewmodel_BillingViewModel_HiltModules_BindsModule {
public fun <init> ()V
}
public class hilt_aggregated_deps/_me_proton_core_paymentcommon_presentation_viewmodel_BillingViewModel_HiltModules_KeyModule {
public fun <init> ()V
}
public abstract interface class me/proton/core/paymentcommon/presentation/ActivePaymentProvider {
public abstract fun getActivePaymentProvider (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun getNextPaymentProviderText ()Ljava/lang/Integer;
public abstract fun switchNextPaymentProvider ()Lme/proton/core/paymentcommon/domain/usecase/PaymentProvider;
}
public final class me/proton/core/paymentcommon/presentation/BuildConfig {
public static final field BUILD_TYPE Ljava/lang/String;
public static final field DEBUG Z
public static final field LIBRARY_PACKAGE_NAME Ljava/lang/String;
public fun <init> ()V
}
public final class me/proton/core/paymentcommon/presentation/entity/BillingInput : android/os/Parcelable {
public static final field CREATOR Landroid/os/Parcelable$Creator;
public fun <init> (Ljava/lang/String;Ljava/util/List;Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;Ljava/util/List;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/util/List;Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;Ljava/util/List;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/util/List;
public final fun component3 ()Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;
public final fun component4 ()Ljava/util/List;
public final fun component5 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/util/List;Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;Ljava/util/List;Ljava/lang/String;)Lme/proton/core/paymentcommon/presentation/entity/BillingInput;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/entity/BillingInput;Ljava/lang/String;Ljava/util/List;Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;Ljava/util/List;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/entity/BillingInput;
public fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public final fun getCodes ()Ljava/util/List;
public final fun getExistingPlans ()Ljava/util/List;
public final fun getPaymentMethodId ()Ljava/lang/String;
public final fun getPlan ()Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;
public final fun getUser ()Lme/proton/core/domain/entity/UserId;
public final fun getUserId ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public fun writeToParcel (Landroid/os/Parcel;I)V
}
public final class me/proton/core/paymentcommon/presentation/entity/BillingResult : android/os/Parcelable {
public static final field CREATOR Landroid/os/Parcelable$Creator;
public static final field Companion Lme/proton/core/paymentcommon/presentation/entity/BillingResult$Companion;
public fun <init> (ZLjava/lang/String;ZJLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;)V
public final fun component1 ()Z
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Z
public final fun component4 ()J
public final fun component5 ()Lme/proton/core/paymentcommon/domain/entity/Currency;
public final fun component6 ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun copy (ZLjava/lang/String;ZJLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;)Lme/proton/core/paymentcommon/presentation/entity/BillingResult;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/entity/BillingResult;ZLjava/lang/String;ZJLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/entity/BillingResult;
public fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public final fun getAmount ()J
public final fun getCurrency ()Lme/proton/core/paymentcommon/domain/entity/Currency;
public final fun getCycle ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun getPaySuccess ()Z
public final fun getSubscriptionCreated ()Z
public final fun getToken ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public fun writeToParcel (Landroid/os/Parcel;I)V
}
public final class me/proton/core/paymentcommon/presentation/entity/BillingResult$Companion {
public final fun paymentDetails (Lme/proton/core/network/domain/client/ClientId;Ljava/lang/String;)Lme/proton/core/network/domain/humanverification/HumanVerificationDetails;
}
public final class me/proton/core/paymentcommon/presentation/entity/CurrentSubscribedPlanDetails : android/os/Parcelable {
public static final field CREATOR Landroid/os/Parcelable$Creator;
public fun <init> (Ljava/lang/String;Ljava/lang/Integer;I)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/Integer;
public final fun component3 ()I
public final fun copy (Ljava/lang/String;Ljava/lang/Integer;I)Lme/proton/core/paymentcommon/presentation/entity/CurrentSubscribedPlanDetails;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/entity/CurrentSubscribedPlanDetails;Ljava/lang/String;Ljava/lang/Integer;IILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/entity/CurrentSubscribedPlanDetails;
public fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public final fun getName ()Ljava/lang/String;
public final fun getServices ()Ljava/lang/Integer;
public final fun getType ()I
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public fun writeToParcel (Landroid/os/Parcel;I)V
}
public final class me/proton/core/paymentcommon/presentation/entity/PlanShortDetails : android/os/Parcelable {
public static final field CREATOR Landroid/os/Parcelable$Creator;
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/Long;Lme/proton/core/paymentcommon/domain/entity/Currency;IILjava/util/Map;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/Long;Lme/proton/core/paymentcommon/domain/entity/Currency;IILjava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun component4 ()Ljava/lang/Long;
public final fun component5 ()Lme/proton/core/paymentcommon/domain/entity/Currency;
public final fun component6 ()I
public final fun component7 ()I
public final fun component8 ()Ljava/util/Map;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/Long;Lme/proton/core/paymentcommon/domain/entity/Currency;IILjava/util/Map;)Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;Ljava/lang/String;Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/Long;Lme/proton/core/paymentcommon/domain/entity/Currency;IILjava/util/Map;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;
public fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public final fun getAmount ()Ljava/lang/Long;
public final fun getCurrency ()Lme/proton/core/paymentcommon/domain/entity/Currency;
public final fun getDisplayName ()Ljava/lang/String;
public final fun getName ()Ljava/lang/String;
public final fun getServices ()I
public final fun getSubscriptionCycle ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun getType ()I
public final fun getVendorNames ()Ljava/util/Map;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public fun writeToParcel (Landroid/os/Parcel;I)V
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/ActivePaymentProviderImpl : me/proton/core/paymentcommon/presentation/ActivePaymentProvider {
public fun <init> (Lme/proton/core/paymentcommon/domain/usecase/GetAvailablePaymentProviders;)V
public fun getActivePaymentProvider (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun getNextPaymentProviderText ()Ljava/lang/Integer;
public fun switchNextPaymentProvider ()Lme/proton/core/paymentcommon/domain/usecase/PaymentProvider;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/ActivePaymentProviderImpl_Factory : dagger/internal/Factory {
public fun <init> (Ljavax/inject/Provider;)V
public static fun create (Ljavax/inject/Provider;)Lme/proton/core/paymentcommon/presentation/viewmodel/ActivePaymentProviderImpl_Factory;
public synthetic fun get ()Ljava/lang/Object;
public fun get ()Lme/proton/core/paymentcommon/presentation/viewmodel/ActivePaymentProviderImpl;
public static fun newInstance (Lme/proton/core/paymentcommon/domain/usecase/GetAvailablePaymentProviders;)Lme/proton/core/paymentcommon/presentation/viewmodel/ActivePaymentProviderImpl;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel : me/proton/core/presentation/viewmodel/ProtonViewModel {
public static final field Companion Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$Companion;
public fun <init> (Lme/proton/core/paymentcommon/domain/usecase/ValidateSubscriptionPlan;Lme/proton/core/paymentcommon/domain/usecase/CreatePaymentTokenWithNewCreditCard;Lme/proton/core/paymentcommon/domain/usecase/CreatePaymentTokenWithNewPayPal;Lme/proton/core/paymentcommon/domain/usecase/CreatePaymentTokenWithExistingPaymentMethod;Lme/proton/core/paymentcommon/domain/usecase/PerformSubscribe;Lme/proton/core/country/domain/usecase/GetCountry;Lme/proton/core/humanverification/domain/HumanVerificationManager;Lme/proton/core/network/domain/client/ClientIdProvider;)V
public final fun getPlansValidationState ()Lkotlinx/coroutines/flow/StateFlow;
public final fun getSubscriptionResult ()Lkotlinx/coroutines/flow/StateFlow;
public final fun onThreeDSTokenApproved (Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/String;)Lkotlinx/coroutines/Job;
public static synthetic fun onThreeDSTokenApproved$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel;Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/String;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
public final fun subscribe (Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;Lme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lme/proton/core/paymentcommon/domain/entity/PaymentType;)Lkotlinx/coroutines/Job;
public static synthetic fun subscribe$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel;Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;Lme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lme/proton/core/paymentcommon/domain/entity/PaymentType;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
public final fun validatePlan (Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;Lme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;)Lkotlinx/coroutines/Job;
public static synthetic fun validatePlan$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel;Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;Lme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$Companion {
public final fun buildPlansList (Ljava/util/List;Ljava/lang/String;II)Ljava/util/List;
public final fun createSubscriptionPlansList (Ljava/util/List;Ljava/lang/String;II)Ljava/util/List;
}
public abstract class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState {
}
public abstract class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Error : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState {
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Error$Message : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Error {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Error$Message;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Error$Message;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Error$Message;
public fun equals (Ljava/lang/Object;)Z
public final fun getMessage ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Idle : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState {
public static final field INSTANCE Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Idle;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Processing : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState {
public static final field INSTANCE Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Processing;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Success : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState {
public fun <init> (Lme/proton/core/paymentcommon/domain/entity/SubscriptionStatus;)V
public final fun component1 ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionStatus;
public final fun copy (Lme/proton/core/paymentcommon/domain/entity/SubscriptionStatus;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Success;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Success;Lme/proton/core/paymentcommon/domain/entity/SubscriptionStatus;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$PlansValidationState$Success;
public fun equals (Ljava/lang/Object;)Z
public final fun getSubscription ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionStatus;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public abstract class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State {
}
public abstract class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Error : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State {
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Error$General : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Error {
public fun <init> (Ljava/lang/Throwable;)V
public final fun component1 ()Ljava/lang/Throwable;
public final fun copy (Ljava/lang/Throwable;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Error$General;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Error$General;Ljava/lang/Throwable;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Error$General;
public fun equals (Ljava/lang/Object;)Z
public final fun getError ()Ljava/lang/Throwable;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Error$SignUpWithPaymentMethodUnsupported : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Error {
public static final field INSTANCE Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Error$SignUpWithPaymentMethodUnsupported;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Idle : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State {
public static final field INSTANCE Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Idle;
}
public abstract class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Incomplete : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State {
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Incomplete$TokenApprovalNeeded : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Incomplete {
public fun <init> (Lme/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult;J)V
public final fun component1 ()Lme/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult;
public final fun component2 ()J
public final fun copy (Lme/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult;J)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Incomplete$TokenApprovalNeeded;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Incomplete$TokenApprovalNeeded;Lme/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult;JILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Incomplete$TokenApprovalNeeded;
public fun equals (Ljava/lang/Object;)Z
public final fun getAmount ()J
public final fun getPaymentToken ()Lme/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Processing : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State {
public static final field INSTANCE Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Processing;
}
public abstract class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State {
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$SignUpTokenReady : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success {
public fun <init> (JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/String;)V
public final fun component1 ()J
public final fun component2 ()Lme/proton/core/paymentcommon/domain/entity/Currency;
public final fun component3 ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun component4 ()Ljava/lang/String;
public final fun copy (JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/String;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$SignUpTokenReady;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$SignUpTokenReady;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$SignUpTokenReady;
public fun equals (Ljava/lang/Object;)Z
public final fun getAmount ()J
public final fun getCurrency ()Lme/proton/core/paymentcommon/domain/entity/Currency;
public final fun getCycle ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun getPaymentToken ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$SubscriptionCreated : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success {
public fun <init> (JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lme/proton/core/paymentcommon/domain/entity/Subscription;Ljava/lang/String;)V
public final fun component1 ()J
public final fun component2 ()Lme/proton/core/paymentcommon/domain/entity/Currency;
public final fun component3 ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun component4 ()Lme/proton/core/paymentcommon/domain/entity/Subscription;
public final fun component5 ()Ljava/lang/String;
public final fun copy (JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lme/proton/core/paymentcommon/domain/entity/Subscription;Ljava/lang/String;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$SubscriptionCreated;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$SubscriptionCreated;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lme/proton/core/paymentcommon/domain/entity/Subscription;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$SubscriptionCreated;
public fun equals (Ljava/lang/Object;)Z
public final fun getAmount ()J
public final fun getCurrency ()Lme/proton/core/paymentcommon/domain/entity/Currency;
public final fun getCycle ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun getPaymentToken ()Ljava/lang/String;
public final fun getSubscriptionStatus ()Lme/proton/core/paymentcommon/domain/entity/Subscription;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$SubscriptionPlanValidated : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success {
public fun <init> (Lme/proton/core/paymentcommon/domain/entity/SubscriptionStatus;)V
public final fun component1 ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionStatus;
public final fun copy (Lme/proton/core/paymentcommon/domain/entity/SubscriptionStatus;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$SubscriptionPlanValidated;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$SubscriptionPlanValidated;Lme/proton/core/paymentcommon/domain/entity/SubscriptionStatus;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$SubscriptionPlanValidated;
public fun equals (Ljava/lang/Object;)Z
public final fun getSubscriptionStatus ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionStatus;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$TokenCreated : me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success {
public fun <init> (Lme/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult;)V
public final fun component1 ()Lme/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult;
public final fun copy (Lme/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$TokenCreated;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$TokenCreated;Lme/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel$State$Success$TokenCreated;
public fun equals (Ljava/lang/Object;)Z
public final fun getPaymentToken ()Lme/proton/core/paymentcommon/domain/entity/PaymentToken$CreatePaymentTokenResult;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel_Factory : dagger/internal/Factory {
public fun <init> (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)V
public static fun create (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel_Factory;
public synthetic fun get ()Ljava/lang/Object;
public fun get ()Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel;
public static fun newInstance (Lme/proton/core/paymentcommon/domain/usecase/ValidateSubscriptionPlan;Lme/proton/core/paymentcommon/domain/usecase/CreatePaymentTokenWithNewCreditCard;Lme/proton/core/paymentcommon/domain/usecase/CreatePaymentTokenWithNewPayPal;Lme/proton/core/paymentcommon/domain/usecase/CreatePaymentTokenWithExistingPaymentMethod;Lme/proton/core/paymentcommon/domain/usecase/PerformSubscribe;Lme/proton/core/country/domain/usecase/GetCountry;Lme/proton/core/humanverification/domain/HumanVerificationManager;Lme/proton/core/network/domain/client/ClientIdProvider;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel : me/proton/core/presentation/viewmodel/ProtonViewModel {
public fun <init> (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel;Lme/proton/core/paymentcommon/presentation/ActivePaymentProvider;)V
public final fun getPaymentProvidersResult ()Lkotlinx/coroutines/flow/StateFlow;
public final fun getPlansValidationState ()Lkotlinx/coroutines/flow/StateFlow;
public final fun getSubscriptionResult ()Lkotlinx/coroutines/flow/StateFlow;
public final fun getUserInteractionState ()Lkotlinx/coroutines/flow/StateFlow;
public final fun onLoadingStateChange (Z)V
public final fun onPay (Lme/proton/core/paymentcommon/presentation/entity/BillingInput;)V
public final fun onThreeDSTokenApproved (Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/String;)Lkotlinx/coroutines/Job;
public static synthetic fun onThreeDSTokenApproved$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel;Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/String;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
public final fun setPlan (Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;)V
public final fun subscribe (Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;Lme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lme/proton/core/paymentcommon/domain/entity/PaymentType;)Lkotlinx/coroutines/Job;
public static synthetic fun subscribe$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel;Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;Lme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lme/proton/core/paymentcommon/domain/entity/PaymentType;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
public final fun switchNextPaymentProvider ()V
public final fun validatePlan (Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;Lme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;)Lkotlinx/coroutines/Job;
public static synthetic fun validatePlan$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel;Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;Lme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
}
public abstract class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState {
}
public abstract class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Error : me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState {
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Error$Message : me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Error {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Error$Message;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Error$Message;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Error$Message;
public fun equals (Ljava/lang/Object;)Z
public final fun getError ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Idle : me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState {
public static final field INSTANCE Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Idle;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$PaymentProvidersEmpty : me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState {
public static final field INSTANCE Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$PaymentProvidersEmpty;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Processing : me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState {
public static final field INSTANCE Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Processing;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Success : me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState {
public fun <init> (Lme/proton/core/paymentcommon/domain/usecase/PaymentProvider;Ljava/lang/Integer;)V
public final fun component1 ()Lme/proton/core/paymentcommon/domain/usecase/PaymentProvider;
public final fun component2 ()Ljava/lang/Integer;
public final fun copy (Lme/proton/core/paymentcommon/domain/usecase/PaymentProvider;Ljava/lang/Integer;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Success;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Success;Lme/proton/core/paymentcommon/domain/usecase/PaymentProvider;Ljava/lang/Integer;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$PaymentProvidersState$Success;
public fun equals (Ljava/lang/Object;)Z
public final fun getActiveProvider ()Lme/proton/core/paymentcommon/domain/usecase/PaymentProvider;
public final fun getNextPaymentProviderTextResource ()Ljava/lang/Integer;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public abstract class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState {
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$Idle : me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState {
public static final field INSTANCE Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$Idle;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$OnLoadingStateChange : me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState {
public fun <init> (Z)V
public final fun component1 ()Z
public final fun copy (Z)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$OnLoadingStateChange;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$OnLoadingStateChange;ZILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$OnLoadingStateChange;
public fun equals (Ljava/lang/Object;)Z
public final fun getLoading ()Z
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$OnPay : me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState {
public fun <init> (Lme/proton/core/paymentcommon/presentation/entity/BillingInput;)V
public final fun component1 ()Lme/proton/core/paymentcommon/presentation/entity/BillingInput;
public final fun copy (Lme/proton/core/paymentcommon/presentation/entity/BillingInput;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$OnPay;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$OnPay;Lme/proton/core/paymentcommon/presentation/entity/BillingInput;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$OnPay;
public fun equals (Ljava/lang/Object;)Z
public final fun getInput ()Lme/proton/core/paymentcommon/presentation/entity/BillingInput;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$PlanValidated : me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState {
public fun <init> (Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;)V
public final fun component1 ()Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;
public final fun copy (Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$PlanValidated;
public static synthetic fun copy$default (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$PlanValidated;Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;ILjava/lang/Object;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel$UserInteractionState$PlanValidated;
public fun equals (Ljava/lang/Object;)Z
public final fun getPlan ()Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel_Factory : dagger/internal/Factory {
public fun <init> (Ljavax/inject/Provider;Ljavax/inject/Provider;)V
public static fun create (Ljavax/inject/Provider;Ljavax/inject/Provider;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel_Factory;
public synthetic fun get ()Ljava/lang/Object;
public fun get ()Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel;
public static fun newInstance (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingCommonViewModel;Lme/proton/core/paymentcommon/presentation/ActivePaymentProvider;)Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel_HiltModules {
}
public abstract class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel_HiltModules$BindsModule {
public abstract fun binds (Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel;)Landroidx/lifecycle/ViewModel;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel_HiltModules$KeyModule {
public static fun provide ()Ljava/lang/String;
}
public final class me/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel_HiltModules_KeyModule_ProvideFactory : dagger/internal/Factory {
public fun <init> ()V
public static fun create ()Lme/proton/core/paymentcommon/presentation/viewmodel/BillingViewModel_HiltModules_KeyModule_ProvideFactory;
public synthetic fun get ()Ljava/lang/Object;
public fun get ()Ljava/lang/String;
public static fun provide ()Ljava/lang/String;
}
@@ -1,70 +0,0 @@
/*
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
import studio.forface.easygradle.dsl.*
import studio.forface.easygradle.dsl.android.*
plugins {
protonAndroidUiLibrary
protonDagger
id("kotlin-parcelize")
}
publishOption.shouldBePublishedAsLib = true
dependencies {
api(
project(Module.countryDomain),
project(Module.humanVerificationDomain),
project(Module.planDomain),
project(Module.paymentCommonDomain),
project(Module.presentation),
`activity-noktx`,
`constraint-layout`,
coordinatorlayout,
`coroutines-core`,
`hilt-android`,
material,
recyclerview
)
implementation(
// Core
project(Module.kotlinUtil),
// Android
activity,
`android-ktx`,
appcompat,
fragment,
`lifecycle-common`,
`lifecycle-runtime`,
`lifecycle-viewModel`,
)
testImplementation(
project(Module.androidTest),
project(Module.kotlinTest),
`android-arch-testing`,
`coroutines-test`,
junit,
`kotlin-test`,
mockk,
turbine
)
}
@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2022 Proton Technologies AG
~ This file is part of Proton AG and ProtonCore.
~
~ ProtonCore is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ ProtonCore is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
-->
<manifest package="me.proton.core.paymentcommon.presentation" />
@@ -1,27 +0,0 @@
/*
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.presentation
import me.proton.core.paymentcommon.domain.usecase.PaymentProvider
public interface ActivePaymentProvider {
public suspend fun getActivePaymentProvider(): PaymentProvider?
public fun switchNextPaymentProvider(): PaymentProvider?
public fun getNextPaymentProviderText(): Int?
}
@@ -1,52 +0,0 @@
/*
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.presentation.entity
import android.os.Parcelable
import kotlinx.parcelize.Parcelize
import me.proton.core.humanverification.domain.entity.TokenType
import me.proton.core.network.domain.client.ClientId
import me.proton.core.network.domain.humanverification.HumanVerificationDetails
import me.proton.core.network.domain.humanverification.HumanVerificationState
import me.proton.core.network.domain.humanverification.VerificationMethod
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
@Parcelize
public data class BillingResult(
val paySuccess: Boolean,
val token: String?,
val subscriptionCreated: Boolean,
val amount: Long,
val currency: Currency,
val cycle: SubscriptionCycle
) : Parcelable {
public companion object {
public fun paymentDetails(clientId: ClientId, token: String): HumanVerificationDetails =
HumanVerificationDetails(
clientId = clientId,
verificationMethods = listOf(VerificationMethod.PAYMENT),
verificationToken = null,
state = HumanVerificationState.HumanVerificationSuccess,
tokenType = TokenType.PAYMENT.value,
tokenCode = token
)
}
}
@@ -1,155 +0,0 @@
/*
* Copyright (c) 2021 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.presentation.viewmodel
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.PaymentType
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
import me.proton.core.paymentcommon.domain.usecase.PaymentProvider
import me.proton.core.paymentcommon.presentation.ActivePaymentProvider
import me.proton.core.paymentcommon.presentation.entity.BillingInput
import me.proton.core.paymentcommon.presentation.entity.PlanShortDetails
import me.proton.core.presentation.viewmodel.ProtonViewModel
import javax.inject.Inject
@HiltViewModel
public class BillingViewModel @Inject constructor(
private val billingCommonViewModel: BillingCommonViewModel,
private val activePaymentProvider: ActivePaymentProvider
) : ProtonViewModel() {
public val plansValidationState: StateFlow<BillingCommonViewModel.PlansValidationState> =
billingCommonViewModel.plansValidationState
public val subscriptionResult: StateFlow<BillingCommonViewModel.State> = billingCommonViewModel.subscriptionResult
private val _paymentProvidersState = MutableStateFlow<PaymentProvidersState>(PaymentProvidersState.Idle)
public val paymentProvidersResult: StateFlow<PaymentProvidersState> = _paymentProvidersState.asStateFlow()
private val _userInteractionState = MutableStateFlow<UserInteractionState>(UserInteractionState.Idle)
public val userInteractionState: StateFlow<UserInteractionState> = _userInteractionState.asStateFlow()
public sealed class UserInteractionState {
public object Idle : UserInteractionState()
public data class OnPay(val input: BillingInput) : UserInteractionState()
public data class OnLoadingStateChange(val loading: Boolean) : UserInteractionState()
public data class PlanValidated(val plan: PlanShortDetails) : UserInteractionState()
}
public sealed class PaymentProvidersState {
public object Idle : PaymentProvidersState()
public object Processing : PaymentProvidersState()
public object PaymentProvidersEmpty : PaymentProvidersState()
public data class Success(
val activeProvider: PaymentProvider,
val nextPaymentProviderTextResource: Int?
) : PaymentProvidersState()
public sealed class Error : PaymentProvidersState() {
public data class Message(val error: String?) : Error()
}
}
init {
viewModelScope.launch { observePaymentProviders() }
}
public fun onPay(input: BillingInput) {
_userInteractionState.tryEmit(UserInteractionState.OnPay(input))
}
public fun onLoadingStateChange(loading: Boolean) {
_userInteractionState.tryEmit(UserInteractionState.OnLoadingStateChange(loading))
}
public fun setPlan(plan: PlanShortDetails) {
_userInteractionState.tryEmit(UserInteractionState.PlanValidated(plan))
}
public fun switchNextPaymentProvider() {
val paymentProvider = activePaymentProvider.switchNextPaymentProvider()
if (paymentProvider == null) {
_paymentProvidersState.tryEmit(PaymentProvidersState.PaymentProvidersEmpty)
} else {
_paymentProvidersState.tryEmit(
PaymentProvidersState.Success(
paymentProvider,
activePaymentProvider.getNextPaymentProviderText()
)
)
}
}
/**
* Observes the most recent payment providers availability.
*/
private fun observePaymentProviders() = flow {
emit(PaymentProvidersState.Processing)
val paymentProvider = activePaymentProvider.getActivePaymentProvider()
if (paymentProvider == null) {
emit(PaymentProvidersState.PaymentProvidersEmpty)
} else {
emit(PaymentProvidersState.Success(paymentProvider, activePaymentProvider.getNextPaymentProviderText()))
}
}.catch { error ->
_paymentProvidersState.tryEmit(PaymentProvidersState.Error.Message(error.message))
}.onEach { subscriptionState ->
_paymentProvidersState.tryEmit(subscriptionState)
}.launchIn(viewModelScope)
public fun subscribe(
userId: UserId?,
planNames: List<String>,
codes: List<String>? = null,
currency: Currency,
cycle: SubscriptionCycle,
paymentType: PaymentType
): Job = billingCommonViewModel.subscribe(userId, planNames, codes, currency, cycle, paymentType)
public fun validatePlan(
userId: UserId?,
plans: List<String>,
codes: List<String>? = null,
currency: Currency,
cycle: SubscriptionCycle
): Job = billingCommonViewModel.validatePlan(userId, plans, codes, currency, cycle)
public fun onThreeDSTokenApproved(
userId: UserId?,
planIds: List<String>,
codes: List<String>? = null,
amount: Long,
currency: Currency,
cycle: SubscriptionCycle,
token: String
): Job = billingCommonViewModel.onThreeDSTokenApproved(userId, planIds, codes, amount, currency, cycle, token)
}
@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2022 Proton Technologies AG
~ This file is part of Proton AG and ProtonCore.
~
~ ProtonCore is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ ProtonCore is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
-->
<resources>
<dimen name="payment_amount_progress">16dp</dimen>
</resources>
@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2022 Proton Technologies AG
~ This file is part of Proton AG and ProtonCore.
~
~ ProtonCore is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ ProtonCore is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
-->
<resources>
<string name="payments_info_not_available">n/a</string>
<string name="payments_billing_yearly">For 1 year</string>
<string name="payment_use_google_pay_instead">Use Google Pay instead</string>
<string name="payment_use_credit_card_instead">Use credit/debit card instead</string>
</resources>
@@ -1,21 +0,0 @@
<!--
~ Copyright (c) 2022 Proton Technologies AG
~ This file is part of Proton AG and ProtonCore.
~
~ ProtonCore is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ ProtonCore is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
-->
<manifest package="me.proton.core.paymentcommon">
<application />
</manifest>
+5 -14
View File
@@ -11,23 +11,14 @@ public final class me/proton/core/paymentiap/dagger/BuildConfig {
public final class me/proton/core/paymentiap/dagger/PaymentIapModule {
public static final field INSTANCE Lme/proton/core/paymentiap/dagger/PaymentIapModule;
public final fun provideBillingClient (Landroid/content/Context;Lcom/android/billingclient/api/PurchasesUpdatedListener;)Lcom/android/billingclient/api/BillingClient;
public final fun providePurchasesUpdatedListener ()Lcom/android/billingclient/api/PurchasesUpdatedListener;
public final fun provideBillingClient (Landroid/content/Context;)Lcom/android/billingclient/api/BillingClient$Builder;
}
public final class me/proton/core/paymentiap/dagger/PaymentIapModule_ProvideBillingClientFactory : dagger/internal/Factory {
public fun <init> (Ljavax/inject/Provider;Ljavax/inject/Provider;)V
public static fun create (Ljavax/inject/Provider;Ljavax/inject/Provider;)Lme/proton/core/paymentiap/dagger/PaymentIapModule_ProvideBillingClientFactory;
public fun get ()Lcom/android/billingclient/api/BillingClient;
public fun <init> (Ljavax/inject/Provider;)V
public static fun create (Ljavax/inject/Provider;)Lme/proton/core/paymentiap/dagger/PaymentIapModule_ProvideBillingClientFactory;
public fun get ()Lcom/android/billingclient/api/BillingClient$Builder;
public synthetic fun get ()Ljava/lang/Object;
public static fun provideBillingClient (Landroid/content/Context;Lcom/android/billingclient/api/PurchasesUpdatedListener;)Lcom/android/billingclient/api/BillingClient;
}
public final class me/proton/core/paymentiap/dagger/PaymentIapModule_ProvidePurchasesUpdatedListenerFactory : dagger/internal/Factory {
public fun <init> ()V
public static fun create ()Lme/proton/core/paymentiap/dagger/PaymentIapModule_ProvidePurchasesUpdatedListenerFactory;
public fun get ()Lcom/android/billingclient/api/PurchasesUpdatedListener;
public synthetic fun get ()Ljava/lang/Object;
public static fun providePurchasesUpdatedListener ()Lcom/android/billingclient/api/PurchasesUpdatedListener;
public static fun provideBillingClient (Landroid/content/Context;)Lcom/android/billingclient/api/BillingClient$Builder;
}
@@ -34,20 +34,10 @@ import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
public object PaymentIapModule {
@Provides
@Singleton
public fun providePurchasesUpdatedListener(): PurchasesUpdatedListener =
PurchasesUpdatedListener { billingResult: BillingResult, purchaseList: List<Purchase>? ->
CoreLogger.d("IAP", "$billingResult -> $purchaseList")
}
@Provides
@Singleton
public fun provideBillingClient(
@ApplicationContext context: Context,
purchasesUpdatedListener: PurchasesUpdatedListener,
): BillingClient = BillingClient.newBuilder(context)
.setListener(purchasesUpdatedListener)
.enablePendingPurchases()
.build()
@ApplicationContext context: Context
): BillingClient.Builder = BillingClient.newBuilder(context).enablePendingPurchases()
}
@@ -46,19 +46,19 @@ public final class me/proton/core/paymentiap/presentation/databinding/PlanShortD
public final class me/proton/core/paymentiap/presentation/entity/GooglePlanShortDetails : android/os/Parcelable {
public static final field CREATOR Landroid/os/Parcelable$Creator;
public static final field Companion Lme/proton/core/paymentiap/presentation/entity/GooglePlanShortDetails$Companion;
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;IILjava/util/Map;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;IILjava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;IILjava/util/Map;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;IILjava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun component3 ()Lme/proton/core/payment/domain/entity/SubscriptionCycle;
public final fun component4 ()Ljava/lang/Long;
public final fun component5 ()Ljava/lang/String;
public final fun component6 ()Ljava/lang/String;
public final fun component7 ()I
public final fun component8 ()I
public final fun component9 ()Ljava/util/Map;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;IILjava/util/Map;)Lme/proton/core/paymentiap/presentation/entity/GooglePlanShortDetails;
public static synthetic fun copy$default (Lme/proton/core/paymentiap/presentation/entity/GooglePlanShortDetails;Ljava/lang/String;Ljava/lang/String;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;IILjava/util/Map;ILjava/lang/Object;)Lme/proton/core/paymentiap/presentation/entity/GooglePlanShortDetails;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;IILjava/util/Map;)Lme/proton/core/paymentiap/presentation/entity/GooglePlanShortDetails;
public static synthetic fun copy$default (Lme/proton/core/paymentiap/presentation/entity/GooglePlanShortDetails;Ljava/lang/String;Ljava/lang/String;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;IILjava/util/Map;ILjava/lang/Object;)Lme/proton/core/paymentiap/presentation/entity/GooglePlanShortDetails;
public fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public final fun getAmount ()Ljava/lang/Long;
@@ -67,7 +67,7 @@ public final class me/proton/core/paymentiap/presentation/entity/GooglePlanShort
public final fun getFormattedPriceAndCurrency ()Ljava/lang/String;
public final fun getName ()Ljava/lang/String;
public final fun getServices ()I
public final fun getSubscriptionCycle ()Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;
public final fun getSubscriptionCycle ()Lme/proton/core/payment/domain/entity/SubscriptionCycle;
public final fun getType ()I
public final fun getVendorNames ()Ljava/util/Map;
public fun hashCode ()I
@@ -76,7 +76,7 @@ public final class me/proton/core/paymentiap/presentation/entity/GooglePlanShort
}
public final class me/proton/core/paymentiap/presentation/entity/GooglePlanShortDetails$Companion {
public final fun fromPlanShortDetails (Lme/proton/core/paymentcommon/presentation/entity/PlanShortDetails;)Lme/proton/core/paymentiap/presentation/entity/GooglePlanShortDetails;
public final fun fromPlanShortDetails (Lme/proton/core/payment/presentation/entity/PlanShortDetails;)Lme/proton/core/paymentiap/presentation/entity/GooglePlanShortDetails;
}
public final class me/proton/core/paymentiap/presentation/ui/BillingIAPFragment : me/proton/core/presentation/ui/ProtonFragment {
@@ -101,85 +101,12 @@ public abstract class me/proton/core/paymentiap/presentation/ui/Hilt_BillingIAPF
public fun onGetLayoutInflater (Landroid/os/Bundle;)Landroid/view/LayoutInflater;
}
public final class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel : me/proton/core/presentation/viewmodel/ProtonViewModel {
public fun <init> (Lcom/android/billingclient/api/BillingClient;)V
public final fun getState ()Lkotlinx/coroutines/flow/StateFlow;
public final fun queryProductDetails (Ljava/lang/String;)V
}
public abstract class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State {
}
public abstract class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error : me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State {
}
public final class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$BillingClientDisconnected : me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State {
public static final field INSTANCE Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$BillingClientDisconnected;
}
public final class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$BillingClientUnavailable : me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State {
public static final field INSTANCE Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$BillingClientUnavailable;
}
public abstract class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$ProductDetailsError : me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State {
}
public final class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$ProductDetailsError$Message : me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$ProductDetailsError {
public fun <init> ()V
public fun <init> (Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$ProductDetailsError$Message;
public static synthetic fun copy$default (Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$ProductDetailsError$Message;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$ProductDetailsError$Message;
public fun equals (Ljava/lang/Object;)Z
public final fun getError ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$ProductDetailsError$Price : me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$ProductDetailsError {
public static final field INSTANCE Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$ProductDetailsError$Price;
}
public final class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$ProductDetailsError$ResponseCode : me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$ProductDetailsError {
public static final field INSTANCE Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Error$ProductDetailsError$ResponseCode;
}
public final class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$GoogleProductDetails : me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State {
public fun <init> (JLjava/lang/String;Ljava/lang/String;Lcom/android/billingclient/api/BillingResult;)V
public final fun component1 ()J
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Lcom/android/billingclient/api/BillingResult;
public final fun copy (JLjava/lang/String;Ljava/lang/String;Lcom/android/billingclient/api/BillingResult;)Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$GoogleProductDetails;
public static synthetic fun copy$default (Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$GoogleProductDetails;JLjava/lang/String;Ljava/lang/String;Lcom/android/billingclient/api/BillingResult;ILjava/lang/Object;)Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$GoogleProductDetails;
public fun equals (Ljava/lang/Object;)Z
public final fun getAmount ()J
public final fun getBillingResult ()Lcom/android/billingclient/api/BillingResult;
public final fun getCurrency ()Ljava/lang/String;
public final fun getFormattedPriceAndCurrency ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Initialized : me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State {
public static final field INSTANCE Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Initialized;
}
public final class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Initializing : me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State {
public static final field INSTANCE Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$Initializing;
}
public final class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$QueryingProductDetails : me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State {
public static final field INSTANCE Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel$State$QueryingProductDetails;
}
public final class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel_Factory : dagger/internal/Factory {
public fun <init> (Ljavax/inject/Provider;)V
public static fun create (Ljavax/inject/Provider;)Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel_Factory;
public synthetic fun get ()Ljava/lang/Object;
public fun get ()Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel;
public static fun newInstance (Lcom/android/billingclient/api/BillingClient;)Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel;
public static fun newInstance (Lcom/android/billingclient/api/BillingClient$Builder;)Lme/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel;
}
public final class me/proton/core/paymentiap/presentation/viewmodel/BillingIAPViewModel_HiltModules {
+1 -1
View File
@@ -34,7 +34,7 @@ dependencies {
project(Module.humanVerificationDomain),
project(Module.networkDomain),
project(Module.presentation),
project(Module.paymentCommonPresentation),
project(Module.paymentPresentation),
`activity-noktx`,
`constraint-layout`,
coordinatorlayout,
@@ -21,4 +21,4 @@ package me.proton.core.paymentiap.presentation
public object LogTag {
/** Default tag for this module. */
public const val DEFAULT: String = "core.paymentiap"
}
}
@@ -21,8 +21,8 @@ package me.proton.core.paymentiap.presentation.entity
import android.os.Parcelable
import kotlinx.parcelize.Parcelize
import me.proton.core.domain.entity.AppStore
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
import me.proton.core.paymentcommon.presentation.entity.PlanShortDetails
import me.proton.core.payment.domain.entity.SubscriptionCycle
import me.proton.core.payment.presentation.entity.PlanShortDetails
/**
* @param vendorNames Map of plan names for app vendors (the plan names are for the given [subscriptionCycle]).
@@ -29,8 +29,12 @@ import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import me.proton.core.domain.entity.AppStore
import me.proton.core.paymentcommon.presentation.entity.PlanShortDetails
import me.proton.core.paymentcommon.presentation.viewmodel.BillingViewModel
import me.proton.core.payment.domain.entity.PaymentType
import me.proton.core.payment.domain.entity.SubscriptionManagement
import me.proton.core.payment.presentation.entity.BillingInput
import me.proton.core.payment.presentation.entity.PlanShortDetails
import me.proton.core.payment.presentation.viewmodel.BillingCommonViewModel.Companion.buildPlansList
import me.proton.core.payment.presentation.viewmodel.BillingViewModel
import me.proton.core.paymentiap.presentation.LogTag.DEFAULT
import me.proton.core.paymentiap.presentation.R
import me.proton.core.paymentiap.presentation.databinding.FragmentBillingIapBinding
@@ -52,6 +56,8 @@ public class BillingIAPFragment : ProtonFragment(R.layout.fragment_billing_iap)
private val billingIAPViewModel by viewModels<BillingIAPViewModel>()
private val binding by viewBinding(FragmentBillingIapBinding::bind)
private var billingInput: BillingInput? = null
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
@@ -59,7 +65,7 @@ public class BillingIAPFragment : ProtonFragment(R.layout.fragment_billing_iap)
.onEach {
when (it) {
is BillingViewModel.UserInteractionState.OnLoadingStateChange -> onLoading(it.loading)
is BillingViewModel.UserInteractionState.OnPay -> onPay()
is BillingViewModel.UserInteractionState.OnPay -> onPay(it.input)
is BillingViewModel.UserInteractionState.PlanValidated -> setPlan(it.plan)
else -> {
// no operation, not interested in other events
@@ -67,26 +73,26 @@ public class BillingIAPFragment : ProtonFragment(R.layout.fragment_billing_iap)
}.exhaustive
}.launchIn(lifecycleScope)
billingIAPViewModel.state
billingIAPViewModel.billingIAPState
.onEach {
@Suppress("IMPLICIT_CAST_TO_ANY")
when (it) {
is BillingIAPViewModel.State.Initialized,
is BillingIAPViewModel.State.Initializing,
is BillingIAPViewModel.State.PurchaseStarted,
is BillingIAPViewModel.State.QueryingProductDetails -> {
// do nothing currently. maybe spinner?
}
is BillingIAPViewModel.State.Error.BillingClientDisconnected,
is BillingIAPViewModel.State.Error.BillingClientUnavailable -> {
onError(R.string.payments_iap_general_error)
}
is BillingIAPViewModel.State.GoogleProductDetails -> {
val currentPlan = binding.selectedPlanDetailsLayout.plan ?: return@onEach
binding.selectedPlanDetailsLayout.plan = currentPlan.copy(
amount = it.amount,
currency = it.currency,
formattedPriceAndCurrency = it.formattedPriceAndCurrency
)
CoreLogger.i(DEFAULT, getString(R.string.payments_iap_error_billing_client_unavailable))
onError(R.string.payments_iap_error_billing_client_unavailable)
}
is BillingIAPViewModel.State.Error.ProductDetailsError.Message -> {
CoreLogger.i(DEFAULT, getString(R.string.payments_iap_invalid_google_plan))
onError(R.string.payments_iap_invalid_google_plan)
}
is BillingIAPViewModel.State.Error.ProductDetailsError.ProductMismatch,
is BillingIAPViewModel.State.Error.ProductDetailsError.Price -> {
CoreLogger.i(DEFAULT, getString(R.string.payments_iap_error_google_plan_price))
onError(R.string.payments_iap_error_google_plan_price)
@@ -95,16 +101,36 @@ public class BillingIAPFragment : ProtonFragment(R.layout.fragment_billing_iap)
CoreLogger.i(DEFAULT, getString(R.string.payments_iap_error_fetching_google_plan))
onError(R.string.payments_iap_error_fetching_google_plan)
}
is BillingIAPViewModel.State.Initialized,
is BillingIAPViewModel.State.Initializing,
is BillingIAPViewModel.State.QueryingProductDetails -> {
// do nothing currently. maybe spinner?
is BillingIAPViewModel.State.Success.GoogleProductDetails -> {
val currentPlan = binding.selectedPlanDetailsLayout.plan ?: return@onEach
binding.selectedPlanDetailsLayout.plan = currentPlan.copy(
amount = it.amount,
currency = it.currency,
formattedPriceAndCurrency = it.formattedPriceAndCurrency
)
viewModel.setGPayButtonState(true)
}
is BillingIAPViewModel.State.Success.PurchaseSuccess -> {
onPurchaseSuccess(it.productId, it.purchaseToken, it.orderID)
}
is BillingIAPViewModel.State.Error.ProductPurchaseError.Message -> {
onError(it.error ?: R.string.payments_iap_general_error)
}
is BillingIAPViewModel.State.Success.PurchaseFlowLaunched,
is BillingIAPViewModel.State.Error.ProductPurchaseError.UserCancelled -> {
onError()
}
is BillingIAPViewModel.State.Error.ProductPurchaseError.ItemAlreadyOwned -> {
CoreLogger.i(DEFAULT, getString(R.string.payments_iap_error_already_owned))
onError(R.string.payments_iap_error_already_owned)
}
}.exhaustive
}.launchIn(lifecycleScope)
requireActivity().onBackPressedDispatcher.addCallback {
requireActivity().finish()
activity?.apply {
onBackPressedDispatcher.addCallback {
finish()
}
}
}
@@ -112,8 +138,29 @@ public class BillingIAPFragment : ProtonFragment(R.layout.fragment_billing_iap)
// no operation
}
private fun onPay() {
// TODO
private fun onPay(input: BillingInput?) {
this.billingInput = input
billingIAPViewModel.launchBillingFlow(input?.userId, requireActivity())
}
private fun onPurchaseSuccess(productId: String, purchaseToken: String, orderId: String) {
requireNotNull(billingInput)
billingInput?.let {
viewModel.subscribe(
userId = it.user,
planNames = it.existingPlans.buildPlansList(it.plan.name, it.plan.services, it.plan.type),
codes = it.codes,
currency = it.plan.currency,
cycle = it.plan.subscriptionCycle,
PaymentType.GoogleIAP(
productId = productId,
purchaseToken = purchaseToken,
orderId = orderId,
packageName = requireContext().packageName
),
subscriptionManagement = SubscriptionManagement.GOOGLE_MANAGED
)
}
}
private fun setPlan(plan: PlanShortDetails) {
@@ -127,9 +174,13 @@ public class BillingIAPFragment : ProtonFragment(R.layout.fragment_billing_iap)
billingIAPViewModel.queryProductDetails(googlePlanName)
}
}
viewModel.setGPayButtonState(false)
}
private fun onError(@StringRes error: Int) {
binding.root.errorSnack(getString(error))
private fun onError(@StringRes error: Int? = null) {
if (error != null) {
binding.root.errorSnack(getString(error))
}
viewModel.setPayButtonsState(false)
}
}
@@ -23,12 +23,10 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
import me.proton.core.paymentcommon.presentation.entity.PlanShortDetails
import me.proton.core.payment.domain.entity.SubscriptionCycle
import me.proton.core.paymentiap.presentation.R
import me.proton.core.paymentiap.presentation.databinding.PlanShortDetailsBinding
import me.proton.core.paymentiap.presentation.entity.GooglePlanShortDetails
import me.proton.core.presentation.utils.formatCentsPriceDefaultLocale
internal class PlanShortDetailsView @JvmOverloads constructor(
context: Context,
@@ -18,16 +18,22 @@
package me.proton.core.paymentiap.presentation.viewmodel
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.viewModelScope
import com.android.billingclient.api.AcknowledgePurchaseParams
import com.android.billingclient.api.BillingClient
import com.android.billingclient.api.BillingClientStateListener
import com.android.billingclient.api.BillingFlowParams
import com.android.billingclient.api.BillingResult
import com.android.billingclient.api.ProductDetails
import com.android.billingclient.api.ProductDetailsResult
import com.android.billingclient.api.Purchase
import com.android.billingclient.api.PurchasesUpdatedListener
import com.android.billingclient.api.QueryProductDetailsParams
import com.android.billingclient.api.queryProductDetails
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
@@ -36,40 +42,67 @@ import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import me.proton.core.paymentiap.presentation.LogTag.DEFAULT
import me.proton.core.presentation.viewmodel.ProtonViewModel
import me.proton.core.util.kotlin.CoreLogger
import javax.inject.Inject
@HiltViewModel
public class BillingIAPViewModel @Inject constructor(
private val billingClient: BillingClient
) : ProtonViewModel() {
internal class BillingIAPViewModel @Inject constructor(
billingClientBuilder: BillingClient.Builder
) : ProtonViewModel(), PurchasesUpdatedListener {
private val mutableState = MutableStateFlow<State>(State.Initializing)
public val state: StateFlow<State> = mutableState.asStateFlow()
private val _billingIAPState = MutableStateFlow<State>(State.Initializing)
val billingIAPState: StateFlow<State> = _billingIAPState.asStateFlow()
public sealed class State {
public object Initializing : State()
public object Initialized : State()
public object QueryingProductDetails : State()
public data class GoogleProductDetails(
val amount: Long,
val currency: String,
val formattedPriceAndCurrency: String,
val billingResult: BillingResult
) : State()
sealed class State {
object Initializing : State()
object Initialized : State()
object QueryingProductDetails : State()
object PurchaseStarted : State()
public sealed class Error : State() {
public object BillingClientUnavailable : State()
public object BillingClientDisconnected : State()
public sealed class ProductDetailsError : State() {
public object ResponseCode : ProductDetailsError()
public object Price : ProductDetailsError()
public data class Message(val error: String? = null) : ProductDetailsError()
sealed class Success : State() {
data class GoogleProductDetails(
val amount: Long,
val currency: String,
val formattedPriceAndCurrency: String,
val billingResult: BillingResult
) : Success()
object PurchaseFlowLaunched : State()
data class PurchaseSuccess(
val responseCode: Int,
val productId: String,
val purchaseToken: String,
val orderID: String
) : Success()
}
sealed class Error : State() {
object BillingClientUnavailable : State()
object BillingClientDisconnected : State()
sealed class ProductDetailsError : State() {
object ResponseCode : ProductDetailsError()
object Price : ProductDetailsError()
object ProductMismatch : ProductDetailsError()
data class Message(val error: String? = null) : ProductDetailsError()
}
sealed class ProductPurchaseError : State() {
object UserCancelled : ProductPurchaseError()
object ItemAlreadyOwned : ProductDetailsError()
data class Message(
val error: Int? = null,
@BillingClient.BillingResponseCode val code: Int
) : ProductPurchaseError()
}
}
}
private lateinit var googlePlanName: String
private lateinit var selectedProduct: ProductDetails
private var billingClient: BillingClient = billingClientBuilder.setListener(this).build()
private val billingClientStateListener = object : BillingClientStateListener {
@@ -82,21 +115,21 @@ public class BillingIAPViewModel @Inject constructor(
} else {
State.Error.BillingClientUnavailable
}
mutableState.tryEmit(state)
_billingIAPState.value = state
}
override fun onBillingServiceDisconnected() {
mutableState.tryEmit(State.Error.BillingClientDisconnected)
_billingIAPState.value = State.Error.BillingClientDisconnected
billingClient.startConnection(this)
}
}
private fun initialize() {
mutableState.tryEmit(State.Initializing)
_billingIAPState.value = State.Initializing
billingClient.startConnection(billingClientStateListener)
}
public fun queryProductDetails(planName: String) {
fun queryProductDetails(planName: String) {
googlePlanName = planName
initialize()
}
@@ -116,12 +149,19 @@ public class BillingIAPViewModel @Inject constructor(
if (result.billingResult.responseCode != BillingClient.BillingResponseCode.OK) {
emit(State.Error.ProductDetailsError.ResponseCode)
} else {
val productDetailsList = result.productDetailsList
if (productDetailsList != null) {
selectedProduct = productDetailsList.first()
} else {
emit(State.Error.ProductDetailsError.ProductMismatch)
return@flow
}
val price = result.getProductPrice()
if (price == null) {
emit(State.Error.ProductDetailsError.Price)
} else {
emit(
State.GoogleProductDetails(
State.Success.GoogleProductDetails(
amount = price.priceAmountMicros,
currency = price.priceCurrencyCode,
formattedPriceAndCurrency = price.formattedPrice,
@@ -131,9 +171,41 @@ public class BillingIAPViewModel @Inject constructor(
}
}
}.catch { error ->
mutableState.tryEmit(State.Error.ProductDetailsError.Message(error.message))
_billingIAPState.tryEmit(State.Error.ProductDetailsError.Message(error.message))
}.onEach { subscriptionState ->
mutableState.tryEmit(subscriptionState)
_billingIAPState.tryEmit(subscriptionState)
}.launchIn(viewModelScope)
// Launch Purchase flow
fun launchBillingFlow(userId: String?, activity: FragmentActivity): Job = flow {
if (!billingClient.isReady) {
CoreLogger.i(DEFAULT, "launchBillingFlow: BillingClient is not ready")
}
require(this@BillingIAPViewModel::selectedProduct.isInitialized) {
"Product must be set before launching the billing flow."
}
val offer = requireNotNull(selectedProduct.subscriptionOfferDetails?.firstOrNull())
emit(State.PurchaseStarted)
val productDetailsParamsList = listOf(
BillingFlowParams.ProductDetailsParams.newBuilder()
.setProductDetails(selectedProduct)
.setOfferToken(offer.offerToken)
.build()
)
val billingFlowParamsBuilder = BillingFlowParams.newBuilder()
.setProductDetailsParamsList(productDetailsParamsList)
if (userId != null) {
billingFlowParamsBuilder.setObfuscatedAccountId(userId)
}
billingClient.launchBillingFlow(activity, billingFlowParamsBuilder.build())
emit(State.Success.PurchaseFlowLaunched)
}.catch { error ->
_billingIAPState.tryEmit(State.Error.ProductDetailsError.Message(error.message))
}.onEach { subscriptionState ->
_billingIAPState.tryEmit(subscriptionState)
}.launchIn(viewModelScope)
override fun onCleared() {
@@ -144,4 +216,49 @@ public class BillingIAPViewModel @Inject constructor(
val offerDetails = productDetailsList?.getOrNull(0)?.subscriptionOfferDetails
return offerDetails?.getOrNull(0)?.pricingPhases?.pricingPhaseList?.getOrNull(0)
}
override fun onPurchasesUpdated(billingResult: BillingResult, purchases: List<Purchase>?) {
when {
billingResult.responseCode == BillingClient.BillingResponseCode.OK && !purchases.isNullOrEmpty() -> {
// handle the purchases
for (purchase in purchases) {
acknowledgePurchases(purchase)
}
}
billingResult.responseCode == BillingClient.BillingResponseCode.USER_CANCELED -> {
_billingIAPState.value = State.Error.ProductPurchaseError.UserCancelled
}
billingResult.responseCode == BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED -> {
_billingIAPState.value = State.Error.ProductPurchaseError.ItemAlreadyOwned
}
else -> {
_billingIAPState.value = State.Error.ProductPurchaseError.Message(code = billingResult.responseCode)
}
}
}
// Perform new subscription purchases' acknowledgement client side.
private fun acknowledgePurchases(purchase: Purchase?) {
purchase?.let {
if (!it.isAcknowledged) {
val params = AcknowledgePurchaseParams.newBuilder()
.setPurchaseToken(it.purchaseToken)
.build()
// TODO: maybe this acknowledge purchase should happen after successful subscription creation on our BE?
billingClient.acknowledgePurchase(params) { billingResult ->
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK &&
it.purchaseState == Purchase.PurchaseState.PURCHASED
) {
_billingIAPState.value = State.Success.PurchaseSuccess(
responseCode = billingResult.responseCode,
productId = selectedProduct.productId,
purchaseToken = it.purchaseToken,
orderID = it.orderId
)
}
}
}
}
}
}
@@ -22,5 +22,7 @@
<string name="payments_iap_invalid_google_plan">Invalid plan name selected. Please restart the process.</string>
<string name="payments_iap_error_google_plan_price">Problem with Google product price. Please restart the process.</string>
<string name="payments_iap_error_fetching_google_plan">Problem fetching Google product. Please restart the process.</string>
<string name="payments_iap_error_already_owned">You already own this product. Please select different one.</string>
<string name="payments_iap_error_billing_client_unavailable">The Google billing client is currently unavailable or disconnected.</string>
<string name="payments_iap_general_error">An error has occurred. Please restart the process.</string>
</resources>
-1
View File
@@ -28,7 +28,6 @@ dependencies {
api(
project(Module.paymentDagger),
project(Module.paymentDomain),
project(Module.paymentData),
project(Module.paymentPresentation)
)
}
+4 -1
View File
@@ -11,7 +11,10 @@ public final class me/proton/core/payment/dagger/BuildConfig {
public abstract interface class me/proton/core/payment/dagger/CorePaymentModule {
public static final field Companion Lme/proton/core/payment/dagger/CorePaymentModule$Companion;
public abstract fun providePaymentsRepository (Lme/proton/core/payment/data/repository/PaymentsRepositoryImpl;)Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;
public abstract fun provideActivePaymentProvider (Lme/proton/core/payment/presentation/ActivePaymentProviderImpl;)Lme/proton/core/payment/presentation/ActivePaymentProvider;
public abstract fun provideGooglePlayBillingLibrary (Lme/proton/core/payment/data/ProtonIAPBillingLibraryImpl;)Lme/proton/core/payment/domain/usecase/ProtonIAPBillingLibrary;
public abstract fun providePaymentManager (Lme/proton/core/payment/data/PaymentManagerImpl;)Lme/proton/core/payment/domain/PaymentManager;
public abstract fun providePaymentsRepository (Lme/proton/core/payment/data/repository/PaymentsRepositoryImpl;)Lme/proton/core/payment/domain/repository/PaymentsRepository;
}
public final class me/proton/core/payment/dagger/CorePaymentModule$Companion {
@@ -23,19 +23,36 @@ import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import me.proton.core.payment.data.repository.PaymentsRepositoryImpl
import me.proton.core.payment.data.PaymentManagerImpl
import me.proton.core.payment.presentation.entity.SecureEndpoint
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.payment.data.ProtonIAPBillingLibraryImpl
import me.proton.core.payment.data.repository.PaymentsRepositoryImpl
import me.proton.core.payment.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.usecase.ProtonIAPBillingLibrary
import me.proton.core.payment.presentation.ActivePaymentProvider
import me.proton.core.payment.presentation.ActivePaymentProviderImpl
import me.proton.core.payment.domain.PaymentManager
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
public interface CorePaymentModule {
@Binds
@Singleton
public fun providePaymentManager(impl: PaymentManagerImpl): PaymentManager
@Binds
@Singleton
public fun providePaymentsRepository(impl: PaymentsRepositoryImpl): PaymentsRepository
@Binds
@Singleton
public fun provideGooglePlayBillingLibrary(impl: ProtonIAPBillingLibraryImpl): ProtonIAPBillingLibrary
@Binds
public fun provideActivePaymentProvider(impl: ActivePaymentProviderImpl): ActivePaymentProvider
public companion object {
@Provides
@Singleton
+55 -6
View File
@@ -5,6 +5,18 @@ public final class me/proton/core/payment/data/BuildConfig {
public fun <init> ()V
}
public final class me/proton/core/payment/data/PaymentManagerImpl : me/proton/core/payment/domain/PaymentManager {
public fun <init> (Lme/proton/core/user/domain/UserManager;Lme/proton/core/payment/domain/usecase/GetAvailablePaymentProviders;)V
public fun getPaymentProviders (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun isSubscriptionAvailable (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun isUpgradeAvailable (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/payment/data/ProtonIAPBillingLibraryImpl : me/proton/core/payment/domain/usecase/ProtonIAPBillingLibrary {
public fun <init> ()V
public fun isAvailable ()Z
}
public final class me/proton/core/payment/data/api/request/CardDetailsBody {
public static final field Companion Lme/proton/core/payment/data/api/request/CardDetailsBody$Companion;
public synthetic fun <init> (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
@@ -47,16 +59,53 @@ public final class me/proton/core/payment/data/api/request/CardDetailsBody$Compa
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public final class me/proton/core/payment/data/repository/PaymentsRepositoryImpl : me/proton/core/paymentcommon/domain/repository/PaymentsRepository {
public final class me/proton/core/payment/data/api/request/IAPDetailsBody {
public static final field Companion Lme/proton/core/payment/data/api/request/IAPDetailsBody$Companion;
public synthetic fun <init> (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lme/proton/core/payment/data/api/request/IAPDetailsBody;
public static synthetic fun copy$default (Lme/proton/core/payment/data/api/request/IAPDetailsBody;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/payment/data/api/request/IAPDetailsBody;
public fun equals (Ljava/lang/Object;)Z
public final fun getOrderId ()Ljava/lang/String;
public final fun getPackageName ()Ljava/lang/String;
public final fun getProductId ()Ljava/lang/String;
public final fun getPurchaseToken ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Lme/proton/core/payment/data/api/request/IAPDetailsBody;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class me/proton/core/payment/data/api/request/IAPDetailsBody$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lme/proton/core/payment/data/api/request/IAPDetailsBody$$serializer;
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lme/proton/core/payment/data/api/request/IAPDetailsBody;
public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lme/proton/core/payment/data/api/request/IAPDetailsBody;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}
public final class me/proton/core/payment/data/api/request/IAPDetailsBody$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public final class me/proton/core/payment/data/repository/PaymentsRepositoryImpl : me/proton/core/payment/domain/repository/PaymentsRepository {
public fun <init> (Lme/proton/core/network/data/ApiProvider;)V
public fun createOrUpdateSubscription (Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/PaymentBody;Ljava/util/List;Ljava/util/Map;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun createPaymentTokenExistingPaymentMethod (Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun createPaymentTokenNewCreditCard (Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/PaymentType$CreditCard;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun createPaymentTokenNewPayPal (Lme/proton/core/domain/entity/UserId;JLme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/PaymentType$PayPal;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun createOrUpdateSubscription (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentBody;Ljava/util/List;Ljava/util/Map;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Lme/proton/core/payment/domain/entity/SubscriptionManagement;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun createPaymentTokenExistingPaymentMethod (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun createPaymentTokenGoogleIAP (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentType$GoogleIAP;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun createPaymentTokenNewCreditCard (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentType$CreditCard;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun createPaymentTokenNewPayPal (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentType$PayPal;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun getAvailablePaymentMethods (Lme/proton/core/domain/entity/UserId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun getPaymentStatus (Lme/proton/core/domain/entity/UserId;Lme/proton/core/domain/entity/AppStore;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun getPaymentTokenStatus (Lme/proton/core/domain/entity/UserId;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun getSubscription (Lme/proton/core/domain/entity/UserId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun validateSubscription (Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/Map;Lme/proton/core/paymentcommon/domain/entity/Currency;Lme/proton/core/paymentcommon/domain/entity/SubscriptionCycle;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun validateSubscription (Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/Map;Lme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
+3 -7
View File
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2021 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,10 +23,6 @@ plugins {
kotlin("plugin.serialization")
}
proton {
apiModeDisabled()
}
publishOption.shouldBePublishedAsLib = true
dependencies {
@@ -34,7 +30,6 @@ dependencies {
project(Module.domain),
project(Module.networkData),
project(Module.paymentDomain),
project(Module.paymentCommonDomain),
`javax-inject`,
`serialization-core`
)
@@ -42,6 +37,7 @@ dependencies {
implementation(
project(Module.kotlinUtil),
project(Module.networkDomain),
project(Module.userDomain),
project(Module.planDomain),
retrofit,
)
@@ -16,18 +16,18 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.payment.data.usecase
package me.proton.core.payment.data
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertFalse
class ProtonIAPBillingLibraryImplTest {
private lateinit var tested: GooglePlayBillingLibraryImpl
private lateinit var tested: ProtonIAPBillingLibraryImpl
@BeforeTest
fun setUp() {
tested = GooglePlayBillingLibraryImpl()
tested = ProtonIAPBillingLibraryImpl()
}
@Test
@@ -16,12 +16,12 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.data
package me.proton.core.payment.data
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.PaymentManager
import me.proton.core.paymentcommon.domain.usecase.GetAvailablePaymentProviders
import me.proton.core.paymentcommon.domain.usecase.PaymentProvider
import me.proton.core.payment.domain.usecase.GetAvailablePaymentProviders
import me.proton.core.payment.domain.usecase.PaymentProvider
import me.proton.core.payment.domain.PaymentManager
import me.proton.core.user.domain.UserManager
import me.proton.core.user.domain.extension.canReadSubscription
import javax.inject.Inject
@@ -16,9 +16,9 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.data
package me.proton.core.payment.data
import me.proton.core.paymentcommon.domain.usecase.ProtonIAPBillingLibrary
import me.proton.core.payment.domain.usecase.ProtonIAPBillingLibrary
import javax.inject.Inject
public class ProtonIAPBillingLibraryImpl @Inject constructor() : ProtonIAPBillingLibrary {
@@ -43,6 +43,27 @@ internal interface PaymentsApi : BaseRetrofitApi {
@POST("payments/v4/tokens")
suspend fun createPaymentToken(@Body body: CreatePaymentToken): CreatePaymentTokenResponse
/**
* Creates new or updates the current active subscription.
* Authorized.
*/
@POST("payments/v4/subscription")
suspend fun createUpdateSubscription(@Body body: CreateSubscription): SubscriptionResponse
/**
* Returns current active subscription.
* Authorized.
*/
@GET("payments/v4/subscription")
suspend fun getCurrentSubscription(): SubscriptionResponse
/**
* Returns the status of payment processors.
* @param appVendor The app vendor for the app (e.g. "google" or "fdroid").
*/
@GET("payments/v4/status/{appVendor}")
suspend fun paymentStatus(@Path("appVendor") appVendor: String): PaymentStatusResponse
/**
* Could be used during account creation as well as a regular Authenticated for plan upgrade for logged in users.
* Check payment token status (usually with polling).
@@ -58,20 +79,6 @@ internal interface PaymentsApi : BaseRetrofitApi {
@GET("payments/v4/methods")
suspend fun getPaymentMethods(): PaymentMethodsResponse
/**
* Returns current active subscription.
* Authorized.
*/
@GET("payments/v4/subscription")
suspend fun getCurrentSubscription(): SubscriptionResponse
/**
* Creates new or updates the current active subscription.
* Authorized.
*/
@POST("payments/v4/subscription")
suspend fun createUpdateSubscription(@Body body: CreateSubscription): SubscriptionResponse
/**
* It checks given a particular plans and cycles how much a user should pay.
* It also takes into an account any special coupon or gift codes.
@@ -80,11 +87,4 @@ internal interface PaymentsApi : BaseRetrofitApi {
*/
@POST("payments/v4/subscription/check")
suspend fun validateSubscription(@Body body: CheckSubscription): CheckSubscriptionResponse
/**
* Returns the status of payment processors.
* @param appVendor The app vendor for the app (e.g. "google" or "fdroid").
*/
@GET("payments/v4/status/{appVendor}")
suspend fun paymentStatus(@Path("appVendor") appVendor: String): PaymentStatusResponse
}
@@ -22,7 +22,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class CardDetailsBody(
public data class CardDetailsBody(
@SerialName("ExpMonth")
val expirationMonth: String,
@SerialName("ExpYear")
@@ -32,12 +32,3 @@ internal data class CreatePaymentToken(
@SerialName("PaymentMethodID")
val paymentMethodId: String?
)
@Serializable
internal sealed class PaymentTypeEntity(@SerialName("Type") val type: String) {
@Serializable
object PayPal : PaymentTypeEntity("paypal")
@Serializable
data class Card(@SerialName("Details") val details: CardDetailsBody) : PaymentTypeEntity("card")
}
@@ -34,5 +34,7 @@ internal data class CreateSubscription(
@SerialName("Plans")
val plans: Map<String, Int>,
@SerialName("Cycle")
val cycle: Int
val cycle: Int,
@SerialName("External")
val external: Int
)
@@ -16,32 +16,19 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
import studio.forface.easygradle.dsl.*
package me.proton.core.payment.data.api.request
plugins {
protonKotlinLibrary
}
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
publishOption.shouldBePublishedAsLib = true
dependencies {
api(
project(Module.domain),
`javax-inject`
)
implementation(
project(Module.humanVerificationDomain),
project(Module.accountManagerDomain),
project(Module.featureFlagDomain),
project(Module.planDomain),
`coroutines-core`,
)
testImplementation(
`coroutines-test`,
junit,
`kotlin-test`,
mockk
)
}
@Serializable
public data class IAPDetailsBody(
@SerialName("productID")
val productId: String,
@SerialName("purchaseToken")
val purchaseToken: String,
@SerialName("orderID")
val orderId: String,
@SerialName("packageName")
val packageName: String
)
@@ -16,19 +16,19 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
import studio.forface.easygradle.dsl.*
package me.proton.core.payment.data.api.request
plugins {
protonAndroidLibrary
protonDagger
}
publishOption.shouldBePublishedAsLib = true
dependencies {
api(
project(Module.paymentCommonData),
project(Module.paymentCommonDomain),
project(Module.paymentCommonPresentation),
)
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
internal sealed class PaymentTypeEntity(@SerialName("Type") val type: String) {
@Serializable
object PayPal : PaymentTypeEntity("paypal")
@Serializable
data class Card(@SerialName("Details") val details: CardDetailsBody) : PaymentTypeEntity("card")
@Serializable
data class GoogleIAP(@SerialName("Details") val details: IAPDetailsBody) : PaymentTypeEntity("google")
}
@@ -20,9 +20,9 @@ package me.proton.core.payment.data.api.response
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
import me.proton.core.paymentcommon.domain.entity.SubscriptionStatus
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.SubscriptionCycle
import me.proton.core.payment.domain.entity.SubscriptionStatus
@Serializable
internal data class CheckSubscriptionResponse(
@@ -20,7 +20,7 @@ package me.proton.core.payment.data.api.response
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import me.proton.core.paymentcommon.domain.entity.Coupon
import me.proton.core.payment.domain.entity.Coupon
@Serializable
internal data class CouponEntity(
@@ -20,8 +20,8 @@ package me.proton.core.payment.data.api.response
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import me.proton.core.paymentcommon.domain.entity.PaymentToken
import me.proton.core.paymentcommon.domain.entity.PaymentTokenStatus
import me.proton.core.payment.domain.entity.PaymentToken
import me.proton.core.payment.domain.entity.PaymentTokenStatus
@Serializable
internal data class CreatePaymentTokenResponse(
@@ -20,8 +20,8 @@ package me.proton.core.payment.data.api.response
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import me.proton.core.paymentcommon.domain.entity.Card
import me.proton.core.paymentcommon.domain.entity.Details
import me.proton.core.payment.domain.entity.Card
import me.proton.core.payment.domain.entity.Details
import me.proton.core.util.kotlin.exhaustive
@Serializable
@@ -20,7 +20,7 @@ package me.proton.core.payment.data.api.response
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import me.proton.core.paymentcommon.domain.entity.PaymentStatus
import me.proton.core.payment.domain.entity.PaymentStatus
import me.proton.core.util.kotlin.toBooleanOrFalse
@Serializable
@@ -20,8 +20,8 @@ package me.proton.core.payment.data.api.response
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import me.proton.core.paymentcommon.domain.entity.PaymentToken
import me.proton.core.paymentcommon.domain.entity.PaymentTokenStatus
import me.proton.core.payment.domain.entity.PaymentToken
import me.proton.core.payment.domain.entity.PaymentTokenStatus
@Serializable
internal data class PaymentTokenStatusResponse(
@@ -20,8 +20,8 @@ package me.proton.core.payment.data.api.response
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import me.proton.core.paymentcommon.domain.entity.Subscription
import me.proton.core.paymentcommon.domain.entity.SubscriptionManagement
import me.proton.core.payment.domain.entity.Subscription
import me.proton.core.payment.domain.entity.SubscriptionManagement
@Serializable
internal data class SubscriptionItemResponse(
@@ -26,25 +26,27 @@ import me.proton.core.payment.data.api.request.CardDetailsBody
import me.proton.core.payment.data.api.request.CheckSubscription
import me.proton.core.payment.data.api.request.CreatePaymentToken
import me.proton.core.payment.data.api.request.CreateSubscription
import me.proton.core.payment.data.api.request.IAPDetailsBody
import me.proton.core.payment.data.api.request.PaymentTypeEntity
import me.proton.core.payment.data.api.request.TokenDetails
import me.proton.core.payment.data.api.request.TokenTypePaymentBody
import me.proton.core.paymentcommon.domain.entity.Card
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.PaymentBody
import me.proton.core.paymentcommon.domain.entity.PaymentMethod
import me.proton.core.paymentcommon.domain.entity.PaymentMethodType
import me.proton.core.paymentcommon.domain.entity.PaymentStatus
import me.proton.core.paymentcommon.domain.entity.PaymentToken
import me.proton.core.paymentcommon.domain.entity.PaymentType
import me.proton.core.paymentcommon.domain.entity.Subscription
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
import me.proton.core.paymentcommon.domain.entity.SubscriptionStatus
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.paymentcommon.domain.repository.PlanQuantity
import me.proton.core.payment.domain.entity.Card
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.PaymentBody
import me.proton.core.payment.domain.entity.PaymentMethod
import me.proton.core.payment.domain.entity.PaymentMethodType
import me.proton.core.payment.domain.entity.PaymentStatus
import me.proton.core.payment.domain.entity.PaymentToken
import me.proton.core.payment.domain.entity.PaymentType
import me.proton.core.payment.domain.entity.Subscription
import me.proton.core.payment.domain.entity.SubscriptionCycle
import me.proton.core.payment.domain.entity.SubscriptionManagement
import me.proton.core.payment.domain.entity.SubscriptionStatus
import me.proton.core.payment.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.repository.PlanQuantity
import javax.inject.Inject
class PaymentsRepositoryImpl @Inject constructor(
public class PaymentsRepositoryImpl @Inject constructor(
private val provider: ApiProvider
) : PaymentsRepository {
@@ -106,6 +108,25 @@ class PaymentsRepositoryImpl @Inject constructor(
createPaymentToken(request).toCreatePaymentTokenResult()
}.valueOrThrow
override suspend fun createPaymentTokenGoogleIAP(
sessionUserId: SessionUserId?,
amount: Long,
currency: Currency,
paymentType: PaymentType.GoogleIAP
): PaymentToken.CreatePaymentTokenResult =
provider.get<PaymentsApi>(sessionUserId).invoke {
val payment = PaymentTypeEntity.GoogleIAP(
IAPDetailsBody(
productId = paymentType.productId,
purchaseToken = paymentType.purchaseToken,
orderId = paymentType.orderId,
packageName = paymentType.packageName
)
)
val request = CreatePaymentToken(amount, currency.name, payment, null)
createPaymentToken(request).toCreatePaymentTokenResult()
}.valueOrThrow
override suspend fun getPaymentTokenStatus(
sessionUserId: SessionUserId?,
paymentToken: String
@@ -146,7 +167,8 @@ class PaymentsRepositoryImpl @Inject constructor(
payment: PaymentBody?,
codes: List<String>?,
plans: PlanQuantity,
cycle: SubscriptionCycle
cycle: SubscriptionCycle,
subscriptionManagement: SubscriptionManagement
): Subscription =
provider.get<PaymentsApi>(sessionUserId).invoke {
val paymentBodyEntity = if (payment is PaymentBody.TokenPaymentBody) {
@@ -159,7 +181,8 @@ class PaymentsRepositoryImpl @Inject constructor(
paymentBodyEntity,
codes,
plans,
cycle.value
cycle.value,
subscriptionManagement.value
)
).subscription.toSubscription()
}.valueOrThrow
@@ -16,15 +16,15 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.data
package me.proton.core.payment.data
import io.mockk.coEvery
import io.mockk.every
import io.mockk.mockk
import kotlinx.coroutines.test.runBlockingTest
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.usecase.GetAvailablePaymentProviders
import me.proton.core.paymentcommon.domain.usecase.PaymentProvider
import me.proton.core.payment.domain.usecase.GetAvailablePaymentProviders
import me.proton.core.payment.domain.usecase.PaymentProvider
import me.proton.core.user.domain.UserManager
import me.proton.core.user.domain.entity.Role
import org.junit.Test
@@ -33,7 +33,7 @@ import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
class PaymentManagerTest {
class PaymentManagerImplTest {
private val currentUserId: UserId = UserId("current")
private var currentRole: Role = Role.NoOrganization
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -33,20 +33,20 @@ import me.proton.core.network.domain.ApiResult
import me.proton.core.network.domain.session.SessionId
import me.proton.core.network.domain.session.SessionProvider
import me.proton.core.payment.data.api.PaymentsApi
import me.proton.core.paymentcommon.domain.entity.Card
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.Details
import me.proton.core.paymentcommon.domain.entity.PaymentBody
import me.proton.core.paymentcommon.domain.entity.PaymentMethod
import me.proton.core.paymentcommon.domain.entity.PaymentMethodType
import me.proton.core.paymentcommon.domain.entity.PaymentStatus
import me.proton.core.paymentcommon.domain.entity.PaymentToken
import me.proton.core.paymentcommon.domain.entity.PaymentTokenStatus
import me.proton.core.paymentcommon.domain.entity.PaymentType
import me.proton.core.paymentcommon.domain.entity.Subscription
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
import me.proton.core.paymentcommon.domain.entity.SubscriptionManagement
import me.proton.core.paymentcommon.domain.entity.SubscriptionStatus
import me.proton.core.payment.domain.entity.Card
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.Details
import me.proton.core.payment.domain.entity.PaymentBody
import me.proton.core.payment.domain.entity.PaymentMethod
import me.proton.core.payment.domain.entity.PaymentMethodType
import me.proton.core.payment.domain.entity.PaymentStatus
import me.proton.core.payment.domain.entity.PaymentToken
import me.proton.core.payment.domain.entity.PaymentTokenStatus
import me.proton.core.payment.domain.entity.PaymentType
import me.proton.core.payment.domain.entity.Subscription
import me.proton.core.payment.domain.entity.SubscriptionCycle
import me.proton.core.payment.domain.entity.SubscriptionManagement
import me.proton.core.payment.domain.entity.SubscriptionStatus
import me.proton.core.test.kotlin.TestDispatcherProvider
import me.proton.core.test.kotlin.assertIs
import org.junit.Before
@@ -387,7 +387,8 @@ class PaymentsRepositoryImplTest {
codes = null,
plans = mapOf("test-plan-id" to 1),
cycle = SubscriptionCycle.YEARLY,
payment = PaymentBody.TokenPaymentBody("test-token-id")
payment = PaymentBody.TokenPaymentBody("test-token-id"),
subscriptionManagement = SubscriptionManagement.PROTON_MANAGED
)
// THEN
assertNotNull(createSubscriptionResult)
@@ -408,7 +409,8 @@ class PaymentsRepositoryImplTest {
codes = null,
plans = mapOf("test-plan-id" to 1),
cycle = SubscriptionCycle.YEARLY,
payment = PaymentBody.TokenPaymentBody("test-token-id")
payment = PaymentBody.TokenPaymentBody("test-token-id"),
subscriptionManagement = SubscriptionManagement.PROTON_MANAGED
)
}
// THEN
+432 -3
View File
@@ -1,15 +1,444 @@
public final class me/proton/core/payment/domain/ConstKt {
public static final field MAX_PLAN_QUANTITY I
}
public abstract interface class me/proton/core/payment/domain/PaymentManager {
public abstract fun getPaymentProviders (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun isSubscriptionAvailable (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun isUpgradeAvailable (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/payment/domain/PaymentManager$DefaultImpls {
public static synthetic fun getPaymentProviders$default (Lme/proton/core/payment/domain/PaymentManager;Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun isSubscriptionAvailable$default (Lme/proton/core/payment/domain/PaymentManager;Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun isUpgradeAvailable$default (Lme/proton/core/payment/domain/PaymentManager;Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
public abstract class me/proton/core/payment/domain/entity/Card {
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun getCountry ()Ljava/lang/String;
public fun getExpirationMonth ()Ljava/lang/String;
public fun getExpirationYear ()Ljava/lang/String;
public fun getName ()Ljava/lang/String;
public fun getZip ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/Card$CardReadOnly : me/proton/core/payment/domain/entity/Card {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Ljava/lang/String;
public final fun component5 ()Ljava/lang/String;
public final fun component6 ()Ljava/lang/String;
public final fun component7 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lme/proton/core/payment/domain/entity/Card$CardReadOnly;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/Card$CardReadOnly;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/Card$CardReadOnly;
public fun equals (Ljava/lang/Object;)Z
public final fun getBrand ()Ljava/lang/String;
public fun getCountry ()Ljava/lang/String;
public fun getExpirationMonth ()Ljava/lang/String;
public fun getExpirationYear ()Ljava/lang/String;
public final fun getLast4 ()Ljava/lang/String;
public fun getName ()Ljava/lang/String;
public fun getZip ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/Card$CardWithPaymentDetails : me/proton/core/payment/domain/entity/Card {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Ljava/lang/String;
public final fun component5 ()Ljava/lang/String;
public final fun component6 ()Ljava/lang/String;
public final fun component7 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lme/proton/core/payment/domain/entity/Card$CardWithPaymentDetails;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/Card$CardWithPaymentDetails;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/Card$CardWithPaymentDetails;
public fun equals (Ljava/lang/Object;)Z
public fun getCountry ()Ljava/lang/String;
public final fun getCvc ()Ljava/lang/String;
public fun getExpirationMonth ()Ljava/lang/String;
public fun getExpirationYear ()Ljava/lang/String;
public fun getName ()Ljava/lang/String;
public final fun getNumber ()Ljava/lang/String;
public fun getZip ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/Coupon {
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/lang/String;)Lme/proton/core/payment/domain/entity/Coupon;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/Coupon;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/Coupon;
public fun equals (Ljava/lang/Object;)Z
public final fun getCode ()Ljava/lang/String;
public final fun getDescription ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/Currency : java/lang/Enum {
public static final field CHF Lme/proton/core/payment/domain/entity/Currency;
public static final field EUR Lme/proton/core/payment/domain/entity/Currency;
public static final field USD Lme/proton/core/payment/domain/entity/Currency;
public static fun valueOf (Ljava/lang/String;)Lme/proton/core/payment/domain/entity/Currency;
public static fun values ()[Lme/proton/core/payment/domain/entity/Currency;
}
public abstract class me/proton/core/payment/domain/entity/Details {
}
public final class me/proton/core/payment/domain/entity/Details$CardDetails : me/proton/core/payment/domain/entity/Details {
public fun <init> (Lme/proton/core/payment/domain/entity/Card$CardReadOnly;)V
public final fun component1 ()Lme/proton/core/payment/domain/entity/Card$CardReadOnly;
public final fun copy (Lme/proton/core/payment/domain/entity/Card$CardReadOnly;)Lme/proton/core/payment/domain/entity/Details$CardDetails;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/Details$CardDetails;Lme/proton/core/payment/domain/entity/Card$CardReadOnly;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/Details$CardDetails;
public fun equals (Ljava/lang/Object;)Z
public final fun getCardDetails ()Lme/proton/core/payment/domain/entity/Card$CardReadOnly;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/Details$PayPalDetails : me/proton/core/payment/domain/entity/Details {
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/lang/String;)Lme/proton/core/payment/domain/entity/Details$PayPalDetails;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/Details$PayPalDetails;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/Details$PayPalDetails;
public fun equals (Ljava/lang/Object;)Z
public final fun getBillingAgreementId ()Ljava/lang/String;
public final fun getPayer ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public abstract class me/proton/core/payment/domain/entity/PaymentBody {
public synthetic fun <init> (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getType ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/PaymentBody$TokenPaymentBody : me/proton/core/payment/domain/entity/PaymentBody {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lme/proton/core/payment/domain/entity/PaymentBody$TokenPaymentBody;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/PaymentBody$TokenPaymentBody;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/PaymentBody$TokenPaymentBody;
public fun equals (Ljava/lang/Object;)Z
public final fun getToken ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/PaymentMethod {
public fun <init> (Ljava/lang/String;Lme/proton/core/payment/domain/entity/PaymentMethodType;Lme/proton/core/payment/domain/entity/Details;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Lme/proton/core/payment/domain/entity/PaymentMethodType;
public final fun component3 ()Lme/proton/core/payment/domain/entity/Details;
public final fun copy (Ljava/lang/String;Lme/proton/core/payment/domain/entity/PaymentMethodType;Lme/proton/core/payment/domain/entity/Details;)Lme/proton/core/payment/domain/entity/PaymentMethod;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/PaymentMethod;Ljava/lang/String;Lme/proton/core/payment/domain/entity/PaymentMethodType;Lme/proton/core/payment/domain/entity/Details;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/PaymentMethod;
public fun equals (Ljava/lang/Object;)Z
public final fun getDetails ()Lme/proton/core/payment/domain/entity/Details;
public final fun getId ()Ljava/lang/String;
public final fun getType ()Lme/proton/core/payment/domain/entity/PaymentMethodType;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/PaymentMethodType : java/lang/Enum {
public static final field CARD Lme/proton/core/payment/domain/entity/PaymentMethodType;
public static final field Companion Lme/proton/core/payment/domain/entity/PaymentMethodType$Companion;
public static final field PAYPAL Lme/proton/core/payment/domain/entity/PaymentMethodType;
public final fun getValue ()Ljava/lang/String;
public static fun valueOf (Ljava/lang/String;)Lme/proton/core/payment/domain/entity/PaymentMethodType;
public static fun values ()[Lme/proton/core/payment/domain/entity/PaymentMethodType;
}
public final class me/proton/core/payment/domain/entity/PaymentMethodType$Companion {
public final fun getMap ()Ljava/util/Map;
}
public final class me/proton/core/payment/domain/entity/PaymentStatus {
public fun <init> (Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)V
public final fun component1 ()Ljava/lang/Boolean;
public final fun component2 ()Ljava/lang/Boolean;
public final fun component3 ()Ljava/lang/Boolean;
public final fun copy (Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lme/proton/core/payment/domain/entity/PaymentStatus;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/PaymentStatus;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/PaymentStatus;
public fun equals (Ljava/lang/Object;)Z
public final fun getCard ()Ljava/lang/Boolean;
public final fun getInApp ()Ljava/lang/Boolean;
public final fun getPaypal ()Ljava/lang/Boolean;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public abstract class me/proton/core/payment/domain/entity/PaymentToken {
public synthetic fun <init> (Lme/proton/core/payment/domain/entity/PaymentTokenStatus;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun getStatus ()Lme/proton/core/payment/domain/entity/PaymentTokenStatus;
}
public final class me/proton/core/payment/domain/entity/PaymentToken$CreatePaymentTokenResult : me/proton/core/payment/domain/entity/PaymentToken {
public fun <init> (Lme/proton/core/payment/domain/entity/PaymentTokenStatus;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public final fun component1 ()Lme/proton/core/payment/domain/entity/PaymentTokenStatus;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Ljava/lang/String;
public final fun copy (Lme/proton/core/payment/domain/entity/PaymentTokenStatus;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lme/proton/core/payment/domain/entity/PaymentToken$CreatePaymentTokenResult;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/PaymentToken$CreatePaymentTokenResult;Lme/proton/core/payment/domain/entity/PaymentTokenStatus;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/PaymentToken$CreatePaymentTokenResult;
public fun equals (Ljava/lang/Object;)Z
public final fun getApprovalUrl ()Ljava/lang/String;
public final fun getReturnHost ()Ljava/lang/String;
public fun getStatus ()Lme/proton/core/payment/domain/entity/PaymentTokenStatus;
public final fun getToken ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/PaymentToken$PaymentTokenStatusResult : me/proton/core/payment/domain/entity/PaymentToken {
public fun <init> (Lme/proton/core/payment/domain/entity/PaymentTokenStatus;)V
public final fun component1 ()Lme/proton/core/payment/domain/entity/PaymentTokenStatus;
public final fun copy (Lme/proton/core/payment/domain/entity/PaymentTokenStatus;)Lme/proton/core/payment/domain/entity/PaymentToken$PaymentTokenStatusResult;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/PaymentToken$PaymentTokenStatusResult;Lme/proton/core/payment/domain/entity/PaymentTokenStatus;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/PaymentToken$PaymentTokenStatusResult;
public fun equals (Ljava/lang/Object;)Z
public fun getStatus ()Lme/proton/core/payment/domain/entity/PaymentTokenStatus;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/PaymentTokenStatus : java/lang/Enum {
public static final field CHARGEABLE Lme/proton/core/payment/domain/entity/PaymentTokenStatus;
public static final field CONSUMED Lme/proton/core/payment/domain/entity/PaymentTokenStatus;
public static final field Companion Lme/proton/core/payment/domain/entity/PaymentTokenStatus$Companion;
public static final field FAILED Lme/proton/core/payment/domain/entity/PaymentTokenStatus;
public static final field NOT_SUPPORTED Lme/proton/core/payment/domain/entity/PaymentTokenStatus;
public static final field PENDING Lme/proton/core/payment/domain/entity/PaymentTokenStatus;
public static fun valueOf (Ljava/lang/String;)Lme/proton/core/payment/domain/entity/PaymentTokenStatus;
public static fun values ()[Lme/proton/core/payment/domain/entity/PaymentTokenStatus;
}
public final class me/proton/core/payment/domain/entity/PaymentTokenStatus$Companion {
public final fun getMap ()Ljava/util/Map;
}
public abstract class me/proton/core/payment/domain/entity/PaymentType {
public synthetic fun <init> (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getType ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/PaymentType$CreditCard : me/proton/core/payment/domain/entity/PaymentType {
public fun <init> (Lme/proton/core/payment/domain/entity/Card;)V
public final fun component1 ()Lme/proton/core/payment/domain/entity/Card;
public final fun copy (Lme/proton/core/payment/domain/entity/Card;)Lme/proton/core/payment/domain/entity/PaymentType$CreditCard;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/PaymentType$CreditCard;Lme/proton/core/payment/domain/entity/Card;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/PaymentType$CreditCard;
public fun equals (Ljava/lang/Object;)Z
public final fun getCard ()Lme/proton/core/payment/domain/entity/Card;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/PaymentType$GoogleIAP : me/proton/core/payment/domain/entity/PaymentType {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lme/proton/core/payment/domain/entity/PaymentType$GoogleIAP;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/PaymentType$GoogleIAP;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/PaymentType$GoogleIAP;
public fun equals (Ljava/lang/Object;)Z
public final fun getOrderId ()Ljava/lang/String;
public final fun getPackageName ()Ljava/lang/String;
public final fun getProductId ()Ljava/lang/String;
public final fun getPurchaseToken ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/PaymentType$PayPal : me/proton/core/payment/domain/entity/PaymentType {
public static final field INSTANCE Lme/proton/core/payment/domain/entity/PaymentType$PayPal;
}
public final class me/proton/core/payment/domain/entity/PaymentType$PaymentMethod : me/proton/core/payment/domain/entity/PaymentType {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lme/proton/core/payment/domain/entity/PaymentType$PaymentMethod;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/PaymentType$PaymentMethod;Ljava/lang/String;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/PaymentType$PaymentMethod;
public fun equals (Ljava/lang/Object;)Z
public final fun getPaymentMethodId ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/Subscription {
public fun <init> (Ljava/lang/String;Ljava/lang/String;IJJLjava/lang/String;Ljava/lang/String;JLme/proton/core/payment/domain/entity/SubscriptionManagement;Ljava/util/List;)V
public final fun component1 ()Ljava/lang/String;
public final fun component10 ()Ljava/util/List;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()I
public final fun component4 ()J
public final fun component5 ()J
public final fun component6 ()Ljava/lang/String;
public final fun component7 ()Ljava/lang/String;
public final fun component8 ()J
public final fun component9 ()Lme/proton/core/payment/domain/entity/SubscriptionManagement;
public final fun copy (Ljava/lang/String;Ljava/lang/String;IJJLjava/lang/String;Ljava/lang/String;JLme/proton/core/payment/domain/entity/SubscriptionManagement;Ljava/util/List;)Lme/proton/core/payment/domain/entity/Subscription;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/Subscription;Ljava/lang/String;Ljava/lang/String;IJJLjava/lang/String;Ljava/lang/String;JLme/proton/core/payment/domain/entity/SubscriptionManagement;Ljava/util/List;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/Subscription;
public fun equals (Ljava/lang/Object;)Z
public final fun getAmount ()J
public final fun getCouponCode ()Ljava/lang/String;
public final fun getCurrency ()Ljava/lang/String;
public final fun getCycle ()I
public final fun getExternal ()Lme/proton/core/payment/domain/entity/SubscriptionManagement;
public final fun getId ()Ljava/lang/String;
public final fun getInvoiceId ()Ljava/lang/String;
public final fun getPeriodEnd ()J
public final fun getPeriodStart ()J
public final fun getPlans ()Ljava/util/List;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class me/proton/core/payment/domain/entity/SubscriptionCycle : java/lang/Enum {
public static final field Companion Lme/proton/core/payment/domain/entity/SubscriptionCycle$Companion;
public static final field FREE Lme/proton/core/payment/domain/entity/SubscriptionCycle;
public static final field MONTHLY Lme/proton/core/payment/domain/entity/SubscriptionCycle;
public static final field TWO_YEARS Lme/proton/core/payment/domain/entity/SubscriptionCycle;
public static final field YEARLY Lme/proton/core/payment/domain/entity/SubscriptionCycle;
public final fun getValue ()I
public static fun valueOf (Ljava/lang/String;)Lme/proton/core/payment/domain/entity/SubscriptionCycle;
public static fun values ()[Lme/proton/core/payment/domain/entity/SubscriptionCycle;
}
public final class me/proton/core/payment/domain/entity/SubscriptionCycle$Companion {
public final fun getMap ()Ljava/util/Map;
}
public final class me/proton/core/payment/domain/entity/SubscriptionManagement : java/lang/Enum {
public static final field Companion Lme/proton/core/payment/domain/entity/SubscriptionManagement$Companion;
public static final field GOOGLE_MANAGED Lme/proton/core/payment/domain/entity/SubscriptionManagement;
public static final field PROTON_MANAGED Lme/proton/core/payment/domain/entity/SubscriptionManagement;
public final fun getValue ()I
public static fun valueOf (Ljava/lang/String;)Lme/proton/core/payment/domain/entity/SubscriptionManagement;
public static fun values ()[Lme/proton/core/payment/domain/entity/SubscriptionManagement;
}
public final class me/proton/core/payment/domain/entity/SubscriptionManagement$Companion {
public final fun getMap ()Ljava/util/Map;
}
public final class me/proton/core/payment/domain/entity/SubscriptionStatus {
public fun <init> (JJIJLme/proton/core/payment/domain/entity/Coupon;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Ljava/lang/Long;)V
public final fun component1 ()J
public final fun component2 ()J
public final fun component3 ()I
public final fun component4 ()J
public final fun component5 ()Lme/proton/core/payment/domain/entity/Coupon;
public final fun component6 ()J
public final fun component7 ()Lme/proton/core/payment/domain/entity/Currency;
public final fun component8 ()Lme/proton/core/payment/domain/entity/SubscriptionCycle;
public final fun component9 ()Ljava/lang/Long;
public final fun copy (JJIJLme/proton/core/payment/domain/entity/Coupon;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Ljava/lang/Long;)Lme/proton/core/payment/domain/entity/SubscriptionStatus;
public static synthetic fun copy$default (Lme/proton/core/payment/domain/entity/SubscriptionStatus;JJIJLme/proton/core/payment/domain/entity/Coupon;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Ljava/lang/Long;ILjava/lang/Object;)Lme/proton/core/payment/domain/entity/SubscriptionStatus;
public fun equals (Ljava/lang/Object;)Z
public final fun getAmount ()J
public final fun getAmountDue ()J
public final fun getCoupon ()Lme/proton/core/payment/domain/entity/Coupon;
public final fun getCouponDiscount ()J
public final fun getCredit ()J
public final fun getCurrency ()Lme/proton/core/payment/domain/entity/Currency;
public final fun getCycle ()Lme/proton/core/payment/domain/entity/SubscriptionCycle;
public final fun getGift ()Ljava/lang/Long;
public final fun getProration ()I
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public abstract interface class me/proton/core/payment/domain/repository/PaymentsRepository {
public abstract fun createOrUpdateSubscription (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentBody;Ljava/util/List;Ljava/util/Map;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Lme/proton/core/payment/domain/entity/SubscriptionManagement;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun createPaymentTokenExistingPaymentMethod (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun createPaymentTokenGoogleIAP (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentType$GoogleIAP;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun createPaymentTokenNewCreditCard (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentType$CreditCard;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun createPaymentTokenNewPayPal (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentType$PayPal;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun getAvailablePaymentMethods (Lme/proton/core/domain/entity/UserId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun getPaymentStatus (Lme/proton/core/domain/entity/UserId;Lme/proton/core/domain/entity/AppStore;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun getPaymentTokenStatus (Lme/proton/core/domain/entity/UserId;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun getSubscription (Lme/proton/core/domain/entity/UserId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun validateSubscription (Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/Map;Lme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/payment/domain/repository/PaymentsRepository$DefaultImpls {
public static synthetic fun createOrUpdateSubscription$default (Lme/proton/core/payment/domain/repository/PaymentsRepository;Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentBody;Ljava/util/List;Ljava/util/Map;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Lme/proton/core/payment/domain/entity/SubscriptionManagement;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun createPaymentTokenExistingPaymentMethod$default (Lme/proton/core/payment/domain/repository/PaymentsRepository;Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun createPaymentTokenGoogleIAP$default (Lme/proton/core/payment/domain/repository/PaymentsRepository;Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentType$GoogleIAP;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun createPaymentTokenNewCreditCard$default (Lme/proton/core/payment/domain/repository/PaymentsRepository;Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentType$CreditCard;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun createPaymentTokenNewPayPal$default (Lme/proton/core/payment/domain/repository/PaymentsRepository;Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentType$PayPal;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun validateSubscription$default (Lme/proton/core/payment/domain/repository/PaymentsRepository;Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/Map;Lme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
public final class me/proton/core/payment/domain/usecase/CreatePaymentTokenWithExistingPaymentMethod {
public fun <init> (Lme/proton/core/payment/domain/repository/PaymentsRepository;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/payment/domain/usecase/CreatePaymentTokenWithGoogleIAP {
public fun <init> (Lme/proton/core/payment/domain/repository/PaymentsRepository;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentType$GoogleIAP;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/payment/domain/usecase/CreatePaymentTokenWithNewCreditCard {
public fun <init> (Lme/proton/core/payment/domain/repository/PaymentsRepository;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentType$CreditCard;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/payment/domain/usecase/CreatePaymentTokenWithNewPayPal {
public fun <init> (Lme/proton/core/payment/domain/repository/PaymentsRepository;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/PaymentType$PayPal;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/payment/domain/usecase/GetAvailablePaymentMethods {
public fun <init> (Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;)V
public fun <init> (Lme/proton/core/payment/domain/repository/PaymentsRepository;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/payment/domain/usecase/GetAvailablePaymentProviders {
public final fun invoke (Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun invoke$default (Lme/proton/core/payment/domain/usecase/GetAvailablePaymentProviders;Lme/proton/core/domain/entity/UserId;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
public final class me/proton/core/payment/domain/usecase/GetCurrentSubscription {
public fun <init> (Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;)V
public fun <init> (Lme/proton/core/payment/domain/repository/PaymentsRepository;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/payment/domain/usecase/GetPaymentTokenStatus {
public fun <init> (Lme/proton/core/paymentcommon/domain/repository/PaymentsRepository;)V
public fun <init> (Lme/proton/core/payment/domain/repository/PaymentsRepository;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/payment/domain/usecase/PaymentProvider : java/lang/Enum {
public static final field CardPayment Lme/proton/core/payment/domain/usecase/PaymentProvider;
public static final field GoogleInAppPurchase Lme/proton/core/payment/domain/usecase/PaymentProvider;
public static final field PayPal Lme/proton/core/payment/domain/usecase/PaymentProvider;
public static fun valueOf (Ljava/lang/String;)Lme/proton/core/payment/domain/usecase/PaymentProvider;
public static fun values ()[Lme/proton/core/payment/domain/usecase/PaymentProvider;
}
public final class me/proton/core/payment/domain/usecase/PerformSubscribe {
public fun <init> (Lme/proton/core/payment/domain/repository/PaymentsRepository;Lme/proton/core/humanverification/domain/HumanVerificationManager;Lme/proton/core/network/domain/client/ClientIdProvider;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Ljava/util/List;Ljava/util/List;Ljava/lang/String;Lme/proton/core/payment/domain/entity/SubscriptionManagement;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun invoke$default (Lme/proton/core/payment/domain/usecase/PerformSubscribe;Lme/proton/core/domain/entity/UserId;JLme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Ljava/util/List;Ljava/util/List;Ljava/lang/String;Lme/proton/core/payment/domain/entity/SubscriptionManagement;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
public abstract interface class me/proton/core/payment/domain/usecase/ProtonIAPBillingLibrary {
public abstract fun isAvailable ()Z
}
public final class me/proton/core/payment/domain/usecase/ValidateSubscriptionPlan {
public fun <init> (Lme/proton/core/payment/domain/repository/PaymentsRepository;)V
public final fun invoke (Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;Lme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun invoke$default (Lme/proton/core/payment/domain/usecase/ValidateSubscriptionPlan;Lme/proton/core/domain/entity/UserId;Ljava/util/List;Ljava/util/List;Lme/proton/core/payment/domain/entity/Currency;Lme/proton/core/payment/domain/entity/SubscriptionCycle;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
+1 -5
View File
@@ -22,10 +22,6 @@ plugins {
protonKotlinLibrary
}
proton {
apiModeDisabled()
}
publishOption.shouldBePublishedAsLib = true
dependencies {
@@ -33,8 +29,8 @@ dependencies {
project(Module.domain),
project(Module.humanVerificationDomain),
project(Module.networkDomain),
project(Module.userDomain),
project(Module.planDomain),
project(Module.paymentCommonDomain),
`javax-inject`
)
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2021 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain
package me.proton.core.payment.domain
// the maximum number of plan items that could be purchased from a mobile app
public const val MAX_PLAN_QUANTITY: Int = 1
@@ -16,10 +16,10 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain
package me.proton.core.payment.domain
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.usecase.PaymentProvider
import me.proton.core.payment.domain.usecase.PaymentProvider
public interface PaymentManager {
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.entity
package me.proton.core.payment.domain.entity
public sealed class Card(
public open val expirationMonth: String,
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.entity
package me.proton.core.payment.domain.entity
public data class Coupon(
val code: String,
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.entity
package me.proton.core.payment.domain.entity
public enum class Currency {
EUR, USD, CHF
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.entity
package me.proton.core.payment.domain.entity
public sealed class PaymentBody(public val type: String) {
public data class TokenPaymentBody(val token: String) : PaymentBody("token")
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.entity
package me.proton.core.payment.domain.entity
public data class PaymentMethod(
val id: String,
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.entity
package me.proton.core.payment.domain.entity
public data class PaymentStatus(
val card: Boolean?,
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.entity
package me.proton.core.payment.domain.entity
public sealed class PaymentToken(
public open val status: PaymentTokenStatus
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,10 +16,12 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.entity
package me.proton.core.payment.domain.entity
public sealed class PaymentType(public val type: String) {
public data class CreditCard(val card: Card) : PaymentType("card")
public object PayPal : PaymentType("paypal")
public data class PaymentMethod(val paymentMethodId: String) : PaymentType("paymentmethod")
public data class GoogleIAP(val productId: String, val purchaseToken: String, val orderId: String, val packageName: String) :
PaymentType("google")
}
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.entity
package me.proton.core.payment.domain.entity
import me.proton.core.plan.domain.entity.Plan
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.entity
package me.proton.core.payment.domain.entity
public enum class SubscriptionCycle(public val value: Int) {
FREE(0),
@@ -16,10 +16,10 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.entity
package me.proton.core.payment.domain.entity
public enum class SubscriptionManagement(public val value: Int) {
PROTON_MANAGED(0), GOOGLE_MANAGED(1);
PROTON_MANAGED(0), GOOGLE_MANAGED(2);
public companion object {
public val map: Map<Int, SubscriptionManagement> = values().associateBy { it.value }
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.entity
package me.proton.core.payment.domain.entity
public data class SubscriptionStatus(
val amount: Long,
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,19 +16,20 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.repository
package me.proton.core.payment.domain.repository
import me.proton.core.domain.entity.AppStore
import me.proton.core.domain.entity.SessionUserId
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.PaymentBody
import me.proton.core.paymentcommon.domain.entity.PaymentMethod
import me.proton.core.paymentcommon.domain.entity.PaymentStatus
import me.proton.core.paymentcommon.domain.entity.PaymentToken
import me.proton.core.paymentcommon.domain.entity.PaymentType
import me.proton.core.paymentcommon.domain.entity.Subscription
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
import me.proton.core.paymentcommon.domain.entity.SubscriptionStatus
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.PaymentBody
import me.proton.core.payment.domain.entity.PaymentMethod
import me.proton.core.payment.domain.entity.PaymentStatus
import me.proton.core.payment.domain.entity.PaymentToken
import me.proton.core.payment.domain.entity.PaymentType
import me.proton.core.payment.domain.entity.Subscription
import me.proton.core.payment.domain.entity.SubscriptionCycle
import me.proton.core.payment.domain.entity.SubscriptionManagement
import me.proton.core.payment.domain.entity.SubscriptionStatus
public typealias PlanQuantity = Map<String, Int> // the plan name along with the quantity number
@@ -71,6 +72,17 @@ public interface PaymentsRepository {
paymentMethodId: String
): PaymentToken.CreatePaymentTokenResult
/**
* Unauthenticated.
* Creates a new payment token which will be used later for a new subscription.
*/
public suspend fun createPaymentTokenGoogleIAP(
sessionUserId: SessionUserId? = null,
amount: Long,
currency: Currency,
paymentType: PaymentType.GoogleIAP
): PaymentToken.CreatePaymentTokenResult
/**
* Unauthenticated.
* Checks the status of the payment token. Certain actions could be only executed for particular statuses. This is
@@ -124,7 +136,8 @@ public interface PaymentsRepository {
payment: PaymentBody?,
codes: List<String>? = null,
plans: PlanQuantity,
cycle: SubscriptionCycle
cycle: SubscriptionCycle,
subscriptionManagement: SubscriptionManagement
): Subscription
// endregion
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,12 +16,12 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.usecase
package me.proton.core.payment.domain.usecase
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.PaymentToken
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.PaymentToken
import me.proton.core.payment.domain.repository.PaymentsRepository
import javax.inject.Inject
/**
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.payment.domain.usecase
import me.proton.core.domain.entity.UserId
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.PaymentToken
import me.proton.core.payment.domain.entity.PaymentType
import me.proton.core.payment.domain.repository.PaymentsRepository
import javax.inject.Inject
/**
* Creates new payment token with Google IAP.
*/
public class CreatePaymentTokenWithGoogleIAP @Inject constructor(
private val paymentsRepository: PaymentsRepository
) {
public suspend operator fun invoke(
userId: UserId?,
amount: Long,
currency: Currency,
paymentType: PaymentType.GoogleIAP
): PaymentToken.CreatePaymentTokenResult = paymentsRepository.createPaymentTokenGoogleIAP(
userId,
amount,
currency,
paymentType
)
}
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,13 +16,13 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.usecase
package me.proton.core.payment.domain.usecase
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.PaymentToken
import me.proton.core.paymentcommon.domain.entity.PaymentType
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.PaymentToken
import me.proton.core.payment.domain.entity.PaymentType
import me.proton.core.payment.domain.repository.PaymentsRepository
import javax.inject.Inject
/**
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,13 +16,13 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.usecase
package me.proton.core.payment.domain.usecase
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.PaymentToken
import me.proton.core.paymentcommon.domain.entity.PaymentType
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.PaymentToken
import me.proton.core.payment.domain.entity.PaymentType
import me.proton.core.payment.domain.repository.PaymentsRepository
import javax.inject.Inject
/**
@@ -19,8 +19,8 @@
package me.proton.core.payment.domain.usecase
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.entity.PaymentMethod
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.entity.PaymentMethod
import me.proton.core.payment.domain.repository.PaymentsRepository
import javax.inject.Inject
/**
@@ -28,9 +28,9 @@ import javax.inject.Inject
* Only upgrade for existing logged in user.
* Could not be used during sign-up.
*/
class GetAvailablePaymentMethods @Inject constructor(
public class GetAvailablePaymentMethods @Inject constructor(
private val paymentsRepository: PaymentsRepository
) {
suspend operator fun invoke(userId: UserId): List<PaymentMethod> =
public suspend operator fun invoke(userId: UserId): List<PaymentMethod> =
paymentsRepository.getAvailablePaymentMethods(userId)
}
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.usecase
package me.proton.core.payment.domain.usecase
import kotlinx.coroutines.flow.first
import me.proton.core.accountmanager.domain.AccountManager
@@ -22,8 +22,9 @@ import me.proton.core.domain.entity.UserId
import me.proton.core.network.domain.ApiException
import me.proton.core.network.domain.ApiResult
import me.proton.core.network.domain.ResponseCodes.PAYMENTS_SUBSCRIPTION_NOT_EXISTS
import me.proton.core.paymentcommon.domain.entity.Subscription
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.entity.Subscription
import me.proton.core.payment.domain.repository.PaymentsRepository
import javax.inject.Inject
/**
@@ -32,10 +33,10 @@ import javax.inject.Inject
* Authorized. This means that it could only be used for upgrades. New accounts created during sign ups logically do not
* have existing subscriptions.
*/
class GetCurrentSubscription @Inject constructor(
public class GetCurrentSubscription @Inject constructor(
private val paymentsRepository: PaymentsRepository
) {
suspend operator fun invoke(userId: UserId): Subscription? {
public suspend operator fun invoke(userId: UserId): Subscription? {
return try {
paymentsRepository.getSubscription(userId)
} catch (exception: ApiException) {
@@ -16,14 +16,14 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.usecase
package me.proton.core.payment.domain.usecase
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import me.proton.core.domain.entity.AppStore
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.entity.PaymentStatus
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.entity.PaymentStatus
import me.proton.core.payment.domain.repository.PaymentsRepository
import javax.inject.Inject
import javax.inject.Singleton
@@ -19,8 +19,9 @@
package me.proton.core.payment.domain.usecase
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.entity.PaymentToken
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.entity.PaymentToken
import me.proton.core.payment.domain.repository.PaymentsRepository
import javax.inject.Inject
/**
@@ -28,10 +29,10 @@ import javax.inject.Inject
* A payment token in it's lifecycle can go through various states and the client should use this use case
* (usually with polling) in order to be able to act on a status change.
*/
class GetPaymentTokenStatus @Inject constructor(
public class GetPaymentTokenStatus @Inject constructor(
private val paymentsRepository: PaymentsRepository
) {
suspend operator fun invoke(userId: UserId?, paymentToken: String): PaymentToken.PaymentTokenStatusResult {
public suspend operator fun invoke(userId: UserId?, paymentToken: String): PaymentToken.PaymentTokenStatusResult {
require(paymentToken.isNotBlank())
return paymentsRepository.getPaymentTokenStatus(userId, paymentToken)
}
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,17 +16,18 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.usecase
package me.proton.core.payment.domain.usecase
import me.proton.core.domain.entity.UserId
import me.proton.core.humanverification.domain.HumanVerificationManager
import me.proton.core.network.domain.client.ClientIdProvider
import me.proton.core.paymentcommon.domain.MAX_PLAN_QUANTITY
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.PaymentBody
import me.proton.core.paymentcommon.domain.entity.Subscription
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.PaymentBody
import me.proton.core.payment.domain.entity.Subscription
import me.proton.core.payment.domain.entity.SubscriptionCycle
import me.proton.core.payment.domain.entity.SubscriptionManagement
import me.proton.core.payment.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.MAX_PLAN_QUANTITY
import javax.inject.Inject
/**
@@ -37,7 +38,7 @@ import javax.inject.Inject
public class PerformSubscribe @Inject constructor(
private val paymentsRepository: PaymentsRepository,
private val humanVerificationManager: HumanVerificationManager,
private val clientIdProvider: ClientIdProvider,
private val clientIdProvider: ClientIdProvider
) {
/**
* @param codes optional an array of [String] coupon or gift codes used for discounts.
@@ -50,7 +51,8 @@ public class PerformSubscribe @Inject constructor(
cycle: SubscriptionCycle,
planNames: List<String>,
codes: List<String>? = null,
paymentToken: String? = null
paymentToken: String? = null,
subscriptionManagement: SubscriptionManagement
): Subscription {
require(amount >= 0)
require(planNames.isNotEmpty())
@@ -64,7 +66,8 @@ public class PerformSubscribe @Inject constructor(
payment = if (amount == 0L) null else PaymentBody.TokenPaymentBody(paymentToken!!),
codes = codes,
plans = planNames.map { it to MAX_PLAN_QUANTITY }.toMap(),
cycle = cycle
cycle = cycle,
subscriptionManagement = subscriptionManagement
).also {
if (paymentToken != null) {
// Clear any previous payment token (unauthenticated session cookie HV details).
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.usecase
package me.proton.core.payment.domain.usecase
public interface ProtonIAPBillingLibrary {
/** Returns `true` if the Proton IAP Billing Library is available on the runtime classpath. */
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,14 +16,14 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.usecase
package me.proton.core.payment.domain.usecase
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.MAX_PLAN_QUANTITY
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.SubscriptionCycle
import me.proton.core.paymentcommon.domain.entity.SubscriptionStatus
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.SubscriptionCycle
import me.proton.core.payment.domain.entity.SubscriptionStatus
import me.proton.core.payment.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.MAX_PLAN_QUANTITY
import javax.inject.Inject
/**
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,17 +16,17 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.usecase
package me.proton.core.payment.domain.usecase
import io.mockk.coEvery
import io.mockk.coVerify
import io.mockk.mockk
import kotlinx.coroutines.test.runBlockingTest
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.PaymentToken
import me.proton.core.paymentcommon.domain.entity.PaymentTokenStatus
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.PaymentToken
import me.proton.core.payment.domain.entity.PaymentTokenStatus
import me.proton.core.payment.domain.repository.PaymentsRepository
import org.junit.Before
import org.junit.Test
import kotlin.test.assertEquals
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,19 +16,19 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.usecase
package me.proton.core.payment.domain.usecase
import io.mockk.coEvery
import io.mockk.coVerify
import io.mockk.mockk
import kotlinx.coroutines.test.runBlockingTest
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.entity.Card
import me.proton.core.paymentcommon.domain.entity.Currency
import me.proton.core.paymentcommon.domain.entity.PaymentToken
import me.proton.core.paymentcommon.domain.entity.PaymentTokenStatus
import me.proton.core.paymentcommon.domain.entity.PaymentType
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.entity.Card
import me.proton.core.payment.domain.entity.Currency
import me.proton.core.payment.domain.entity.PaymentToken
import me.proton.core.payment.domain.entity.PaymentTokenStatus
import me.proton.core.payment.domain.entity.PaymentType
import me.proton.core.payment.domain.repository.PaymentsRepository
import org.junit.Before
import org.junit.Test
import kotlin.test.assertEquals
@@ -22,11 +22,11 @@ import io.mockk.coEvery
import io.mockk.mockk
import kotlinx.coroutines.test.runBlockingTest
import me.proton.core.domain.entity.UserId
import me.proton.core.paymentcommon.domain.entity.Card
import me.proton.core.paymentcommon.domain.entity.Details
import me.proton.core.paymentcommon.domain.entity.PaymentMethod
import me.proton.core.paymentcommon.domain.entity.PaymentMethodType
import me.proton.core.paymentcommon.domain.repository.PaymentsRepository
import me.proton.core.payment.domain.entity.Card
import me.proton.core.payment.domain.entity.Details
import me.proton.core.payment.domain.entity.PaymentMethod
import me.proton.core.payment.domain.entity.PaymentMethodType
import me.proton.core.payment.domain.repository.PaymentsRepository
import org.junit.Before
import org.junit.Test
import kotlin.test.assertEquals
@@ -16,7 +16,7 @@
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.paymentcommon.domain.usecase
package me.proton.core.payment.domain.usecase
import io.mockk.coEvery
import io.mockk.every
@@ -28,7 +28,7 @@ import me.proton.core.accountmanager.domain.AccountManager
import me.proton.core.domain.entity.AppStore
import me.proton.core.network.domain.ApiException
import me.proton.core.network.domain.ApiResult
import me.proton.core.paymentcommon.domain.entity.PaymentStatus
import me.proton.core.payment.domain.entity.PaymentStatus
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals

Some files were not shown because too many files have changed in this diff Show More