Socket
Socket
Sign inDemoInstall

paddle-sdk

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paddle-sdk - npm Package Compare versions

Comparing version 1.3.0 to 2.0.0

11

CHANGELOG.md

@@ -5,2 +5,13 @@ # Changelog

## [2.0.0](https://github.com/avaly/paddle-sdk/compare/v1.3.0...v2.0.0) (2019-12-27)
### ⚠ BREAKING CHANGES
* Requires node v10+
### Features
* Upgrade all dependencies ([ce2d240](https://github.com/avaly/paddle-sdk/commit/ce2d2401681d1564e1c77f7904a98de0186fb85a))
## [1.3.0](https://github.com/avaly/paddle-sdk/compare/v1.2.2...v1.3.0) (2019-11-12)

@@ -7,0 +18,0 @@

2

lib/serialize.js

@@ -0,1 +1,3 @@

/* eslint no-prototype-builtins: 0 */
// Source: https://github.com/kvz/locutus/blob/master/src/php/var/serialize.js

@@ -2,0 +4,0 @@ function serialize(mixedValue) {

22

package.json
{
"name": "paddle-sdk",
"description": "The Paddle.com Node.js SDK",
"version": "1.3.0",
"version": "2.0.0",
"main": "sdk.js",

@@ -20,3 +20,3 @@ "author": "Valentin Agachi <github-com@agachi.name>",

"engines": {
"node": ">=8.5.0"
"node": ">=10.0.0"
},

@@ -39,13 +39,13 @@ "files": [

"dependencies": {
"got": "^9.6.0"
"got": "^10.2.0"
},
"devDependencies": {
"eslint": "^5.16.0",
"husky": "^2.4.1",
"jest": "^24.8.0",
"jsdoc-to-markdown": "^5.0.0",
"lint-staged": "^8.2.1",
"nock": "^10.0.6",
"prettier": "^1.18.2",
"standard-version": "^6.0.1",
"eslint": "^6.8.0",
"husky": "^3.1.0",
"jest": "^24.9.0",
"jsdoc-to-markdown": "^5.0.3",
"lint-staged": "^9.5.0",
"nock": "^11.7.0",
"prettier": "^1.19.1",
"standard-version": "^7.0.1",
"validate-commit-msg": "^2.14.0"

@@ -52,0 +52,0 @@ },

@@ -35,33 +35,39 @@ const crypto = require('crypto');

* @param {string} url - url to do request
* @param {object} body - body parameters / object
* @param {object} [headers] - header parameters
* @param {boolean} [form] - form parameter (ref: got package)
* @param {boolean} [json] - json parameter (ref: got package)
* @param {object} options
* @param {object} [options.body] - body parameters / object
* @param {object} [options.headers] - header parameters
* @param {boolean} [options.form] - form parameter (ref: got package)
* @param {boolean} [options.json] - json parameter (ref: got package)
*/
_request(path, body = {}, headers = {}, form = true, json = true) {
_request(path, { body = {}, headers = {}, form = true, json = false } = {}) {
const url = this.server + path;
const fullBody = Object.assign(body, this._getDefaultBody());
const options = {
body: Object.assign(body, this._getDefaultBody()),
form,
headers: this._getDefaultHeaders(headers),
json,
method: 'POST',
};
if (form) {
options.form = fullBody;
}
if (json) {
options.json = fullBody;
}
// console.log('options', options);
return got(url, options).then(response => {
const { body } = response;
return got(url, options)
.json()
.then(body => {
if (typeof body.success === 'boolean') {
if (body.success) {
return body.response || body;
}
if (typeof body.success === 'boolean') {
if (body.success) {
return body.response || body;
throw new Error(
`Request ${url} returned an error! response=${JSON.stringify(body)}`
);
}
throw new Error(
`Request ${url} returned an error! response=${JSON.stringify(body)}`
);
}
return body;
});
return body;
});
}

@@ -117,3 +123,5 @@

getProductCoupons(productID) {
return this._request('/product/list_coupons', { product_id: productID });
return this._request('/product/list_coupons', {
body: { product_id: productID },
});
}

@@ -133,3 +141,5 @@

getProductPlans(productID) {
return this._request('/subscription/plans', { product_id: productID });
return this._request('/subscription/plans', {
body: { product_id: productID },
});
}

@@ -149,3 +159,5 @@

getPlanUsers(planID) {
return this._request('/subscription/users', { plan: planID });
return this._request('/subscription/users', {
body: { plan: planID },
});
}

@@ -165,3 +177,5 @@

getPlanPayments(planID) {
return this._request('/subscription/payments', { plan: planID });
return this._request('/subscription/payments', {
body: { plan: planID },
});
}

@@ -308,3 +322,3 @@

return this._request('/subscription/users_cancel', {
subscription_id: subscriptionID,
body: { subscription_id: subscriptionID },
});

@@ -314,3 +328,3 @@ }

/**
* Generate a custom pay link
* Generate a custom pay link
*

@@ -320,3 +334,3 @@ * @method

* @returns {Promise}
* @fulfil {object} - The new pay link url
* @fulfil {object} - The new pay link url
*

@@ -331,6 +345,10 @@ * @example

* ]
* });
* });
*/
generatePayLink(body) {
return this._request('/product/generate_pay_link', body, {}, false);
return this._request('/product/generate_pay_link', {
body,
form: false,
json: true,
});
}

@@ -337,0 +355,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc