diff --git a/TransactionProcessor.Mobile.BusinessLogic/RequestHandlers/MerchantRequestHandler.cs b/TransactionProcessor.Mobile.BusinessLogic/RequestHandlers/MerchantRequestHandler.cs index d94e91f7..714c6c87 100644 --- a/TransactionProcessor.Mobile.BusinessLogic/RequestHandlers/MerchantRequestHandler.cs +++ b/TransactionProcessor.Mobile.BusinessLogic/RequestHandlers/MerchantRequestHandler.cs @@ -92,11 +92,11 @@ public async Task>> Handle(MerchantQueries.Ge } products = getProductsResult.Data; + } - if (request.ProductType.HasValue) - { - products = products.Where(p => p.ProductType == request.ProductType).ToList(); - } + if (request.ProductType.HasValue) + { + products = products.Where(p => p.ProductType == request.ProductType).ToList(); } List operators = products.GroupBy(c => new diff --git a/TransactionProcessor.Mobile.BusinessLogic/Services/TrainingModeServices/TrainingMerchantService.cs b/TransactionProcessor.Mobile.BusinessLogic/Services/TrainingModeServices/TrainingMerchantService.cs index f67eaa89..79d74b33 100644 --- a/TransactionProcessor.Mobile.BusinessLogic/Services/TrainingModeServices/TrainingMerchantService.cs +++ b/TransactionProcessor.Mobile.BusinessLogic/Services/TrainingModeServices/TrainingMerchantService.cs @@ -12,7 +12,7 @@ private record Contract(Guid ContractId, Guid OperatorId, string OperatorIdentfi private readonly Contract Hospital1Contract = new(Guid.Parse("21DA6AC5-70E6-478E-A5E9-74C9B27F5725"), Guid.Parse("2CA5F4C7-34EC-425B-BB53-7EEDF48D9967"), "Hospital 1 Contract", "Hospital 1 Contract"); private readonly Contract SafaricomContract = new(Guid.Parse("D57DAC9B-4039-4120-B5A8-F7FDF1D3A3C2"), Guid.Parse("2CA5F4C7-34EC-425B-BB53-7EEDF48D9967"), "Safaricom", "Safaricom"); private readonly Contract PataPawaPostPayContract = new(Guid.Parse("0615E7F6-2749-4507-8588-E019E8110C95"), Guid.Parse("C485F21B-EF17-448D-8B8C-E217A07C1863"), "PataPawaPostPay", "PataPawaPostPay"); - private readonly Contract PataPawaPrePayContract = new(Guid.Parse("7AAFFE8D-4EA2-485F-8600-D4D29A0043F0"), Guid.Parse("C485F21B-EF17-448D-8B8C-E217A07C1863"), "PataPawaPrePay", "PataPawaPrePay"); + private readonly Contract PataPawaPrePayContract = new(Guid.Parse("7AAFFE8D-4EA2-485F-8600-D4D29A0043F0"), Guid.Parse("DD5F1E0D-797C-4A00-ADD8-CA328A8543C3"), "PataPawaPrePay", "PataPawaPrePay"); private static ContractProductModel CreateContractProductModel(Contract contract, string productDisplayText, Guid productId, ProductType productType, decimal? value = null) { ContractProductModel product = new() { diff --git a/TransactionProcessor.Mobile/App.xaml.cs b/TransactionProcessor.Mobile/App.xaml.cs index 318875cb..e7db6020 100644 --- a/TransactionProcessor.Mobile/App.xaml.cs +++ b/TransactionProcessor.Mobile/App.xaml.cs @@ -153,40 +153,47 @@ public App(IApplicationThemeService applicationThemeService) #endif MainPage = new AppShell(); - Routing.RegisterRoute("login", typeof(LoginPage)); - Routing.RegisterRoute("home", typeof(HomePage)); - - Routing.RegisterRoute(nameof(MobileTopupSelectOperatorPage), typeof(MobileTopupSelectOperatorPage)); - Routing.RegisterRoute(nameof(MobileTopupSelectProductPage), typeof(MobileTopupSelectProductPage)); - Routing.RegisterRoute(nameof(MobileTopupPerformTopupPage), typeof(MobileTopupPerformTopupPage)); - Routing.RegisterRoute(nameof(MobileTopupSuccessPage), typeof(MobileTopupSuccessPage)); - Routing.RegisterRoute(nameof(MobileTopupFailedPage), typeof(MobileTopupFailedPage)); - - Routing.RegisterRoute(nameof(VoucherSelectOperatorPage), typeof(VoucherSelectOperatorPage)); - Routing.RegisterRoute(nameof(VoucherSelectProductPage), typeof(VoucherSelectProductPage)); - Routing.RegisterRoute(nameof(VoucherPerformIssuePage), typeof(VoucherPerformIssuePage)); - Routing.RegisterRoute(nameof(VoucherIssueSuccessPage), typeof(VoucherIssueSuccessPage)); - Routing.RegisterRoute(nameof(VoucherIssueFailedPage), typeof(VoucherIssueFailedPage)); - - Routing.RegisterRoute(nameof(BillPaymentSelectOperatorPage), typeof(BillPaymentSelectOperatorPage)); - Routing.RegisterRoute(nameof(BillPaymentSelectProductPage), typeof(BillPaymentSelectProductPage)); - Routing.RegisterRoute(nameof(BillPaymentGetAccountPage), typeof(BillPaymentGetAccountPage)); - Routing.RegisterRoute(nameof(BillPaymentGetMeterPage), typeof(BillPaymentGetMeterPage)); - Routing.RegisterRoute(nameof(BillPaymentPayBillPage), typeof(BillPaymentPayBillPage)); - Routing.RegisterRoute(nameof(BillPaymentSuccessPage), typeof(BillPaymentSuccessPage)); - Routing.RegisterRoute(nameof(BillPaymentFailedPage), typeof(BillPaymentFailedPage)); - - Routing.RegisterRoute(nameof(AdminPage), typeof(AdminPage)); - Routing.RegisterRoute(nameof(LoginPage), typeof(LoginPage)); - - Routing.RegisterRoute(nameof(ViewLogsPage), typeof(ViewLogsPage)); - - Routing.RegisterRoute(nameof(ReportsBalanceAnalysisPage), typeof(ReportsBalanceAnalysisPage)); - Routing.RegisterRoute(nameof(ReportsSalesAnalysisPage), typeof(ReportsSalesAnalysisPage)); - - Routing.RegisterRoute(nameof(MyAccountAddressesPage), typeof(MyAccountAddressesPage)); - Routing.RegisterRoute(nameof(MyAccountContactPage), typeof(MyAccountContactPage)); - Routing.RegisterRoute(nameof(MyAccountDetailsPage), typeof(MyAccountDetailsPage)); + //RegisterRouteOnce("login", typeof(LoginPage)); + //RegisterRouteOnce("home", typeof(HomePage)); + + RegisterRouteOnce(nameof(MobileTopupSelectOperatorPage), typeof(MobileTopupSelectOperatorPage)); + RegisterRouteOnce(nameof(MobileTopupSelectProductPage), typeof(MobileTopupSelectProductPage)); + RegisterRouteOnce(nameof(MobileTopupPerformTopupPage), typeof(MobileTopupPerformTopupPage)); + RegisterRouteOnce(nameof(MobileTopupSuccessPage), typeof(MobileTopupSuccessPage)); + RegisterRouteOnce(nameof(MobileTopupFailedPage), typeof(MobileTopupFailedPage)); + + RegisterRouteOnce(nameof(VoucherSelectOperatorPage), typeof(VoucherSelectOperatorPage)); + RegisterRouteOnce(nameof(VoucherSelectProductPage), typeof(VoucherSelectProductPage)); + RegisterRouteOnce(nameof(VoucherPerformIssuePage), typeof(VoucherPerformIssuePage)); + RegisterRouteOnce(nameof(VoucherIssueSuccessPage), typeof(VoucherIssueSuccessPage)); + RegisterRouteOnce(nameof(VoucherIssueFailedPage), typeof(VoucherIssueFailedPage)); + + RegisterRouteOnce(nameof(BillPaymentSelectOperatorPage), typeof(BillPaymentSelectOperatorPage)); + RegisterRouteOnce(nameof(BillPaymentSelectProductPage), typeof(BillPaymentSelectProductPage)); + RegisterRouteOnce(nameof(BillPaymentGetAccountPage), typeof(BillPaymentGetAccountPage)); + RegisterRouteOnce(nameof(BillPaymentGetMeterPage), typeof(BillPaymentGetMeterPage)); + RegisterRouteOnce(nameof(BillPaymentPayBillPage), typeof(BillPaymentPayBillPage)); + RegisterRouteOnce(nameof(BillPaymentSuccessPage), typeof(BillPaymentSuccessPage)); + RegisterRouteOnce(nameof(BillPaymentFailedPage), typeof(BillPaymentFailedPage)); + RegisterRouteOnce(nameof(AdminPage), typeof(AdminPage)); + //RegisterRouteOnce(nameof(LoginPage), typeof(LoginPage)); + + RegisterRouteOnce(nameof(ViewLogsPage), typeof(ViewLogsPage)); + + RegisterRouteOnce(nameof(ReportsBalanceAnalysisPage), typeof(ReportsBalanceAnalysisPage)); + RegisterRouteOnce(nameof(ReportsSalesAnalysisPage), typeof(ReportsSalesAnalysisPage)); + + RegisterRouteOnce(nameof(MyAccountAddressesPage), typeof(MyAccountAddressesPage)); + RegisterRouteOnce(nameof(MyAccountContactPage), typeof(MyAccountContactPage)); + RegisterRouteOnce(nameof(MyAccountDetailsPage), typeof(MyAccountDetailsPage)); + } + + static readonly HashSet s_registeredRoutes = new(); + + static void RegisterRouteOnce(string route, Type pageType) + { + if (s_registeredRoutes.Add(route)) + Routing.RegisterRoute(route, pageType); } } diff --git a/TransactionProcessor.Mobile/UIServices/ShellNavigationService.cs b/TransactionProcessor.Mobile/UIServices/ShellNavigationService.cs index 84bb9a9a..8308a5c2 100644 --- a/TransactionProcessor.Mobile/UIServices/ShellNavigationService.cs +++ b/TransactionProcessor.Mobile/UIServices/ShellNavigationService.cs @@ -37,7 +37,6 @@ public async Task GoBack() { } public async Task GoToHome() { - Application.Current.MainPage = new AppShell(); await NavigateTo("///main/home"); } @@ -166,7 +165,7 @@ public async Task GoToBillPaymentPayBillPage(ProductDetails productDetails, public async Task GoToLoginPage() { Application.Current.MainPage = new AppShell(); - await NavigateTo("///loginpage"); + await NavigateTo("///login"); } public async Task GoToViewLogsPage() {