update the symbol to send_max_amount with debug output
This commit is contained in:
parent
c18d40286e
commit
3fdb0e3426
@ -313,6 +313,8 @@ func (h *MenuHandlers) ResetTransactionAmount(ctx context.Context, sym string, i
|
||||
func (h *MenuHandlers) MaxAmount(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
var res resource.Result
|
||||
|
||||
fmt.Println("running in MaxAmount with sym:", sym)
|
||||
|
||||
sessionId, ok := ctx.Value("SessionId").(string)
|
||||
if !ok {
|
||||
return res, fmt.Errorf("missing session")
|
||||
@ -335,10 +337,11 @@ func (h *MenuHandlers) MaxAmount(ctx context.Context, sym string, input []byte)
|
||||
// Format the active balance amount to 2 decimal places
|
||||
formattedBalance, _ := store.TruncateDecimalString(string(activeBal), 2)
|
||||
|
||||
// If normal transaction, or if the sym is max_amount, return balance
|
||||
if string(transactionType) == "normal" || sym == "max_amount" {
|
||||
// If normal transaction, or if the sym is send_max_amount, return balance
|
||||
if string(transactionType) == "normal" || sym == "send_max_amount" {
|
||||
res.FlagReset = append(res.FlagReset, flag_swap_transaction)
|
||||
|
||||
fmt.Println("running in send_max_amount with:", formattedBalance, string(activeSym))
|
||||
res.Content = l.Get("Maximum amount: %s %s\nEnter amount:", formattedBalance, string(activeSym))
|
||||
|
||||
return res, nil
|
||||
|
||||
@ -277,7 +277,7 @@ func TestMaxAmount(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
res, err := h.MaxAmount(ctx, "max_amount", []byte(""))
|
||||
res, err := h.MaxAmount(ctx, "send_max_amount", []byte(""))
|
||||
|
||||
if tt.expectedError {
|
||||
assert.Error(t, err)
|
||||
|
||||
@ -85,7 +85,7 @@ func (ls *LocalHandlerService) GetHandler(accountService remote.AccountService)
|
||||
ls.DbRs.AddLocalFunc("validate_recipient", appHandlers.ValidateRecipient)
|
||||
ls.DbRs.AddLocalFunc("transaction_reset", appHandlers.TransactionReset)
|
||||
ls.DbRs.AddLocalFunc("invite_valid_recipient", appHandlers.InviteValidRecipient)
|
||||
ls.DbRs.AddLocalFunc("max_amount", appHandlers.MaxAmount)
|
||||
ls.DbRs.AddLocalFunc("send_max_amount", appHandlers.MaxAmount)
|
||||
ls.DbRs.AddLocalFunc("credit_max_amount", appHandlers.MaxAmount)
|
||||
ls.DbRs.AddLocalFunc("validate_amount", appHandlers.ValidateAmount)
|
||||
ls.DbRs.AddLocalFunc("reset_transaction_amount", appHandlers.ResetTransactionAmount)
|
||||
|
||||
@ -1 +1 @@
|
||||
{{.max_amount}}
|
||||
{{.send_max_amount}}
|
||||
@ -1,8 +1,8 @@
|
||||
LOAD reset_transaction_amount 10
|
||||
RELOAD reset_transaction_amount
|
||||
LOAD max_amount 0
|
||||
RELOAD max_amount
|
||||
MAP max_amount
|
||||
LOAD send_max_amount 0
|
||||
RELOAD send_max_amount
|
||||
MAP send_max_amount
|
||||
MOUT back 0
|
||||
HALT
|
||||
LOAD validate_amount 64
|
||||
|
||||
@ -1 +1 @@
|
||||
{{.max_amount}}
|
||||
{{.send_max_amount}}
|
||||
Loading…
Reference in New Issue
Block a user