Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

better validations

Blue Mousea4818dba1a74
diff --git a/backend/apps/cloud/src/user/user.service.ts b/backend/apps/cloud/src/user/user.service.ts
index d13954763..ca7f946c4 100644
--- a/backend/apps/cloud/src/user/user.service.ts
+++ b/backend/apps/cloud/src/user/user.service.ts
@@ -382,6 +382,12 @@ export class UserService {
throw new BadRequestException('You are already subscribed to this plan')
}
+ if (user.cancellationEffectiveDate) {
+ throw new BadRequestException(
+ 'Cannot preview a subscription change as it has been cancelled, please subscribe to a new plan',
+ )
+ }
+
const url = 'https://vendors.paddle.com/api/2.0/subscription/preview_update'
let preview: any = {}
@@ -443,6 +449,12 @@ export class UserService {
throw new BadRequestException('You are already subscribed to this plan')
}
+ if (user.cancellationEffectiveDate) {
+ throw new BadRequestException(
+ 'Cannot change your subscription as it has been cancelled, please subscribe to a new plan',
+ )
+ }
+
const url = 'https://vendors.paddle.com/api/2.0/subscription/users/update'
let result: any = {}