@@ -134,7 +134,7 @@
|
|||||||
private async Task LaunchPayment()
|
private async Task LaunchPayment()
|
||||||
{
|
{
|
||||||
if (SelectedGateway == null)
|
if (SelectedGateway == null)
|
||||||
return;
|
throw new DisplayException("You need to select a payment method");
|
||||||
|
|
||||||
var url = await SelectedGateway.Start(Amount);
|
var url = await SelectedGateway.Start(Amount);
|
||||||
Navigation.NavigateTo(url, true);
|
Navigation.NavigateTo(url, true);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
@using Moonlight.App.Services.ServiceManage
|
@using Moonlight.App.Services.ServiceManage
|
||||||
@using Microsoft.EntityFrameworkCore
|
@using Microsoft.EntityFrameworkCore
|
||||||
@using Moonlight.App.Models.Abstractions.Services
|
@using Moonlight.App.Models.Abstractions.Services
|
||||||
|
@using Moonlight.App.Models.Enums
|
||||||
@using Moonlight.App.Services
|
@using Moonlight.App.Services
|
||||||
|
|
||||||
@inject Repository<Service> ServiceRepository
|
@inject Repository<Service> ServiceRepository
|
||||||
@@ -19,7 +20,8 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (NeedsRenewal)
|
// An admin should still be able to manage the service, that's why we check for permissions here
|
||||||
|
if (NeedsRenewal && !IdentityService.Permissions[Permission.AdminServices])
|
||||||
{
|
{
|
||||||
<NeedsRenewalAlert />
|
<NeedsRenewalAlert />
|
||||||
}
|
}
|
||||||
@@ -50,7 +52,7 @@
|
|||||||
private ServiceDefinition Definition;
|
private ServiceDefinition Definition;
|
||||||
private ServiceViewContext ViewContext;
|
private ServiceViewContext ViewContext;
|
||||||
|
|
||||||
private bool NeedsRenewal = false;
|
private bool NeedsRenewal;
|
||||||
|
|
||||||
private async Task Load(LazyLoader lazyLoader)
|
private async Task Load(LazyLoader lazyLoader)
|
||||||
{
|
{
|
||||||
@@ -73,9 +75,12 @@
|
|||||||
if (Service == null)
|
if (Service == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Check expiration
|
||||||
NeedsRenewal = await ServiceService.Manage.NeedsRenewal(Service);
|
NeedsRenewal = await ServiceService.Manage.NeedsRenewal(Service);
|
||||||
|
|
||||||
if(NeedsRenewal) // Stop loading more data
|
// Stop loading more data if the user is not an admin
|
||||||
|
// because a admin should still be able to manage the service
|
||||||
|
if(NeedsRenewal && !IdentityService.Permissions[Permission.AdminServices])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Load implementation
|
// Load implementation
|
||||||
|
|||||||
Reference in New Issue
Block a user