cordova-plugin-purchase
Advanced tools
Comparing version 10.3.0 to 10.4.0
This have moved: | ||
See https://github.com/j3k0/cordova-plugin-purchase/wiki/HOWTO#setup-android-applications | ||
See https://purchase.cordova.fovea.cc/use-cases/subscription-android |
{ | ||
"name": "cordova-plugin-purchase", | ||
"version": "10.3.0", | ||
"version": "10.4.0", | ||
"description": "Cordova Purchase plugin for iOS, Android, Windows (AppStore, Play, UWP)", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -136,2 +136,3 @@ declare var store: IapStore.IStore; | ||
order(id: string, additionalData?: null | IAdditionalData): void; | ||
applicationUsername?: string | () => string; | ||
} | ||
@@ -138,0 +139,0 @@ |
@@ -547,3 +547,6 @@ /*global storekit */ | ||
appStoreReceipt.in_app.forEach(function(transaction) { | ||
lastTransactions[transaction.product_id] = transaction; | ||
var existing = lastTransactions[transaction.product_id]; | ||
if (existing && +existing.purchase_date_ms < +transaction.purchase_date_ms) { | ||
lastTransactions[transaction.product_id] = transaction; | ||
} | ||
}); | ||
@@ -719,4 +722,9 @@ } | ||
// finds a product that is both owned and expired more than 1 minute ago | ||
// but less that 1h ago (it's only meant for detecting interactive renewals) | ||
var expired = store.products.find(function(product) { | ||
return product.owned && now > +product.expiryDate + 60000; | ||
var ONE_MINUTE = 60000; | ||
var ONE_HOUR = 3600000; | ||
return product.owned && | ||
(now > +product.expiryDate + ONE_MINUTE) && | ||
(now < +product.expiryDate + ONE_HOUR); | ||
}); | ||
@@ -723,0 +731,0 @@ // if one is found, refresh purchases using the validator (if setup) |
@@ -11,4 +11,15 @@ (function() { | ||
if (key === 'isExpired' && value === true && this.owned) { | ||
this.set('owned', false); | ||
this.set('state', store.VALID); | ||
this.set('expired', true); | ||
this.trigger('expired'); | ||
} | ||
if (key === 'isExpired' && value === false && !this.owned) { | ||
this.set('expired', false); | ||
if (this.state !== store.APPROVED) { | ||
// user have to "finish()" to own an approved transaction | ||
// in other cases, we can safely set the OWNED state. | ||
this.set('state', store.OWNED); | ||
} | ||
} | ||
this[key] = value; | ||
@@ -15,0 +26,0 @@ if (key === 'state') |
@@ -236,8 +236,3 @@ (function() { | ||
if (success) { | ||
if (that.expired) | ||
that.set("expired", false); | ||
store.log.debug("verify -> success: " + JSON.stringify(data)); | ||
store.utils.callExternal('verify.success', successCb, that, data); | ||
store.utils.callExternal('verify.done', doneCb, that); | ||
that.trigger("verified"); | ||
@@ -272,2 +267,4 @@ // Process the list of products that are ineligible | ||
if (data && data.collection && data.collection.forEach) { | ||
// new behavior: the validator sets products state in the collection | ||
// (including expiry status) | ||
data.collection.forEach(function(purchase) { | ||
@@ -279,3 +276,12 @@ var p = store.get(purchase.id); | ||
}); | ||
} | ||
else if (that.expired) { | ||
// old behavior: a valid receipt means the subscription isn't expired. | ||
that.set("expired", false); | ||
} | ||
store.utils.callExternal('verify.success', successCb, that, data); | ||
store.utils.callExternal('verify.done', doneCb, that); | ||
that.trigger("verified"); | ||
} | ||
@@ -282,0 +288,0 @@ else { |
@@ -364,2 +364,2 @@ /// ### Philosophy | ||
store.version = '10.3.0'; | ||
store.version = '10.4.0'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1024730
18380