This commit is contained in:
2023-01-10 01:33:52 +00:00
parent 8467470c1d
commit 8a9970d346
4 changed files with 66 additions and 7 deletions

View File

@@ -676,6 +676,9 @@ namespace Sockeye.Biz
l.TrialMode = true;
l.Key = sKey;
//get number of users count and features etc
LicenseBiz.ParseKeySetDTOFields(l);
//Parse key as we need the expiry dates and they are only stored in the key not the trial request
string keyNoWS = System.Text.RegularExpressions.Regex.Replace(StringUtil.Extract(l.Key, "[KEY", "KEY]").Trim(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
var jKey = JObject.Parse(keyNoWS);
@@ -707,12 +710,30 @@ namespace Sockeye.Biz
l.Active = true;//active here means it's been fully prepared and is viable for use, all prior licenses fit this description so all are active
l.NotificationSent = true;
//workaround sketchy old testing licenses
if (l.PGroup == ProductGroup.RavenSubscription)
{
if (l.MaxDataGB == null || l.MaxDataGB == 0)
l.MaxDataGB = 20;
if (l.CustomerUsers == null || l.CustomerUsers == 0)
l.CustomerUsers = 250;
}
LicenseBiz lbiz = LicenseBiz.GetBiz(ct);
var newLicenseObject = await lbiz.CreateAsync(l, true);
#if (DEBUG)
if (newLicenseObject == null)
;
else
TrialKeyId = newLicenseObject.Id;
{
System.Diagnostics.Debugger.Break();
}
#endif
TrialKeyId = newLicenseObject.Id;
}
}
@@ -730,7 +751,7 @@ namespace Sockeye.Biz
tlr.Processed = DateUtil.EpochToDateNullIsNull(jTrialRequestItem["dtProcessed"].Value<long?>());
tlr.Status = (TrialRequestStatus)jTrialRequestItem["status"].Value<int>();
tlr.RejectReason = jTrialRequestItem["rejectReason"].Value<string>();
tlr.KeyId = TrialKeyId;
tlr.LicenseId = TrialKeyId;
var biz = TrialLicenseRequestBiz.GetBiz(ct);
await biz.CreateAsync(tlr);
}

View File

@@ -401,9 +401,43 @@ namespace Sockeye.Biz
"Count": 20
}
]
"Key": {
"LicenseFormat": "8",
"Id": "00-1593712003",
"RegisteredTo": "Test corporation",
"DBID": "mRntGkdwvYCDOAOroCQpB5Elbct09iNIS7lcU7QgRCY=",
"LicenseExpiration": "2020-08-16T17:46:43.6261717Z",
"MaintenanceExpiration": "2020-08-16T17:46:43.6261717Z",
"Features": [
{
"Name": "TrialMode"
},
{
"Name": "ServiceMode"
},
{
"Name": "Accounting"
},
{
"Name": "ServiceTechs",
"Count": 1000
}
]
}
}
*/
string keyNoWS = System.Text.RegularExpressions.Regex.Replace(StringUtil.Extract(l.Key, "[KEY", "KEY]").Trim(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
var jKey = JObject.Parse(keyNoWS);
// #if (DEBUG)
// if (jKey["Key"]["DBID"].Value<string>() == "mRntGkdwvYCDOAOroCQpB5Elbct09iNIS7lcU7QgRCY=")
// System.Diagnostics.Debugger.Break();
// #endif
var jaFeatures = (JArray)jKey.SelectToken("Key.Features");
for (int x = 0; x < jaFeatures.Count; x++)
{
@@ -417,7 +451,7 @@ namespace Sockeye.Biz
if (jFeature["Count"] != null)
count = jFeature["Count"].Value<int>();
if (feature == "ActiveInternalUsers")
if (feature == "ActiveInternalUsers" || feature == "ServiceTechs")//at one point early in testing was ServiceTechs kept for import from rockfish
l.Users = count;
if (feature == "ActiveCustomerUsers")
@@ -429,6 +463,10 @@ namespace Sockeye.Biz
}
}
#if (DEBUG)
if (l.Users == 0)
System.Diagnostics.Debugger.Break();
#endif
return l;
}

View File

@@ -29,7 +29,7 @@ namespace Sockeye.Models
public DateTime? Processed { get; set; }
public TrialRequestStatus Status { get; set; } = TrialRequestStatus.New;
public string RejectReason { get; set; }
public long? KeyId { get; set; }
public long? LicenseId { get; set; }
[Required]
public ProductGroup PGroup { get; set; }
public List<string> Tags { get; set; }