File tree 3 files changed +8
-4
lines changed
3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -482,6 +482,10 @@ export namespace Plans {
482
482
) ;
483
483
}
484
484
485
+ export function isFreeTier ( chargebeeId : string | undefined ) : boolean {
486
+ return chargebeeId === Plans . FREE . chargebeeId || chargebeeId === Plans . FREE_50 . chargebeeId ;
487
+ }
488
+
485
489
export function isFreeNonTransientPlan ( chargebeeId : string | undefined ) : boolean {
486
490
return chargebeeId === Plans . FREE_OPEN_SOURCE . chargebeeId ;
487
491
}
Original file line number Diff line number Diff line change @@ -196,8 +196,7 @@ export class EntitlementServiceChargebee implements EntitlementService {
196
196
*/
197
197
async limitNetworkConnections ( user : User , date : Date = new Date ( ) ) : Promise < boolean > {
198
198
const subscriptions = await this . subscriptionService . getNotYetCancelledSubscriptions ( user , date . toISOString ( ) ) ;
199
- const freePlans = [ Plans . FREE , Plans . FREE_50 ] . map ( ( p ) => p . chargebeeId ) ;
200
-
201
- return subscriptions . filter ( ( s ) => ! freePlans . includes ( s . planId ! ) ) . length > 0 ;
199
+ const hasPaidPlan = subscriptions . some ( ( s ) => ! Plans . isFreeTier ( s . planId ) ) ;
200
+ return ! hasPaidPlan ;
202
201
}
203
202
}
Original file line number Diff line number Diff line change @@ -102,7 +102,8 @@ export class EntitlementServiceUBP implements EntitlementService {
102
102
* @param user
103
103
*/
104
104
async limitNetworkConnections ( user : User , date : Date ) : Promise < boolean > {
105
- return ! this . hasPaidSubscription ( user , date ) ;
105
+ const hasPaidPlan = await this . hasPaidSubscription ( user , date ) ;
106
+ return ! hasPaidPlan ;
106
107
}
107
108
108
109
protected async hasPaidSubscription ( user : User , date : Date ) : Promise < boolean > {
You can’t perform that action at this time.
0 commit comments