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_invalid_amount, _ := h.flagManager.GetFlag("flag_invalid_amount")
|
||||||
flag_api_error, _ := h.flagManager.GetFlag("flag_api_call_error")
|
|
||||||
|
|
||||||
store := h.userdataStore
|
store := h.userdataStore
|
||||||
publicKey, _ := store.ReadEntry(ctx, sessionId, utils.DATA_PUBLIC_KEY)
|
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))
|
balanceRes, err := h.accountService.CheckBalance(string(publicKey))
|
||||||
balanceStr := balanceRes.Result.Balance
|
balanceStr := balanceRes.Result.Balance
|
||||||
|
|
||||||
if !balanceRes.Ok {
|
|
||||||
res.FlagSet = append(res.FlagSet, flag_api_error)
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
res.Content = balanceStr
|
res.Content = balanceStr
|
||||||
res.FlagReset = append(res.FlagReset, flag_api_error)
|
|
||||||
|
|
||||||
// Parse the balance
|
// Parse the balance
|
||||||
balanceParts := strings.Split(balanceStr, " ")
|
balanceParts := strings.Split(balanceStr, " ")
|
||||||
|
|||||||
@ -1468,7 +1468,6 @@ func TestValidateAmount(t *testing.T) {
|
|||||||
t.Logf(err.Error())
|
t.Logf(err.Error())
|
||||||
}
|
}
|
||||||
flag_invalid_amount, _ := fm.parser.GetFlag("flag_invalid_amount")
|
flag_invalid_amount, _ := fm.parser.GetFlag("flag_invalid_amount")
|
||||||
flag_api_error, _ := fm.GetFlag("flag_api_call_error")
|
|
||||||
mockDataStore := new(mocks.MockUserDataStore)
|
mockDataStore := new(mocks.MockUserDataStore)
|
||||||
mockCreateAccountService := new(mocks.MockAccountService)
|
mockCreateAccountService := new(mocks.MockAccountService)
|
||||||
|
|
||||||
@ -1504,7 +1503,6 @@ func TestValidateAmount(t *testing.T) {
|
|||||||
publicKey: []byte("0xrqeqrequuq"),
|
publicKey: []byte("0xrqeqrequuq"),
|
||||||
expectedResult: resource.Result{
|
expectedResult: resource.Result{
|
||||||
Content: "0.001",
|
Content: "0.001",
|
||||||
FlagReset: []uint32{flag_api_error},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1523,7 +1521,6 @@ func TestValidateAmount(t *testing.T) {
|
|||||||
publicKey: []byte("0xrqeqrequuq"),
|
publicKey: []byte("0xrqeqrequuq"),
|
||||||
expectedResult: resource.Result{
|
expectedResult: resource.Result{
|
||||||
FlagSet: []uint32{flag_invalid_amount},
|
FlagSet: []uint32{flag_invalid_amount},
|
||||||
FlagReset: []uint32{flag_api_error},
|
|
||||||
Content: "0.02",
|
Content: "0.02",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1543,7 +1540,6 @@ func TestValidateAmount(t *testing.T) {
|
|||||||
publicKey: []byte("0xrqeqrequuq"),
|
publicKey: []byte("0xrqeqrequuq"),
|
||||||
expectedResult: resource.Result{
|
expectedResult: resource.Result{
|
||||||
FlagSet: []uint32{flag_invalid_amount},
|
FlagSet: []uint32{flag_invalid_amount},
|
||||||
FlagReset: []uint32{flag_api_error},
|
|
||||||
Content: "0.02ms",
|
Content: "0.02ms",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -5,7 +5,6 @@ MOUT back 0
|
|||||||
HALT
|
HALT
|
||||||
LOAD validate_amount 64
|
LOAD validate_amount 64
|
||||||
RELOAD validate_amount
|
RELOAD validate_amount
|
||||||
CATCH api_failure flag_api_call_error 1
|
|
||||||
CATCH invalid_amount flag_invalid_amount 1
|
CATCH invalid_amount flag_invalid_amount 1
|
||||||
INCMP _ 0
|
INCMP _ 0
|
||||||
LOAD get_recipient 12
|
LOAD get_recipient 12
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user