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

razorpay

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

razorpay - npm Package Compare versions

Comparing version 2.0.7 to 2.8.0

dist/resources/fundAccount.js

6

dist/razorpay.js

@@ -67,3 +67,7 @@ 'use strict';

subscriptions: require('./resources/subscriptions')(this.api),
addons: require('./resources/addons')(this.api)
addons: require('./resources/addons')(this.api),
settlements: require('./resources/settlements')(this.api),
qrCode: require('./resources/qrCode')(this.api),
fundAccount: require('./resources/fundAccount')(this.api),
items: require('./resources/items')(this.api)
});

@@ -70,0 +74,0 @@ }

@@ -7,4 +7,9 @@ "use strict";

var Promise = require("promise");
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var Promise = require("promise"),
_require = require('../utils/razorpay-utils'),
normalizeDate = _require.normalizeDate;
module.exports = function (api) {

@@ -57,4 +62,45 @@

}, callback);
},
all: function all() {
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var callback = arguments[1];
/*
* Get all Addons
*
* @param {Object} params
* @param {Funtion} callback
*
* @return {Promise}
*/
var from = params.from,
to = params.to,
count = params.count,
skip = params.skip,
url = BASE_URL;
if (from) {
from = normalizeDate(from);
}
if (to) {
to = normalizeDate(to);
}
count = Number(count) || 10;
skip = Number(skip) || 0;
return api.get({
url: url,
data: _extends({}, params, {
from: from,
to: to,
count: count,
skip: skip
})
}, callback);
}
};
};

@@ -6,3 +6,4 @@ 'use strict';

var _require = require('../utils/razorpay-utils'),
normalizeNotes = _require.normalizeNotes;
normalizeNotes = _require.normalizeNotes,
normalizeBoolean = _require.normalizeBoolean;

