paypal-nvp-api
Advanced tools
Comparing version 1.3.0 to 2.0.0-rc1
{ | ||
"version": "1.3.0", | ||
"version": "2.0.0rc1", | ||
"name": "paypal-nvp-api", | ||
@@ -13,20 +13,19 @@ "description": "Node.js wrapper for the Paypal Name-Value Pair — NVP ", | ||
"engines": { | ||
"node": ">= 8.6" | ||
"node": ">= 10.14.2" | ||
}, | ||
"scripts": { | ||
"lint": "eslint ./src ./test", | ||
"lint": "eslint ./src ./tests", | ||
"pretest": "npm run lint", | ||
"test": "tap test/start.js --coverage --reporter=spec", | ||
"test": "tap tests/start.js --coverage --reporter=spec --coverage-report=html --no-browser", | ||
"citest": "tap tests/start.js --coverage --reporter=spec --coverage-report=lcov --no-browser", | ||
"reset": "node reset" | ||
}, | ||
"dependencies": { | ||
"bellajs": "^7.5.0", | ||
"promise-wtf": "^1.2.4", | ||
"request": "^2.86.0" | ||
"bellajs": "^9.2.2", | ||
"node-fetch": "^2.6.1" | ||
}, | ||
"devDependencies": { | ||
"codecov": "^3.0.1", | ||
"eslint-config-goes": "^1.1.6", | ||
"nock": "^9.2.5", | ||
"tap": "^14.5.0" | ||
"eslint-config-goes": "^1.1.8", | ||
"nock": "^13.0.4", | ||
"tap": "^14.10.8" | ||
}, | ||
@@ -33,0 +32,0 @@ "keywords": [ |
@@ -5,3 +5,5 @@ # paypal-nvp-api | ||
[![NPM](https://badge.fury.io/js/paypal-nvp-api.svg)](https://badge.fury.io/js/paypal-nvp-api) | ||
[![Build Status](https://travis-ci.org/ndaidong/paypal-nvp-api.svg?branch=master)](https://travis-ci.org/ndaidong/paypal-nvp-api) | ||
![CI test](https://github.com/ndaidong/paypal-nvp-api/workflows/ci-test/badge.svg) | ||
[![Coverage Status](https://coveralls.io/repos/github/ndaidong/paypal-nvp-api/badge.svg)](https://coveralls.io/github/ndaidong/paypal-nvp-api) | ||
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ndaidong_paypal-nvp-api&metric=alert_status)](https://sonarcloud.io/dashboard?id=ndaidong_paypal-nvp-api) | ||
@@ -8,0 +10,0 @@ |
@@ -6,6 +6,2 @@ /** | ||
const { | ||
decode, | ||
} = require('bellajs'); | ||
const parse = (s) => { | ||
@@ -18,3 +14,3 @@ const d = {}; | ||
if (b.length === 2) { | ||
d[b[0]] = decode(b[1]); | ||
d[b[0]] = decodeURIComponent(b[1]); | ||
} | ||
@@ -21,0 +17,0 @@ }); |
@@ -11,3 +11,2 @@ /** | ||
hasProperty, | ||
encode, | ||
} = require('bellajs'); | ||
@@ -25,7 +24,7 @@ | ||
if (isString(val)) { | ||
val = encode(val); | ||
val = encodeURIComponent(val); | ||
} else if (isArray(val) || isObject(val)) { | ||
val = JSON.stringify(val); | ||
} | ||
ar.push(encode(k) + '=' + val); | ||
ar.push(encodeURIComponent(k) + '=' + val); | ||
} | ||
@@ -32,0 +31,0 @@ } |
@@ -13,4 +13,2 @@ /** | ||
global.Promise = require('promise-wtf'); | ||
const { | ||
@@ -21,3 +19,3 @@ isObject, | ||
const request = require('request'); | ||
const fetch = require('node-fetch'); | ||
@@ -48,35 +46,31 @@ const { | ||
const sendRequest = (method, params = {}) => { | ||
return new Promise((resolve, reject) => { | ||
if (!isObject(params)) { | ||
return reject(new Error('Params must be an object')); | ||
} | ||
const sendRequest = async (method, params = {}) => { | ||
if (!isObject(params)) { | ||
return new Error('Params must be an object'); | ||
} | ||
const o = copies(payload, params); | ||
o.METHOD = method; | ||
try { | ||
const query = copies(payload, params); | ||
query.METHOD = method; | ||
return request.post({ | ||
url: baseURL, | ||
const res = await fetch(baseURL, { | ||
method: 'POST', | ||
headers: { | ||
'X-PAYPAL-SECURITY-USERID': o.USER, | ||
'X-PAYPAL-SECURITY-PASSWORD': o.PWD, | ||
'X-PAYPAL-SECURITY-SIGNATURE': o.SIGNATURE, | ||
'X-PAYPAL-SECURITY-USERID': query.USER, | ||
'X-PAYPAL-SECURITY-PASSWORD': query.PWD, | ||
'X-PAYPAL-SECURITY-SIGNATURE': query.SIGNATURE, | ||
'X-PAYPAL-RESPONSE-DATA-FORMAT': 'JSON', | ||
}, | ||
body: stringify(params), | ||
}, (err, response, body) => { | ||
if (err) { | ||
return reject(err); | ||
} | ||
const { | ||
statusCode, | ||
} = response; | ||
if (statusCode !== 200) { | ||
return reject(new Error(`Error: Response error with code: ${statusCode}`)); | ||
} | ||
const r = parse(body); | ||
return resolve(r); | ||
body: stringify(query), | ||
}); | ||
}); | ||
if (!res.ok) { | ||
return new Error(`Error: Response error with code: ${res.statusText}`); | ||
} | ||
const data = await res.text(); | ||
return parse(data); | ||
} catch (err) { | ||
return err; | ||
} | ||
}; | ||
return { | ||
@@ -83,0 +77,0 @@ request: sendRequest, |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
15850
2
3
129
420
1
4
+ Addednode-fetch@^2.6.1
+ Addedbellajs@9.3.0(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
- Removedpromise-wtf@^1.2.4
- Removedrequest@^2.86.0
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedbellajs@7.5.0(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpromise-wtf@1.2.11(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)
Updatedbellajs@^9.2.2