This commit is contained in:
@@ -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