Make Proxy Configuration Work (#902)

Proxy setting were not being respected, so once  is
returned, setHttpProxy() is called to add the proxy option if
need prior to getting and OAuth token or executing a call to
PayPal
This commit is contained in:
jmgibson1976
2017-08-03 10:29:39 -05:00
committed by Randy
parent 2e18c2b577
commit e3aadb48c2
2 changed files with 10 additions and 0 deletions

View File

@@ -226,6 +226,11 @@ class OAuthTokenCredential extends PayPalResourceModel
{ {
$httpConfig = new PayPalHttpConfig(null, 'POST', $config); $httpConfig = new PayPalHttpConfig(null, 'POST', $config);
// if proxy set via config, add it
if (!empty($config['http.Proxy'])) {
$httpConfig->setHttpProxy($config['http.Proxy']);
}
$handlers = array(self::$AUTH_HANDLER); $handlers = array(self::$AUTH_HANDLER);
/** @var IPayPalHandler $handler */ /** @var IPayPalHandler $handler */

View File

@@ -61,6 +61,11 @@ class PayPalRestCall
) )
); );
// if proxy set via config, add it
if (!empty($config['http.Proxy'])) {
$httpConfig->setHttpProxy($config['http.Proxy']);
}
/** @var \Paypal\Handler\IPayPalHandler $handler */ /** @var \Paypal\Handler\IPayPalHandler $handler */
foreach ($handlers as $handler) { foreach ($handlers as $handler) {
if (!is_object($handler)) { if (!is_object($handler)) {