From 6058a31fe0d9ca8ad13b601a9ef3a214bdaecab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Meyer?= Date: Mon, 26 Jun 2017 13:55:29 +0200 Subject: [PATCH] PATCH SUPEE-8167 EE 1.14.1.0 1.14.3.2 v1-2017-05-08-02-42-22 --- app/code/core/Mage/Paypal/Model/Ipn.php | 31 ++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/app/code/core/Mage/Paypal/Model/Ipn.php b/app/code/core/Mage/Paypal/Model/Ipn.php index 974a7eb339f..2409986964b 100644 --- a/app/code/core/Mage/Paypal/Model/Ipn.php +++ b/app/code/core/Mage/Paypal/Model/Ipn.php @@ -36,6 +36,20 @@ class Mage_Paypal_Model_Ipn */ const DEFAULT_LOG_FILE = 'paypal_unknown_ipn.log'; + /** + * Default postback endpoint URL. + * + * @var string + */ + const DEFAULT_POSTBACK_URL = 'https://ipnpb.paypal.com/cgi-bin/webscr'; + + /** + * Sandbox postback endpoint URL. + * + * @var string + */ + const SANDBOX_POSTBACK_URL = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr'; + /** * Store order instance * @@ -133,14 +147,15 @@ public function processIpnRequest(array $request, Zend_Http_Client_Adapter_Inter */ protected function _postBack(Zend_Http_Client_Adapter_Interface $httpAdapter) { + $url = $this->_getPostbackUrl(); + $postbackQuery = http_build_query($this->_request) . '&cmd=_notify-validate'; - $postbackUrl = $this->_config->getPostbackUrl(); - $this->_debugData['postback_to'] = $postbackUrl; + $this->_debugData['postback_to'] = $url; $httpAdapter->setConfig(array('verifypeer' => $this->_config->verifyPeer)); $httpAdapter->write( Zend_Http_Client::POST, - $postbackUrl, + $url, '1.1', array('Connection: close'), $postbackQuery @@ -176,6 +191,16 @@ protected function _postBack(Zend_Http_Client_Adapter_Interface $httpAdapter) } } + /** + * Get postback endpoint URL. + * + * @return string + */ + protected function _getPostbackUrl() + { + return $this->_config->sandboxFlag ? self::SANDBOX_POSTBACK_URL : self::DEFAULT_POSTBACK_URL; + } + /** * Load and validate order, instantiate proper configuration *