diff --git a/internal/entity/order.go b/internal/entity/order.go index e4fd30c..ec3181a 100644 --- a/internal/entity/order.go +++ b/internal/entity/order.go @@ -137,6 +137,18 @@ type HistoryOrder struct { Source string `gorm:"type:numeric;column:source"` } +func (h *HistoryOrder) GetPaymentStatus() string { + if h.Status == "PAID" { + return "E-TICKET TELAH TERBIT" + } + + if h.Status == "PENDING" { + return "MENUNGGU PEMBAYARAN" + } + + return "" +} + type HistoryOrderDB struct { HistoryOrder } diff --git a/internal/handlers/http/customerorder/order.go b/internal/handlers/http/customerorder/order.go index f7f8a8d..49f56eb 100644 --- a/internal/handlers/http/customerorder/order.go +++ b/internal/handlers/http/customerorder/order.go @@ -155,7 +155,7 @@ func (h *Handler) toHistoryOrderResponse(resp *entity.HistoryOrder) response.His BookingTime: resp.BookingTime.Format(time.RFC3339), Tickets: resp.Tickets, PaymentType: resp.PaymentType, - Status: resp.Status, + Status: resp.GetPaymentStatus(), Amount: resp.Amount, } }