Skip to content

Commit

Permalink
Merge pull request #1056 from ITfoxtec/1.12.x-development
Browse files Browse the repository at this point in the history
Client, add catch TokenUnavailableException in SetHourPrice method.
  • Loading branch information
Revsgaard authored Nov 26, 2024
2 parents efad6b3 + 9cf656c commit 999190a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 12 deletions.
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.7</Version>
<Version>1.12.8</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.7</Version>
<Version>1.12.8</Version>
<RootNamespace>FoxIDs.Client</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down
19 changes: 13 additions & 6 deletions src/FoxIDs.ControlClient/Pages/Usage/Usage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,22 @@ private async Task UsedViewModelAfterInitAsync(GeneralUsedViewModel generalUsed,

private async Task SetHourPrice(GeneralUsedViewModel generalUsed)
{
var tenant = await TenantService.GetTenantAsync(generalUsed.TenantName);
if (tenant.HourPrice > 0)
try
{
generalUsed.HourPrice = tenant.HourPrice.Value;
var tenant = await TenantService.GetTenantAsync(generalUsed.TenantName);
if (tenant.HourPrice > 0)
{
generalUsed.HourPrice = tenant.HourPrice.Value;
}
else
{
var rate = GetExchangesRate(tenant.Currency, usageSettings.CurrencyExchanges);
generalUsed.HourPrice = decimal.Round(usageSettings.HourPrice * rate, 2);
}
}
else
catch (TokenUnavailableException)
{
var rate = GetExchangesRate(tenant.Currency, usageSettings.CurrencyExchanges);
generalUsed.HourPrice = decimal.Round(usageSettings.HourPrice * rate, 2);
await (OpenidConnectPkce as TenantOpenidConnectPkce).TenantLoginAsync();
}
}

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.7</Version>
<Version>1.12.8</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.7</Version>
<Version>1.12.8</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.7</Version>
<Version>1.12.8</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.7</Version>
<Version>1.12.8</Version>
<RootNamespace>FoxIDs</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down

0 comments on commit 999190a

Please sign in to comment.