Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

PATCH SUPEE-8167 EE 1.14.1.0 1.14.3.2 v1-2017-05-08-02-42-22 #63

Open
wants to merge 1 commit into
base: magento-1.9.3.3
Choose a base branch
from
Open
Changes from all 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
31 changes: 28 additions & 3 deletions app/code/core/Mage/Paypal/Model/Ipn.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
*
Expand Down