Comparing version 1.0.0 to 1.1.0
# Changelog | ||
## Next Release | ||
- [Feature] Adds Customer & tokens support | ||
- [Tests] Adds test coverage | ||
## 1.0.0 | ||
@@ -4,0 +8,0 @@ - [Docs] Update readme.md |
@@ -27,2 +27,5 @@ 'use strict'; | ||
pass: options.key_secret | ||
}, | ||
headers: { | ||
'User-Agent': options.ua | ||
} | ||
@@ -48,2 +51,17 @@ }); | ||
} | ||
}, { | ||
key: 'put', | ||
value: function put(params, cb) { | ||
return nodeify(this.rq.put({ | ||
url: params.url, | ||
form: params.data | ||
}).catch(normalizeError), cb); | ||
} | ||
}, { | ||
key: 'delete', | ||
value: function _delete(params, cb) { | ||
return nodeify(this.rq.delete({ | ||
url: params.url | ||
}).catch(normalizeError), cb); | ||
} | ||
}]); | ||
@@ -50,0 +68,0 @@ |
@@ -8,11 +8,12 @@ 'use strict'; | ||
var API = require('./api'); | ||
var pkg = require('../package.json'); | ||
var Razorpay = function () { | ||
function Razorpay() { | ||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
_classCallCheck(this, Razorpay); | ||
var key_id = options.key_id; | ||
var key_secret = options.key_secret; | ||
var key_id = options.key_id, | ||
key_secret = options.key_secret; | ||
@@ -33,2 +34,3 @@ | ||
hostUrl: 'https://api.razorpay.com/v1/', | ||
ua: 'razorpay-node@' + Razorpay.VERSION, | ||
key_id: key_id, | ||
@@ -46,3 +48,4 @@ key_secret: key_secret | ||
refunds: require('./resources/refunds')(this.api), | ||
orders: require('./resources/orders')(this.api) | ||
orders: require('./resources/orders')(this.api), | ||
customers: require('./resources/customers')(this.api) | ||
}); | ||
@@ -55,2 +58,5 @@ } | ||
Razorpay.VERSION = pkg.version; | ||
module.exports = Razorpay; |
'use strict'; | ||
var _require = require('../utils/razorpay-utils'); | ||
var _require = require('../utils/razorpay-utils'), | ||
normalizeDate = _require.normalizeDate, | ||
normalizeBoolean = _require.normalizeBoolean, | ||
normalizeNotes = _require.normalizeNotes; | ||
var normalizeDate = _require.normalizeDate; | ||
var normalizeBoolean = _require.normalizeBoolean; | ||
var normalizeNotes = _require.normalizeNotes; | ||
module.exports = function (api) { | ||
return { | ||
all: function all() { | ||
var params = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var callback = arguments[1]; | ||
var from = params.from; | ||
var to = params.to; | ||
var count = params.count; | ||
var skip = params.skip; | ||
var authorized = params.authorized; | ||
var receipt = params.receipt; | ||
var from = params.from, | ||
to = params.to, | ||
count = params.count, | ||
skip = params.skip, | ||
authorized = params.authorized, | ||
receipt = params.receipt; | ||
@@ -57,9 +55,9 @@ | ||
create: function create() { | ||
var params = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var callback = arguments[1]; | ||
var amount = params.amount; | ||
var currency = params.currency; | ||
var receipt = params.receipt; | ||
var payment_capture = params.payment_capture; | ||
var notes = params.notes; | ||
var amount = params.amount, | ||
currency = params.currency, | ||
receipt = params.receipt, | ||
payment_capture = params.payment_capture, | ||
notes = params.notes; | ||
@@ -66,0 +64,0 @@ currency = currency || 'INR'; |
@@ -5,17 +5,15 @@ 'use strict'; | ||
var _require = require('../utils/razorpay-utils'); | ||
var _require = require('../utils/razorpay-utils'), | ||
normalizeDate = _require.normalizeDate, | ||
normalizeNotes = _require.normalizeNotes; | ||
var normalizeDate = _require.normalizeDate; | ||
var normalizeNotes = _require.normalizeNotes; | ||
module.exports = function (api) { | ||
return { | ||
all: function all() { | ||
var params = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var callback = arguments[1]; | ||
var from = params.from; | ||
var to = params.to; | ||
var count = params.count; | ||
var skip = params.skip; | ||
var from = params.from, | ||
to = params.to, | ||
count = params.count, | ||
skip = params.skip; | ||
@@ -70,7 +68,7 @@ | ||
refund: function refund(paymentId) { | ||
var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var callback = arguments[2]; | ||
var notes = params.notes; | ||
var otherParams = _objectWithoutProperties(params, ['notes']); | ||
var notes = params.notes, | ||
otherParams = _objectWithoutProperties(params, ['notes']); | ||
@@ -77,0 +75,0 @@ if (!paymentId) { |
'use strict'; | ||
var _require = require('../utils/razorpay-utils'); | ||
var _require = require('../utils/razorpay-utils'), | ||
normalizeDate = _require.normalizeDate; | ||
var normalizeDate = _require.normalizeDate; | ||
module.exports = function (api) { | ||
return { | ||
all: function all() { | ||
var params = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var callback = arguments[1]; | ||
var from = params.from; | ||
var to = params.to; | ||
var count = params.count; | ||
var skip = params.skip; | ||
var payment_id = params.payment_id; | ||
var from = params.from, | ||
to = params.to, | ||
count = params.count, | ||
skip = params.skip, | ||
payment_id = params.payment_id; | ||
@@ -47,3 +45,3 @@ var url = '/refunds'; | ||
fetch: function fetch(refundId) { | ||
var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var callback = arguments[2]; | ||
@@ -50,0 +48,0 @@ var payment_id = params.payment_id; |
"use strict"; | ||
function getDateInSecs(date) { | ||
return +new Date(date) / 1000; | ||
} | ||
function normalizeDate(date) { | ||
return isNumber(date) ? date : +new Date(date) / 1000; | ||
return isNumber(date) ? date : getDateInSecs(date); | ||
} | ||
@@ -16,3 +20,3 @@ | ||
function normalizeNotes() { | ||
var notes = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var notes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -30,3 +34,4 @@ var normalizedNotes = {}; | ||
normalizeBoolean: normalizeBoolean, | ||
isNumber: isNumber | ||
isNumber: isNumber, | ||
getDateInSecs: getDateInSecs | ||
}; |
{ | ||
"name": "razorpay", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Official Node SDK for Razorpay API", | ||
@@ -12,3 +12,4 @@ "main": "dist/razorpay.js", | ||
"debug": "npm run build && node-debug examples/index.js", | ||
"test": "npm run build && mocha" | ||
"test": "npm run build && mocha --require babel-register", | ||
"build-test": "babel test" | ||
}, | ||
@@ -34,4 +35,7 @@ "repository": { | ||
"babel-preset-stage-0": "^6.5.0", | ||
"babel-register": "^6.18.0", | ||
"chai": "^3.5.0", | ||
"mocha": "^3.1.0" | ||
"deep-equal": "^1.0.1", | ||
"mocha": "^3.1.0", | ||
"nock": "^9.0.2" | ||
}, | ||
@@ -38,0 +42,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
378
14831
8
1
0