From 266d3d06c3c86ec631b10011ca4e193ea1f367fe Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Mon, 4 Nov 2024 17:56:25 +0300 Subject: [PATCH] Check the flag_no_active_voucher before proceeding --- internal/handlers/ussd/menuhandler.go | 3 ++- services/registration/no_voucher | 2 +- services/registration/no_voucher_swa | 2 +- services/registration/select_voucher.vis | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/handlers/ussd/menuhandler.go b/internal/handlers/ussd/menuhandler.go index 6c1917d..ca4af09 100644 --- a/internal/handlers/ussd/menuhandler.go +++ b/internal/handlers/ussd/menuhandler.go @@ -1254,7 +1254,8 @@ func (h *Handlers) SetDefaultVoucher(ctx context.Context, sym string, input []by // Fetch vouchers from the API using the public key vouchersResp, err := h.accountService.FetchVouchers(ctx, string(publicKey)) if err != nil { - return res, err + res.FlagSet = append(res.FlagSet, flag_no_active_voucher) + return res, nil } // Return if there is no voucher diff --git a/services/registration/no_voucher b/services/registration/no_voucher index 332f00e..6303197 100644 --- a/services/registration/no_voucher +++ b/services/registration/no_voucher @@ -1 +1 @@ -You need a voucher to send \ No newline at end of file +You need a voucher to proceed \ No newline at end of file diff --git a/services/registration/no_voucher_swa b/services/registration/no_voucher_swa index 66e8f26..7291650 100644 --- a/services/registration/no_voucher_swa +++ b/services/registration/no_voucher_swa @@ -1 +1 @@ -Unahitaji sarafu kutuma \ No newline at end of file +Unahitaji sarafu kuendelea \ No newline at end of file diff --git a/services/registration/select_voucher.vis b/services/registration/select_voucher.vis index 08aa434..058d791 100644 --- a/services/registration/select_voucher.vis +++ b/services/registration/select_voucher.vis @@ -1,3 +1,4 @@ +CATCH no_voucher flag_no_active_voucher 1 LOAD get_vouchers 0 MAP get_vouchers MOUT back 0