Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

paypal-nvp-api

Package Overview
Dependencies
Maintainers
3
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paypal-nvp-api - npm Package Compare versions

Comparing version 1.3.0 to 2.0.0-rc1

.github/workflows/ci-test.yml

21

package.json
{
"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,

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