Update Status
This commit is contained in:
parent
a4bad0c088
commit
299d65095f
@ -71,12 +71,13 @@ func (s *TransactionService) Approval(ctx mycontext.Context, req *entity.Transac
|
||||
return errors2.ErrorInsufficientBalance
|
||||
}
|
||||
wallet.AuthBalance -= transaction.Amount
|
||||
|
||||
transaction.Status = "REJECTED"
|
||||
case "REJECT":
|
||||
if wallet.AuthBalance < transaction.Amount {
|
||||
trx.Rollback()
|
||||
return errors2.ErrorInsufficientBalance
|
||||
}
|
||||
transaction.Status = "APPROVED"
|
||||
wallet.AuthBalance -= transaction.Amount
|
||||
wallet.Balance += transaction.Amount
|
||||
|
||||
@ -93,7 +94,6 @@ func (s *TransactionService) Approval(ctx mycontext.Context, req *entity.Transac
|
||||
}
|
||||
|
||||
// Update the transaction status and persist changes
|
||||
transaction.Status = req.Status
|
||||
transaction.UpdatedBy = ctx.RequestedBy()
|
||||
|
||||
if _, err := s.repo.Update(ctx, trx, transaction); err != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user