refactor: use external email package

This commit is contained in:
2023-12-26 10:58:26 +01:00
parent da1228082a
commit bc29b63114
12 changed files with 78 additions and 268 deletions

View File

@@ -18,6 +18,7 @@ import (
"gitea.urkob.com/urko/btc-pay-checker/internal/services/mail"
"gitea.urkob.com/urko/btc-pay-checker/internal/services/price"
"gitea.urkob.com/urko/btc-pay-checker/kit/cfg"
"gitea.urkob.com/urko/emailsender/pkg/email"
)
const (
@@ -30,7 +31,7 @@ type RestServer struct {
config *cfg.Config
btcService *btc.BitcoinService
orderSrv *services.Order
mailSrv *mail.MailService
emailSrv *mail.MailService
priceSrv *price.PriceConversor
}
@@ -39,14 +40,14 @@ func NewRestServer(
orderSrv *services.Order,
btcService *btc.BitcoinService,
priceSrv *price.PriceConversor,
mailSrv *mail.MailService,
emailSrv *email.EmailService,
) *RestServer {
return &RestServer{
config: config,
orderSrv: orderSrv,
btcService: btcService,
priceSrv: priceSrv,
mailSrv: mailSrv,
emailSrv: mail.NewMailService(emailSrv),
}
}
@@ -118,7 +119,7 @@ func (s *RestServer) onNotification(ctx context.Context, notifChan chan domain.N
}
// Send email to client and provider
if err := s.mailSrv.SendProviderConfirm(mail.SendOK{
if err := s.emailSrv.SendProviderConfirm(mail.SendOK{
Tx: order.Tx,
Block: order.Block,
Amount: order.Amount,