Compare commits
No commits in common. "0be570ae2df88c7181c50cd643b244f74f793103" and "4889e6d18bc20e8bfb977576706968d9b5da97f8" have entirely different histories.
0be570ae2d
...
4889e6d18b
@ -829,7 +829,6 @@ func (h *Handlers) ValidateAmount(ctx context.Context, sym string, input []byte)
|
||||
}
|
||||
|
||||
flag_invalid_amount, _ := h.flagManager.GetFlag("flag_invalid_amount")
|
||||
flag_api_error, _ := h.flagManager.GetFlag("flag_api_call_error")
|
||||
|
||||
store := h.userdataStore
|
||||
publicKey, _ := store.ReadEntry(ctx, sessionId, utils.DATA_PUBLIC_KEY)
|
||||
@ -839,15 +838,10 @@ func (h *Handlers) ValidateAmount(ctx context.Context, sym string, input []byte)
|
||||
balanceRes, err := h.accountService.CheckBalance(string(publicKey))
|
||||
balanceStr := balanceRes.Result.Balance
|
||||
|
||||
if !balanceRes.Ok {
|
||||
res.FlagSet = append(res.FlagSet, flag_api_error)
|
||||
return res, nil
|
||||
}
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
res.Content = balanceStr
|
||||
res.FlagReset = append(res.FlagReset, flag_api_error)
|
||||
|
||||
// Parse the balance
|
||||
balanceParts := strings.Split(balanceStr, " ")
|
||||
|
@ -1468,7 +1468,6 @@ func TestValidateAmount(t *testing.T) {
|
||||
t.Logf(err.Error())
|
||||
}
|
||||
flag_invalid_amount, _ := fm.parser.GetFlag("flag_invalid_amount")
|
||||
flag_api_error, _ := fm.GetFlag("flag_api_call_error")
|
||||
mockDataStore := new(mocks.MockUserDataStore)
|
||||
mockCreateAccountService := new(mocks.MockAccountService)
|
||||
|
||||
@ -1503,8 +1502,7 @@ func TestValidateAmount(t *testing.T) {
|
||||
},
|
||||
publicKey: []byte("0xrqeqrequuq"),
|
||||
expectedResult: resource.Result{
|
||||
Content: "0.001",
|
||||
FlagReset: []uint32{flag_api_error},
|
||||
Content: "0.001",
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -1522,9 +1520,8 @@ func TestValidateAmount(t *testing.T) {
|
||||
},
|
||||
publicKey: []byte("0xrqeqrequuq"),
|
||||
expectedResult: resource.Result{
|
||||
FlagSet: []uint32{flag_invalid_amount},
|
||||
FlagReset: []uint32{flag_api_error},
|
||||
Content: "0.02",
|
||||
FlagSet: []uint32{flag_invalid_amount},
|
||||
Content: "0.02",
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -1542,9 +1539,8 @@ func TestValidateAmount(t *testing.T) {
|
||||
},
|
||||
publicKey: []byte("0xrqeqrequuq"),
|
||||
expectedResult: resource.Result{
|
||||
FlagSet: []uint32{flag_invalid_amount},
|
||||
FlagReset: []uint32{flag_api_error},
|
||||
Content: "0.02ms",
|
||||
FlagSet: []uint32{flag_invalid_amount},
|
||||
Content: "0.02ms",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ MOUT back 0
|
||||
HALT
|
||||
LOAD validate_amount 64
|
||||
RELOAD validate_amount
|
||||
CATCH api_failure flag_api_call_error 1
|
||||
CATCH invalid_amount flag_invalid_amount 1
|
||||
INCMP _ 0
|
||||
LOAD get_recipient 12
|
||||
|
Loading…
Reference in New Issue
Block a user