Compare commits
54 Commits
31423ea48d
..
1.54
| Author | SHA1 | Date | |
|---|---|---|---|
| 956c19b9f7 | |||
| f27433a277 | |||
| 7294e5470f | |||
| 5db926f4c6 | |||
| a4460888af | |||
| 9de7abc3fb | |||
| e9b2e958d2 | |||
| 44df489406 | |||
| 0ea31a33ae | |||
| 4f44d0c597 | |||
| fbde2ea1a9 | |||
| 651682156c | |||
| e81789f8c6 | |||
| b9f3274633 | |||
| 552e9ff1b4 | |||
| 629dbe7cfe | |||
| 25acd67485 | |||
| d3672a6db9 | |||
| a8056e7a9a | |||
| 4458a1e189 | |||
| 2aeeb7a240 | |||
| 378044d011 | |||
| 4e42d9f21a | |||
| 0b7476d31c | |||
| 925c1f5988 | |||
| 9629d9ddf9 | |||
| 7a11572294 | |||
| a75bf5951d | |||
| bbcf64aa65 | |||
| a688bc816a | |||
| 4fe801583e | |||
| af3d40531b | |||
| bc2b9f81e0 | |||
| 49279c0cec | |||
| edabe266e5 | |||
| 248dd32b1b | |||
| 1645b6bbae | |||
| 72725a302a | |||
| f3d79174be | |||
| c086aa60e4 | |||
| 66b377bf69 | |||
| 82389a9304 | |||
| 4bf1d2e77a | |||
| 2b6576de85 | |||
| 7de957ed6f | |||
| 16fdcc8005 | |||
| a614d14da5 | |||
| b722ea2cd0 | |||
| 73145fd360 | |||
| 7f29680993 | |||
| 56626d2693 | |||
| f9f6788c79 | |||
| 249ad319d9 | |||
| 4a476febf4 |
+1
-5
@@ -23,7 +23,7 @@ trigger:
|
|||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: package
|
name: package
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: docker-build
|
- name: docker-build
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
@@ -31,10 +31,6 @@ steps:
|
|||||||
registry: nexus.khongisa.co.za
|
registry: nexus.khongisa.co.za
|
||||||
repo: nexus.khongisa.co.za/midrandbooks
|
repo: nexus.khongisa.co.za/midrandbooks
|
||||||
tags: [ latest, "1.${DRONE_BUILD_NUMBER}" ]
|
tags: [ latest, "1.${DRONE_BUILD_NUMBER}" ]
|
||||||
use_cache: true
|
|
||||||
cache_from: nexus.khongisa.co.za/midrandbooks:latest
|
|
||||||
build_args:
|
|
||||||
- BUILDKIT_INLINE_CACHE=1
|
|
||||||
custom_labels:
|
custom_labels:
|
||||||
- org.opencontainers.image.source=https://gitea.khongisa.co.za/litecharms/midrandbooks
|
- org.opencontainers.image.source=https://gitea.khongisa.co.za/litecharms/midrandbooks
|
||||||
- org.opencontainers.image.version=1.${DRONE_BUILD_NUMBER}
|
- org.opencontainers.image.version=1.${DRONE_BUILD_NUMBER}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public partial class Checkout()
|
|||||||
[Inject] public IOptions<PayfastSettings> PayfastOptions { get; set; } = default!;
|
[Inject] public IOptions<PayfastSettings> PayfastOptions { get; set; } = default!;
|
||||||
[Inject] private AuthenticationStateProvider AuthStateProvider { get; set; } = default!;
|
[Inject] private AuthenticationStateProvider AuthStateProvider { get; set; } = default!;
|
||||||
[Inject] public IJSRuntime JSRuntime { get; set; } = default!;
|
[Inject] public IJSRuntime JSRuntime { get; set; } = default!;
|
||||||
|
[Inject] private HydrationService HydrationService { get; set; } = default!;
|
||||||
[Inject] private CancellationToken CancellationToken { get; set; } = default!;
|
[Inject] private CancellationToken CancellationToken { get; set; } = default!;
|
||||||
|
|
||||||
private Cart ShoppingCart => CartService.ShoppingCart;
|
private Cart ShoppingCart => CartService.ShoppingCart;
|
||||||
@@ -37,6 +38,19 @@ public partial class Checkout()
|
|||||||
|
|
||||||
Navigation.LocationChanged += OnLocationChanged;
|
Navigation.LocationChanged += OnLocationChanged;
|
||||||
CartService.OnCartChanged += CartService_OnCartChanged;
|
CartService.OnCartChanged += CartService_OnCartChanged;
|
||||||
|
|
||||||
|
await CartService.LoadCartFromStorageAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
|
{
|
||||||
|
if (firstRender == false && HydrationService.CartHydrated == false)
|
||||||
|
{
|
||||||
|
await HydrationService.EnsureCustomerExistsAsync(CancellationToken);
|
||||||
|
await HydrationService.RehydrateCartFromPendingOrderAsync(CancellationToken);
|
||||||
|
|
||||||
|
CartService.NotifyStateChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void CartService_OnCartChanged() => await InvokeAsync(StateHasChanged);
|
private async void CartService_OnCartChanged() => await InvokeAsync(StateHasChanged);
|
||||||
@@ -103,26 +117,13 @@ public partial class Checkout()
|
|||||||
var orderHash = HashService.HashEncodeLongId(orderId).Value;
|
var orderHash = HashService.HashEncodeLongId(orderId).Value;
|
||||||
var paymentGen = await PaymentService.CreatePaymentAsync(ShoppingCart.TotalAmount, orderId, orderHash, CancellationToken);
|
var paymentGen = await PaymentService.CreatePaymentAsync(ShoppingCart.TotalAmount, orderId, orderHash, CancellationToken);
|
||||||
|
|
||||||
long paymentId = 0;
|
|
||||||
|
|
||||||
if (paymentGen.IsSuccess) paymentId = paymentGen.Value;
|
|
||||||
|
|
||||||
if(paymentGen.IsFailed)
|
|
||||||
{
|
|
||||||
var paymentFetch = await PaymentService.GetOrderPaymentAsync(orderId, CancellationToken);
|
|
||||||
|
|
||||||
if (paymentFetch.IsFailed) return;
|
|
||||||
|
|
||||||
paymentId = paymentFetch.Value.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateLedgerEntry ledgerRequest = new()
|
CreateLedgerEntry ledgerRequest = new()
|
||||||
{
|
{
|
||||||
OrderId = orderId,
|
OrderId = orderId,
|
||||||
CustomerId = customerId,
|
CustomerId = customerId,
|
||||||
PaymentGatewayId = 1,
|
PaymentGatewayId = 1, // TODO: lookup value to match user selection
|
||||||
PaymentGatewayReference = orderHash,
|
PaymentGatewayReference = orderHash,
|
||||||
PaymentId = paymentId,
|
PaymentId = paymentGen.Value,
|
||||||
Status = LiteCharms.Features.LedgerStatuses.Sent,
|
Status = LiteCharms.Features.LedgerStatuses.Sent,
|
||||||
};
|
};
|
||||||
await PaymentService.WriteLedgerEntryAsync(ledgerRequest, CancellationToken);
|
await PaymentService.WriteLedgerEntryAsync(ledgerRequest, CancellationToken);
|
||||||
@@ -134,8 +135,8 @@ public partial class Checkout()
|
|||||||
{
|
{
|
||||||
{ "merchant_id", PayfastOptions.Value.MerchantId! },
|
{ "merchant_id", PayfastOptions.Value.MerchantId! },
|
||||||
{ "merchant_key", PayfastOptions.Value.MerchantKey! },
|
{ "merchant_key", PayfastOptions.Value.MerchantKey! },
|
||||||
{ "return_url", $"{hostAddress}/payment-success?reference={orderHash}" },
|
{ "return_url", $"{hostAddress}/payment-success" },
|
||||||
{ "cancel_url", $"{hostAddress}/payment-failed?reference={orderHash}" },
|
{ "cancel_url", $"{hostAddress}/payment-failed" },
|
||||||
{ "notify_url", "https://api.uat.midrandbooks.co.za/v1/payments/payfast/confirm" },
|
{ "notify_url", "https://api.uat.midrandbooks.co.za/v1/payments/payfast/confirm" },
|
||||||
{ "email_address", User?.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Email)!.Value! },
|
{ "email_address", User?.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Email)!.Value! },
|
||||||
{ "m_payment_id", orderHash },
|
{ "m_payment_id", orderHash },
|
||||||
|
|||||||
@@ -99,18 +99,14 @@ public partial class Home : ComponentBase
|
|||||||
|
|
||||||
private bool HasMoreItems => FilteredData.Count() > VisibleCount;
|
private bool HasMoreItems => FilteredData.Count() > VisibleCount;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync() => await CartService.LoadCartFromStorageAsync();
|
||||||
{
|
|
||||||
if (CartService.ShoppingCart.Items.Count == 0)
|
|
||||||
await CartService.LoadCartFromStorageAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
if (firstRender == false && HydrationService.CartHydrated == false)
|
if (firstRender == false && HydrationService.CartHydrated == false)
|
||||||
{
|
{
|
||||||
if(!CartService.ShoppingCart.CustomerId.HasValue)
|
await HydrationService.EnsureCustomerExistsAsync(CancellationToken);
|
||||||
await HydrationService.EnsureCustomerExistsAsync(CancellationToken);
|
await HydrationService.RehydrateCartFromPendingOrderAsync(CancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
@page "/payment-failed"
|
@page "/payment-failed"
|
||||||
@rendermode InteractiveServer
|
@rendermode InteractiveServer
|
||||||
@inject NavigationManager Navigation
|
|
||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
|
|
||||||
<div class="container py-5">
|
<div class="container py-5">
|
||||||
@@ -14,16 +13,18 @@
|
|||||||
<line x1="12" y1="16" x2="12.01" y2="16"></line>
|
<line x1="12" y1="16" x2="12.01" y2="16"></line>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<h1 class="fw-bold mb-3">Payment Cancelled</h1>
|
<h1 class="fw-bold mb-3">Payment Failed</h1>
|
||||||
<p class="text-muted fs-5">We couldn't process your transaction. Don't worry, no money was deducted from your account.</p>
|
<p class="text-muted fs-5">We couldn't process your transaction. Don't worry, no money was deducted from your account, and your cart items are safe.</p>
|
||||||
|
|
||||||
<div class="bg-light p-3 rounded mt-4">
|
<div class="bg-light p-3 rounded mt-4">
|
||||||
<p class="mb-0 text-muted small text-uppercase fw-bold">Common Causes</p>
|
<p class="mb-0 text-muted small text-uppercase fw-bold">Common Causes</p>
|
||||||
<p class="mb-0 fs-6 text-dark mt-1">The order was cancelled / insufficient funds, incorrect card details, or a temporary bank gateway timeout.</p>
|
<p class="mb-0 fs-6 text-dark mt-1">Insufficient funds, incorrect card details, or a temporary bank gateway timeout.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-grid gap-3 mt-5">
|
<div class="d-grid gap-3 mt-5">
|
||||||
|
<a href="/checkout" class="btn btn-dark btn-lg rounded-pill py-3">Try Again</a>
|
||||||
|
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<a href="/" class="btn btn-outline-dark w-100 rounded-pill py-3">View Store</a>
|
<a href="/" class="btn btn-outline-dark w-100 rounded-pill py-3">View Store</a>
|
||||||
@@ -34,7 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="mt-5 text-muted small">If you noticed a charge or have any order questions, please contact our support desk with your account email <strong>shop@litecharms.co.za</strong>.</p>
|
<p class="mt-5 text-muted small">If you noticed a charge or have any order questions, please contact our support desk with your account email <strong>user@email.com</strong>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
using LiteCharms.Features;
|
|
||||||
using LiteCharms.Features.Hasher;
|
|
||||||
using LiteCharms.Features.MidrandBooks.Customers;
|
|
||||||
using LiteCharms.Features.MidrandBooks.Orders;
|
|
||||||
using LiteCharms.Features.MidrandBooks.Payments;
|
|
||||||
using LiteCharms.Features.MidrandBooks.Payments.Models;
|
|
||||||
|
|
||||||
namespace MidrandBookshop.Components.Pages;
|
|
||||||
|
|
||||||
public partial class PaymentFailed
|
|
||||||
{
|
|
||||||
[Inject] public CartService CartService { get; set; } = default!;
|
|
||||||
[Inject] public OrderService OrderService { get; set; } = default!;
|
|
||||||
[Inject] private CustomerService CustomerService { get; set; } = default!;
|
|
||||||
[Inject] public PaymentService PaymentService { get; set; } = default!;
|
|
||||||
[Inject] public HashService HashService { get; set; } = default!;
|
|
||||||
[Inject] private AuthenticationStateProvider AuthStateProvider { get; set; } = default!;
|
|
||||||
[Inject] private CancellationToken CancellationToken { get; set; } = default!;
|
|
||||||
|
|
||||||
private ClaimsPrincipal? User { get; set; }
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
[SupplyParameterFromQuery(Name = "reference")]
|
|
||||||
public string? PaymentReference { get; set; }
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
var authState = await AuthStateProvider.GetAuthenticationStateAsync();
|
|
||||||
User = authState!.User;
|
|
||||||
|
|
||||||
if (User?.Identity?.IsAuthenticated == false) Navigation.NavigateTo("/login");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
||||||
{
|
|
||||||
if (!firstRender) return;
|
|
||||||
|
|
||||||
long orderId = HashService.DecodeLongIdHash(PaymentReference!).Value;
|
|
||||||
|
|
||||||
var customerEmail = User!.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Email)!.Value!;
|
|
||||||
|
|
||||||
var customerFetch = await CustomerService.GetCustomerAsync(customerEmail, CancellationToken);
|
|
||||||
|
|
||||||
if (customerFetch.IsFailed) return;
|
|
||||||
|
|
||||||
long customerId = customerFetch.Value.Id;
|
|
||||||
|
|
||||||
var orderUpdateResult = await OrderService.UpdateOrderStatusAsync(orderId, OrderStatus.Cancelled, CancellationToken);
|
|
||||||
|
|
||||||
if (orderUpdateResult.IsFailed) return;
|
|
||||||
|
|
||||||
var paymentIdFetch = await PaymentService.GetOrderPaymentAsync(orderId, CancellationToken);
|
|
||||||
|
|
||||||
if (paymentIdFetch.IsFailed) return;
|
|
||||||
|
|
||||||
await PaymentService.WriteLedgerEntryAsync(new CreateLedgerEntry
|
|
||||||
{
|
|
||||||
CustomerId = customerId,
|
|
||||||
OrderId = orderId,
|
|
||||||
PaymentGatewayId = 1,
|
|
||||||
PaymentGatewayReference = PaymentReference,
|
|
||||||
PaymentId = paymentIdFetch.Value.Id,
|
|
||||||
Status = LedgerStatuses.Cancelled
|
|
||||||
|
|
||||||
}, CancellationToken);
|
|
||||||
|
|
||||||
CartService.Clear();
|
|
||||||
CartService.ShoppingCart.OrderId = null;
|
|
||||||
await CartService.SaveCartToStorageAsync();
|
|
||||||
CartService.NotifyStateChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
@page "/payment-success"
|
@page "/payment-success"
|
||||||
@rendermode InteractiveServer
|
@rendermode InteractiveServer
|
||||||
@inject NavigationManager Navigation
|
|
||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
|
|
||||||
<div class="container py-5">
|
<div class="container py-5">
|
||||||
@@ -17,7 +16,7 @@
|
|||||||
<p class="text-muted fs-5">Thank you for shopping with Midrand Books. Your order has been received and is being processed.</p>
|
<p class="text-muted fs-5">Thank you for shopping with Midrand Books. Your order has been received and is being processed.</p>
|
||||||
<div class="bg-light p-3 rounded mt-4">
|
<div class="bg-light p-3 rounded mt-4">
|
||||||
<p class="mb-0 text-muted small text-uppercase fw-bold">Order Number</p>
|
<p class="mb-0 text-muted small text-uppercase fw-bold">Order Number</p>
|
||||||
<h5 class="fw-bold mb-0">@PaymentReference</h5>
|
<h5 class="fw-bold mb-0">#MB-2026-8834</h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -28,12 +27,12 @@
|
|||||||
<a href="/account" class="btn btn-outline-dark w-100 rounded-pill py-3">Order History</a>
|
<a href="/account" class="btn btn-outline-dark w-100 rounded-pill py-3">Order History</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<a href="/account" class="btn btn-outline-dark w-100 rounded-pill py-3">Track Order</a>
|
<a href="/track-order" class="btn btn-outline-dark w-100 rounded-pill py-3">Track Order</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="mt-5 text-muted small">You will receive a confirmation email shortly at <strong>@CustomerEmail</strong>.</p>
|
<p class="mt-5 text-muted small">You will receive a confirmation email shortly at <strong>user@email.com</strong>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
using LiteCharms.Features;
|
|
||||||
using LiteCharms.Features.Hasher;
|
|
||||||
using LiteCharms.Features.MidrandBooks.Customers;
|
|
||||||
using LiteCharms.Features.MidrandBooks.Payments;
|
|
||||||
using LiteCharms.Features.MidrandBooks.Payments.Models;
|
|
||||||
|
|
||||||
namespace MidrandBookshop.Components.Pages;
|
|
||||||
|
|
||||||
public partial class PaymentSuccess
|
|
||||||
{
|
|
||||||
[Inject] private CartService CartService { get; set; } = default!;
|
|
||||||
[Inject] private CustomerService CustomerService { get; set; } = default!;
|
|
||||||
[Inject] private PaymentService PaymentService { get; set; } = default!;
|
|
||||||
[Inject] private HashService HashService { get; set; } = default!;
|
|
||||||
[Inject] private AuthenticationStateProvider AuthStateProvider { get; set; } = default!;
|
|
||||||
[Inject] private CancellationToken CancellationToken { get; set; } = default!;
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
[SupplyParameterFromQuery(Name = "reference")]
|
|
||||||
public string? PaymentReference { get; set; }
|
|
||||||
|
|
||||||
private ClaimsPrincipal? User { get; set; }
|
|
||||||
|
|
||||||
private string? CustomerEmail { get; set; }
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
var authState = await AuthStateProvider.GetAuthenticationStateAsync();
|
|
||||||
User = authState!.User;
|
|
||||||
|
|
||||||
if (User?.Identity?.IsAuthenticated == false) Navigation.NavigateTo("/login");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
||||||
{
|
|
||||||
if (!firstRender) return;
|
|
||||||
|
|
||||||
long orderId = HashService.DecodeLongIdHash(PaymentReference!).Value;
|
|
||||||
string orderHash = HashService.HashEncodeLongId(orderId).Value;
|
|
||||||
|
|
||||||
CustomerEmail = User!.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Email)!.Value!;
|
|
||||||
|
|
||||||
var customerFetch = await CustomerService.GetCustomerAsync(CustomerEmail, CancellationToken);
|
|
||||||
|
|
||||||
if (customerFetch.IsFailed) return;
|
|
||||||
|
|
||||||
long customerId = customerFetch.Value.Id;
|
|
||||||
|
|
||||||
var paymentIdFetch = await PaymentService.GetOrderPaymentAsync(orderId, CancellationToken);
|
|
||||||
|
|
||||||
if (paymentIdFetch.IsFailed) return;
|
|
||||||
|
|
||||||
await PaymentService.WriteLedgerEntryAsync(new CreateLedgerEntry
|
|
||||||
{
|
|
||||||
CustomerId = customerId,
|
|
||||||
OrderId = orderId,
|
|
||||||
PaymentGatewayId = 1,
|
|
||||||
PaymentGatewayReference = orderHash,
|
|
||||||
PaymentId = paymentIdFetch.Value.Id,
|
|
||||||
Status = LedgerStatuses.Changed
|
|
||||||
|
|
||||||
}, CancellationToken);
|
|
||||||
|
|
||||||
CartService.Clear();
|
|
||||||
CartService.ShoppingCart.OrderId = null;
|
|
||||||
await CartService.SaveCartToStorageAsync();
|
|
||||||
CartService.NotifyStateChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -38,13 +38,13 @@ public sealed class HydrationService(AuthenticationStateProvider authStateProvid
|
|||||||
|
|
||||||
if (existingCustomer.IsFailed)
|
if (existingCustomer.IsFailed)
|
||||||
{
|
{
|
||||||
var name = User!.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name)?.Value ?? string.Empty;
|
var name = User!.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name)!.Value!;
|
||||||
var lastname = User!.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Surname)?.Value ?? string.Empty;
|
var lastname = User!.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Surname)!.Value!;
|
||||||
var mobile = User!.Claims.FirstOrDefault(c => c.Type == ClaimTypes.MobilePhone)?.Value ?? string.Empty;
|
var mobile = User!.Claims.FirstOrDefault(c => c.Type == ClaimTypes.MobilePhone)!.Value!;
|
||||||
|
|
||||||
var customerCreate = await customerService.CreateCustomerAsync(new CreateCustomer { Email = email }, cancellationToken);
|
var customerCreate = await customerService.CreateCustomerAsync(new CreateCustomer { Email = email }, cancellationToken);
|
||||||
|
|
||||||
if (customerCreate.IsSuccess && !string.IsNullOrWhiteSpace(name))
|
if (customerCreate.IsSuccess)
|
||||||
{
|
{
|
||||||
ShoppingCart.CustomerId = customerCreate.Value;
|
ShoppingCart.CustomerId = customerCreate.Value;
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ public sealed class HydrationService(AuthenticationStateProvider authStateProvid
|
|||||||
{
|
{
|
||||||
if (User?.Identity?.IsAuthenticated == false) return;
|
if (User?.Identity?.IsAuthenticated == false) return;
|
||||||
|
|
||||||
if (ShoppingCart.OrderId.HasValue && ShoppingCart.CustomerId.HasValue)
|
if (ShoppingCart.OrderId > 0 && ShoppingCart.CustomerId > 0)
|
||||||
{
|
{
|
||||||
cartService.CalculateTotalPrice();
|
cartService.CalculateTotalPrice();
|
||||||
CartHydrated = true;
|
CartHydrated = true;
|
||||||
|
|||||||
@@ -27,6 +27,13 @@ app.UseHealthChecks("/health", new HealthCheckOptions
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.MapStaticAssets();
|
app.MapStaticAssets();
|
||||||
|
app.Use((context, next) =>
|
||||||
|
{
|
||||||
|
if (context.Request.Host.Value!.Contains("midrandbooks.co.za", StringComparison.OrdinalIgnoreCase))
|
||||||
|
context.Request.Scheme = "https";
|
||||||
|
|
||||||
|
return next();
|
||||||
|
});
|
||||||
app.UseCookiePolicy();
|
app.UseCookiePolicy();
|
||||||
|
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
|
|||||||
@@ -48,8 +48,7 @@ metadata:
|
|||||||
name: midrandbooks
|
name: midrandbooks
|
||||||
namespace: midrandbooks-uat
|
namespace: midrandbooks-uat
|
||||||
spec:
|
spec:
|
||||||
replicas: 2
|
replicas: 1
|
||||||
revisionHistoryLimit: 0
|
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: midrandbooks
|
app: midrandbooks
|
||||||
|
|||||||
Reference in New Issue
Block a user