Skip to content

Commit

Permalink
Revert "refactor hostUrl"
Browse files Browse the repository at this point in the history
This reverts commit 282d7ef.
  • Loading branch information
ankitdas13 committed Aug 1, 2023
1 parent 282d7ef commit d463011
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
18 changes: 17 additions & 1 deletion e2e/razorpay.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
'use strict';

const Razorpay = require("../dist/razorpay");
let request = require('request-promise');

module.exports = new Razorpay({
class RazorpayTest extends Razorpay {
constructor(options) {
super(options)
this.api.rq = request.defaults({
baseUrl: hostUrl,
json: true,
auth: {
user: options.key_id,
pass: options.key_secret
}
})
}
}


module.exports = new RazorpayTest({
key_id: process.env.API_KEY || "",
key_secret: process.env.API_SECRET || "",
hostUrl : "https://api-web.dev.razorpay.in"
Expand Down
1 change: 0 additions & 1 deletion lib/razorpay.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ interface IRazorpayConfig {
key_id: string;
key_secret?: string;
headers?: RazorpayHeaders;
hostUrl? : string;
}

declare class Razorpay {
Expand Down
8 changes: 2 additions & 6 deletions lib/razorpay.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,17 @@ class Razorpay {
}

constructor(options = {}) {
let { key_id, key_secret, headers, hostUrl } = options
let { key_id, key_secret, headers } = options

if (!key_id) {
throw new Error('`key_id` is mandatory')
}

if(!hostUrl){
hostUrl = 'https://api.razorpay.com'
}

this.key_id = key_id
this.key_secret = key_secret

this.api = new API({
hostUrl,
hostUrl: 'https://api.razorpay.com',
ua: `razorpay-node@${Razorpay.VERSION}`,
key_id,
key_secret,
Expand Down

0 comments on commit d463011

Please sign in to comment.