Update template email

This commit is contained in:
aditya.siregar
2025-03-08 00:35:23 +07:00
parent 3c80b710af
commit 18003313dd
54 changed files with 2309 additions and 199 deletions
+2 -2
View File
@@ -66,8 +66,8 @@ type SearchSiteByIDResponse struct {
}
type SearchProductSiteByIDResponse struct {
ID int64 `json:"id"`
SiteID int64 `json:"site_id"`
ID int64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Price float64 `json:"price"`
+1 -9
View File
@@ -84,9 +84,6 @@ type OrderBranchRevenue struct {
type CreateOrderResponse struct {
ID int64 `json:"id"`
SiteName string `json:"site_name"`
VisitDate string `json:"visit_date"`
RefID string `json:"ref_id"`
PartnerID int64 `json:"partner_id"`
Status string `json:"status"`
Amount float64 `json:"amount"`
@@ -95,9 +92,6 @@ type CreateOrderResponse struct {
PaymentType string `json:"payment_type"`
CreatedAt time.Time `json:"created_at"`
OrderItems []CreateOrderItemResponse `json:"order_items"`
Token string `json:"token"`
BankCode string `json:"bank_code"`
BankName string `json:"bank_name"`
}
type PrintDetailResponse struct {
@@ -117,7 +111,6 @@ type PrintDetailResponse struct {
type ExecuteOrderResponse struct {
ID int64 `json:"id"`
RefID string `json:"ref_id"`
PartnerID int64 `json:"partner_id"`
Status string `json:"status"`
Amount float64 `json:"amount"`
@@ -134,7 +127,6 @@ type ExecuteOrderResponse struct {
type ExecuteCheckinResponse struct {
ID int64 `json:"id"`
RefID string `json:"ref_id"`
PartnerID int64 `json:"partner_id"`
Status string `json:"status"`
Amount float64 `json:"amount"`
@@ -153,7 +145,7 @@ type CheckingInquiryResponse struct {
type CreateOrderItemResponse struct {
ID int64 `json:"id"`
ItemID int64 `json:"item_id"`
Quantity int64 `json:"quantity"`
Quantity int `json:"quantity"`
Price float64 `json:"price"`
Name string `json:"name"`
}
+119
View File
@@ -0,0 +1,119 @@
package response
import (
"enaklo-pos-be/internal/entity"
"time"
)
type OrderInquiryResponse struct {
ID string `json:"id"`
Status string `json:"status"`
Amount float64 `json:"amount"`
Fee float64 `json:"fee"`
Total float64 `json:"total"`
CustomerID int64 `json:"customer_id"`
PaymentType string `json:"payment_type"`
CustomerName string `json:"customer_name"`
CustomerPhoneNumber string `json:"customer_phone_number"`
CustomerEmail string `json:"customer_email"`
ExpiresAt time.Time `json:"expires_at"`
CreatedAt time.Time `json:"created_at"`
Items []OrderItemResponse `json:"items"`
Token string `json:"token"`
}
type OrderItemResponse struct {
ProductID int64 `json:"product_id"`
ProductName string `json:"product_name"`
Price float64 `json:"price"`
Quantity int `json:"quantity"`
Subtotal float64 `json:"subtotal"`
}
func mapToOrderItemResponses(items []entity.OrderItem) []OrderItemResponse {
result := make([]OrderItemResponse, 0, len(items))
for _, item := range items {
productName := ""
if item.Product != nil {
productName = item.Product.Name
}
result = append(result, OrderItemResponse{
ProductID: item.ItemID,
ProductName: productName,
Price: item.Price,
Quantity: item.Quantity,
Subtotal: item.Price * float64(item.Quantity),
})
}
return result
}
func MapToInquiryResponse(result *entity.OrderInquiryResponse) OrderInquiryResponse {
resp := OrderInquiryResponse{
ID: result.OrderInquiry.ID,
Status: result.OrderInquiry.Status,
Amount: result.OrderInquiry.Amount,
Fee: result.OrderInquiry.Fee,
Total: result.OrderInquiry.Total,
CustomerID: result.OrderInquiry.CustomerID,
PaymentType: result.OrderInquiry.PaymentType,
ExpiresAt: result.OrderInquiry.ExpiresAt,
CreatedAt: result.OrderInquiry.CreatedAt,
Items: mapToOrderItemResponses(result.OrderInquiry.OrderItems),
Token: result.Token,
CustomerName: result.OrderInquiry.CustomerName,
CustomerEmail: result.OrderInquiry.CustomerEmail,
CustomerPhoneNumber: result.OrderInquiry.CustomerPhoneNumber,
}
return resp
}
type OrderResponse struct {
ID int64 `json:"id"`
Status string `json:"status"`
Amount float64 `json:"amount"`
Fee float64 `json:"fee"`
Total float64 `json:"total"`
CustomerName string `json:"customer_name,omitempty"`
PaymentType string `json:"payment_type"`
Source string `json:"source"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
Items []OrderItemResponse `json:"items"`
}
func MapToOrderResponse(result *entity.OrderResponse) OrderResponse {
resp := OrderResponse{
ID: result.Order.ID,
Status: result.Order.Status,
Amount: result.Order.Amount,
Fee: result.Order.Fee,
Total: result.Order.Total,
PaymentType: result.Order.PaymentType,
CreatedAt: result.Order.CreatedAt,
Items: MapToOrderItemResponses(result.Order.OrderItems),
}
return resp
}
func MapToOrderItemResponses(items []entity.OrderItem) []OrderItemResponse {
result := make([]OrderItemResponse, 0, len(items))
for _, item := range items {
productName := ""
if item.Product != nil {
productName = item.Product.Name
}
result = append(result, OrderItemResponse{
ProductID: item.ItemID,
ProductName: productName,
Price: item.Price,
Quantity: item.Quantity,
Subtotal: item.Price * float64(item.Quantity),
})
}
return result
}
-1
View File
@@ -3,7 +3,6 @@ package response
type Product struct {
ID int64 `json:"id"`
PartnerID int64 `json:"partner_id"`
SiteID int64 `json:"site_id"`
Name string `json:"name"`
Type string `json:"type"`
Price float64 `json:"price"`