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

added proxy support #332

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

added proxy support #332

wants to merge 2 commits into from

Conversation

ankitdas13
Copy link
Contributor

issue : #79

code snippet

$api = new Razorpay\Api\Api('key', 'secret');
$api->addRequestOptions("proxy","20.230.175.193:8080");
$api->addRequestOptions("timeout",100);  // optional

$api->payment->all();

src/Request.php Outdated
@@ -46,11 +54,10 @@ public function request($method, $url, $data = array())

$hooks->register('curl.before_send', array($this, 'setCurlSslOpts'));

$options = array(
$options = array_merge(self::$options,array(

Choose a reason for hiding this comment

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

Rename $options to remove confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed $options to $opt

* Headers to be sent with every http request to the API
* @var array
*/
protected static $options = array(

Choose a reason for hiding this comment

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

Check this if static is required or not. Also test if values are getting overriden.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ndhaka007 static keyword is required because when i removed static, I get this error
Warning: Undefined variable $options in /Applications/MAMP/htdocs/razorpay-php/src/Request.php on line 57

Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, null given in /Applications/MAMP/htdocs/razorpay-php/src/Request.php:59

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ndhaka007 also the timeout values are getting override
Screenshot 2022-09-20 at 1 32 35 PM

Copy link

@ndhaka007 ndhaka007 left a comment

Choose a reason for hiding this comment

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

Approved with comments

@ankitdas13 ankitdas13 mentioned this pull request Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants