Skip to content

Commit

Permalink
only send welcome email for new subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
imolorhe committed Nov 8, 2024
1 parent c06e930 commit 1630ab9
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ export class StripeWebhookController {
}
} else if (planRole === PRO_PLAN_ID) {
await this.userService.toProPlan(user.id, quantity);
// Send welcome email
console.log('Sending welcome email');
await this.emailService.sendWelcomeEmail(user.id);
// Subscribe user
console.log('Subscribing user');
await this.emailService.subscribeUser(user.id);
if (event.type === 'customer.subscription.created') {
// Send welcome email
console.log('Sending welcome email');
await this.emailService.sendWelcomeEmail(user.id);
// Subscribe user
console.log('Subscribing user');
await this.emailService.subscribeUser(user.id);
}
}
break;
}
Expand Down

0 comments on commit 1630ab9

Please sign in to comment.