feat(payment): confirm renewal only at checkout
Docker Image / Build and Push Docker Image (push) Successful in 2m9s
Docker Image / Build and Push Docker Image (push) Successful in 2m9s
This commit is contained in:
@@ -105,30 +105,6 @@ export function findSelectedSubscriptionPlan(input: {
|
||||
return plans.find((plan) => plan.id === input.selectedPlanId) ?? null;
|
||||
}
|
||||
|
||||
export function requiresVipPlanConfirmation(input: {
|
||||
planId: string;
|
||||
vipPlans: readonly VipOfferPlanView[];
|
||||
confirmedVipPlanIds: ReadonlySet<string>;
|
||||
}): boolean {
|
||||
return (
|
||||
input.vipPlans.some((plan) => plan.id === input.planId) &&
|
||||
!input.confirmedVipPlanIds.has(input.planId)
|
||||
);
|
||||
}
|
||||
|
||||
export function canCheckoutSubscriptionPlan(input: {
|
||||
selectedPlanId: string;
|
||||
vipPlans: readonly VipOfferPlanView[];
|
||||
confirmedVipPlanIds: ReadonlySet<string>;
|
||||
}): boolean {
|
||||
if (!input.selectedPlanId) return false;
|
||||
return !requiresVipPlanConfirmation({
|
||||
planId: input.selectedPlanId,
|
||||
vipPlans: input.vipPlans,
|
||||
confirmedVipPlanIds: input.confirmedVipPlanIds,
|
||||
});
|
||||
}
|
||||
|
||||
export function getDefaultSubscriptionPlanId(input: {
|
||||
canSubscribeVip: boolean;
|
||||
selectedPlanId: string;
|
||||
|
||||
Reference in New Issue
Block a user