This commit is contained in:
@@ -293,6 +293,30 @@ namespace Sockeye.Biz
|
||||
else
|
||||
{
|
||||
//it's a RAVEN license
|
||||
|
||||
//get last license for this dbid, if active then take all it's value and update it with this
|
||||
/*
|
||||
Check if new or renewal:
|
||||
if it's a renewal it will have several "original_XXXX" fields (they won't exist on first purcahse):
|
||||
"subscription": {
|
||||
"expiration_date": "2023-03-07T00:15:13.0000000Z",
|
||||
"id": "833674953-1",
|
||||
"interval": "Monthly without end",
|
||||
"original_notification_no": "7925",
|
||||
"original_purchase_id": "833674953",
|
||||
"original_running_no": "1",
|
||||
*/
|
||||
|
||||
//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 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
|
||||
|
||||
//iterate the purchases and update / set the license
|
||||
foreach (var purchase in purchaseGroup)
|
||||
{
|
||||
@@ -314,7 +338,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
|
||||
// - 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);
|
||||
|
||||
@@ -246,10 +246,26 @@ namespace Sockeye.Biz
|
||||
p.Quantity = jPurchase["quantity"].Value<int>();
|
||||
p.VendorNotificationId = vn.Id;
|
||||
|
||||
p.IsRenewal = false;//default, set to true in subscription block processor below
|
||||
//it's a subscription?
|
||||
if (jPurchase["subscription"] != null && jPurchase["subscription"]["expiration_date"] != null)
|
||||
if (jPurchase["subscription"] != null)
|
||||
{
|
||||
p.ExpireDate = jPurchase["subscription"]["expiration_date"].Value<DateTime>();
|
||||
if (jPurchase["subscription"]["expiration_date"] != null)
|
||||
p.ExpireDate = jPurchase["subscription"]["expiration_date"].Value<DateTime>();
|
||||
|
||||
if (jPurchase["subscription"]["original_purchase_id"] != null)
|
||||
p.IsRenewal = true;//the existance of the field is enough, we're going to assume the original purchase id is most definitive though there are other original_xx fields:
|
||||
/*
|
||||
Renewal example:
|
||||
if it's a renewal it will have several "original_XXXX" fields (they won't exist on first non-renewal purchase):
|
||||
"subscription": {
|
||||
"expiration_date": "2023-03-07T00:15:13.0000000Z",
|
||||
"id": "833674953-1",
|
||||
"interval": "Monthly without end",
|
||||
"original_notification_no": "7925",
|
||||
"original_purchase_id": "833674953",
|
||||
"original_running_no": "1",
|
||||
*/
|
||||
}
|
||||
|
||||
PurchaseBiz pbiz = PurchaseBiz.GetBiz(ct);
|
||||
|
||||
Reference in New Issue
Block a user