Comparing version 2.0.3 to 2.0.4
# Changelog | ||
## 2.0.4 - 2019-03-06 | ||
- Added `recipient_settlement_id` parameter for Transfers. | ||
- Renamed "X-Razorpay-Header" to "X-Razorpay-Signature header" in the error message in `validateWebhookSignature`. | ||
- Added support for `currency` in `capture` method for Payments. | ||
## 2.0.3 - 2018-11-13 | ||
@@ -4,0 +9,0 @@ - Added support for Partner Auth. |
@@ -55,3 +55,3 @@ 'use strict'; | ||
}, | ||
capture: function capture(paymentId, amount, callback) { | ||
capture: function capture(paymentId, amount, currency, callback) { | ||
if (!paymentId) { | ||
@@ -65,7 +65,22 @@ throw new Error('`payment_id` is mandatory'); | ||
var payload = { | ||
amount: amount | ||
}; | ||
/** | ||
* For backward compatibility, | ||
* the third argument can be a callback | ||
* instead of currency. | ||
* Set accordingly. | ||
*/ | ||
if (typeof currency === 'function' && !callback) { | ||
callback = currency; | ||
currency = undefined; | ||
} else if (typeof currency === 'string') { | ||
payload.currency = currency; | ||
} | ||
return api.post({ | ||
url: '/payments/' + paymentId + '/capture', | ||
data: { | ||
amount: amount | ||
} | ||
data: payload | ||
}, callback); | ||
@@ -72,0 +87,0 @@ }, |
@@ -19,3 +19,4 @@ "use strict"; | ||
skip = params.skip, | ||
payment_id = params.payment_id; | ||
payment_id = params.payment_id, | ||
recipient_settlement_id = params.recipient_settlement_id; | ||
@@ -45,3 +46,4 @@ var url = '/transfers'; | ||
count: count, | ||
skip: skip | ||
skip: skip, | ||
recipient_settlement_id: recipient_settlement_id | ||
} | ||
@@ -48,0 +50,0 @@ }, callback); |
@@ -85,3 +85,3 @@ "use strict"; | ||
throw Error("Invalid Parameters: Please give request body," + "signature sent in X-Razorpay-Header and " + "webhook secret from dashboard as parameters"); | ||
throw Error("Invalid Parameters: Please give request body," + "signature sent in X-Razorpay-Signature header and " + "webhook secret from dashboard as parameters"); | ||
} | ||
@@ -88,0 +88,0 @@ |
@@ -1,2 +0,2 @@ | ||
Copyright (c) 2017 Razorpay | ||
Copyright (c) 2019 Razorpay | ||
@@ -3,0 +3,0 @@ MIT License |
{ | ||
"name": "razorpay", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Official Node SDK for Razorpay API", | ||
@@ -43,5 +43,5 @@ "main": "dist/razorpay", | ||
"promise": "^8.0.1", | ||
"request": "^2.87.0", | ||
"request": "^2.88.0", | ||
"request-promise": "^4.2.2" | ||
} | ||
} |
# Razorpay Node SDK | ||
[![npm](https://img.shields.io/npm/v/razorpay.svg?maxAge=2592000?style=flat-square)](https://www.npmjs.com/package/razorpay) | ||
@@ -17,6 +18,4 @@ [![Build Status](https://travis-ci.org/razorpay/razorpay-node.svg?branch=master)](https://travis-ci.org/razorpay/razorpay-node) | ||
Documentation of Razorpay's API and their usage is available at <https://docs.razorpay.com> | ||
### Basic Usage | ||
@@ -29,4 +28,4 @@ | ||
key_id: 'YOUR_KEY_ID', | ||
key_secret: 'YOUR_KEY_SECRET' | ||
}) | ||
key_secret: 'YOUR_KEY_SECRET', | ||
}); | ||
``` | ||
@@ -41,3 +40,3 @@ | ||
// example | ||
instance.payments.fetch(paymentId) | ||
instance.payments.fetch(paymentId); | ||
``` | ||
@@ -48,10 +47,13 @@ | ||
```js | ||
instance.payments.all({ | ||
from: '2016-08-01', | ||
to: '2016-08-20' | ||
}).then((response) => { | ||
// handle success | ||
}).catch((error) => { | ||
// handle error | ||
}) | ||
instance.payments | ||
.all({ | ||
from: '2016-08-01', | ||
to: '2016-08-20', | ||
}) | ||
.then(response => { | ||
// handle success | ||
}) | ||
.catch(error => { | ||
// handle error | ||
}); | ||
``` | ||
@@ -62,12 +64,15 @@ | ||
```js | ||
instance.payments.all({ | ||
from: '2016-08-01', | ||
to: '2016-08-20' | ||
}, (error, response) => { | ||
if (error) { | ||
// handle error | ||
} else { | ||
// handle success | ||
instance.payments.all( | ||
{ | ||
from: '2016-08-01', | ||
to: '2016-08-20', | ||
}, | ||
(error, response) => { | ||
if (error) { | ||
// handle error | ||
} else { | ||
// handle success | ||
} | ||
} | ||
}) | ||
); | ||
``` | ||
@@ -100,5 +105,5 @@ | ||
- [Partner Auth](https://github.com/razorpay/razorpay-node/wiki#partner-auth) | ||
--- | ||
## Development | ||
@@ -118,13 +123,11 @@ | ||
1. Switch to `master` branch. Make sure you have the latest changes in the local master | ||
2. Update the `CHANGELOG.md` & bump the version in `package.json` | ||
3. Commit | ||
4. Tag the release & push to Github | ||
5. Create a release on GitHub using the website with more details about the release | ||
6. Publish to npm with `npm publish` command | ||
1. Switch to `master` branch. Make sure you have the latest changes in the local master | ||
2. Update the `CHANGELOG.md` & bump the version in `package.json` | ||
3. Commit | ||
4. Tag the release & push to Github | ||
5. Create a release on GitHub using the website with more details about the release | ||
6. Publish to npm with `npm publish` command | ||
## Licence | ||
MIT Licensed. LICENSE file added to repo. | ||
MIT Licensed. See [LICENSE.txt](LICENSE.txt) for more details |
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
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
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
49535
1231
127
1
Updatedrequest@^2.88.0