Skip to content

Commit

Permalink
Fix linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
j3k0 committed Oct 22, 2016
1 parent 93d0848 commit a9a4919
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 29 deletions.
3 changes: 2 additions & 1 deletion doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ Products object have the following fields and methods.
- `product.owned` - Product is owned
- `product.downloading` - Product is downloading non-consumable content
- `product.downloaded` - Non-consumable content has been successfully downloaded for this product
- `product.additionalData` - additional data possibly required for product purchase
- `product.transaction` - Latest transaction data for this product (see [transactions](#transactions)).
- `product.additionalData` - additional data possibly required for passing info in event based behavior.

### *store.Product* public methods

Expand Down Expand Up @@ -658,6 +658,7 @@ The `product` argument can be either:
The `additionalData` argument can be either:
- null
- object with attribute `oldPurchasedSkus`, a string array with the old subscription to upgrade/downgrade on Android. See: [android developer](https://developer.android.com/google/play/billing/billing_reference.html#upgrade-getBuyIntentToReplaceSkus) for more info
- object with attribute `developerPayload`, string representing the developer payload as described in [billing best practices](https://developer.android.com/google/play/billing/billing_best_practices.html)

See the ["Purchasing section"](#purchasing) to learn more about
the purchase process.
Expand Down
2 changes: 1 addition & 1 deletion src/js/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ store.order = function(pid, additionalData) {
}
}
if (additionalData) {
p.additionalData = additionalData;
p.additionalData = additionalData;
}

var localCallbackId = callbackId++;
Expand Down
2 changes: 1 addition & 1 deletion src/js/platforms/plugin-bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ InAppBilling.prototype.subscribe = function (success, fail, productId, additiona
}
additionalData = (!!additionalData) && (additionalData.constructor === Object) ? additionalData : {};
if (additionalData.oldPurchasedSkus && this.options.showLog) {
log('subscribe called with upgrading of old SKUs!');
log('subscribe called with upgrading of old SKUs!');
}
return cordova.exec(success, errorCb(fail), "InAppBillingPlugin", "subscribe", [productId, additionalData || {}]);
};
Expand Down
6 changes: 3 additions & 3 deletions www/store-android.js
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ store.order = function(pid, additionalData) {
}
}
if (additionalData) {
p.additionalData = additionalData;
p.additionalData = additionalData;
}

var localCallbackId = callbackId++;
Expand Down Expand Up @@ -2072,8 +2072,8 @@ InAppBilling.prototype.subscribe = function (success, fail, productId, additiona
}
additionalData = (!!additionalData) && (additionalData.constructor === Object) ? additionalData : {};
if (additionalData.oldPurchasedSkus && this.options.showLog) {
log('subscribe called with upgrading of old SKUs!');
}
log('subscribe called with upgrading of old SKUs!');
}
return cordova.exec(success, errorCb(fail), "InAppBillingPlugin", "subscribe", [productId, additionalData || {}]);
};
InAppBilling.prototype.consumePurchase = function (success, fail, productId, transactionId) {
Expand Down
18 changes: 9 additions & 9 deletions www/store-ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ var ERROR_CODES_BASE = 6777000;
/*///*/ store.ERR_REFRESH = ERROR_CODES_BASE + 19; // Failed to refresh the store.
/*///*/ store.ERR_PAYMENT_EXPIRED = ERROR_CODES_BASE + 20;
/*///*/ store.ERR_DOWNLOAD = ERROR_CODES_BASE + 21;
/*///*/ store.ERR_SUBSCRIPTION_UPDATE_NOT_AVAILABLE = ERROR_CODES_BASE + 22;
/*///*/ store.ERR_SUBSCRIPTION_UPDATE_NOT_AVAILABLE = ERROR_CODES_BASE + 22;

///
/// ### product states
Expand Down Expand Up @@ -481,12 +481,12 @@ store.Product = function(options) {
/// - `product.downloaded` - Non-consumable content has been successfully downloaded for this product
this.downloaded = options.downloaded;

/// - `product.additionalData` - additional data possibly required for product purchase
this.additionalData = options.additionalData || null;

/// - `product.transaction` - Latest transaction data for this product (see [transactions](#transactions)).
this.transaction = null;

/// - `product.additionalData` - additional data possibly required for passing info in event based behavior.
this.additionalData = null;

this.stateChanged();
};

Expand Down Expand Up @@ -1131,6 +1131,7 @@ var callbackId = 0;
/// The `additionalData` argument can be either:
/// - null
/// - object with attribute `oldPurchasedSkus`, a string array with the old subscription to upgrade/downgrade on Android. See: [android developer](https://developer.android.com/google/play/billing/billing_reference.html#upgrade-getBuyIntentToReplaceSkus) for more info
/// - object with attribute `developerPayload`, string representing the developer payload as described in [billing best practices](https://developer.android.com/google/play/billing/billing_best_practices.html)
///
/// See the ["Purchasing section"](#purchasing) to learn more about
/// the purchase process.
Expand All @@ -1145,13 +1146,12 @@ store.order = function(pid, additionalData) {
p = new store.Product({
id: pid,
loaded: true,
valid: false,
additionalData: additionalData
valid: false
});
}
else if (additionalData) {
p.additionalData = additionalData;
}
}
if (additionalData) {
p.additionalData = additionalData;
}

