Skip to content
Open
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions test_prod/razorpay.js

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename the folder to e2e ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have renamed the folder to e2e

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

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

class RazorpayTest extends Razorpay {
constructor(options) {
super(options)
this.api.rq = request.defaults({
Copy link

@1995navinkumar 1995navinkumar Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pass hostUrl as options in constructor of Razorpay itself ?
By default, it would be api.razorpay.com else it can be https://api-web.dev.razorpay.in

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added hostUrl in options

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mean adding it in RazorpayTest but in Razorpay class. In that case, we don't need RazorpayTest itself. We can directly use Razorpay by passing hostUrl.
Sorry for this confusion.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realised that adding it in class Razorpay would have other problems since that is a public API. Let's keep this as such for now.

baseUrl: "https://api-web.dev.razorpay.in",
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 || ""
});