forked from urdt/ussd
Merge remote-tracking branch 'refs/remotes/origin/wip-account-creation' into wip-account-creation
This commit is contained in:
@@ -501,8 +501,9 @@ func (h *Handlers) TransactionReset(ctx context.Context, sym string, input []byt
|
||||
return res, err
|
||||
}
|
||||
|
||||
// reset the recipient
|
||||
// reset the transaction
|
||||
accountData["Recipient"] = ""
|
||||
accountData["Amount"] = ""
|
||||
|
||||
err = h.accountFileHandler.WriteAccountData(accountData)
|
||||
if err != nil {
|
||||
@@ -669,6 +670,21 @@ func (h *Handlers) GetSender(ctx context.Context, sym string, input []byte) (res
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// GetAmount retrieves the amount from a JSON data file.
|
||||
func (h *Handlers) GetAmount(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
res := resource.Result{}
|
||||
|
||||
accountData, err := h.accountFileHandler.ReadAccountData()
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
||||
res.Content = accountData["Amount"]
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
|
||||
// QuickWithBalance retrieves the balance for a given public key from the custodial balance API endpoint before
|
||||
// gracefully exiting the session.
|
||||
func (h *Handlers) QuitWithBalance(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
@@ -686,3 +702,13 @@ func (h *Handlers) QuitWithBalance(ctx context.Context, sym string, input []byte
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (h *Handlers) InitiateTransaction(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
res := resource.Result{}
|
||||
|
||||
// TODO
|
||||
// Use the amount, recipient and sender to call the API and initialize the transaction
|
||||
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user