wip-account-creation #4
@ -706,9 +706,30 @@ func (h *Handlers) QuitWithBalance(ctx context.Context, sym string, input []byte
|
|||||||
func (h *Handlers) InitiateTransaction(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (h *Handlers) InitiateTransaction(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
res := resource.Result{}
|
res := resource.Result{}
|
||||||
|
|
||||||
|
accountData, err := h.accountFileHandler.ReadAccountData()
|
||||||
|
if err != nil {
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// Use the amount, recipient and sender to call the API and initialize the transaction
|
// Use the amount, recipient and sender to call the API and initialize the transaction
|
||||||
|
|
||||||
|
switch codeFromCtx(ctx) {
|
||||||
|
case "swa":
|
||||||
|
res.Content = fmt.Sprintf("Ombi lako limetumwa. %s atapokea %s kutoka kwa %s.", accountData["Recipient"], accountData["Amount"], accountData["PublicKey"])
|
||||||
|
default:
|
||||||
|
res.Content = fmt.Sprintf("Your request has been sent. %s will receive %s from %s.", accountData["Recipient"], accountData["Amount"], accountData["PublicKey"])
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset the transaction
|
||||||
|
accountData["Recipient"] = ""
|
||||||
|
accountData["Amount"] = ""
|
||||||
|
|
||||||
|
err = h.accountFileHandler.WriteAccountData(accountData)
|
||||||
|
if err != nil {
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
|
||||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
|
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Your request has been sent. {{.get_recipient}} will receive {{.get_amount}} from {{.get_sender}}.
|
|
@ -6,7 +6,4 @@ MAP get_recipient
|
|||||||
RELOAD get_sender
|
RELOAD get_sender
|
||||||
MAP get_sender
|
MAP get_sender
|
||||||
LOAD initiate_transaction 0
|
LOAD initiate_transaction 0
|
||||||
RELOAD transaction_reset
|
|
||||||
MOUT quit 9
|
|
||||||
HALT
|
HALT
|
||||||
INCMP quit 9
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Ombi lako limetumwa. {{.get_recipient}} atapokea {{.get_amount}} kutoka kwa {{.get_sender}}.
|
|
Loading…
Reference in New Issue
Block a user