Checkout page clean up
continuous-integration/drone/pr Build is passing

This commit is contained in:
Khwezi Mngoma
2026-06-16 21:12:12 +02:00
parent 554741c2e5
commit 5d614d2a94
5 changed files with 630 additions and 79 deletions
@@ -29,6 +29,7 @@ public partial class Checkout()
private decimal ShippingCost = 0;
private bool IsSameAddress = true;
public string? OrderNotes { get; set; }
private Dictionary<string, string> CheckoutPayload { get; set; } = [];
protected override async Task OnInitializedAsync()
@@ -38,6 +39,9 @@ public partial class Checkout()
Navigation.LocationChanged += OnLocationChanged;
CartService.OnCartChanged += CartService_OnCartChanged;
if (CartService.ShoppingCart.Items.Count == 0)
await CartService.LoadCartFromStorageAsync();
}
private async void CartService_OnCartChanged() => await InvokeAsync(StateHasChanged);
@@ -113,7 +117,7 @@ public partial class Checkout()
if (paymentGen.IsSuccess) paymentId = paymentGen.Value;
if(paymentGen.IsFailed)
if (paymentGen.IsFailed)
{
var paymentFetch = await PaymentService.GetOrderPaymentAsync(orderId, CancellationToken);
@@ -161,7 +165,7 @@ public partial class Checkout()
await JSRuntime.InvokeVoidAsync("eval", "document.getElementById('payfastForm').submit();");
}
catch(Exception ex)
catch (Exception ex)
{
ToastService.ShowError($"Failed to perform checkout: {ex.Message}", "Checkout");