Skip to content

Commit 864e7f1

Browse files
committed
MAGETWO-68911: [Backport] - Outdated PayPal IPN Url to 2.0.x
1 parent a3fca93 commit 864e7f1

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

app/code/Magento/Paypal/Model/AbstractIpn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function _postBack()
8282
{
8383
$httpAdapter = $this->_curlFactory->create();
8484
$postbackQuery = http_build_query($this->getRequestData()) . '&cmd=_notify-validate';
85-
$postbackUrl = $this->_config->getPaypalUrl();
85+
$postbackUrl = $this->_config->getPayPalIpnUrl();
8686
$this->_addDebugData('postback_to', $postbackUrl);
8787

8888
$httpAdapter->setConfig(['verifypeer' => $this->_config->getValue('verifyPeer')]);

app/code/Magento/Paypal/Model/Config.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* Config model that is aware of all \Magento\Paypal payment methods
1313
* Works with PayPal-specific system configuration
14-
* @SuppressWarnings(PHPMD.ExcesivePublicCount)
14+
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
1515
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
1616
*/
1717
class Config extends AbstractConfig
@@ -918,6 +918,19 @@ public function getPaypalUrl(array $params = [])
918918
);
919919
}
920920

921+
/**
922+
* PayPal web URL for IPN
923+
*
924+
* @return string
925+
*/
926+
public function getPayPalIpnUrl()
927+
{
928+
return sprintf(
929+
'https://ipnpb.%spaypal.com/cgi-bin/webscr',
930+
$this->getValue('sandboxFlag') ? 'sandbox.' : ''
931+
);
932+
}
933+
921934
/**
922935
* Whether Express Checkout button should be rendered dynamically
923936
*

app/code/Magento/Paypal/Test/Unit/Model/IpnTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ protected function setUp()
7878
$configMock->expects($this->any())->method('isMethodActive')->will($this->returnValue(true));
7979
$configMock->expects($this->any())->method('isMethodAvailable')->will($this->returnValue(true));
8080
$configMock->expects($this->any())->method('getValue')->will($this->returnValue(null));
81-
$configMock->expects($this->any())->method('getPaypalUrl')
82-
->will($this->returnValue('http://paypal_url'));
81+
$configMock->expects($this->any())->method('getPayPalIpnUrl')
82+
->will($this->returnValue('https://ipnpb_paypal_url'));
8383

8484
$this->curlFactory = $this->getMock(
8585
'Magento\Framework\HTTP\Adapter\CurlFactory',

0 commit comments

Comments
 (0)