From 7cc4f1d152613c7199b5c321c4bb1137a32490b0 Mon Sep 17 00:00:00 2001 From: "aditya.siregar" Date: Tue, 13 Aug 2024 23:53:01 +0700 Subject: [PATCH] Update Status --- internal/services/order/order.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/services/order/order.go b/internal/services/order/order.go index d81fa8c..0f0d213 100644 --- a/internal/services/order/order.go +++ b/internal/services/order/order.go @@ -133,6 +133,10 @@ func (s *OrderService) CheckInInquiry(ctx mycontext.Context, qrCode string, part return nil, errors2.ErrorBadRequest } + if order.Status != "PAID" { + return nil, errors2.ErrorInvalidRequest + } + if order.TicketStatus == "USED" { return nil, errors2.ErrorTicketInvalidOrAlreadyUsed } @@ -179,11 +183,11 @@ func (s *OrderService) CheckInExecute(ctx mycontext.Context, Order: order, } - if order.Status != "UNUSED" { + if order.TicketStatus != "UNUSED" { return resp, nil } - order.Status = "USED" + order.TicketStatus = "USED" order, err = s.repo.Update(ctx, order) if err != nil { logger.ContextLogger(ctx).Error("error when updating order status", zap.Error(err))