Some checks failed
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
ci/woodpecker/push/bump_version Pipeline failed
28 lines
923 B
Go
28 lines
923 B
Go
package notificationimp
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
|
|
"github.com/tech/sendico/pkg/model"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func (a *NotificationAPI) onConfirmationCode(ctx context.Context, account *model.Account, destination string, target model.ConfirmationTarget, code string) error {
|
|
builder := a.client.MailBuilder().
|
|
AddRecipient(account.Name, strings.TrimSpace(destination)).
|
|
SetAccountID(account.ID.Hex()).
|
|
SetLocale(account.Locale).
|
|
SetTemplateID("confirmation-code").
|
|
AddData("Name", account.Name).
|
|
AddData("Code", code).
|
|
AddData("Target", string(target))
|
|
|
|
if err := a.client.Send(builder); err != nil {
|
|
a.logger.Warn("Failed to send confirmation code email", zap.Error(err), zap.String("login", account.Login))
|
|
return err
|
|
}
|
|
a.logger.Info("Confirmation code email sent", zap.String("login", account.Login), zap.String("destination", destination), zap.String("target", string(target)))
|
|
return nil
|
|
}
|