|
|
|
@ -488,6 +488,13 @@ func (h *MenuHandlers) ConfirmPinChange(ctx context.Context, sym string, input [
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// clear the temporary value as it has been used
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
|
|
|
|
if err != nil {
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -528,6 +535,13 @@ func (h *MenuHandlers) ResetOthersPin(ctx context.Context, sym string, input []b
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// clear the temporary value as it has been used
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
|
|
|
|
if err != nil {
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -703,6 +717,12 @@ func (h *MenuHandlers) SaveFirstname(ctx context.Context, sym string, input []by
|
|
|
|
|
if err != nil {
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
// clear the temporary value as it has been used
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
|
|
|
|
if err != nil {
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
res.FlagSet = append(res.FlagSet, flag_firstname_set)
|
|
|
|
|
} else {
|
|
|
|
|
if firstNameSet {
|
|
|
|
@ -747,6 +767,12 @@ func (h *MenuHandlers) SaveFamilyname(ctx context.Context, sym string, input []b
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write familyName entry with", "key", storedb.DATA_FAMILY_NAME, "value", temporaryFamilyName, "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
// clear the temporary value as it has been used
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
|
|
|
|
if err != nil {
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
res.FlagSet = append(res.FlagSet, flag_familyname_set)
|
|
|
|
|
} else {
|
|
|
|
|
if familyNameSet {
|
|
|
|
@ -821,6 +847,12 @@ func (h *MenuHandlers) SaveYob(ctx context.Context, sym string, input []byte) (r
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write yob entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", temporaryYob, "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
// clear the temporary value as it has been used
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
|
|
|
|
if err != nil {
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
res.FlagSet = append(res.FlagSet, flag_yob_set)
|
|
|
|
|
} else {
|
|
|
|
|
if yobSet {
|
|
|
|
@ -864,6 +896,12 @@ func (h *MenuHandlers) SaveLocation(ctx context.Context, sym string, input []byt
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write location entry with", "key", storedb.DATA_LOCATION, "value", temporaryLocation, "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
// clear the temporary value as it has been used
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
|
|
|
|
if err != nil {
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
res.FlagSet = append(res.FlagSet, flag_location_set)
|
|
|
|
|
} else {
|
|
|
|
|
if locationSet {
|
|
|
|
@ -909,6 +947,12 @@ func (h *MenuHandlers) SaveGender(ctx context.Context, sym string, input []byte)
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write gender entry with", "key", storedb.DATA_GENDER, "value", gender, "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
// clear the temporary value as it has been used
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
|
|
|
|
if err != nil {
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
res.FlagSet = append(res.FlagSet, flag_gender_set)
|
|
|
|
|
} else {
|
|
|
|
|
if genderSet {
|
|
|
|
@ -954,6 +998,12 @@ func (h *MenuHandlers) SaveOfferings(ctx context.Context, sym string, input []by
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write offerings entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", offerings, "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
// clear the temporary value as it has been used
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
|
|
|
|
if err != nil {
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
res.FlagSet = append(res.FlagSet, flag_offerings_set)
|
|
|
|
|
} else {
|
|
|
|
|
if offeringsSet {
|
|
|
|
@ -1634,6 +1684,12 @@ func (h *MenuHandlers) InviteValidRecipient(ctx context.Context, sym string, inp
|
|
|
|
|
// res.Content = l.Get("Your invitation to %s to join Sarafu Network has been sent.", string(recipient))
|
|
|
|
|
|
|
|
|
|
res.Content = l.Get("Your invite request for %s to Sarafu Network failed. Please try again later.", string(recipient))
|
|
|
|
|
// clear the temporary value as it has been used
|
|
|
|
|
err := store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
|
|
|
|
if err != nil {
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
return res, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2382,20 +2438,3 @@ func (h *MenuHandlers) constructAccountAlias(ctx context.Context) error {
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (h *MenuHandlers) ClearTemporaryValue(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
|
|
|
|
var res resource.Result
|
|
|
|
|
sessionId, ok := ctx.Value("SessionId").(string)
|
|
|
|
|
if !ok {
|
|
|
|
|
return res, fmt.Errorf("missing session")
|
|
|
|
|
}
|
|
|
|
|
userStore := h.userdataStore
|
|
|
|
|
|
|
|
|
|
// clear the temporary value at the start
|
|
|
|
|
err := userStore.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
|
|
|
|
if err != nil {
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
|
return res, nil
|
|
|
|
|
}
|
|
|
|
|