Update template
This commit is contained in:
@@ -52,7 +52,7 @@ func (s *orderSvc) processPostOrderActions(
|
||||
}
|
||||
|
||||
if order.CustomerID != nil && *order.CustomerID > 0 {
|
||||
err = s.addCustomerPoints(ctx, *order.CustomerID, int(order.Total/1000), fmt.Sprintf("TRX #%s", trx.ID))
|
||||
err = s.addCustomerPoints(ctx, *order.CustomerID, int(order.Total/50000), fmt.Sprintf("TRX #%s", trx.ID))
|
||||
if err != nil {
|
||||
logger.ContextLogger(ctx).Error("error when adding points", zap.Error(err))
|
||||
}
|
||||
@@ -84,10 +84,21 @@ func (s *orderSvc) addCustomerPoints(ctx mycontext.Context, customerID int64, po
|
||||
}
|
||||
|
||||
func (s *orderSvc) sendTransactionReceipt(ctx mycontext.Context, order *entity.Order, transaction *entity.Transaction, paymentMethod string) error {
|
||||
newPoint := int(order.Total / 50000)
|
||||
|
||||
if newPoint <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
if order.CustomerID == nil || *order.CustomerID == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
customerPoint, err := s.customer.GetCustomerPoints(ctx, *order.CustomerID)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
customer, err := s.customer.GetCustomer(ctx, *order.CustomerID)
|
||||
if err != nil {
|
||||
logger.ContextLogger(ctx).Error("error getting customer details", zap.Error(err))
|
||||
@@ -133,14 +144,15 @@ func (s *orderSvc) sendTransactionReceipt(ctx mycontext.Context, order *entity.O
|
||||
}
|
||||
|
||||
transactionDate := transaction.CreatedAt.Format("02 January 2006 15:04")
|
||||
viewTransactionLink := fmt.Sprintf("https://enaklo.co.id/transaction/%s", transaction.ID)
|
||||
viewTransactionLink := "https://web.enaklo.co.id"
|
||||
|
||||
emailData := map[string]interface{}{
|
||||
"UserName": customer.Name,
|
||||
"PointsName": "ELP",
|
||||
"PointsBalance": int(order.Total / 1000),
|
||||
"NewPoints": int(order.Total / 1000),
|
||||
"RedeemLink": "enaklo.co.id",
|
||||
"PointsName": "Point",
|
||||
"PointsBalance": newPoint,
|
||||
"NewPoints": newPoint,
|
||||
"TotalPoints": customerPoint.TotalPoints,
|
||||
"RedeemLink": "web.enaklo.co.id",
|
||||
"BranchName": branchName,
|
||||
"TransactionNumber": order.ID,
|
||||
"TransactionDate": transactionDate,
|
||||
@@ -149,6 +161,8 @@ func (s *orderSvc) sendTransactionReceipt(ctx mycontext.Context, order *entity.O
|
||||
"TotalPayment": fmt.Sprintf("Rp %s", formatCurrency(order.Total)),
|
||||
"ViewTransactionLink": viewTransactionLink,
|
||||
"ExpiryDate": order.CreatedAt.Format("02 January 2006"),
|
||||
"UndianDate": "17 Mei 2025",
|
||||
"WebURL": "https://web.enaklo.co.id/undian",
|
||||
}
|
||||
|
||||
return s.notification.SendEmailTransactional(ctx, entity.SendEmailNotificationParam{
|
||||
|
||||
@@ -44,6 +44,7 @@ type CustomerService interface {
|
||||
ResolveCustomer(ctx mycontext.Context, req *entity.CustomerResolutionRequest) (int64, error)
|
||||
AddPoints(ctx mycontext.Context, customerID int64, points int, reference string) error
|
||||
GetCustomer(ctx mycontext.Context, id int64) (*entity.Customer, error)
|
||||
GetCustomerPoints(ctx mycontext.Context, customerID int64) (*entity.CustomerPoints, error)
|
||||
}
|
||||
|
||||
type TransactionService interface {
|
||||
|
||||
Reference in New Issue
Block a user