19 lines
727 B
Go
19 lines
727 B
Go
package verificationimp
|
|
|
|
import (
|
|
cnotifications "github.com/tech/sendico/pkg/messaging/notifications/confirmation"
|
|
"github.com/tech/sendico/pkg/model"
|
|
"github.com/tech/sendico/pkg/mutil/mzap"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func (a *VerificationAPI) sendCode(account *model.Account, target model.VerificationPurpose, destination, code string) {
|
|
a.logger.Info("Confirmation code generated",
|
|
zap.String("target", string(target)),
|
|
mzap.MaskEmail("destination", destination),
|
|
mzap.AccRef(account.ID))
|
|
if err := a.producer.SendMessage(cnotifications.Code(a.Name(), account.ID, destination, target, code)); err != nil {
|
|
a.logger.Warn("Failed to send confirmation code notification", zap.Error(err), mzap.AccRef(account.ID))
|
|
}
|
|
}
|