This commit is contained in:
aditya.siregar
2024-10-27 19:48:10 +07:00
parent 758df918ae
commit 081a1aa27b
13 changed files with 190 additions and 35 deletions
@@ -7,6 +7,7 @@ import (
"furtuna-be/internal/handlers/request"
"furtuna-be/internal/handlers/response"
"furtuna-be/internal/services"
"furtuna-be/internal/utils"
"net/http"
"time"
@@ -56,7 +57,7 @@ func (h *Handler) Inquiry(c *gin.Context) {
c.JSON(http.StatusOK, response.BaseResponse{
Success: true,
Status: http.StatusOK,
Data: MapOrderToCreateOrderResponse(order),
Data: MapOrderToCreateOrderResponse(order, req),
})
}
@@ -88,7 +89,7 @@ func (h *Handler) Execute(c *gin.Context) {
})
}
func MapOrderToCreateOrderResponse(orderResponse *entity.OrderResponse) response.CreateOrderResponse {
func MapOrderToCreateOrderResponse(orderResponse *entity.OrderResponse, req request.CustomerOrder) response.CreateOrderResponse {
order := orderResponse.Order
orderItems := make([]response.CreateOrderItemResponse, len(order.OrderItems))
for i, item := range order.OrderItems {
@@ -115,6 +116,8 @@ func MapOrderToCreateOrderResponse(orderResponse *entity.OrderResponse) response
Total: order.Total,
VisitDate: order.VisitDate.Format("2006-01-02"),
SiteName: order.Site.Name,
BankCode: req.BankCode,
BankName: utils.BankName(req.BankCode),
}
}