From 4a53b4eb10835737aecb2a074a34b9fda5ca75c0 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Wed, 15 Apr 2026 21:48:15 +0100 Subject: [PATCH] Handle contract product load failures with warning toast Added error handling for failed contract product loads. If loading fails, a warning toast is shown to the user and further processing is stopped to prevent issues with missing or invalid data. --- .../BillPaymentSelectProductPageViewModel.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/TransactionProcessor.Mobile.BusinessLogic/ViewModels/Transactions/BillPaymentSelectProductPageViewModel.cs b/TransactionProcessor.Mobile.BusinessLogic/ViewModels/Transactions/BillPaymentSelectProductPageViewModel.cs index fa35a491a..27fde7696 100644 --- a/TransactionProcessor.Mobile.BusinessLogic/ViewModels/Transactions/BillPaymentSelectProductPageViewModel.cs +++ b/TransactionProcessor.Mobile.BusinessLogic/ViewModels/Transactions/BillPaymentSelectProductPageViewModel.cs @@ -51,9 +51,13 @@ public async Task Initialise(CancellationToken cancellationToken) GetContractProductsRequest request = GetContractProductsRequest.Create(ProductType.BillPayment); - Result> productsresult = await this.Mediator.Send(request, cancellationToken); - // TODO: Handle the failure result - List products = productsresult.Data; + Result> productsResult = await this.Mediator.Send(request, cancellationToken); + if (productsResult.IsFailed) { + await this.DialogService.ShowWarningToast("Unable to load products. Please try again later.", cancellationToken: cancellationToken); + return; + } + + List products = productsResult.Data; products = products.Where(p => p.OperatorId == this.ProductDetails.OperatorId).ToList(); this.Products = products;