diff --git a/handlers/application/balance.go b/handlers/application/balance.go index 53104c7..b09e49d 100644 --- a/handlers/application/balance.go +++ b/handlers/application/balance.go @@ -13,8 +13,7 @@ import ( "gopkg.in/leonelquinteros/gotext.v1" ) -// CheckBalance retrieves the balance of the active voucher and sets -// the balance as the result content. +// CheckBalance retrieves the balance of the active voucher, alias and pool symbol func (h *MenuHandlers) CheckBalance(ctx context.Context, sym string, input []byte) (resource.Result, error) { var ( res resource.Result @@ -38,7 +37,6 @@ func (h *MenuHandlers) CheckBalance(ctx context.Context, sym string, input []byt return res, err } } - activeBal, err := store.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_BAL) if err != nil { if !db.IsNotFound(err) { @@ -47,6 +45,7 @@ func (h *MenuHandlers) CheckBalance(ctx context.Context, sym string, input []byt } } + // get the account alias accAlias, err := store.ReadEntry(ctx, sessionId, storedb.DATA_ACCOUNT_ALIAS) if err != nil { if !db.IsNotFound(err) { @@ -55,7 +54,13 @@ func (h *MenuHandlers) CheckBalance(ctx context.Context, sym string, input []byt } } - content, err = loadUserContent(ctx, string(activeSym), string(activeBal), string(accAlias)) + // Resolve active pool + _, activePoolSymbol, err := h.resolveActivePoolDetails(ctx, sessionId) + if err != nil { + return res, err + } + + content, err = loadUserContent(ctx, string(activeSym), string(activeBal), string(accAlias), string(activePoolSymbol)) if err != nil { return res, err } @@ -65,7 +70,7 @@ func (h *MenuHandlers) CheckBalance(ctx context.Context, sym string, input []byt } // loadUserContent loads the main user content in the main menu: the alias, balance and active symbol associated with active voucher -func loadUserContent(ctx context.Context, activeSym, balance, alias string) (string, error) { +func loadUserContent(ctx context.Context, activeSym, balance, alias, activePoolSymbol string) (string, error) { var content string code := codeFromCtx(ctx) @@ -82,9 +87,9 @@ func loadUserContent(ctx context.Context, activeSym, balance, alias string) (str balStr := fmt.Sprintf("%s %s", formattedAmount, activeSym) if alias != "" { - content = l.Get("%s\nBalance: %s\n", alias, balStr) + content = l.Get("%s\n%s\nPool: %s\n", alias, balStr, activePoolSymbol) } else { - content = l.Get("Balance: %s\n", balStr) + content = l.Get("%s\nPool: %s\n", balStr, activePoolSymbol) } return content, nil } diff --git a/services/registration/account_menu b/services/registration/account_menu index 7aa9fe9..8e25807 100644 --- a/services/registration/account_menu +++ b/services/registration/account_menu @@ -1 +1 @@ -My Account \ No newline at end of file +Account \ No newline at end of file diff --git a/services/registration/account_menu_swa b/services/registration/account_menu_swa index c77102f..fec7f84 100644 --- a/services/registration/account_menu_swa +++ b/services/registration/account_menu_swa @@ -1 +1 @@ -Akaunti yangu \ No newline at end of file +Akaunti \ No newline at end of file diff --git a/services/registration/select_pool_menu b/services/registration/select_pool_menu index 5fc7cb4..ed22b5c 100644 --- a/services/registration/select_pool_menu +++ b/services/registration/select_pool_menu @@ -1 +1 @@ -Select pool \ No newline at end of file +Pool \ No newline at end of file diff --git a/services/registration/select_pool_menu_swa b/services/registration/select_pool_menu_swa index 546dc7d..c1a5131 100644 --- a/services/registration/select_pool_menu_swa +++ b/services/registration/select_pool_menu_swa @@ -1 +1 @@ -Chagua Bwawa \ No newline at end of file +Bwawa \ No newline at end of file diff --git a/services/registration/vouchers_menu b/services/registration/vouchers_menu index 5084c32..f8210cc 100644 --- a/services/registration/vouchers_menu +++ b/services/registration/vouchers_menu @@ -1 +1 @@ -My Vouchers \ No newline at end of file +Vouchers \ No newline at end of file diff --git a/services/registration/vouchers_menu_swa b/services/registration/vouchers_menu_swa index 64ba54e..55090b1 100644 --- a/services/registration/vouchers_menu_swa +++ b/services/registration/vouchers_menu_swa @@ -1 +1 @@ -Sarafu yangu \ No newline at end of file +Sarafu \ No newline at end of file