Add convenience function to determine if subscription is 'free' or not

This commit is contained in:
Johannes Zellner
2018-05-29 13:16:36 +02:00
parent 915e04eb08
commit 541fabcb2e
3 changed files with 9 additions and 6 deletions
+5
View File
@@ -5,6 +5,7 @@ exports = module.exports = {
unpurchase: unpurchase,
getSubscription: getSubscription,
isFreePlan: isFreePlan,
sendAliveStatus: sendAliveStatus,
@@ -90,6 +91,10 @@ function getSubscription(callback) {
});
}
function isFreePlan(subscription) {
return !subscription || subscription.plan.id === 'free';
}
function purchase(appId, appstoreId, callback) {
assert.strictEqual(typeof appId, 'string');
assert.strictEqual(typeof appstoreId, 'string');