@@ -38,2 +39,20 @@ module.exports = function (api) {

},
all: function all() {
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var callback = arguments[1];
var count = params.count,
skip = params.skip;
count = Number(count) || 10;
skip = Number(skip) || 0;
return api.get({
url: '/customers',
data: {
count: count,
skip: skip
}
}, callback);
},
fetchTokens: function fetchTokens(customerId, callback) {

@@ -40,0 +59,0 @@ return api.get({

@@ -89,2 +89,19 @@ 'use strict';

},
edit: function edit(orderId) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var callback = arguments[2];
var notes = params.notes;
if (!orderId) {
throw new Error('`order_id` is mandatory');
}
var data = Object.assign(normalizeNotes(notes));
return api.patch({
url: '/orders/' + orderId,
data: data
}, callback);
},
fetchPayments: function fetchPayments(orderId, callback) {

@@ -91,0 +108,0 @@ if (!orderId) {

@@ -23,3 +23,3 @@ "use strict";

return {
create: function() {
create: function create() {
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -49,3 +49,3 @@ var callback = arguments[1];

},
cancel: function(paymentLinkId, callback) {
cancel: function cancel(paymentLinkId, callback) {

@@ -66,3 +66,3 @@ /*

var url = `${BASE_URL}/${paymentLinkId}/cancel`;
var url = BASE_URL + "/" + paymentLinkId + "/cancel";

@@ -73,3 +73,3 @@ return api.post({

},
fetch: function(paymentLinkId, callback) {
fetch: function fetch(paymentLinkId, callback) {

@@ -90,3 +90,3 @@ /*

var url = `${BASE_URL}/${paymentLinkId}`;
var url = BASE_URL + "/" + paymentLinkId;

@@ -97,3 +97,3 @@ return api.get({

},
all: function() {
all: function all() {
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -139,4 +139,43 @@ var callback = arguments[1];

}, callback);
},
edit: function edit(paymentLinkId, params, callback) {
var notes = params.notes,
rest = _objectWithoutProperties(params, ["notes"]);
var data = Object.assign(rest, normalizeNotes(notes));
return api.patch({
url: BASE_URL + "/" + paymentLinkId,
data: data
}, callback);
},
notifyBy: function notifyBy(paymentLinkId, medium, callback) {
/*
* Send/re-send notification for invoice by given medium
*
* @param {String} paymentLinkId
* @param {String} medium
* @param {Function} callback
*
* @return {Promise}
*/
if (!paymentLinkId) {
return Promise.reject(MISSING_ID_ERROR);
}
if (!medium) {
return Promise.reject("`medium` is required");
}
var url = BASE_URL + "/" + paymentLinkId + "/notify_by/" + medium;
return api.post({
url: url
}, callback);
}
};
};
'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

@@ -86,2 +88,40 @@

},
createPaymentJson: function createPaymentJson(params, callback) {
var url = 'payments/create/json',
rest = _objectWithoutProperties(params, []),
data = Object.assign(rest);
return api.post({
url: url,
data: data
}, callback);
},
createRecurringPayment: function createRecurringPayment(params, callback) {
var notes = params.notes,
rest = _objectWithoutProperties(params, ['notes']);
var data = Object.assign(rest, normalizeNotes(notes));
return api.post({
url: '/payments/create/recurring',
data: data
}, callback);
},
edit: function edit(paymentId) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var callback = arguments[2];
var notes = params.notes;
if (!paymentId) {
throw new Error('`payment_id` is mandatory');
}
var data = Object.assign(normalizeNotes(notes));
return api.patch({
url: '/payments/' + paymentId,
data: data
}, callback);
},
refund: function refund(paymentId) {

@@ -104,2 +144,67 @@ var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

},
fetchMultipleRefund: function fetchMultipleRefund(paymentId) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var callback = arguments[2];
/*
* Fetch multiple refunds for a payment
*
* @param {String} paymentId
* @param {Object} params
* @param {Function} callback
*
* @return {Promise}
*/
var from = params.from,
to = params.to,
count = params.count,
skip = params.skip,
url = '/payments/' + paymentId + '/refunds';
return api.get({
url: url,
data: _extends({}, params, {
from: from,
to: to,
count: count,
skip: skip
})
}, callback);
},
fetchRefund: function fetchRefund(paymentId, refundId, callback) {
if (!paymentId) {
throw new Error('payment Id` is mandatory');
}
if (!refundId) {
throw new Error('refund Id` is mandatory');
}
return api.get({
url: '/payments/' + paymentId + '/refunds/' + refundId
}, callback);
},
fetchTransfer: function fetchTransfer(paymentId, callback) {
/*
* Fetch transfers for a payment
*
* @param {String} paymentId
* @param {Function} callback
*
* @return {Promise}
*/
if (!paymentId) {
throw new Error('payment Id` is mandatory');
}
return api.get({
url: '/payments/' + paymentId + '/transfers'
}, callback);
},
transfer: function transfer(paymentId) {

@@ -139,4 +244,66 @@ var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

}, callback);
},
fetchCardDetails: function fetchCardDetails(paymentId, callback) {
if (!paymentId) {
return Promise.reject(ID_REQUIRED_MSG);
}
return api.get({
url: '/payments/' + paymentId + '/card'
}, callback);
},
fetchPaymentDowntime: function fetchPaymentDowntime(callback) {
return api.get({
url: '/payments/downtimes'
}, callback);
},
fetchPaymentDowntimeById: function fetchPaymentDowntimeById(downtimeId, callback) {
/*
* Fetch Payment Downtime
*
* @param {String} downtimeId
* @param {Function} callback
*
* @return {Promise}
*/
if (!downtimeId) {
return Promise.reject("Downtime Id is mandatory");
}
return api.get({
url: '/payments/downtimes/' + downtimeId
}, callback);
},
otpSubmit: function otpSubmit(paymentId) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var callback = arguments[2];
/*
* OTP Submit
*
* @param {String} paymentId
* @param {Object} params
* @param {Function} callback
*
* @return {Promise}
*/
if (!paymentId) {
return Promise.reject("payment Id is mandatory");
}
return api.post({
url: '/payments/' + paymentId + '/otp/submit',
data: params
}, callback);
}
};
};
'use strict';
var _require = require('../utils/razorpay-utils'),
normalizeDate = _require.normalizeDate;
normalizeDate = _require.normalizeDate,
normalizeNotes = _require.normalizeNotes;

