This commit is contained in:
2020-06-15 14:48:45 +00:00
parent f80d1bbca0
commit e7b5e1a388
5 changed files with 77 additions and 153 deletions

View File

@@ -86,12 +86,12 @@ namespace AyaNova.Core
public enum LicenseStatus
{
NONE = 0,
ActiveTrial = 1,
ExpiredTrial = 2,
ActivePurchased = 3,
ExpiredPurchased = 4,
Revoked = 5
NONE = 0,//fast track
ActiveTrial = 1,//slow track
ExpiredTrial = 2,//fast track
ActivePurchased = 3,//slow track
ExpiredPurchased = 4,//fast track
Revoked = 5//slow track
}
public AyaNovaLicenseKey()
@@ -174,7 +174,6 @@ namespace AyaNova.Core
return LicenseStatus.ActivePurchased;
if (!TrialLicense && LicenseExpired)
return LicenseStatus.ExpiredPurchased;
throw new System.Exception("License::Status - unable to determine license status");
}
}
@@ -484,9 +483,13 @@ namespace AyaNova.Core
/// Fetch a key, validate it and install it in the db then initialize with it
/// </summary>
/// <returns>Result string</returns>
internal static async Task<string> FetchKeyAsync(AyaNova.Api.ControllerHelpers.ApiServerState apiServerState, AyContext ct, ILogger log, bool calledFromInternalJob = true)
internal static async Task<string> FetchKeyAsync(AyaNova.Api.ControllerHelpers.ApiServerState apiServerState, AyContext ct, ILogger log, bool calledFromInternalJob)
{
log.LogInformation($"Fetching license for DBID {LicenseDbId.ToString()}");
if (calledFromInternalJob)
log.LogTrace($"Fetching license for DBID {LicenseDbId.ToString()} (called by job)");
else
log.LogInformation($"Fetching license for DBID {LicenseDbId.ToString()}");
string sUrl = $"{LICENSE_SERVER_URL}rvf/{LicenseDbId.ToString()}";
try
{
@@ -504,11 +507,8 @@ namespace AyaNova.Core
if (ParsedKey != null)
{
await InstallAsync(keyText, ParsedKey, apiServerState, ct, log);
log.LogInformation($"Installed new license key {ParsedKey.Id}");
//Log the license info so it's on the record
log.LogInformation($"License - new key installed [{AyaNova.Core.License.LicenseInfoLogFormat}]");
return "ok";
}
return $"E1020 - Error fetching license key: No key was returned";