Skip to content

Commit

Permalink
fix: trigger stripe account creation on sign-in (#559)
Browse files Browse the repository at this point in the history
* create stripe account on sign in

* create stripe account on sign in

* account submitter

---------

Co-authored-by: Ankur Banerjee <[email protected]>
  • Loading branch information
benyam7 and ankurdotb authored Jul 24, 2024
1 parent d2992dd commit d2fec93
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/controllers/api/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,17 @@ export class AccountController {
await UserService.instance.update(user.logToId, customer);
} else {
customer = user.customer;
// this time user exists, so notify stripe account should be created.
if (process.env.STRIPE_ENABLED === 'true' && !customer.paymentProviderId) {
eventTracker.submit({
operation: OperationNameEnum.STRIPE_ACCOUNT_CREATE,
data: {
name: customer.name,
email: customer.email,
customerId: customer.customerId,
} satisfies ISubmitStripeCustomerCreateData,
} satisfies ISubmitOperation);
}
}

// 4. Check is paymentAccount exists for the customer
Expand Down

0 comments on commit d2fec93

Please sign in to comment.