Compare commits
No commits in common. "3e422f269fab0341a5dcd062adf89a390ebc204e" and "8f7d5ff66d760fa531ae61b6b84cd10a6d16e790" have entirely different histories.
3e422f269f
...
8f7d5ff66d
@ -1441,13 +1441,8 @@ func (h *MenuHandlers) ShowBlockedAccount(ctx context.Context, sym string, input
|
|||||||
// CheckBalance retrieves the balance of the active voucher and sets
|
// CheckBalance retrieves the balance of the active voucher and sets
|
||||||
// the balance as the result content.
|
// the balance as the result content.
|
||||||
func (h *MenuHandlers) CheckBalance(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (h *MenuHandlers) CheckBalance(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
|
var res resource.Result
|
||||||
var (
|
var err error
|
||||||
res resource.Result
|
|
||||||
err error
|
|
||||||
alias string
|
|
||||||
content string
|
|
||||||
)
|
|
||||||
|
|
||||||
sessionId, ok := ctx.Value("SessionId").(string)
|
sessionId, ok := ctx.Value("SessionId").(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -1460,27 +1455,12 @@ func (h *MenuHandlers) CheckBalance(ctx context.Context, sym string, input []byt
|
|||||||
|
|
||||||
store := h.userdataStore
|
store := h.userdataStore
|
||||||
|
|
||||||
accAlias, err := store.ReadEntry(ctx, sessionId, storedb.DATA_ACCOUNT_ALIAS)
|
|
||||||
if err != nil {
|
|
||||||
if !db.IsNotFound(err) {
|
|
||||||
logg.ErrorCtxf(ctx, "failed to read account alias entry with", "key", storedb.DATA_ACCOUNT_ALIAS, "error", err)
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
alias = strings.Split(string(accAlias), ".")[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the active sym and active balance
|
// get the active sym and active balance
|
||||||
activeSym, err := store.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_SYM)
|
activeSym, err := store.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_SYM)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if db.IsNotFound(err) {
|
if db.IsNotFound(err) {
|
||||||
balance := "0.00"
|
balance := "0.00"
|
||||||
if alias != "" {
|
res.Content = l.Get("Balance: %s\n", balance)
|
||||||
content = l.Get("Alias: %s\nBalance: %s\n", alias, balance)
|
|
||||||
} else {
|
|
||||||
content = l.Get("Balance: %s\n", balance)
|
|
||||||
}
|
|
||||||
res.Content = content
|
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1504,12 +1484,7 @@ func (h *MenuHandlers) CheckBalance(ctx context.Context, sym string, input []byt
|
|||||||
// Format to 2 decimal places
|
// Format to 2 decimal places
|
||||||
balStr := fmt.Sprintf("%.2f %s", balFloat, activeSym)
|
balStr := fmt.Sprintf("%.2f %s", balFloat, activeSym)
|
||||||
|
|
||||||
if alias != "" {
|
res.Content = l.Get("Balance: %s\n", balStr)
|
||||||
content = l.Get("Alias: %s\nBalance: %s\n", alias, balStr)
|
|
||||||
} else {
|
|
||||||
content = l.Get("Balance: %s\n", balStr)
|
|
||||||
}
|
|
||||||
res.Content = content
|
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
@ -2445,8 +2420,7 @@ func (h *MenuHandlers) constructAccountAlias(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
//RequestCustomAlias requests an ENS based alias name based on a user's input,then saves it as temporary value
|
||||||
// RequestCustomAlias requests an ENS based alias name based on a user's input,then saves it as temporary value
|
|
||||||
func (h *MenuHandlers) RequestCustomAlias(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (h *MenuHandlers) RequestCustomAlias(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
var res resource.Result
|
var res resource.Result
|
||||||
sessionId, ok := ctx.Value("SessionId").(string)
|
sessionId, ok := ctx.Value("SessionId").(string)
|
||||||
@ -2490,7 +2464,7 @@ func (h *MenuHandlers) RequestCustomAlias(ctx context.Context, sym string, input
|
|||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSuggestedAlias loads and displays the suggested alias name from the temporary value
|
//GetSuggestedAlias loads and displays the suggested alias name from the temporary value
|
||||||
func (h *MenuHandlers) GetSuggestedAlias(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (h *MenuHandlers) GetSuggestedAlias(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
var res resource.Result
|
var res resource.Result
|
||||||
store := h.userdataStore
|
store := h.userdataStore
|
||||||
@ -2507,7 +2481,7 @@ func (h *MenuHandlers) GetSuggestedAlias(ctx context.Context, sym string, input
|
|||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConfirmNewAlias reads the suggested alias from the temporary value and confirms it as the new account alias.
|
//ConfirmNewAlias reads the suggested alias from the temporary value and confirms it as the new account alias.
|
||||||
func (h *MenuHandlers) ConfirmNewAlias(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (h *MenuHandlers) ConfirmNewAlias(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
var res resource.Result
|
var res resource.Result
|
||||||
store := h.userdataStore
|
store := h.userdataStore
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
Lakabu ya sasa: {{.get_current_profile_info}}
|
Lakabu ya sasa
|
||||||
Badilisha Lakabu yangu:
|
Badilisha Lakabu yangu:
|
||||||
@ -4,7 +4,6 @@ LOAD reset_allow_update 4
|
|||||||
LOAD verify_new_pin 2
|
LOAD verify_new_pin 2
|
||||||
LOAD save_temporary_pin 1
|
LOAD save_temporary_pin 1
|
||||||
LOAD reset_incorrect 0
|
LOAD reset_incorrect 0
|
||||||
LOAD reset_invalid_pin 6
|
|
||||||
MOUT change_pin 1
|
MOUT change_pin 1
|
||||||
MOUT reset_pin 2
|
MOUT reset_pin 2
|
||||||
MOUT back 0
|
MOUT back 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user