Skip to content

Commit 0eaf9a4

Browse files
committed
MAGETWO-68833: [Magento Cloud] - Paypal shows error in checkout but order still goes through but all subsequent orders fail afterwards
- Fixed integration and static tests
1 parent 757ccf1 commit 0eaf9a4

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

app/code/Magento/Paypal/Model/Api/AbstractApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ public function getDebugReplacePrivateDataKeys()
635635
* Formats value according to configured filters or converts to 0.00 format if value is float.
636636
*
637637
* @param string|int|float|\Magento\Framework\Phrase $value
638-
* @param $publicKey
638+
* @param string $publicKey
639639
* @return string
640640
*/
641641
private function formatValue($value, $publicKey)

dev/tests/integration/testsuite/Magento/Paypal/Model/Api/PayflowNvpTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66
namespace Magento\Paypal\Model\Api;
77

88
use Magento\Framework\Api\SearchCriteriaBuilder;
9+
use Magento\Framework\App\ProductMetadataInterface;
910
use Magento\Framework\HTTP\Adapter\Curl;
1011
use Magento\Framework\HTTP\Adapter\CurlFactory;
1112
use Magento\Framework\ObjectManagerInterface;
1213
use Magento\Paypal\Model\CartFactory;
14+
use Magento\Paypal\Model\Config;
1315
use Magento\Quote\Model\Quote;
1416
use Magento\Quote\Model\QuoteRepository;
1517
use Magento\TestFramework\Helper\Bootstrap;
1618
use PHPUnit_Framework_MockObject_MockObject as MockObject;
17-
use Magento\Paypal\Model\Config;
1819

1920
class PayflowNvpTest extends \PHPUnit_Framework_TestCase
2021
{
@@ -55,9 +56,21 @@ protected function setUp()
5556
'curlFactory' => $httpFactory
5657
]);
5758

59+
/** @var ProductMetadataInterface|MockObject $productMetadata */
60+
$productMetadata = $this->getMockBuilder(ProductMetadataInterface::class)
61+
->getMock();
62+
$productMetadata->method('getEdition')
63+
->willReturn('');
64+
5865
/** @var Config $config */
5966
$config = $this->objectManager->get(Config::class);
6067
$config->setMethodCode(Config::METHOD_WPP_PE_EXPRESS);
68+
69+
$refObject = new \ReflectionObject($config);
70+
$refProperty = $refObject->getProperty('productMetadata');
71+
$refProperty->setAccessible(true);
72+
$refProperty->setValue($config, $productMetadata);
73+
6174
$this->nvpApi->setConfigObject($config);
6275
}
6376

@@ -78,7 +91,7 @@ public function testRequestLineItems()
7891
. 'L_NAME1=Simple 2&L_QTY1=2&L_COST1=9.69&'
7992
. 'L_NAME2=Simple 3&L_QTY2=3&L_COST2=11.69&'
8093
. 'L_NAME3=Discount&L_QTY3=1&L_COST3=-10.00&'
81-
. 'TRXTYPE=A&ACTION=S&BUTTONSOURCE=Magento_Cart_Community';
94+
. 'TRXTYPE=A&ACTION=S&BUTTONSOURCE=Magento_Cart_';
8295

8396
$this->httpClient->method('write')
8497
->with(

0 commit comments

Comments
 (0)