feat: force 100% discount — remove slider, auto-apply max discount from wallet
Build and Deploy to Kubernetes / build-and-deploy (push) Has been cancelled

- Remove MudSlider and MudNumericField from Checkout
- Auto-apply MaxUsable (full discount balance)
- Show fixed '100% تخفیفی' badge on Products, Cart, ProductDetail, Checkout
- GatewayAmount = TotalPrice - MaxUsable (no user choice)
This commit is contained in:
masoodafar-web
2026-02-16 21:52:21 +03:30
parent fa9205bd8a
commit 1dc60faf4a
5 changed files with 50 additions and 66 deletions
@@ -16,7 +16,6 @@ public partial class Checkout
private bool _loadingAddresses;
private long _discountBalance;
private long _discountBalanceToUse;
private string? _notes;
private bool _placing;
@@ -27,13 +26,14 @@ public partial class Checkout
/// <summary>
/// Maximum the user can actually use = min(balance, allowed discount)
/// Always applied at 100% — no user selection
/// </summary>
private long MaxUsable => Math.Min(_discountBalance, MaxAllowedDiscount);
/// <summary>
/// Amount to be charged via payment gateway
/// Amount to be charged via payment gateway (total minus auto-applied discount)
/// </summary>
private long GatewayAmount => DiscountCart.TotalPrice - _discountBalanceToUse;
private long GatewayAmount => DiscountCart.TotalPrice - MaxUsable;
private bool CanPlaceOrder => DiscountCart.Items.Count > 0 && _selectedAddress is not null;
@@ -44,9 +44,6 @@ public partial class Checkout
var addressTask = LoadAddresses();
var balanceTask = LoadDiscountBalance();
await Task.WhenAll(addressTask, balanceTask);
// Default: use maximum possible discount
_discountBalanceToUse = MaxUsable;
}
private async Task LoadDiscountBalance()
@@ -101,12 +98,10 @@ public partial class Checkout
_placing = true;
try
{
// Clamp the discount balance to use
var discountToUse = Math.Min(_discountBalanceToUse, MaxUsable);
// Always use maximum possible discount (100%)
var result = await DiscountOrderService.PlaceOrderAsync(
_selectedAddress.Id,
discountToUse,
MaxUsable,
_notes);
if (!result.Success)