Update
This commit is contained in:
parent
2554533e09
commit
214a80e5f9
@ -3,7 +3,9 @@ package brevo
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"enaklo-pos-be/internal/common/logger"
|
||||
"enaklo-pos-be/internal/entity"
|
||||
"go.uber.org/zap"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
@ -22,7 +24,7 @@ type ServiceImpl struct {
|
||||
func (s ServiceImpl) SendEmailTransactional(ctx context.Context, param entity.SendEmailNotificationParam) error {
|
||||
templateFile, err := ioutil.ReadFile(param.TemplatePath)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
logger.ContextLogger(ctx).Error("error when reading file template", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
|
||||
@ -91,9 +93,11 @@ func (s ServiceImpl) sendEmail(ctx context.Context, tmpl *template.Template, par
|
||||
|
||||
_, _, err = s.brevoConn.TransactionalEmailsApi.SendTransacEmail(ctx, payload)
|
||||
if err != nil {
|
||||
logger.ContextLogger(ctx).Error("error when sending email", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
|
||||
logger.ContextLogger(ctx).Info("sending email success")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -211,7 +211,7 @@ func (s *memberSvc) sendRegistrationOTP(
|
||||
Recipient: registration.Email,
|
||||
Subject: "Enaklo - Registration Verification Code",
|
||||
TemplateName: "member_registration_otp",
|
||||
TemplatePath: "templates/member_registration_otp.html",
|
||||
TemplatePath: "/templates/member_registration_otp.html",
|
||||
Data: emailData,
|
||||
})
|
||||
|
||||
@ -246,7 +246,7 @@ func (s *memberSvc) sendWelcomeEmail(
|
||||
Recipient: customer.Email,
|
||||
Subject: "Welcome to Enaklo Membership Program",
|
||||
TemplateName: "welcome_member",
|
||||
TemplatePath: "templates/welcome_member.html",
|
||||
TemplatePath: "/templates/welcome_member.html",
|
||||
Data: welcomeData,
|
||||
})
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ func (s *orderSvc) sendTransactionReceipt(ctx mycontext.Context, order *entity.O
|
||||
Recipient: customer.Email,
|
||||
Subject: "Hore, kamu dapat poin!",
|
||||
TemplateName: "monthly_points",
|
||||
TemplatePath: "templates/monthly_points.html",
|
||||
TemplatePath: "/templates/monthly_points.html",
|
||||
Data: emailData,
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user