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

paypal-nvp-api

Package Overview
Dependencies
Maintainers
1
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 0.2.31 to 1.0.0

.coveralls.yml

25

package.json
{
"version": "0.2.31",
"version": "1.0.0",
"name": "paypal-nvp-api",

@@ -13,20 +13,21 @@ "description": "Node.js wrapper for the Paypal Name-Value Pair — NVP ",

"engines": {
"node": ">= 4.0"
"node": ">= 6.0"
},
"scripts": {
"test": "./node_modules/.bin/mocha",
"coverage": "./node_modules/.bin/nyc mocha",
"report": "npm run coverage && ./node_modules/.bin/nyc report --reporter=lcov",
"coveralls": "npm run report && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls"
"test": "snyk test && tape test/start.js | tap-spec",
"coverage": "nyc tape test/start.js | tap-spec",
"report": "npm run coverage && nyc report --reporter=lcov",
"coveralls": "npm run report && cat ./coverage/lcov.info | coveralls"
},
"dependencies": {
"bellajs": "5.1.3",
"bluebird": "3.4.0",
"request": "2.72.0"
"bellajs": "5.3.0",
"promise-wtf": "0.1.25",
"request": "2.73.0"
},
"devDependencies": {
"chai": "latest",
"coveralls": "latest",
"mocha": "latest",
"nyc": "latest"
"nyc": "latest",
"snyk": "latest",
"tap-spec": "latest",
"tape": "latest"
},

@@ -33,0 +34,0 @@ "keywords": [

@@ -8,3 +8,5 @@ # paypal-nvp-api

![devDependency Status](https://david-dm.org/ndaidong/paypal-nvp-api.svg)
[![Known Vulnerabilities](https://snyk.io/test/npm/paypal-nvp-api/badge.svg)](https://snyk.io/test/npm/paypal-nvp-api)
# Usage

@@ -11,0 +13,0 @@

@@ -7,6 +7,4 @@ /**

'use strict'; // to use "let" keyword
var bella = require('bellajs');
var Promise = require('bluebird');
var Promise = require('promise-wtf');
var request = require('request');

@@ -13,0 +11,0 @@

module.exports = {
rootDir: '../../../src/',
mode: 'sandbox',

@@ -3,0 +4,0 @@ track: 'https://www.sandbox.paypal.com',

@@ -5,92 +5,67 @@ /**

*/
/* global describe it */
/* eslint no-undefined: 0*/
/* eslint no-array-constructor: 0*/
/* eslint no-new-func: 0*/
/* eslint no-console: 0*/
'use strict';
var path = require('path');
var chai = require('chai');
chai.should();
var expect = chai.expect;
var bella = require('bellajs');
var test = require('tape');
var config = require('../config');
var rootDir = config.rootDir;
var rootDir = '../../../src/';
var nvp = require(path.join(rootDir, 'paypal-nvp-api'));
var paypal = nvp(config);
var Paypal = require(path.join(rootDir, 'paypal-nvp-api'));
var paypal = Paypal(config);
var hasRequiredKeys = (o, keys) => {
return keys.every((k) => {
return bella.hasProperty(o, k);
});
};
describe('.GetBalance()', () => {
test('.GetBalance()', (assert) => {
let props = [
'L_AMT0',
'L_CURRENCYCODE0',
'TIMESTAMP',
'CORRELATIONID',
'ACK',
'VERSION',
'BUILD'
];
let result;
paypal.request('GetBalance', {}).then((re) => {
assert.ok(bella.isObject(re), 'Result should be an object');
assert.ok(hasRequiredKeys(re, props), 'Result should contain regular properties');
}).catch((e) => {
console.log(e);
return false;
}).finally(assert.end);
before((done) => {
paypal.request('GetBalance', {}).then((re) => {
result = re;
}).catch((e) => {
console.log(e);
return false;
}).finally(done);
});
it(' should be an object', (done) => {
expect(result).to.be.an('object');
done();
});
it(' should contain regular properties', (done) => {
expect(result).to.have.all.keys(
'L_AMT0',
'L_CURRENCYCODE0',
'TIMESTAMP',
'CORRELATIONID',
'ACK',
'VERSION',
'BUILD'
);
done();
});
});
describe('.SetExpressCheckout()', () => {
test('.SetExpressCheckout()', (assert) => {
let query = {
'PAYMENTREQUEST_0_AMT': '20.00',
'PAYMENTREQUEST_0_CURRENCYCODE': 'USD',
'PAYMENTREQUEST_0_PAYMENTACTION': 'Sale',
'RETURNURL': 'http://google.com/test/onreturn',
'CANCELURL': 'http://google.com/test/oncancel'
PAYMENTREQUEST_0_AMT: '20.00',
PAYMENTREQUEST_0_CURRENCYCODE: 'USD',
PAYMENTREQUEST_0_PAYMENTACTION: 'Sale',
RETURNURL: 'http://google.com/test/onreturn',
CANCELURL: 'http://google.com/test/oncancel'
};
let result;
before((done) => {
paypal.request('SetExpressCheckout', query).then((re) => {
result = re;
}).catch((e) => {
console.log(e);
return false;
}).finally(done);
});
let props = [
'TOKEN',
'TIMESTAMP',
'CORRELATIONID',
'ACK',
'VERSION',
'BUILD'
];
it(' should be an object', (done) => {
console.log(result);
expect(result).to.be.an('object');
done();
});
it(' should contain regular properties', (done) => {
expect(result).to.have.all.keys(
'TOKEN',
'TIMESTAMP',
'CORRELATIONID',
'ACK',
'VERSION',
'BUILD'
);
done();
});
paypal.request('SetExpressCheckout', query).then((re) => {
assert.ok(bella.isObject(re), 'Result should be an object');
assert.ok(hasRequiredKeys(re, props), 'Result should contain regular properties');
}).catch((e) => {
console.log(e);
return false;
}).finally(assert.end);
});

@@ -5,25 +5,16 @@ /**

*/
/* global describe it */
/* eslint no-undefined: 0*/
/* eslint no-array-constructor: 0*/
/* eslint no-new-func: 0*/
'use strict';
var path = require('path');
var path = require('path');
var chai = require('chai');
var bella = require('bellajs');
var test = require('tape');
chai.should();
var expect = chai.expect;
var config = require('../config');
var rootDir = config.rootDir;
var rootDir = '../../../src/';
var nvp = require(path.join(rootDir, 'paypal-nvp-api'));
var paypal = nvp(config);
var Paypal = require(path.join(rootDir, 'paypal-nvp-api'));
var paypal = Paypal(config);
test('.formatCurrency()', (assert) => {
describe('.formatCurrency()', () => {
let sample = [

@@ -106,11 +97,7 @@ {

let v = item.value;
describe(' / paypal.formatCurrency(' + (bella.isString(v) ? `'${v}'` : v) + ')', () => {
let result = paypal.formatCurrency(v);
assert.deepEquals(result, item.result, ' / paypal.formatCurrency(' + (bella.isString(v) ? `'${v}'` : v) + ')');
});
let result = paypal.formatCurrency(v);
it(' should be "' + item.result + '"', (done) => {
expect(result).to.equal(item.result);
done();
});
});
});
assert.end();
});

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

'use strict';
var fs = require('fs');

@@ -10,3 +8,3 @@ var path = require('path');

var dirs = [ '', 'utils', 'Paypal' ];
var dirs = ['', 'utils', 'Paypal'];
dirs.forEach((dir) => {

@@ -13,0 +11,0 @@ let where = './test/specs/' + dir;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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