From dacd341c6e84913affd525a4d278a44e5f5637ee Mon Sep 17 00:00:00 2001 From: "aditya.siregar" Date: Wed, 28 Aug 2024 13:55:21 +0700 Subject: [PATCH] Return Payment Status --- internal/entity/order.go | 12 ++++++++++++ internal/handlers/http/customerorder/order.go | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) 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, } }