Skip to content

Commit 6d28ea9

Browse files
Merge branch 'develop' of github.com:magento/magento2ce into PR-4
2 parents 3a00196 + 16bbf9d commit 6d28ea9

File tree

6 files changed

+239
-80
lines changed

6 files changed

+239
-80
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,9 +1482,9 @@ protected function _exportAddressses($data)
14821482
protected function _applyStreetAndRegionWorkarounds(\Magento\Framework\DataObject $address)
14831483
{
14841484
// merge street addresses into 1
1485-
if ($address->hasStreet2()) {
1486-
$address->setStreet(implode("\n", [$address->getStreet(), $address->getStreetLine(2)]));
1487-
$address->unsStreet2();
1485+
if ($address->getData('street2') !== null) {
1486+
$address->setStreet(implode("\n", [$address->getData('street'), $address->getData('street2')]));
1487+
$address->unsetData('street2');
14881488
}
14891489
// attempt to fetch region_id from directory
14901490
if ($address->getCountryId() && $address->getRegion()) {

app/code/Magento/Paypal/Model/Express/Checkout.php

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -900,35 +900,19 @@ public function getCheckoutMethod()
900900
* @param Address $address
901901
* @param array $exportedAddress
902902
* @return void
903-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
904903
*/
905904
protected function _setExportedAddressData($address, $exportedAddress)
906905
{
907906
// Exported data is more priority if we came from Express Checkout button
908-
$isButton = (bool)$this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_BUTTON);
907+
$isButton = (bool)$this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_BUTTON);
909908
if (!$isButton) {
910-
foreach ($exportedAddress->getExportedKeys() as $key) {
911-
$oldData = $address->getDataUsingMethod($key);
912-
$isEmpty = null;
913-
if (is_array($oldData)) {
914-
foreach ($oldData as $val) {
915-
if (!empty($val)) {
916-
$isEmpty = false;
917-
break;
918-
}
919-
$isEmpty = true;
920-
}
921-
}
922-
if (empty($oldData) || $isEmpty === true) {
923-
$address->setDataUsingMethod($key, $exportedAddress->getData($key));
924-
}
925-
}
926-
} else {
927-
foreach ($exportedAddress->getExportedKeys() as $key) {
928-
$data = $exportedAddress->getData($key);
929-
if (!empty($data)) {
930-
$address->setDataUsingMethod($key, $data);
931-
}
909+
return;
910+
}
911+
912+
foreach ($exportedAddress->getExportedKeys() as $key) {
913+
$data = $exportedAddress->getData($key);
914+
if (!empty($data)) {
915+
$address->setDataUsingMethod($key, $data);
932916
}
933917
}
934918
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Paypal\Setup;
7+
8+
use Magento\Framework\DB\Ddl\Table;
9+
use Magento\Framework\Setup\ModuleContextInterface;
10+
use Magento\Framework\Setup\SchemaSetupInterface;
11+
use Magento\Framework\Setup\UpgradeSchemaInterface;
12+
13+
/**
14+
* Upgrade the Paypal module DB scheme
15+
*/
16+
class UpgradeSchema implements UpgradeSchemaInterface
17+
{
18+
/**
19+
* {@inheritdoc}
20+
*/
21+
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
22+
{
23+
if (version_compare($context->getVersion(), '2.0.1', '<')) {
24+
$setup->getConnection()->modifyColumn(
25+
$setup->getTable('paypal_settlement_report'),
26+
'report_date',
27+
[
28+
'type' => Table::TYPE_DATE,
29+
'comment' => 'Report Date'
30+
]
31+
);
32+
}
33+
}
34+
}

app/code/Magento/Paypal/Test/Unit/Model/Api/NvpTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,21 @@ public function testCallGetExpressCheckoutDetails()
194194
->method('read')
195195
->will($this->returnValue(
196196
"\r\n" . 'ACK=Success&SHIPTONAME=Ship%20To%20Name'
197+
. '&SHIPTOSTREET=testStreet'
198+
. '&SHIPTOSTREET2=testApartment'
199+
. '&BUSINESS=testCompany'
200+
. '&SHIPTOCITY=testCity'
201+
. '&PHONENUM=223322'
202+
. '&STATE=testSTATE'
197203
));
198204
$this->model->callGetExpressCheckoutDetails();
199-
$this->assertEquals('Ship To Name', $this->model->getExportedShippingAddress()->getData('firstname'));
205+
$address = $this->model->getExportedShippingAddress();
206+
$this->assertEquals('Ship To Name', $address->getData('firstname'));
207+
$this->assertEquals(implode("\n", ['testStreet','testApartment']), $address->getStreet());
208+
$this->assertEquals('testCompany', $address->getCompany());
209+
$this->assertEquals('testCity', $address->getCity());
210+
$this->assertEquals('223322', $address->getTelephone());
211+
$this->assertEquals('testSTATE', $address->getRegion());
200212
}
201213

202214
public function testGetDebugReplacePrivateDataKeys()

app/code/Magento/Paypal/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Paypal" setup_version="2.0.0">
9+
<module name="Magento_Paypal" setup_version="2.0.1">
1010
<sequence>
1111
<module name="Magento_Checkout"/>
1212
<module name="Magento_Sales"/>

0 commit comments

Comments
 (0)