@@ -152,15 +152,19 @@ export class AccountStore {
152
152
const selectedPlan : SubscriptionPlanCode | undefined = yield this . pickPlan ( ) ;
153
153
if ( ! selectedPlan ) return ;
154
154
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
+ }
157
162
158
163
const isRiskyPayment = this . subscriptionPlans [ selectedPlan ] . prices ?. currency === 'BRL' &&
159
164
this . userEmail ?. endsWith ( '@gmail.com' ) ; // So far, all chargebacks have been from gmail accounts
160
165
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 ) {
164
168
// This is annoying, I wish we didn't have to do this, but fraudulent BRL payments are now 80% of chargebacks,
165
169
// and we need to tighten this up and block that somehow or payment platforms will eventually block
166
170
// HTTP Toolkit globally. This error message is left intentionally vague to try and discourage fraudsters
@@ -178,12 +182,6 @@ export class AccountStore {
178
182
return ;
179
183
}
180
184
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
-
187
185
// Otherwise, it's checkout time, and the rest is in the hands of Paddle
188
186
yield this . purchasePlan ( this . user . email ! , selectedPlan ) ;
189
187
} catch ( error : any ) {
0 commit comments