var localCallbackId = callbackId++;
Expand Down
34 changes: 20 additions & 14 deletions www/store-windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ var ERROR_CODES_BASE = 6777000;
/*///*/ store.ERR_REFRESH = ERROR_CODES_BASE + 19; // Failed to refresh the store.
/*///*/ store.ERR_PAYMENT_EXPIRED = ERROR_CODES_BASE + 20;
/*///*/ store.ERR_DOWNLOAD = ERROR_CODES_BASE + 21;
/*///*/ store.ERR_SUBSCRIPTION_UPDATE_NOT_AVAILABLE = ERROR_CODES_BASE + 22;
/*///*/ store.ERR_SUBSCRIPTION_UPDATE_NOT_AVAILABLE = ERROR_CODES_BASE + 22;

///
/// ### product states
Expand Down Expand Up @@ -460,12 +460,12 @@ store.Product = function(options) {
/// - `product.downloaded` - Non-consumable content has been successfully downloaded for this product
this.downloaded = options.downloaded;

/// - `product.additionalData` - additional data possibly required for product purchase
this.additionalData = options.additionalData || null;

/// - `product.transaction` - Latest transaction data for this product (see [transactions](#transactions)).
this.transaction = null;

/// - `product.additionalData` - additional data possibly required for passing info in event based behavior.
this.additionalData = null;

this.stateChanged();
};

Expand Down Expand Up @@ -1110,6 +1110,7 @@ var callbackId = 0;
/// The `additionalData` argument can be either:
/// - null
/// - object with attribute `oldPurchasedSkus`, a string array with the old subscription to upgrade/downgrade on Android. See: [android developer](https://developer.android.com/google/play/billing/billing_reference.html#upgrade-getBuyIntentToReplaceSkus) for more info
/// - object with attribute `developerPayload`, string representing the developer payload as described in [billing best practices](https://developer.android.com/google/play/billing/billing_best_practices.html)
///
/// See the ["Purchasing section"](#purchasing) to learn more about
/// the purchase process.
Expand All @@ -1124,13 +1125,12 @@ store.order = function(pid, additionalData) {
p = new store.Product({
id: pid,
loaded: true,
valid: false,
additionalData: additionalData
valid: false
});
}
else if (additionalData) {
p.additionalData = additionalData;
}
}
if (additionalData) {
p.additionalData = additionalData;
}

var localCallbackId = callbackId++;
Expand Down Expand Up @@ -2059,17 +2059,22 @@ InAppBilling.prototype.getPurchases = function (success, fail) {
}
return cordova.exec(success, errorCb(fail), "InAppBillingPlugin", "getPurchases", ["null"]);
};
InAppBilling.prototype.buy = function (success, fail, productId) {
InAppBilling.prototype.buy = function (success, fail, productId, additionalData) {
if (this.options.showLog) {
log('buy called!');
}
return cordova.exec(success, errorCb(fail), "InAppBillingPlugin", "buy", [productId]);
additionalData = (!!additionalData) && (additionalData.constructor === Object) ? additionalData : {};
return cordova.exec(success, errorCb(fail), "InAppBillingPlugin", "buy", [productId, additionalData]);
};
InAppBilling.prototype.subscribe = function (success, fail, productId) {
InAppBilling.prototype.subscribe = function (success, fail, productId, additionalData) {
if (this.options.showLog) {
log('subscribe called!');
}
return cordova.exec(success, errorCb(fail), "InAppBillingPlugin", "subscribe", [productId]);
additionalData = (!!additionalData) && (additionalData.constructor === Object) ? additionalData : {};
if (additionalData.oldPurchasedSkus && this.options.showLog) {
log('subscribe called with upgrading of old SKUs!');
}
return cordova.exec(success, errorCb(fail), "InAppBillingPlugin", "subscribe", [productId, additionalData || {}]);
};
InAppBilling.prototype.consumePurchase = function (success, fail, productId, transactionId) {
if (this.options.showLog) {
Expand Down Expand Up @@ -2266,6 +2271,7 @@ store.when("requested", function(product) {
if (product.type === store.FREE_SUBSCRIPTION || product.type === store.PAID_SUBSCRIPTION) {
method = 'subscribe';
}

store.inappbilling[method](function(data) {
// Success callabck.
//
Expand Down Expand Up @@ -2302,7 +2308,7 @@ store.when("requested", function(product) {
else {
product.set("state", store.VALID);
}
}, product.id);
}, product.id, product.additionalData);
});
});

Expand Down

0 comments on commit a9a4919

Please sign in to comment.