wip-flag-migration #28
@ -483,12 +483,12 @@ func (h *Handlers) Authorize(ctx context.Context, sym string, input []byte) (res
|
|||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
pin := string(input)
|
// pin := string(input)
|
||||||
|
|
||||||
accountData, err := h.accountFileHandler.ReadAccountData()
|
// accountData, err := h.accountFileHandler.ReadAccountData()
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return res, err
|
// return res, err
|
||||||
}
|
// }
|
||||||
|
|
||||||
storedpin, err := h.db.Fetch([]byte(AccountPin))
|
storedpin, err := h.db.Fetch([]byte(AccountPin))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@ -512,21 +512,6 @@ func (h *Handlers) Authorize(ctx context.Context, sym string, input []byte) (res
|
|||||||
} else {
|
} else {
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// if len(input) == 4 {
|
|
||||||
// if pin != accountData["AccountPIN"] {
|
|
||||||
// res.FlagSet = append(res.FlagSet, flags["flag_incorrect_pin"])
|
|
||||||
// res.FlagReset = append(res.FlagReset, flags["flag_account_authorized"])
|
|
||||||
// return res, nil
|
|
||||||
// }
|
|
||||||
// if h.fs.St.MatchFlag(flags["flag_account_authorized"], false) {
|
|
||||||
// res.FlagReset = append(res.FlagReset, flags["flag_incorrect_pin"])
|
|
||||||
// res.FlagSet = append(res.FlagSet, flags["flag_allow_update"], flags["flag_account_authorized"])
|
|
||||||
// } else {
|
|
||||||
// res.FlagSet = append(res.FlagSet, flags["flag_allow_update"])
|
|
||||||
// res.FlagReset = append(res.FlagReset, flags["flag_account_authorized"])
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,14 +535,6 @@ func (h *Handlers) ResetIncorrectPin(ctx context.Context, sym string, input []by
|
|||||||
func (h *Handlers) CheckAccountStatus(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (h *Handlers) CheckAccountStatus(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
res := resource.Result{}
|
res := resource.Result{}
|
||||||
|
|
||||||
// Preload the required flags
|
|
||||||
|
|
||||||
flagKeys := []string{"flag_account_success", "flag_account_pending"}
|
|
||||||
flags, err := h.PreloadFlags(flagKeys)
|
|
||||||
if err != nil {
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Preload the required flags
|
// Preload the required flags
|
||||||
flagKeys := []string{"flag_account_success", "flag_account_pending"}
|
flagKeys := []string{"flag_account_success", "flag_account_pending"}
|
||||||
flags, err := h.PreloadFlags(flagKeys)
|
flags, err := h.PreloadFlags(flagKeys)
|
||||||
@ -693,13 +670,12 @@ func (h *Handlers) ValidateRecipient(ctx context.Context, sym string, input []by
|
|||||||
res := resource.Result{}
|
res := resource.Result{}
|
||||||
recipient := string(input)
|
recipient := string(input)
|
||||||
|
|
||||||
accountData, err := h.accountFileHandler.ReadAccountData()
|
flagKeys := []string{"flag_invalid_recipient"}
|
||||||
|
flags, err := h.PreloadFlags(flagKeys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
recipient := string(input)
|
|
||||||
if recipient != "0" {
|
if recipient != "0" {
|
||||||
// mimic invalid number check
|
// mimic invalid number check
|
||||||
if recipient == "000" {
|
if recipient == "000" {
|
||||||
@ -731,7 +707,7 @@ func (h *Handlers) TransactionReset(ctx context.Context, sym string, input []byt
|
|||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err := h.db.Delete([]byte(Amount))
|
err = h.db.Delete([]byte(Amount))
|
||||||
if err != nil && !errors.Is(err, gdbm.ErrItemNotFound) {
|
if err != nil && !errors.Is(err, gdbm.ErrItemNotFound) {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -756,7 +732,7 @@ func (h *Handlers) ResetTransactionAmount(ctx context.Context, sym string, input
|
|||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err := h.db.Delete([]byte(Amount))
|
err = h.db.Delete([]byte(Amount))
|
||||||
if err != nil && !errors.Is(err, gdbm.ErrItemNotFound) {
|
if err != nil && !errors.Is(err, gdbm.ErrItemNotFound) {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -970,11 +946,11 @@ func (h *Handlers) InitiateTransaction(ctx context.Context, sym string, input []
|
|||||||
l := gotext.NewLocale(translationDir, code)
|
l := gotext.NewLocale(translationDir, code)
|
||||||
l.AddDomain("default")
|
l.AddDomain("default")
|
||||||
// Preload the required flags
|
// Preload the required flags
|
||||||
flagKeys := []string{"flag_invalid_recipient"}
|
// flagKeys := []string{"flag_invalid_recipient"}
|
||||||
flags, err := h.PreloadFlags(flagKeys)
|
// flags, err := h.PreloadFlags(flagKeys)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return res, err
|
// 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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user