feat(profile): enhance ChargeCreditWallet and Wallet components with club membership checks
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 4m42s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 4m42s
- Added logic to display alerts and buttons based on club membership status in the ChargeCreditWallet and Wallet components. - Implemented user authentication checks to determine if the user is a club member and has purchased a package before allowing wallet charging. - Updated UI to guide users on purchasing packages or signing club contracts if they are not eligible to charge their wallet. These changes improve user experience by providing clear instructions and preventing unauthorized wallet charges.
This commit is contained in:
@@ -125,11 +125,26 @@ public partial class CheckoutSummary : ComponentBase
|
||||
return false;
|
||||
|
||||
var shortfall = totalRequired - walletBalance;
|
||||
var allowCharge = false;
|
||||
var hasPurchasedPackage = false;
|
||||
try
|
||||
{
|
||||
var userInfo = await AuthService.GetUserAuthInfo();
|
||||
allowCharge = userInfo.IsClubMemberActive;
|
||||
hasPurchasedPackage = userInfo.HasPurchasedPackage;
|
||||
}
|
||||
catch
|
||||
{
|
||||
allowCharge = false;
|
||||
}
|
||||
|
||||
var parameters = new DialogParameters<InsufficientCreditDialog>
|
||||
{
|
||||
{ x => x.CurrentBalance, walletBalance },
|
||||
{ x => x.RequiredAmount, totalRequired },
|
||||
{ x => x.ShortfallAmount, shortfall }
|
||||
{ x => x.ShortfallAmount, shortfall },
|
||||
{ x => x.AllowChargeCredit, allowCharge },
|
||||
{ x => x.HasPurchasedPackage, hasPurchasedPackage }
|
||||
};
|
||||
|
||||
var dialog = await DialogService.ShowAsync<InsufficientCreditDialog>(
|
||||
@@ -143,7 +158,7 @@ public partial class CheckoutSummary : ComponentBase
|
||||
});
|
||||
|
||||
var result = await dialog.Result;
|
||||
if (result is { Canceled: false } && result.Data is long chargeShortfall)
|
||||
if (allowCharge && result is { Canceled: false } && result.Data is long chargeShortfall)
|
||||
{
|
||||
var chargeAmount = CreditChargeNavigation.NormalizeChargeAmount(chargeShortfall);
|
||||
Navigation.NavigateTo(CreditChargeNavigation.BuildChargeUrl(
|
||||
|
||||
Reference in New Issue
Block a user