add dummy vouchers list

This commit is contained in:
Carlosokumu 2024-09-25 13:27:13 +03:00
parent 0caf82a27e
commit 188cb573dd
Signed by: carlos
GPG Key ID: 7BD6BC8160A5C953
5 changed files with 45 additions and 1 deletions

View File

@ -94,6 +94,7 @@ func (ls *LocalHandlerService) GetHandler() (*ussd.Handlers, error) {
ls.DbRs.AddLocalFunc("verify_new_pin", ussdHandlers.VerifyNewPin)
ls.DbRs.AddLocalFunc("confirm_pin_change", ussdHandlers.ConfirmPinChange)
ls.DbRs.AddLocalFunc("quit_with_help", ussdHandlers.QuitWithHelp)
ls.DbRs.AddLocalFunc("get_vouchers",ussdHandlers.GetVoucherList)
return ussdHandlers, nil
}

View File

@ -254,6 +254,38 @@ func (h *Handlers) SaveTemporaryPin(ctx context.Context, sym string, input []byt
return res, nil
}
func (h *Handlers) GetVoucherList(ctx context.Context,sym string,input []byte) (resource.Result,error){
var res resource.Result
vouchers := []string{
"SRF",
"CRF",
"VCF",
"VSAPA",
"FSTMP",
"FSAW",
"PTAQ",
"VCRXT",
"VSGAQ",
"QPWIQQ",
"FSTMP",
"FSAW",
"PTAQ",
"VCRXT",
"VSGAQ",
"QPWIQQ",
"FSTMP",
"FSAW",
"PTAQ",
"VCRXT",
"VSGAQ",
"QPWIQQ",
}
res.Content = strings.Join(vouchers,"\n")
return res,nil
}
func (h *Handlers) ConfirmPinChange(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var res resource.Result
sessionId, ok := ctx.Value("SessionId").(string)

View File

@ -8,7 +8,7 @@ MOUT help 4
MOUT quit 9
HALT
INCMP send 1
INCMP quit 2
INCMP select_voucher 2
INCMP my_account 3
INCMP help 4
INCMP quit 9

View File

@ -0,0 +1,2 @@
Select number or symbol from your vouchers:
{{.get_vouchers}}

View File

@ -0,0 +1,9 @@
LOAD get_vouchers 0
MAP get_vouchers
MNEXT next 11
MPREV back 22
HALT
INCMP > 11
INCMP < 22
INCMP _*