diff --git a/src/FrontOffice.Main/Pages/DiscountStore/Checkout.razor b/src/FrontOffice.Main/Pages/DiscountStore/Checkout.razor
index 647a7de..47b8b1a 100644
--- a/src/FrontOffice.Main/Pages/DiscountStore/Checkout.razor
+++ b/src/FrontOffice.Main/Pages/DiscountStore/Checkout.razor
@@ -52,55 +52,6 @@
}
-
-
-
-
- تخفیف کیف تخفیفی
-
-
-
-
- موجودی کیف تخفیفی شما:
-
- @FormatPrice(_discountBalance) تومان
-
-
-
- @if (MaxUsable > 0)
- {
-
-
- مبلغ تخفیف اعمالشده:
-
- @FormatPrice(MaxUsable) تومان
-
-
-
-
- @if (GatewayAmount > 0)
- {
-
- مبلغ @FormatPrice(MaxUsable) تومان از کیف تخفیفی کسر و
- مبلغ @FormatPrice(GatewayAmount) تومان از درگاه پرداخت دریافت خواهد شد.
-
- }
- else
- {
-
- کل مبلغ سفارش از کیف تخفیفی پرداخت خواهد شد.
-
- }
- }
- else
- {
-
- موجودی کیف تخفیفی شما کافی نیست. کل مبلغ از درگاه پرداخت دریافت خواهد شد.
-
- }
-
-
-
توضیحات سفارش
@@ -149,30 +100,15 @@
- جمع کل:
- @FormatPrice(DiscountCart.TotalPrice)
-
-
- @if (MaxUsable > 0)
- {
-
- از کیف تخفیفی:
- @FormatPrice(MaxUsable)-
-
- }
-
-
-
-
- پرداخت از درگاه:
+ جمع کل:
- @FormatPrice(GatewayAmount) تومان
+ @FormatPrice(DiscountCart.TotalPrice) تومان
-
- مالیات بر ارزش افزوده صرفاً بر مبلغ درگاه محاسبه خواهد شد.
-
+
+ تخفیف ۱۰۰٪ از کیف تخفیفی اعمال میشود.
+
- /// Maximum discount allowed based on cart items' MaxDiscountPercent
- ///
- private long MaxAllowedDiscount => DiscountCart.TotalDiscount;
-
- ///
- /// Maximum the user can actually use = min(balance, allowed discount)
- /// Always applied at 100% — no user selection
- ///
- private long MaxUsable => Math.Min(_discountBalance, MaxAllowedDiscount);
-
- ///
- /// Amount to be charged via payment gateway (total minus auto-applied discount)
- ///
- private long GatewayAmount => DiscountCart.TotalPrice - MaxUsable;
-
private bool CanPlaceOrder => DiscountCart.Items.Count > 0 && _selectedAddress is not null;
protected override async Task OnInitializedAsync()
{
await DiscountCart.EnsureInitializedAsync();
-
- var addressTask = LoadAddresses();
- var balanceTask = LoadDiscountBalance();
- await Task.WhenAll(addressTask, balanceTask);
- }
-
- private async Task LoadDiscountBalance()
- {
- try
- {
- var balances = await WalletService.GetBalancesAsync();
- _discountBalance = balances.DiscountBalance;
- }
- catch
- {
- _discountBalance = 0;
- }
+ await LoadAddresses();
}
private async Task LoadAddresses()
@@ -98,10 +65,10 @@ public partial class Checkout
_placing = true;
try
{
- // Always use maximum possible discount (100%)
+ // Always use 100% discount — send full price, server will apply max from wallet
var result = await DiscountOrderService.PlaceOrderAsync(
_selectedAddress.Id,
- MaxUsable,
+ DiscountCart.TotalPrice,
_notes);
if (!result.Success)