From 4de517c1a13e8a1f65b5c30869b1ff45c6c27836 Mon Sep 17 00:00:00 2001 From: AlexandreSi <32449369+AlexandreSi@users.noreply.github.com> Date: Fri, 24 May 2024 16:49:08 +0200 Subject: [PATCH] Remove distinction between paypal and stripe when dealing with cancellation --- .../src/Profile/Subscription/SubscriptionDialog.js | 14 +------------- newIDE/app/src/Utils/GDevelopServices/Usage.js | 8 -------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/newIDE/app/src/Profile/Subscription/SubscriptionDialog.js b/newIDE/app/src/Profile/Subscription/SubscriptionDialog.js index dc07797ed52e..8634689f3af2 100644 --- a/newIDE/app/src/Profile/Subscription/SubscriptionDialog.js +++ b/newIDE/app/src/Profile/Subscription/SubscriptionDialog.js @@ -10,7 +10,6 @@ import { changeUserSubscription, getRedirectToCheckoutUrl, canSeamlesslyChangeSubscription, - canCancelAtEndOfPeriod, hasValidSubscriptionPlan, EDUCATION_PLAN_MAX_SEATS, EDUCATION_PLAN_MIN_SEATS, @@ -102,13 +101,6 @@ const cancelConfirmationTexts = { dismissButtonLabel: t`Keep subscription`, maxWidth: 'sm', }; -const cancelImmediatelyConfirmationTexts = { - title: t`Cancel your subscription?`, - message: t`By canceling your subscription you will lose all your premium features IMMEDIATELY. Continue?`, - confirmButtonLabel: t`Cancel my subscription now`, - dismissButtonLabel: t`Keep subscription`, - maxWidth: 'sm', -}; const seamlesslyChangeConfirmationTexts = { title: t`Update your subscription`, message: t`Are you sure you want to change your plan? Your next payment will be pro-rated.`, @@ -291,11 +283,7 @@ export default function SubscriptionDialog({ if (!subscriptionPlanPricingSystem) { // Cancelling the existing subscription. - const answer = await showConfirmation( - canCancelAtEndOfPeriod(subscription) - ? cancelConfirmationTexts - : cancelImmediatelyConfirmationTexts - ); + const answer = await showConfirmation(cancelConfirmationTexts); if (!answer) return; setCancelReasonDialogOpen(true); diff --git a/newIDE/app/src/Utils/GDevelopServices/Usage.js b/newIDE/app/src/Utils/GDevelopServices/Usage.js index 14f80905618c..93f5d29e8640 100644 --- a/newIDE/app/src/Utils/GDevelopServices/Usage.js +++ b/newIDE/app/src/Utils/GDevelopServices/Usage.js @@ -334,14 +334,6 @@ export const canSeamlesslyChangeSubscription = ( return false; }; -export const canCancelAtEndOfPeriod = (subscription: Subscription) => { - // If the subscription is on Stripe, it can be set as cancelled and only removed at the - // end of the period already paid. - // Otherwise (Paypal), it will be cancelled immediately. - // TODO: When the backend allows it, remove this payment provider condition. - return !!subscription.stripeSubscriptionId; -}; - export const hasMobileAppStoreSubscriptionPlan = ( subscription: ?Subscription ): boolean => {