|
|
|
|
@@ -121,8 +121,8 @@ namespace Sockeye.Biz
|
|
|
|
|
License newLicense = new License();
|
|
|
|
|
//Get last license if any, set up some basic stuff common to all license types
|
|
|
|
|
var firstPurchase = purchaseGroup.First();
|
|
|
|
|
License lastLicense=null;
|
|
|
|
|
|
|
|
|
|
License lastLicense = null;
|
|
|
|
|
|
|
|
|
|
newLicense.CustomerId = firstPurchase.CustomerId;
|
|
|
|
|
newLicense.Active = false;
|
|
|
|
|
newLicense.RegTo = firstPurchase.RegTo;
|
|
|
|
|
@@ -131,7 +131,7 @@ namespace Sockeye.Biz
|
|
|
|
|
//if there is one and it's not entirely expired then duplicate and fixup from purchases in this group
|
|
|
|
|
if (isV7)
|
|
|
|
|
{
|
|
|
|
|
lastLicense = await ct.License.AsNoTracking().OrderByDescending(z => z.Id).FirstOrDefaultAsync(z => z.CustomerId == firstPurchase.CustomerId && z.PGroup == firstPurchase.PGroup);
|
|
|
|
|
lastLicense = await ct.License.AsNoTracking().OrderByDescending(z => z.Id).FirstOrDefaultAsync(z => z.CustomerId == firstPurchase.CustomerId && z.PGroup == firstPurchase.PGroup);
|
|
|
|
|
|
|
|
|
|
newLicense.FetchEmail = purchaseGroupCustomer.EmailAddress;
|
|
|
|
|
newLicense.PGroup = ProductGroup.AyaNova7;
|
|
|
|
|
@@ -207,6 +207,8 @@ namespace Sockeye.Biz
|
|
|
|
|
21 Single AyaNova service techncian perpetual license 301028314 135 100
|
|
|
|
|
22 Single AyaNova service techncian 1 year maintenance plan - new 301028317 135 100
|
|
|
|
|
23 Single AyaNova service techncian 1 year maintenance plan - active 301028315 100 100
|
|
|
|
|
case 4576
|
|
|
|
|
25 Up to 25 AyaNova schedulable resource 1 year subscription license
|
|
|
|
|
*/
|
|
|
|
|
var dtOneYear = DateTime.UtcNow.AddYears(1);
|
|
|
|
|
switch (product.VendorCode)
|
|
|
|
|
@@ -280,6 +282,10 @@ namespace Sockeye.Biz
|
|
|
|
|
newLicense.Users = 15;
|
|
|
|
|
newLicense.MaintenanceExpire = dtOneYear;
|
|
|
|
|
break;
|
|
|
|
|
case "301091845": //case 4576
|
|
|
|
|
newLicense.Users = 25;
|
|
|
|
|
newLicense.MaintenanceExpire = dtOneYear;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
var err = $"SockBotProcessPurchasesIntoLicenses purchase: {purchase.Id} has product not part of v7 group expected: {product.Name}-{product.VendorCode}";
|
|
|
|
|
//serious issue requires immediate notification
|
|
|
|
|
@@ -299,19 +305,19 @@ namespace Sockeye.Biz
|
|
|
|
|
//it's a RAVEN license
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//get last license for this dbid, if active then take all it's value and update it with this
|
|
|
|
|
lastLicense = await ct.License.AsNoTracking().OrderByDescending(z => z.Id).FirstOrDefaultAsync(z => z.CustomerId == firstPurchase.CustomerId && z.PGroup == firstPurchase.PGroup);
|
|
|
|
|
//get last license for this dbid, if active then take all it's value and update it with this
|
|
|
|
|
lastLicense = await ct.License.AsNoTracking().OrderByDescending(z => z.Id).FirstOrDefaultAsync(z => z.CustomerId == firstPurchase.CustomerId && z.PGroup == firstPurchase.PGroup);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//If renewal and there is no last license then it's a problem -> THROW EXCEPTION
|
|
|
|
|
//If renewal and there is no last license then it's a problem -> THROW EXCEPTION
|
|
|
|
|
|
|
|
|
|
//If no last license and not renewal then it's a new purchase -> GENERATE NEW
|
|
|
|
|
//If no last license and not renewal then it's a new purchase -> GENERATE NEW
|
|
|
|
|
|
|
|
|
|
//If last license and renewal then it's a renewal -> UPDATE LAST LICENSE DATES SAVE NEW
|
|
|
|
|
//If last license and renewal then it's a renewal -> UPDATE LAST LICENSE DATES SAVE NEW
|
|
|
|
|
|
|
|
|
|
//If last license and NEW then it's an additional add on count
|
|
|
|
|
//if dbid matches -> ADD TO COUNT PUT THAT IN NOTES OF LICENSE
|
|
|
|
|
//if no dbid match then -> THROW EXCEPTION
|
|
|
|
|
//If last license and NEW then it's an additional add on count
|
|
|
|
|
//if dbid matches -> ADD TO COUNT PUT THAT IN NOTES OF LICENSE
|
|
|
|
|
//if no dbid match then -> THROW EXCEPTION
|
|
|
|
|
|
|
|
|
|
//iterate the purchases and update / set the license
|
|
|
|
|
foreach (var purchase in purchaseGroup)
|
|
|
|
|
@@ -334,10 +340,10 @@ namespace Sockeye.Biz
|
|
|
|
|
301033168 AyaNova subscription additional 250 customer users yearly 250customerusersyearly Product 12 months HD1 Oct 6, 2022, 12:59 AM
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// - sockeye note: Need to handle multiple raven license purchases, my policy is the freshest date is honoured so for examle tri-star bought in December then in Feb 2 users each time so the feb is the freshest, the trick is when the december renews not to cut it short but still use the feb date. since eventually sockeye will be automated it needs to handle this up front now, not later
|
|
|
|
|
//algorithm: check if existing license for db id, if yes, is it for more users than current license?
|
|
|
|
|
//if yes then is it unexpired?
|
|
|
|
|
//if yes then honour the
|
|
|
|
|
// - sockeye note: Need to handle multiple raven license purchases, my policy is the freshest date is honoured so for examle tri-star bought in December then in Feb 2 users each time so the feb is the freshest, the trick is when the december renews not to cut it short but still use the feb date. since eventually sockeye will be automated it needs to handle this up front now, not later
|
|
|
|
|
//algorithm: check if existing license for db id, if yes, is it for more users than current license?
|
|
|
|
|
//if yes then is it unexpired?
|
|
|
|
|
//if yes then honour the
|
|
|
|
|
//RAVEN licenses have one week padding to be on the safe side
|
|
|
|
|
var dtOneYear = DateTime.UtcNow.AddYears(1).AddDays(7);
|
|
|
|
|
var dtOneMonth = DateTime.UtcNow.AddMonths(1).AddDays(7);
|
|
|
|
|
|