Compare commits

...

4 Commits

9 changed files with 29 additions and 4 deletions

View File

@ -122,6 +122,7 @@ func (ls *LocalHandlerService) GetHandler(accountService remote.AccountServiceIn
ls.DbRs.AddLocalFunc("get_transactions", ussdHandlers.GetTransactionsList)
ls.DbRs.AddLocalFunc("view_statement", ussdHandlers.ViewTransactionStatement)
ls.DbRs.AddLocalFunc("update_all_profile_items", ussdHandlers.UpdateAllProfileItems)
ls.DbRs.AddLocalFunc("set_back", ussdHandlers.SetBack)
return ussdHandlers, nil
}

View File

@ -726,6 +726,18 @@ func (h *Handlers) ResetIncorrectPin(ctx context.Context, sym string, input []by
return res, nil
}
// Setback sets the flag_back_set flag when the navigation is back
func (h *Handlers) SetBack(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var res resource.Result
//TODO:
//Add check if the navigation is lateral nav instead of checking the input.
if string(input) == "0" {
flag_back_set, _ := h.flagManager.GetFlag("flag_back_set")
res.FlagSet = append(res.FlagSet, flag_back_set)
}
return res, nil
}
// CheckAccountStatus queries the API using the TrackingId and sets flags
// based on the account status
func (h *Handlers) CheckAccountStatus(ctx context.Context, sym string, input []byte) (resource.Result, error) {
@ -1332,6 +1344,9 @@ func (h *Handlers) GetCurrentProfileInfo(ctx context.Context, sym string, input
flag_gender_set, _ := h.flagManager.GetFlag("flag_gender_set")
flag_location_set, _ := h.flagManager.GetFlag("flag_location_set")
flag_offerings_set, _ := h.flagManager.GetFlag("flag_offerings_set")
flag_back_set, _ := h.flagManager.GetFlag("flag_back_set")
res.FlagReset = append(res.FlagReset, flag_back_set)
sessionId, ok := ctx.Value("SessionId").(string)
if !ok {
@ -2017,6 +2032,7 @@ func (h *Handlers) insertProfileItems(ctx context.Context, sessionId string, res
return nil
}
// UpdateAllProfileItems is used to persist all the new profile information and setup the required profile flags
func (h *Handlers) UpdateAllProfileItems(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var res resource.Result
sessionId, ok := ctx.Value("SessionId").(string)

View File

@ -5,9 +5,10 @@ RELOAD get_current_profile_info
MAP get_current_profile_info
MOUT back 0
HALT
RELOAD set_back
CATCH _ flag_back_set 1
LOAD save_familyname 64
RELOAD save_familyname
INCMP _ 0
CATCH pin_entry flag_familyname_set 1
CATCH select_gender flag_gender_set 0
CATCH edit_yob flag_yob_set 0

View File

@ -5,7 +5,8 @@ RELOAD get_current_profile_info
MAP get_current_profile_info
MOUT back 0
HALT
INCMP _ 0
RELOAD set_back
CATCH _ flag_back_set 1
LOAD save_firstname 128
RELOAD save_firstname
CATCH pin_entry flag_firstname_set 1
@ -15,4 +16,3 @@ CATCH edit_yob flag_yob_set 0
CATCH edit_location flag_location_set 0
CATCH edit_offerings flag_offerings_set 0
CATCH pin_entry flag_firstname_set 0
INCMP edit_family_name *

View File

@ -5,6 +5,8 @@ RELOAD get_current_profile_info
LOAD save_location 16
MOUT back 0
HALT
RELOAD set_back
CATCH _ flag_back_set 1
RELOAD save_location
INCMP _ 0
CATCH pin_entry flag_location_set 1

View File

@ -5,6 +5,8 @@ RELOAD get_current_profile_info
LOAD save_offerings 8
MOUT back 0
HALT
RELOAD set_back
CATCH _ flag_back_set 1
RELOAD save_offerings
INCMP _ 0
CATCH pin_entry flag_offerings_set 1

View File

@ -11,6 +11,7 @@ MOUT edit_offerings 6
MOUT view 7
MOUT back 0
HALT
LOAD set_back 6
INCMP ^ 0
INCMP edit_first_name 1
INCMP edit_family_name 2

View File

@ -5,12 +5,13 @@ RELOAD get_current_profile_info
MAP get_current_profile_info
MOUT back 0
HALT
RELOAD set_back
CATCH _ flag_back_set 1
LOAD verify_yob 6
RELOAD verify_yob
CATCH incorrect_date_format flag_incorrect_date_format 1
LOAD save_yob 32
RELOAD save_yob
INCMP _ 0
CATCH pin_entry flag_yob_set 1
CATCH edit_location flag_location_set 0
CATCH edit_offerings flag_offerings_set 0

View File

@ -27,3 +27,4 @@ flag,flag_yob_set,33,this is set when the yob of the profile is set
flag,flag_gender_set,34,this is set when the gender of the profile is set
flag,flag_location_set,35,this is set when the location of the profile is set
flag,flag_offerings_set,36,this is set when the offerings of the profile is set
flag,flag_back_set,37,this is set when it is a back navigation

1 flag flag_language_set 8 checks whether the user has set their prefered language
27 flag flag_gender_set 34 this is set when the gender of the profile is set
28 flag flag_location_set 35 this is set when the location of the profile is set
29 flag flag_offerings_set 36 this is set when the offerings of the profile is set
30 flag flag_back_set 37 this is set when it is a back navigation