@@ -44,2 +45,17 @@ module.exports = function (api) {

},
edit: function edit(refundId, params, callback) {
var notes = params.notes;
if (!refundId) {
throw new Error('refund Id is mandatory');
}
var data = Object.assign(normalizeNotes(notes));
return api.patch({
url: '/refunds/' + refundId,
data: data
}, callback);
},
fetch: function fetch(refundId) {

@@ -46,0 +62,0 @@ var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

@@ -14,3 +14,4 @@ "use strict";

normalizeDate = _require.normalizeDate,
normalizeNotes = _require.normalizeNotes;
normalizeNotes = _require.normalizeNotes,
normalizeBoolean = _require.normalizeBoolean;

@@ -69,2 +70,145 @@

},
update: function update(subscriptionId, params, callback) {
/*
* Update Subscription
*
* @param {Object} params
* @param {Function} callback
*
* @return {Promise}
*/
var url = BASE_URL + "/" + subscriptionId;
if (!subscriptionId) {
return Promise.reject(MISSING_ID_ERROR);
}
return api.patch({
url: url,
data: params
}, callback);
},
pendingUpdate: function pendingUpdate(subscriptionId, callback) {
/*
* Update a Subscription
*
* @param {String} subscription
* @param {Function} callback
*
* @return {Promise}
*/
var url = BASE_URL + "/" + subscriptionId + "/retrieve_scheduled_changes";
if (!subscriptionId) {
return Promise.reject(MISSING_ID_ERROR);
}
return api.get({ url: url }, callback);
},
cancelScheduledChanges: function cancelScheduledChanges(subscriptionId, callback) {
/*
* Cancel Schedule
*
* @param {String} subscription
* @param {Object} params
* @param {Function} callback
*
* @return {Promise}
*/
var url = BASE_URL + "/" + subscriptionId + "/cancel_scheduled_changes";
if (!subscriptionId) {
return Promise.reject("Subscription Id is mandatory");
}
return api.post({
url: url
}, callback);
},
pause: function pause(subscriptionId) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var callback = arguments[2];
/*
* Pause a subscription
*
* @param {String} subscription
* @param {Object} params
* @param {Function} callback
*
* @return {Promise}
*/
var url = BASE_URL + "/" + subscriptionId + "/pause";
if (!subscriptionId) {
return Promise.reject("Subscription Id is mandatory");
}
return api.post({
url: url,
data: params
}, callback);
},
resume: function resume(subscriptionId) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var callback = arguments[2];
/*
* resume a subscription
*
* @param {String} subscription
* @param {Object} params
* @param {Function} callback
*
* @return {Promise}
*/
var url = BASE_URL + "/" + subscriptionId + "/resume";
if (!subscriptionId) {
return Promise.reject("Subscription Id is mandatory");
}
return api.post({
url: url,
data: params
}, callback);
},
deleteOffer: function deleteOffer(subscriptionId, offerId, callback) {
/*
* Delete an Offer Linked to a Subscription
*
* @param {String} subscription
* @param {String} offerId
* @param {Function} callback
*
* @return {Promise}
*/
var url = BASE_URL + "/" + subscriptionId + "/" + offerId;
if (!subscriptionId) {
return Promise.reject("Subscription Id is mandatory");
}
return api.delete({
url: url
}, callback);
},
all: function all() {

@@ -166,4 +310,35 @@ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

}, callback);
},
createRegistrationLink: function createRegistrationLink() {
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var callback = arguments[1];
var email_notify = params.email_notify,
sms_notify = params.sms_notify,
receipt = params.receipt,
notes = params.notes,
otherParams = _objectWithoutProperties(params, ["email_notify", "sms_notify", "receipt", "notes"]);
/*
* Creates a Registration Link
*
* @param {Object} params
* @param {Function} callback
*
* @return {Promise}
*/
var data = Object.assign(_extends({
email_notify: normalizeBoolean(email_notify),
sms_notify: normalizeBoolean(sms_notify),
receipt: receipt
}, otherParams), normalizeNotes(notes));
return api.post({
url: 'subscription_registration/auth_links',
data: data
}, callback);
}
};
};

@@ -106,4 +106,76 @@ "use strict";

}, callback);
},
addReceiver: function addReceiver(virtualAccountId) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var callback = arguments[2];
/*
* Add Receiver to an Existing Virtual Account
*
* @param {Object} params
* @param {Function} callback
*
* @return {Promise}
*/
if (!virtualAccountId) {
return Promise.reject(ID_REQUIRED_MSG);
}
return api.post({
url: BASE_URL + "/" + virtualAccountId + "/receivers",
data: params
}, callback);
},
allowedPayer: function allowedPayer(virtualAccountId) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var callback = arguments[2];
/*
* Add an Allowed Payer Account
* @param {Object} params
* @param {Function} callback
*
* @return {Promise}
*/
if (!virtualAccountId) {
return Promise.reject(ID_REQUIRED_MSG);
}
return api.post({
url: BASE_URL + "/" + virtualAccountId + "/allowed_payers",
data: params
}, callback);
},
deleteAllowedPayer: function deleteAllowedPayer(virtualAccountId, allowedPayerId, callback) {
/*
* Delete an Allowed Payer Account
* @param {String} virtualAccountId
* @param {String} allowedPayerId
* @param {Function} callback
*
* @return {Promise}
*/
if (!virtualAccountId) {
return Promise.reject(ID_REQUIRED_MSG);
}
if (!allowedPayerId) {
return Promise.reject("allowed payer id is mandatory");
}
return api.delete({
url: BASE_URL + "/" + virtualAccountId + "/allowed_payers/" + allowedPayerId
}, callback);
}
};
};

