@@ -152,15 +152,19 @@ export class AccountStore {
152152 const selectedPlan : SubscriptionPlanCode | undefined = yield this . pickPlan ( ) ;
153153 if ( ! selectedPlan ) return ;
154154
155- const alreadyLoggedIn = this . isLoggedIn ;
156- if ( ! alreadyLoggedIn ) yield this . logIn ( ) ;
155+ if ( ! this . isLoggedIn ) yield this . logIn ( ) ;
156+
157+ // If we cancelled login, or we've already got a plan, we're done.
158+ if ( ! this . isLoggedIn || this . userHasSubscription ) {
159+ if ( this . isPastDueUser ) this . goToSettings ( ) ;
160+ return ;
161+ }
157162
158163 const isRiskyPayment = this . subscriptionPlans [ selectedPlan ] . prices ?. currency === 'BRL' &&
159164 this . userEmail ?. endsWith ( '@gmail.com' ) ; // So far, all chargebacks have been from gmail accounts
160165
161- this . user . subscription
162-
163- if ( ! alreadyLoggedIn && isRiskyPayment ) {
166+ const newUser = ! this . user . subscription ; // Even cancelled users will have an expired subscription left
167+ if ( newUser && isRiskyPayment ) {
164168 // This is annoying, I wish we didn't have to do this, but fraudulent BRL payments are now 80% of chargebacks,
165169 // and we need to tighten this up and block that somehow or payment platforms will eventually block
166170 // HTTP Toolkit globally. This error message is left intentionally vague to try and discourage fraudsters
@@ -178,12 +182,6 @@ export class AccountStore {
178182 return ;
179183 }
180184
181- // If we cancelled login, or we've already got a plan, we're done.
182- if ( ! this . isLoggedIn || this . userHasSubscription ) {
183- if ( this . isPastDueUser ) this . goToSettings ( ) ;
184- return ;
185- }
186-
187185 // Otherwise, it's checkout time, and the rest is in the hands of Paddle
188186 yield this . purchasePlan ( this . user . email ! , selectedPlan ) ;
189187 } catch ( error : any ) {
0 commit comments