Compare commits

...

4 Commits

3 changed files with 25 additions and 2 deletions

View File

@ -130,10 +130,14 @@ func (h *Handlers) SetResetSingleEdit(ctx context.Context, sym string, input []b
switch menuOPtion {
case "2":
fmt.Println("Resetting unlock for update")
res.FlagReset = append(res.FlagSet, models.USERFLAG_UNLOCKFORUPDATE)
res.FlagSet = append(res.FlagSet, models.USERFLAG_SINGLE_EDIT)
case "3":
res.FlagReset = append(res.FlagSet, models.USERFLAG_UNLOCKFORUPDATE)
res.FlagSet = append(res.FlagSet, models.USERFLAG_SINGLE_EDIT)
case "4":
res.FlagReset = append(res.FlagSet, models.USERFLAG_UNLOCKFORUPDATE)
res.FlagSet = append(res.FlagSet, models.USERFLAG_SINGLE_EDIT)
default:
res.FlagReset = append(res.FlagReset, models.USERFLAG_SINGLE_EDIT)
@ -339,6 +343,8 @@ func (h *Handlers) CheckIdentifier(ctx context.Context, sym string, input []byte
return res, nil
}
// Unlock attempts to unlock the next sequential nodes by verifying the provided PIN against the already set PIN.
// It sets the required flags that control the flow.
func (h *Handlers) Unlock(ctx context.Context, sym string, input []byte) (resource.Result, error) {
res := resource.Result{}
pin := string(input)
@ -348,7 +354,7 @@ func (h *Handlers) Unlock(ctx context.Context, sym string, input []byte) (resour
return res, err
}
if len(input) > 1 {
if len(input) == 4 {
if pin != accountData["AccountPIN"] {
res.FlagSet = append(res.FlagSet, models.USERFLAG_INCORRECTPIN)
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
@ -359,6 +365,7 @@ func (h *Handlers) Unlock(ctx context.Context, sym string, input []byte) (resour
res.FlagSet = append(res.FlagSet, models.USERFLAG_UNLOCKFORUPDATE)
res.FlagSet = append(res.FlagSet, models.USERFLAG_ACCOUNT_UNLOCKED)
} else {
res.FlagSet = append(res.FlagSet, models.USERFLAG_UNLOCKFORUPDATE)
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
}
}
@ -678,6 +685,8 @@ func (h *Handlers) GetAmount(ctx context.Context, sym string, input []byte) (res
}
// 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) {
res := resource.Result{}

View File

@ -0,0 +1,11 @@
package ussd
import "testing"
func CreateAccountTest(t *testing.T){
}

View File

@ -1,4 +1,6 @@
LOAD reset_unlocked 0
LOAD reset_unlocked 16
LOAD reset_unlock_for_update 0
RELOAD reset_unlock_for_update
MOUT edit_name 1
MOUT edit_gender 2
MOUT edit_yob 3
@ -9,6 +11,7 @@ MOUT back 0
HALT
INCMP _ 0
LOAD set_reset_single_edit 0
RELOAD set_reset_single_edit
INCMP enter_name 1
INCMP select_gender 2
INCMP enter_yob 3