Skip to content

Commit

Permalink
Remove distinction between paypal and stripe when dealing with cancel…
Browse files Browse the repository at this point in the history
…lation
  • Loading branch information
AlexandreSi committed May 24, 2024
1 parent 7d95e44 commit 4de517c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
14 changes: 1 addition & 13 deletions newIDE/app/src/Profile/Subscription/SubscriptionDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
changeUserSubscription,
getRedirectToCheckoutUrl,
canSeamlesslyChangeSubscription,
canCancelAtEndOfPeriod,
hasValidSubscriptionPlan,
EDUCATION_PLAN_MAX_SEATS,
EDUCATION_PLAN_MIN_SEATS,
Expand Down Expand Up @@ -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.`,
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 0 additions & 8 deletions newIDE/app/src/Utils/GDevelopServices/Usage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 4de517c

Please sign in to comment.