fix: remove hardcoded 56M amounts — dynamic package pricing
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 2m52s
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 2m52s
- ActivationSection: load base package price via PackageService on init - ClubMembershipContractDialog: dynamic package name/price in contract text
This commit is contained in:
@@ -10,6 +10,7 @@ public partial class ActivationSection : ComponentBase
|
||||
[Inject] private ClubMembershipService ClubService { get; set; } = default!;
|
||||
[Inject] private AuthService AuthService { get; set; } = default!;
|
||||
[Inject] private UserContract.UserContractClient UserContract { get; set; } = default!;
|
||||
[Inject] private PackageService PackageService { get; set; } = default!;
|
||||
|
||||
[Parameter] public EventCallback OnActivationSuccess { get; set; }
|
||||
|
||||
@@ -21,6 +22,18 @@ public partial class ActivationSection : ComponentBase
|
||||
private long _packageId = 1;
|
||||
private int _durationMonths = 1;
|
||||
private string? _activationCode;
|
||||
private long _basePackagePrice;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var packages = await PackageService.GetAllPackagesAsync();
|
||||
var basePackage = packages.FirstOrDefault(p => p.IsBasePackage) ?? packages.FirstOrDefault();
|
||||
_basePackagePrice = basePackage?.Price ?? 0;
|
||||
}
|
||||
catch { /* fallback to 0 */ }
|
||||
}
|
||||
|
||||
private async Task HandleActivateAsync()
|
||||
{
|
||||
@@ -75,9 +88,8 @@ public partial class ActivationSection : ComponentBase
|
||||
|
||||
private string GetEstimatedCost()
|
||||
{
|
||||
// فرمول تقریبی: 56M per month (base amount from BFF implementation)
|
||||
var baseAmount = 56_000_000;
|
||||
var total = baseAmount * _durationMonths;
|
||||
if (_basePackagePrice <= 0) return "در حال بارگذاری...";
|
||||
var total = _basePackagePrice * _durationMonths;
|
||||
return $"{total:N0} تومان";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user