Skip to content

Commit

Permalink
Merge pull request #1060 from ITfoxtec/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
Revsgaard authored Nov 27, 2024
2 parents c9af149 + 600b8fd commit 031de37
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public TMyTenantController(FoxIDsControlSettings settings, TelemetryScopedLogger
logger.Error(exp, "Unable to update plan in tenant.");
}

if(!mTenant.CustomDomain.Equals(tenant.CustomDomain, StringComparison.OrdinalIgnoreCase))
if(mTenant.CustomDomain.IsNullOrEmpty() || !mTenant.CustomDomain.Equals(tenant.CustomDomain, StringComparison.OrdinalIgnoreCase))
{
mTenant.CustomDomain = tenant.CustomDomain?.ToLower();
mTenant.CustomDomainVerified = false;
Expand Down
2 changes: 1 addition & 1 deletion src/FoxIDs.Control/FoxIDs.Control.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.12.8</Version>
<Version>1.12.9</Version>
<RootNamespace>FoxIDs</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down
2 changes: 1 addition & 1 deletion src/FoxIDs.ControlClient/FoxIDs.ControlClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.12.8</Version>
<Version>1.12.9</Version>
<RootNamespace>FoxIDs.Client</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down
23 changes: 6 additions & 17 deletions src/FoxIDs.ControlClient/Logic/RouteBindingLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,32 +44,21 @@ public RouteBindingLogic(ClientSettings clientSettings, IServiceProvider service

public bool RequestPayment { get; private set; }

public async Task SetMyTenantAsync(TenantResponse tenant)
public void SetMyTenant(TenantResponse tenant)
{
myTenant = tenant;

if (!IsMasterTenant && clientSettings.EnablePayment)
{
await UpdatRequestPaymentAsync(myTenant);
UpdatRequestPayment(myTenant);
}
}

private async Task UpdatRequestPaymentAsync(TenantResponse myTenant)
private void UpdatRequestPayment(TenantResponse myTenant)
{
if (myTenant.EnableUsage && myTenant.DoPayment && !myTenant.PlanName.IsNullOrEmpty() && "free" != myTenant.PlanName && myTenant.Payment?.IsActive != true)
if (myTenant.DoPayment && myTenant.Payment?.IsActive != true)
{
var helpersService = serviceProvider.GetService<HelpersService>();
var planInfoList = await helpersService.GetPlanInfoAsync();

decimal planCost = planInfoList.Where(p => p.Name == myTenant.PlanName).Select(p => p.CostPerMonth).FirstOrDefault();
if (planCost > 0)
{
RequestPayment = true;
}
else
{
RequestPayment = false;
}
RequestPayment = true;
}
else
{
Expand Down Expand Up @@ -152,7 +141,7 @@ private async Task LoadMyTenantAsync()
if (authenticationState.User.Identity.IsAuthenticated && !IsMasterTenant)
{
var myTenantService = serviceProvider.GetService<MyTenantService>();
await SetMyTenantAsync(await myTenantService.GetTenantAsync());
SetMyTenant(await myTenantService.GetTenantAsync());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class TenantViewModel
[Display(Name = "Enable usage")]
public bool EnableUsage { get; set; }

[Display(Name = "Do payment")]
[Display(Name = "Do card payment")]
public bool DoPayment { get; set; }

/// <summary>
Expand Down
12 changes: 10 additions & 2 deletions src/FoxIDs.ControlClient/Pages/MasterTenant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public partial class MasterTenant
[Inject]
public MyTenantService MyTenantService { get; set; }

[Inject]
public TrackService TrackService { get; set; }

[Parameter]
public string TenantName { get; set; }

Expand All @@ -77,6 +80,11 @@ protected override async Task OnInitializedAsync()
TrackSelectedLogic.OnTrackSelectedAsync += OnTrackSelectedAsync;
NotificationLogic.OnClientSettingLoaded += OnClientSettingLoaded;
NotificationLogic.OnOpenPaymentMethodAsync += OnOpenPaymentMethodAsync;
if (TrackSelectedLogic.Track.Name != Constants.Routes.MasterTrackName)
{
var masterTrack = await TrackService.GetTrackAsync(Constants.Routes.MasterTrackName);
await TrackSelectedLogic.TrackSelectedAsync(masterTrack);
}
if (TrackSelectedLogic.IsTrackSelected)
{
await DefaultLoadAsync();
Expand Down Expand Up @@ -110,7 +118,7 @@ private async Task DefaultLoadAsync()
deleteTenantAcknowledge = false;

myTenant = await MyTenantService.GetTenantAsync();
await RouteBindingLogic.SetMyTenantAsync(myTenant);
RouteBindingLogic.SetMyTenant(myTenant);

savedCustomDomain = myTenant.CustomDomain;

Expand Down Expand Up @@ -146,7 +154,7 @@ private async Task OnUpdateTenantValidSubmitAsync(EditContext editContext)
savedCustomDomain = myTenant.CustomDomain;
tenantSettingsForm.Model.CustomDomain = myTenant.CustomDomain;
tenantSettingsForm.Model.CustomDomainVerified = myTenant.CustomDomainVerified;
await RouteBindingLogic.SetMyTenantAsync(myTenant);
RouteBindingLogic.SetMyTenant(myTenant);
tenantWorking = false;
}
catch (Exception ex)
Expand Down
2 changes: 1 addition & 1 deletion src/FoxIDs.ControlShared/FoxIDs.ControlShared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.12.8</Version>
<Version>1.12.9</Version>
<RootNamespace>FoxIDs</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down
2 changes: 1 addition & 1 deletion src/FoxIDs.Shared/FoxIDs.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.12.8</Version>
<Version>1.12.9</Version>
<RootNamespace>FoxIDs</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down
2 changes: 1 addition & 1 deletion src/FoxIDs.SharedBase/FoxIDs.SharedBase.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.12.8</Version>
<Version>1.12.9</Version>
<RootNamespace>FoxIDs</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down
2 changes: 1 addition & 1 deletion src/FoxIDs/FoxIDs.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.12.8</Version>
<Version>1.12.9</Version>
<RootNamespace>FoxIDs</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down

0 comments on commit 031de37

Please sign in to comment.