This commit is contained in:
parent
5f37856927
commit
3b16e25ebd
@ -1468,7 +1468,6 @@ func loadUserContent(ctx context.Context, activeSym string, balance string, alia
|
|||||||
// 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 (
|
var (
|
||||||
res resource.Result
|
res resource.Result
|
||||||
err error
|
err error
|
||||||
@ -1496,19 +1495,21 @@ func (h *MenuHandlers) CheckBalance(ctx context.Context, sym string, input []byt
|
|||||||
// 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 {
|
||||||
|
logg.InfoCtxf(ctx, "could not find the activeSym in checkBalance:", "err", err)
|
||||||
if !db.IsNotFound(err) {
|
if !db.IsNotFound(err) {
|
||||||
logg.ErrorCtxf(ctx, "failed to read activeSym entry with", "key", storedb.DATA_ACTIVE_SYM, "error", err)
|
logg.ErrorCtxf(ctx, "failed to read activeSym entry with", "key", storedb.DATA_ACTIVE_SYM, "error", err)
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logg.InfoCtxf(ctx, "The active data in CheckBalance:", "activeSym", string(activeSym))
|
||||||
|
|
||||||
activeBal, err := store.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_BAL)
|
activeBal, err := store.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_BAL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !db.IsNotFound(err) {
|
if !db.IsNotFound(err) {
|
||||||
logg.ErrorCtxf(ctx, "failed to read activeBal entry with", "key", storedb.DATA_ACTIVE_BAL, "error", err)
|
logg.ErrorCtxf(ctx, "failed to read activeBal entry with", "key", storedb.DATA_ACTIVE_BAL, "error", err)
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
content, err = loadUserContent(ctx, string(activeSym), string(activeBal), alias)
|
content, err = loadUserContent(ctx, string(activeSym), string(activeBal), alias)
|
||||||
@ -1944,7 +1945,7 @@ func (h *MenuHandlers) SetDefaultVoucher(ctx context.Context, sym string, input
|
|||||||
activeSym, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_SYM)
|
activeSym, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_SYM)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logg.InfoCtxf(ctx, "Checking the data as no", "DATA_ACTIVE_SYM", storedb.DATA_ACTIVE_SYM)
|
logg.InfoCtxf(ctx, "Checking the data as no activeSym", "DATA_ACTIVE_SYM", storedb.DATA_ACTIVE_SYM)
|
||||||
|
|
||||||
if db.IsNotFound(err) {
|
if db.IsNotFound(err) {
|
||||||
publicKey, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY)
|
publicKey, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY)
|
||||||
@ -2011,7 +2012,7 @@ func (h *MenuHandlers) SetDefaultVoucher(ctx context.Context, sym string, input
|
|||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
logg.InfoCtxf(ctx, "The activeSym:", "activeSym", string(activeSym))
|
logg.InfoCtxf(ctx, "The activeSym in SetDefaultVoucher:", "activeSym", string(activeSym))
|
||||||
|
|
||||||
res.FlagReset = append(res.FlagReset, flag_no_active_voucher)
|
res.FlagReset = append(res.FlagReset, flag_no_active_voucher)
|
||||||
|
|
||||||
@ -2074,8 +2075,16 @@ func (h *MenuHandlers) CheckVouchers(ctx context.Context, sym string, input []by
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
activeBal, _ := userStore.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_BAL)
|
||||||
|
activeAddr, _ := userStore.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_ADDRESS)
|
||||||
|
|
||||||
|
logg.InfoCtxf(ctx, "The active data in CheckVouchers:", "activeSym", string(activeSym), string(activeBal), string(activeAddr))
|
||||||
|
|
||||||
data := store.ProcessVouchers(vouchersResp)
|
data := store.ProcessVouchers(vouchersResp)
|
||||||
|
|
||||||
|
logg.InfoCtxf(ctx, "The data in CheckVouchers:", "data", data)
|
||||||
|
|
||||||
// Store all voucher data
|
// Store all voucher data
|
||||||
dataMap := map[storedb.DataTyp]string{
|
dataMap := map[storedb.DataTyp]string{
|
||||||
storedb.DATA_VOUCHER_SYMBOLS: data.Symbols,
|
storedb.DATA_VOUCHER_SYMBOLS: data.Symbols,
|
||||||
|
Loading…
Reference in New Issue
Block a user