Compare commits
No commits in common. "dd0b0ce5a300f2503b940fd581ccec1db0d2e904" and "ca86ef15073f10c91386f3b0587b240671c7d9b3" have entirely different histories.
dd0b0ce5a3
...
ca86ef1507
@ -46,7 +46,7 @@ func main() {
|
||||
state.FlagDebugger.Register(models.USERFLAG_PIN_SET, "PIN_SET")
|
||||
state.FlagDebugger.Register(models.USERFLAG_INVALID_RECIPIENT_WITH_INVITE, "INVALIDRECIPIENT_WITH_INVITE")
|
||||
state.FlagDebugger.Register(models.USERFLAG_INVALID_AMOUNT, "INVALIDAMOUNT")
|
||||
state.FlagDebugger.Register(models.USERFLAG_ALLOW_UPDATE, "UNLOCKFORUPDATE")
|
||||
state.FlagDebugger.Register(models.USERFLAG_UNLOCKFORUPDATE, "UNLOCKFORUPDATE")
|
||||
state.FlagDebugger.Register(models.USERFLAG_VALIDPIN, "VALIDPIN")
|
||||
state.FlagDebugger.Register(models.USERFLAG_VALIDPIN, "ACCOUNTUNLOCKED")
|
||||
state.FlagDebugger.Register(models.USERFLAG_ACCOUNT_CREATION_FAILED, "ACCOUNT_CREATION_FAILED")
|
||||
@ -91,7 +91,7 @@ func main() {
|
||||
rfs.AddLocalFunc("verify_pin", ussdHandlers.VerifyPin)
|
||||
rfs.AddLocalFunc("check_identifier", ussdHandlers.CheckIdentifier)
|
||||
rfs.AddLocalFunc("check_account_status", ussdHandlers.CheckAccountStatus)
|
||||
rfs.AddLocalFunc("unlock_account", ussdHandlers.Authorize)
|
||||
rfs.AddLocalFunc("unlock_account", ussdHandlers.Unlock)
|
||||
rfs.AddLocalFunc("quit", ussdHandlers.Quit)
|
||||
rfs.AddLocalFunc("check_balance", ussdHandlers.CheckBalance)
|
||||
rfs.AddLocalFunc("validate_recipient", ussdHandlers.ValidateRecipient)
|
||||
@ -110,8 +110,8 @@ func main() {
|
||||
rfs.AddLocalFunc("save_yob", ussdHandlers.SaveYob)
|
||||
rfs.AddLocalFunc("save_offerings", ussdHandlers.SaveOfferings)
|
||||
rfs.AddLocalFunc("quit_with_balance", ussdHandlers.QuitWithBalance)
|
||||
rfs.AddLocalFunc("reset_unlocked", ussdHandlers.ResetAccountAuthorized)
|
||||
rfs.AddLocalFunc("reset_unlock_for_update", ussdHandlers.ResetAllowUpdate)
|
||||
rfs.AddLocalFunc("reset_unlocked", ussdHandlers.ResetAccountUnlocked)
|
||||
rfs.AddLocalFunc("reset_unlock_for_update", ussdHandlers.ResetUnlockForUpdate)
|
||||
rfs.AddLocalFunc("get_profile_info", ussdHandlers.GetProfileInfo)
|
||||
rfs.AddLocalFunc("verify_yob", ussdHandlers.VerifyYob)
|
||||
rfs.AddLocalFunc("reset_incorrect_date_format", ussdHandlers.ResetIncorrectYob)
|
||||
|
@ -59,8 +59,6 @@ func NewHandlers(path string, st *state.State) *Handlers {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Define the regex pattern as a constant
|
||||
const pinPattern = `^\d{4}$`
|
||||
|
||||
@ -166,13 +164,13 @@ func (h *Handlers) SetResetSingleEdit(ctx context.Context, sym string, input []b
|
||||
menuOption := string(input)
|
||||
switch menuOption {
|
||||
case "2":
|
||||
res.FlagReset = append(res.FlagSet, models.USERFLAG_ALLOW_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_ALLOW_UPDATE)
|
||||
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_ALLOW_UPDATE)
|
||||
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)
|
||||
@ -319,7 +317,7 @@ func (h *Handlers) SaveGender(ctx context.Context, sym string, input []byte) (re
|
||||
case "2":
|
||||
gender = "Female"
|
||||
case "3":
|
||||
gender = "Unspecified"
|
||||
gender = "Other"
|
||||
}
|
||||
accountData["Gender"] = gender
|
||||
|
||||
@ -352,17 +350,17 @@ func (h *Handlers) SaveOfferings(ctx context.Context, sym string, input []byte)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// ResetAllowUpdate resets the allowupdate flag that allows a user to update profile data.
|
||||
func (h *Handlers) ResetAllowUpdate(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
//ResetUnlockForUpdate resets the unlockforupdate flag to correctly show appropriate nodes as a user provides the profile data.
|
||||
func (h *Handlers) ResetUnlockForUpdate(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
res := resource.Result{}
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ALLOW_UPDATE)
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_UNLOCKFORUPDATE)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// ResetAccountAuthorized resets the account authorization flag after a successful PIN entry.
|
||||
func (h *Handlers) ResetAccountAuthorized(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
//ResetAccountUnlocked locks an account that had already been unlocked.
|
||||
func (h *Handlers) ResetAccountUnlocked(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
res := resource.Result{}
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_AUTHORIZED)
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@ -380,9 +378,9 @@ func (h *Handlers) CheckIdentifier(ctx context.Context, sym string, input []byte
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Authorize attempts to unlock the next sequential nodes by verifying the provided PIN against the already set PIN.
|
||||
// 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) Authorize(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
func (h *Handlers) Unlock(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
res := resource.Result{}
|
||||
pin := string(input)
|
||||
|
||||
@ -394,16 +392,16 @@ func (h *Handlers) Authorize(ctx context.Context, sym string, input []byte) (res
|
||||
if len(input) == 4 {
|
||||
if pin != accountData["AccountPIN"] {
|
||||
res.FlagSet = append(res.FlagSet, models.USERFLAG_INCORRECTPIN)
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_AUTHORIZED)
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
|
||||
return res, nil
|
||||
}
|
||||
if h.fs.St.MatchFlag(models.USERFLAG_ACCOUNT_AUTHORIZED, false) {
|
||||
if h.fs.St.MatchFlag(models.USERFLAG_ACCOUNT_UNLOCKED, false) {
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_INCORRECTPIN)
|
||||
res.FlagSet = append(res.FlagSet, models.USERFLAG_ALLOW_UPDATE)
|
||||
res.FlagSet = append(res.FlagSet, models.USERFLAG_ACCOUNT_AUTHORIZED)
|
||||
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_ALLOW_UPDATE)
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_AUTHORIZED)
|
||||
res.FlagSet = append(res.FlagSet, models.USERFLAG_UNLOCKFORUPDATE)
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
|
||||
}
|
||||
}
|
||||
return res, nil
|
||||
@ -460,7 +458,7 @@ func (h *Handlers) Quit(ctx context.Context, sym string, input []byte) (resource
|
||||
l.AddDomain("default")
|
||||
|
||||
res.Content = l.Get("Thank you for using Sarafu. Goodbye!")
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_AUTHORIZED)
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@ -739,6 +737,7 @@ func (h *Handlers) GetAmount(ctx context.Context, sym string, input []byte) (res
|
||||
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) {
|
||||
@ -755,7 +754,7 @@ func (h *Handlers) QuitWithBalance(ctx context.Context, sym string, input []byte
|
||||
return res, nil
|
||||
}
|
||||
res.Content = l.Get("Your account balance is %s", balance)
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_AUTHORIZED)
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@ -786,6 +785,6 @@ func (h *Handlers) InitiateTransaction(ctx context.Context, sym string, input []
|
||||
return res, err
|
||||
}
|
||||
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_AUTHORIZED)
|
||||
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
|
||||
return res, nil
|
||||
}
|
||||
|
@ -7,11 +7,11 @@ const (
|
||||
USERFLAG_ACCOUNT_CREATED
|
||||
USERFLAG_ACCOUNT_PENDING
|
||||
USERFLAG_ACCOUNT_SUCCESS
|
||||
USERFLAG_ACCOUNT_AUTHORIZED
|
||||
USERFLAG_ACCOUNT_UNLOCKED
|
||||
USERFLAG_INVALID_RECIPIENT
|
||||
USERFLAG_INVALID_RECIPIENT_WITH_INVITE
|
||||
USERFLAG_INCORRECTPIN
|
||||
USERFLAG_ALLOW_UPDATE
|
||||
USERFLAG_UNLOCKFORUPDATE
|
||||
USERFLAG_INVALID_AMOUNT
|
||||
USERFLAG_PIN_SET
|
||||
USERFLAG_VALIDPIN
|
||||
|
1
services/registration/other_gender_menu
Normal file
1
services/registration/other_gender_menu
Normal file
@ -0,0 +1 @@
|
||||
Other
|
1
services/registration/other_gender_menu_swa
Normal file
1
services/registration/other_gender_menu_swa
Normal file
@ -0,0 +1 @@
|
||||
Nyingineo
|
@ -2,7 +2,7 @@ LOAD save_familyname 0
|
||||
CATCH update_success 16 1
|
||||
MOUT male 1
|
||||
MOUT female 2
|
||||
MOUT unspecified 3
|
||||
MOUT other_gender 3
|
||||
MOUT back 0
|
||||
HALT
|
||||
LOAD save_gender 0
|
||||
|
@ -1 +0,0 @@
|
||||
Unspecified
|
@ -1 +0,0 @@
|
||||
Haijabainishwa
|
Loading…
Reference in New Issue
Block a user