diff --git a/lib/apple.js b/lib/apple.js index 5a8627e..e7c482e 100644 --- a/lib/apple.js +++ b/lib/apple.js @@ -41,10 +41,7 @@ var testMode = false; function isExpired(responseData) { if (responseData[REC_KEYS.LRI] && responseData[REC_KEYS.LRI][REC_KEYS.EXPIRES_DATE]) { var exp = parseInt(responseData[REC_KEYS.LRI][REC_KEYS.EXPIRES_DATE]); - if (exp > Date.now()) { - return true; - } - return false; + return exp > Date.now(); } // old receipt } @@ -349,7 +346,7 @@ module.exports.getPurchaseData = function (purchase, options) { }; function bool(val) { - return val === 'true' ? true : false; + return val === 'true'; } function getSubscriptionExpireDate(data) { @@ -413,6 +410,8 @@ function send(url, content, cb) { function applyResponseData(target, source) { for (var key in source) { + if (!source.hasOwnProperty(key)) + continue; if (target[key] === undefined) { target[key] = source[key]; }