From e9684fcf45b4fc3873d84dda5d932bf7721b193b Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Sat, 12 Oct 2024 16:28:02 +0300 Subject: [PATCH] check whether the active symbol is empty --- internal/handlers/ussd/menuhandler.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/internal/handlers/ussd/menuhandler.go b/internal/handlers/ussd/menuhandler.go index 4196325..d6d8102 100644 --- a/internal/handlers/ussd/menuhandler.go +++ b/internal/handlers/ussd/menuhandler.go @@ -652,6 +652,20 @@ func (h *Handlers) CheckBalance(ctx context.Context, sym string, input []byte) ( return res, nil } + + return res, err + } + + if len(activeSym) == 0 { + logg.Printf(logging.LVL_INFO, "Using the default sym to fetch balance") + balance, err := h.accountService.CheckBalance(string(publicKey)) + if err != nil { + return res, err + } + + res.Content = balance + + return res, nil } activeBal, err := store.ReadEntry(ctx, sessionId, utils.DATA_ACTIVE_BAL)