feat(T4.2+T4.3+F3): conditional payment, re-purchase, PV display
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 2m33s
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 2m33s
T4.2: Conditional Payment in Checkout - Load package flags via PackageService.GetAllPackagesAsync - Respect SupportsDirectPurchase/SupportsDayaPurchase flags - Add Daya loan payment button when supported - Show alert when no payment method available T4.3: MyPackages Re-Purchase Logic - Load MagicWallet status to detect cycle completion - Show re-purchase CTA when magic cycle is complete - Show magic wallet progress bar during active cycle - Display deposit progress, remaining, and credited amounts F3: PV Display in Order Details - Add CalculateOrderPVAsync to OrderService - Show per-product PV and total PV in Store OrderDetail - Update NuGet to v0.0.188
This commit is contained in:
@@ -9,7 +9,9 @@ public partial class MyPackages : ComponentBase
|
||||
[Inject] private PackageService PackageService { get; set; } = default!;
|
||||
|
||||
private UserPackageStatusDto? _userStatus;
|
||||
private MagicWalletStatus? _magicStatus;
|
||||
private bool _isLoading = true;
|
||||
private bool _canRepurchase = false;
|
||||
|
||||
private List<BreadcrumbItem> _breadcrumbItems = new()
|
||||
{
|
||||
@@ -30,6 +32,18 @@ public partial class MyPackages : ComponentBase
|
||||
try
|
||||
{
|
||||
_userStatus = await PackageService.GetUserPackageStatusAsync();
|
||||
|
||||
if (_userStatus?.HasPurchasedPackage == true)
|
||||
{
|
||||
_magicStatus = await WalletService.GetMagicWalletStatusAsync();
|
||||
|
||||
// Cycle complete: wallet back to Normal mode, at least one cycle done,
|
||||
// and deposit ceiling fully used (remaining = 0)
|
||||
_canRepurchase = _magicStatus != null
|
||||
&& _magicStatus.WalletMode == 0 // Normal mode
|
||||
&& _magicStatus.PurchaseCycleCount >= 1 // At least one cycle completed
|
||||
&& _magicStatus.MagicRemainingDeposit == 0; // Deposit ceiling used up
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -67,4 +81,11 @@ public partial class MyPackages : ComponentBase
|
||||
{
|
||||
return string.Format("{0:N0} تومان", price);
|
||||
}
|
||||
|
||||
private int GetDepositProgress()
|
||||
{
|
||||
if (_magicStatus == null || _magicStatus.MagicMaxDeposit <= 0) return 0;
|
||||
var pct = (int)((_magicStatus.MagicTotalDeposited * 100) / _magicStatus.MagicMaxDeposit);
|
||||
return Math.Min(pct, 100);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user