From c02d70eaa4e2825905ec50b60e8bfcf4837e425e Mon Sep 17 00:00:00 2001 From: lash Date: Mon, 23 Sep 2024 17:35:17 +0100 Subject: [PATCH 1/6] Upgrade dep, improve logging --- cmd/async/main.go | 4 ++++ go.mod | 5 +---- go.sum | 10 ++-------- internal/handlers/base.go | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/cmd/async/main.go b/cmd/async/main.go index fbcf9d8..b936538 100644 --- a/cmd/async/main.go +++ b/cmd/async/main.go @@ -138,22 +138,26 @@ func main() { for true { rqs, err = sh.Process(rqs) if err != nil { + logg.ErrorCtxf(ctx, "error in process: %v", "err", err) fmt.Errorf("error in process: %v", err) os.Exit(1) } rqs, err = sh.Output(rqs) if err != nil { + logg.ErrorCtxf(ctx, "error in output: %v", "err", err) fmt.Errorf("error in output: %v", err) os.Exit(1) } rqs, err = sh.Reset(rqs) if err != nil { + logg.ErrorCtxf(ctx, "error in reset: %v", "err", err) fmt.Errorf("error in reset: %v", err) os.Exit(1) } fmt.Println("") _, err = fmt.Scanln(&rqs.Input) if err != nil { + logg.ErrorCtxf(ctx, "error in input", "err", err) fmt.Errorf("error in input: %v", err) os.Exit(1) } diff --git a/go.mod b/go.mod index 486f8ee..c4c5167 100644 --- a/go.mod +++ b/go.mod @@ -3,15 +3,12 @@ module git.grassecon.net/urdt/ussd go 1.22.6 require ( - git.defalsify.org/vise.git v0.1.0-rc.3.0.20240922152136-7ea16f9137b4 + git.defalsify.org/vise.git v0.1.0-rc.3.0.20240923162317-c20d557a3dbb github.com/alecthomas/assert/v2 v2.2.2 github.com/peteole/testdata-loader v0.3.0 - golang.org/x/crypto v0.17.0 gopkg.in/leonelquinteros/gotext.v1 v1.3.1 ) -require golang.org/x/sys v0.15.0 // indirect - require ( github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/alecthomas/repr v0.2.0 // indirect diff --git a/go.sum b/go.sum index 8dfead8..ed5636f 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -git.defalsify.org/vise.git v0.1.0-rc.3.0.20240922152136-7ea16f9137b4 h1:IMVUK9OkZ/QtYZPHgTZ+XUs5VQ4eIewIaTyVSCF/nAY= -git.defalsify.org/vise.git v0.1.0-rc.3.0.20240922152136-7ea16f9137b4/go.mod h1:JDguWmcoWBdsnpw7PUjVZAEpdC/ubBmjdUBy3tjP63M= +git.defalsify.org/vise.git v0.1.0-rc.3.0.20240923162317-c20d557a3dbb h1:6P4kxihcwMjDKzvUFC6t2zGNb7MDW+l/ACGlSAN1N8Y= +git.defalsify.org/vise.git v0.1.0-rc.3.0.20240923162317-c20d557a3dbb/go.mod h1:JDguWmcoWBdsnpw7PUjVZAEpdC/ubBmjdUBy3tjP63M= github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= github.com/alecthomas/participle/v2 v2.0.0 h1:Fgrq+MbuSsJwIkw3fEj9h75vDP0Er5JzepJ0/HNHv0g= @@ -28,12 +28,6 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/leonelquinteros/gotext.v1 v1.3.1 h1:8d9/fdTG0kn/B7NNGV1BsEyvektXFAbkMsTZS2sFSCc= diff --git a/internal/handlers/base.go b/internal/handlers/base.go index aa83e0b..4d2aa4c 100644 --- a/internal/handlers/base.go +++ b/internal/handlers/base.go @@ -46,7 +46,7 @@ func(f *BaseSessionHandler) Process(rqs RequestSession) (RequestSession, error) var err error var ok bool - logg.InfoCtxf(rqs.Ctx, "new request", rqs) + logg.InfoCtxf(rqs.Ctx, "new request", "data", rqs) rqs.Storage, err = f.provider.Get(rqs.Config.SessionId) if err != nil { From cf4e80dcb85d9e56e65c7953a1a2b6b7cb4b51bc Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Mon, 23 Sep 2024 20:09:37 +0300 Subject: [PATCH 2/6] update profile edit nodes --- services/registration/edit_familyname_menu | 1 + services/registration/edit_profile.vis | 24 ++++++++++--------- services/registration/enter_familyname.vis | 8 +++++-- services/registration/enter_location.vis | 11 ++++----- services/registration/enter_name.vis | 10 +++++++- services/registration/enter_offerings.vis | 6 ++--- services/registration/enter_yob.vis | 13 +++++----- services/registration/my_account.vis | 2 +- services/registration/profile_update_success | 1 + .../registration/profile_update_success.vis | 5 ++++ services/registration/select_gender.vis | 14 +++++------ 11 files changed, 58 insertions(+), 37 deletions(-) create mode 100644 services/registration/edit_familyname_menu create mode 100644 services/registration/profile_update_success create mode 100644 services/registration/profile_update_success.vis diff --git a/services/registration/edit_familyname_menu b/services/registration/edit_familyname_menu new file mode 100644 index 0000000..21a9033 --- /dev/null +++ b/services/registration/edit_familyname_menu @@ -0,0 +1 @@ +Edit family name \ No newline at end of file diff --git a/services/registration/edit_profile.vis b/services/registration/edit_profile.vis index 566b827..6c1986f 100644 --- a/services/registration/edit_profile.vis +++ b/services/registration/edit_profile.vis @@ -2,19 +2,21 @@ LOAD reset_account_authorized 16 LOAD reset_allow_update 0 RELOAD reset_allow_update MOUT edit_name 1 -MOUT edit_gender 2 -MOUT edit_yob 3 -MOUT edit_location 4 -MOUT edit_offerings 5 -MOUT view 6 +MOUT edit_familyname 2 +MOUT edit_gender 3 +MOUT edit_yob 4 +MOUT edit_location 5 +MOUT edit_offerings 6 +MOUT view 7 MOUT back 0 HALT -INCMP _ 0 +INCMP my_account 0 LOAD set_reset_single_edit 0 RELOAD set_reset_single_edit INCMP enter_name 1 -INCMP select_gender 2 -INCMP enter_yob 3 -INCMP enter_location 4 -INCMP enter_offerings 5 -INCMP view_profile 6 +INCMP enter_familyname 2 +INCMP select_gender 3 +INCMP enter_yob 4 +INCMP enter_location 5 +INCMP enter_offerings 6 +INCMP view_profile 7 diff --git a/services/registration/enter_familyname.vis b/services/registration/enter_familyname.vis index 93def9b..b9fe7b0 100644 --- a/services/registration/enter_familyname.vis +++ b/services/registration/enter_familyname.vis @@ -1,5 +1,9 @@ -LOAD save_firstname 0 +CATCH incorrect_pin flag_incorrect_pin 1 +CATCH profile_update_success flag_allow_update 1 +LOAD save_familyname 0 +RELOAD save_familyname MOUT back 0 HALT +RELOAD save_familyname INCMP _ 0 -INCMP select_gender * +INCMP pin_entry * diff --git a/services/registration/enter_location.vis b/services/registration/enter_location.vis index 00bed3d..fdd29ce 100644 --- a/services/registration/enter_location.vis +++ b/services/registration/enter_location.vis @@ -1,9 +1,8 @@ -CATCH incorrect_date_format flag_incorrect_date_format 1 -LOAD save_yob 0 -CATCH update_success flag_allow_update 1 +CATCH incorrect_pin flag_incorrect_pin 1 +CATCH profile_update_success flag_allow_update 1 +LOAD save_location 0 MOUT back 0 HALT +RELOAD save_location INCMP _ 0 -LOAD save_location 0 -CATCH pin_entry flag_single_edit 1 -INCMP enter_offerings * +INCMP pin_entry * diff --git a/services/registration/enter_name.vis b/services/registration/enter_name.vis index 4126f07..563577e 100644 --- a/services/registration/enter_name.vis +++ b/services/registration/enter_name.vis @@ -1,4 +1,12 @@ +CATCH incorrect_pin flag_incorrect_pin 1 +CATCH profile_update_success flag_allow_update 1 +LOAD save_firstname 0 +RELOAD save_firstname MOUT back 0 HALT +RELOAD save_firstname INCMP _ 0 -INCMP enter_familyname * +INCMP pin_entry * + + + diff --git a/services/registration/enter_offerings.vis b/services/registration/enter_offerings.vis index e590321..26e4b61 100644 --- a/services/registration/enter_offerings.vis +++ b/services/registration/enter_offerings.vis @@ -1,8 +1,8 @@ -LOAD save_location 0 CATCH incorrect_pin flag_incorrect_pin 1 -CATCH update_success flag_allow_update 1 +CATCH profile_update_success flag_allow_update 1 +LOAD save_offerings 0 MOUT back 0 HALT -LOAD save_offerings 0 +RELOAD save_offerings INCMP _ 0 INCMP pin_entry * diff --git a/services/registration/enter_yob.vis b/services/registration/enter_yob.vis index 3b27846..40bf3f4 100644 --- a/services/registration/enter_yob.vis +++ b/services/registration/enter_yob.vis @@ -1,9 +1,10 @@ -LOAD save_gender 0 -CATCH update_success flag_allow_update 1 +CATCH incorrect_pin flag_incorrect_pin 1 +CATCH profile_update_success flag_allow_update 1 +LOAD save_yob 0 MOUT back 0 HALT +LOAD verify_yob 0 +CATCH incorrect_date_format flag_incorrect_date_format 1 +RELOAD save_yob INCMP _ 0 -LOAD verify_yob 8 -LOAD save_yob 0 -CATCH pin_entry flag_single_edit 1 -INCMP enter_location * +INCMP pin_entry * diff --git a/services/registration/my_account.vis b/services/registration/my_account.vis index 7df0ef7..43ee6a2 100644 --- a/services/registration/my_account.vis +++ b/services/registration/my_account.vis @@ -7,7 +7,7 @@ MOUT pin_options 5 MOUT my_address 6 MOUT back 0 HALT -INCMP _ 0 +INCMP main 0 INCMP edit_profile 1 INCMP change_language 2 INCMP balances 3 diff --git a/services/registration/profile_update_success b/services/registration/profile_update_success new file mode 100644 index 0000000..2bcb2ae --- /dev/null +++ b/services/registration/profile_update_success @@ -0,0 +1 @@ +Profile information updated successfully diff --git a/services/registration/profile_update_success.vis b/services/registration/profile_update_success.vis new file mode 100644 index 0000000..a035093 --- /dev/null +++ b/services/registration/profile_update_success.vis @@ -0,0 +1,5 @@ +MOUT back 0 +MOUT quit 9 +HALT +INCMP edit_profile 0 +INCMP quit 9 diff --git a/services/registration/select_gender.vis b/services/registration/select_gender.vis index dd354fc..25e53d3 100644 --- a/services/registration/select_gender.vis +++ b/services/registration/select_gender.vis @@ -1,13 +1,13 @@ -LOAD save_familyname 0 -CATCH update_success flag_allow_update 1 +CATCH incorrect_pin flag_incorrect_pin 1 +CATCH profile_update_success flag_allow_update 1 +LOAD save_gender 0 MOUT male 1 MOUT female 2 MOUT unspecified 3 MOUT back 0 HALT -LOAD save_gender 0 -CATCH pin_entry flag_single_edit 1 +RELOAD save_gender INCMP _ 0 -INCMP enter_yob 1 -INCMP enter_yob 2 -INCMP enter_yob 3 +INCMP pin_entry * + + From cb32cfe9d862151694ae79b32030d18079de1c01 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Mon, 23 Sep 2024 20:09:51 +0300 Subject: [PATCH 3/6] update dep --- go.mod | 2 +- go.sum | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 7cceaa6..fc7c2ef 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.grassecon.net/urdt/ussd go 1.22.6 require ( - git.defalsify.org/vise.git v0.1.0-rc.3.0.20240920144308-b2d2c5f18f38 + git.defalsify.org/vise.git v0.1.0-rc.3.0.20240922152136-7ea16f9137b4 github.com/alecthomas/assert/v2 v2.2.2 github.com/peteole/testdata-loader v0.3.0 gopkg.in/leonelquinteros/gotext.v1 v1.3.1 diff --git a/go.sum b/go.sum index 5d235cc..9000575 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,5 @@ -git.defalsify.org/vise.git v0.1.0-rc.3.0.20240911231817-0d23e0dbb57f h1:CuJvG3NyMoRtHUim4aZdrfjjJBg2AId7z0yp7Q97bRM= -git.defalsify.org/vise.git v0.1.0-rc.3.0.20240911231817-0d23e0dbb57f/go.mod h1:JDguWmcoWBdsnpw7PUjVZAEpdC/ubBmjdUBy3tjP63M= -git.defalsify.org/vise.git v0.1.0-rc.3.0.20240914163514-577f56f43bea h1:6ZYT+dIjd/f5vn9y5AJDZ7SQQckA6w5ZfUoKygyI11o= -git.defalsify.org/vise.git v0.1.0-rc.3.0.20240914163514-577f56f43bea/go.mod h1:JDguWmcoWBdsnpw7PUjVZAEpdC/ubBmjdUBy3tjP63M= -git.defalsify.org/vise.git v0.1.0-rc.3.0.20240920144308-b2d2c5f18f38 h1:4aAZijIcq33ixnZ+U48ckDIkwSfZL3St/CqoXZcC5K8= -git.defalsify.org/vise.git v0.1.0-rc.3.0.20240920144308-b2d2c5f18f38/go.mod h1:JDguWmcoWBdsnpw7PUjVZAEpdC/ubBmjdUBy3tjP63M= +git.defalsify.org/vise.git v0.1.0-rc.3.0.20240922152136-7ea16f9137b4 h1:IMVUK9OkZ/QtYZPHgTZ+XUs5VQ4eIewIaTyVSCF/nAY= +git.defalsify.org/vise.git v0.1.0-rc.3.0.20240922152136-7ea16f9137b4/go.mod h1:JDguWmcoWBdsnpw7PUjVZAEpdC/ubBmjdUBy3tjP63M= github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= github.com/alecthomas/participle/v2 v2.0.0 h1:Fgrq+MbuSsJwIkw3fEj9h75vDP0Er5JzepJ0/HNHv0g= From 4a447fbb45d1cb7704cb40ade625fa741febbbed Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Mon, 23 Sep 2024 20:10:37 +0300 Subject: [PATCH 4/6] update profile update --- internal/handlers/ussd/menuhandler.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/internal/handlers/ussd/menuhandler.go b/internal/handlers/ussd/menuhandler.go index 805dcff..ff8d8bd 100644 --- a/internal/handlers/ussd/menuhandler.go +++ b/internal/handlers/ussd/menuhandler.go @@ -356,7 +356,6 @@ func (h *Handlers) SaveFirstname(ctx context.Context, sym string, input []byte) if !ok { return res, fmt.Errorf("missing session") } - if len(input) > 0 { firstName := string(input) store := h.userdataStore @@ -640,7 +639,6 @@ func (h *Handlers) QuitWithHelp(ctx context.Context, sym string, input []byte) ( return res, nil } - // VerifyYob verifies the length of the given input func (h *Handlers) VerifyYob(ctx context.Context, sym string, input []byte) (resource.Result, error) { var res resource.Result From fa0070b9a866997b6ac7741b5e6bdae357a5e4a1 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Mon, 23 Sep 2024 20:20:20 +0300 Subject: [PATCH 5/6] add swahili templates --- services/registration/edit_familyname_menu_swa | 1 + services/registration/enter_familyname_swa | 1 + services/registration/profile_update_success_swa | 1 + 3 files changed, 3 insertions(+) create mode 100644 services/registration/edit_familyname_menu_swa create mode 100644 services/registration/profile_update_success_swa diff --git a/services/registration/edit_familyname_menu_swa b/services/registration/edit_familyname_menu_swa new file mode 100644 index 0000000..48a38b2 --- /dev/null +++ b/services/registration/edit_familyname_menu_swa @@ -0,0 +1 @@ +Weka jina la familia \ No newline at end of file diff --git a/services/registration/enter_familyname_swa b/services/registration/enter_familyname_swa index e69de29..82f64cd 100644 --- a/services/registration/enter_familyname_swa +++ b/services/registration/enter_familyname_swa @@ -0,0 +1 @@ +Weka jina la familia diff --git a/services/registration/profile_update_success_swa b/services/registration/profile_update_success_swa new file mode 100644 index 0000000..df0af2c --- /dev/null +++ b/services/registration/profile_update_success_swa @@ -0,0 +1 @@ +Ombi la Kuweka wasifu limefanikiwa From c7ebca4729fdebfc66c91c8667df8ec7bf78a29b Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Mon, 23 Sep 2024 20:20:41 +0300 Subject: [PATCH 6/6] update template text --- services/registration/profile_update_success | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/registration/profile_update_success b/services/registration/profile_update_success index 2bcb2ae..652942a 100644 --- a/services/registration/profile_update_success +++ b/services/registration/profile_update_success @@ -1 +1 @@ -Profile information updated successfully +Profile updated successfully