Set up default currency accounts automatically (#72)

This commit is contained in:
Stephan D committed 2026-10-23 12:43:55 +02:00
1 parent 62df9eac5f
commit 5c255296d3
21 files changed
+675 -62

No files matched your search

+15
View File
@@ -31,8 +31,13 @@ type SignupFacts interface {
Ready(context.Context, bson.ObjectID) error
}
type CurrencyAccounts interface {
Ensure(context.Context, *customer.Account) error
}
type Service struct {
Facts SignupFacts
Wallet CurrencyAccounts
Accounts account.DB
Customers accountservice.AccountService
Tokens verification.DB
@@ -110,6 +115,11 @@ func (s *Service) Signup(ctx context.Context, a *customer.Account, ip, key strin
return nil, err
}
}
if s.Wallet != nil {
if err := s.Wallet.Ensure(ctx, a); err != nil {
return nil, err
}
}
if raw != "" {
u, _ := url.Parse(s.ActivationURL)
q := u.Query()
@@ -148,6 +158,11 @@ func (s *Service) ResendActivation(ctx context.Context, email, ip, key string) e
return err
}
}
if s.Wallet != nil {
if err := s.Wallet.Ensure(ctx, a); err != nil {
return err
}
}
_, err = s.sendActivation(ctx, a, key)
return err
}