@@ -93,2 +93,45 @@ "use strict";

return expectedSignature === signature;
}
function validatePaymentVerification() {
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var signature = arguments[1];
var secret = arguments[2];
/*
* Payment verfication
*
* @param {Object} params
* @param {String} signature
* @param {String} secret
* @return {Boolean}
*/
var paymentId = params.payment_id;
if (!secret) {
throw new Error("secret is mandatory");
}
if (isDefined(params.order_id) === true) {
var orderId = params.order_id;
var payload = orderId + '|' + paymentId;
} else if (isDefined(params.subscription_id) === true) {
var subscriptionId = params.subscription_id;
var payload = paymentId + '|' + subscriptionId;
} else if (isDefined(params.payment_link_id) === true) {
var paymentLinkId = params.payment_link_id;
var paymentLinkRefId = params.payment_link_reference_id;
var paymentLinkStatus = params.payment_link_status;
var payload = paymentLinkId + '|' + paymentLinkRefId + '|' + paymentLinkStatus + '|' + paymentId;
} else {
throw new Error('Either order_id or subscription_id is mandatory');
}
return validateWebhookSignature(payload, signature, secret);
};

@@ -106,3 +149,4 @@

getTestError: getTestError,
validateWebhookSignature: validateWebhookSignature
validateWebhookSignature: validateWebhookSignature,
validatePaymentVerification: validatePaymentVerification
};

2

package.json
{
"name": "razorpay",
"version": "2.0.7",
"version": "2.8.0",
"description": "Official Node SDK for Razorpay API",

@@ -5,0 +5,0 @@ "main": "dist/razorpay",

# Razorpay Node SDK
[![npm](https://img.shields.io/npm/v/razorpay.svg?maxAge=2592000?style=flat-square)](https://www.npmjs.com/package/razorpay)
[![Build Status](https://travis-ci.org/razorpay/razorpay-node.svg?branch=master)](https://travis-ci.org/razorpay/razorpay-node)

@@ -76,27 +75,43 @@ Official nodejs library for [Razorpay API](https://docs.razorpay.com/docs/payments).

## Supported Resources
- [Addon](documents/addon.md)
- [Payments](https://github.com/razorpay/razorpay-node/wiki#payments)
- [Item](documents/items.md)
- [Refunds](https://github.com/razorpay/razorpay-node/wiki#refunds)
- [Customer](documents/customer.md)
- [Orders](https://github.com/razorpay/razorpay-node/wiki#orders)
- [Token](documents/token.md)
- [Customers](https://github.com/razorpay/razorpay-node/wiki#customers)
- [Order](documents/order.md)
- [Transfers](https://github.com/razorpay/razorpay-node/wiki#transfers)
- [Payments](documents/payment.md)
- [Virtual Accounts](https://github.com/razorpay/razorpay-node/wiki#virtual-accounts)
- [Settlements](documents/settlement.md)
- [Invoices](https://github.com/razorpay/razorpay-node/wiki#invoices)
- [Refunds](documents/refund.md)
- [Plans](https://github.com/razorpay/razorpay-node/wiki#plans)
- [Invoice](documents/invoice.md)
- [Subscriptions](https://github.com/razorpay/razorpay-node/wiki#subscriptions)
- [Subscriptions](documents/subscription.md)
- [Addons](https://github.com/razorpay/razorpay-node/wiki#addons)
- [Payment Links](documents/paymentLink.md)
- [Webhooks](https://github.com/razorpay/razorpay-node/wiki#webhooks)
- [Smart Collect](documents/virtualAccount.md)
- [Partner Auth](https://github.com/razorpay/razorpay-node/wiki#partner-auth)
- [Route](documents/transfer.md)
- [QR Code](documents/qrcode.md)
- [Emandate](documents/emandate.md)
- [Cards](documents/card.md)
- [Paper NACH](documents/papernach.md)
- [UPI](documents/upi.md)
- [Register Emandate and Charge First Payment Together](documents/registerEmandate.md)
- [Register NACH and Charge First Payment Together](documents/registerNach.md)
- [Payment Verification](documents/paymentVerfication.md)
---

@@ -103,0 +118,0 @@

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