Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test beta env #370

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
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 || ""
});