Update Error Message Scan
This commit is contained in:
parent
aae740c77f
commit
f7e5e493fa
@ -167,15 +167,24 @@ func (s *OrderService) CheckInInquiry(ctx mycontext.Context, qrCode string, part
|
|||||||
return nil, errors2.ErrorInvalidRequest
|
return nil, errors2.ErrorInvalidRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
if order.TicketStatus == "USED" {
|
location, _ := time.LoadLocation("Asia/Jakarta")
|
||||||
return nil, errors2.ErrorTicketInvalidOrAlreadyUsed
|
today := time.Now().In(location).Format("2006-01-02")
|
||||||
|
visitDate := time.Date(
|
||||||
|
order.VisitDate.Year(),
|
||||||
|
order.VisitDate.Month(),
|
||||||
|
order.VisitDate.Day(),
|
||||||
|
0, 0, 0, 0,
|
||||||
|
location,
|
||||||
|
).Format("2006-01-02")
|
||||||
|
|
||||||
|
if order.TicketStatus == "USED" || visitDate < today {
|
||||||
|
return nil, errors2.NewErrorMessage(errors2.ErrorTicketInvalidOrAlreadyUsed,
|
||||||
|
"Maaf! Tiket ini tidak valid karena sudah terpakai atau sudah kadaluwarsa")
|
||||||
}
|
}
|
||||||
|
|
||||||
today := time.Now().Format("2006-01-02")
|
|
||||||
visitDate := order.VisitDate.Format("2006-01-02")
|
|
||||||
|
|
||||||
if visitDate != today {
|
if visitDate != today {
|
||||||
return nil, errors2.ErrorTicketInvalidOrAlreadyUsed
|
return nil, errors2.NewErrorMessage(errors2.ErrorTicketInvalidOrAlreadyUsed,
|
||||||
|
"Maaf Tiket ini tidak valid karena tidak sesuai dengan tanggal tiket")
|
||||||
}
|
}
|
||||||
|
|
||||||
token, err := s.crypt.GenerateJWTOrder(order)
|
token, err := s.crypt.GenerateJWTOrder(order)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user