Skip to content

Commit 3711da7

Browse files
committed
Merge remote-tracking branch 'remotes/mainline-ce/2.3-develop' into team3-delivery
2 parents fa22753 + b16dfc6 commit 3711da7

File tree

32 files changed

+968
-202
lines changed

32 files changed

+968
-202
lines changed

app/code/Magento/Braintree/Model/Adminhtml/System/Config/CountryCreditCard.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ public function __construct(
6666
public function beforeSave()
6767
{
6868
$value = $this->getValue();
69+
if (!is_array($value)) {
70+
try {
71+
$value = $this->serializer->unserialize($value);
72+
} catch (\InvalidArgumentException $e) {
73+
$value = [];
74+
}
75+
}
6976
$result = [];
7077
foreach ($value as $data) {
7178
if (empty($data['country_id']) || empty($data['cc_types'])) {

app/code/Magento/Catalog/Block/Product/ListProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public function getIdentities()
356356
* Get post parameters
357357
*
358358
* @param Product $product
359-
* @return string
359+
* @return array
360360
*/
361361
public function getAddToCartPostParams(Product $product)
362362
{

app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,11 @@
4747
"data": <?= /* @escapeNotVerified */ $block->getGalleryImagesJson() ?>,
4848
"options": {
4949
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/nav") ?>",
50-
<?php if (($block->getVar("gallery/loop"))): ?>
51-
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ?>,
52-
<?php endif; ?>
53-
<?php if (($block->getVar("gallery/keyboard"))): ?>
54-
"keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ?>,
55-
<?php endif; ?>
56-
<?php if (($block->getVar("gallery/arrows"))): ?>
57-
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ?>,
58-
<?php endif; ?>
59-
<?php if (($block->getVar("gallery/allowfullscreen"))): ?>
60-
"allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ?>,
61-
<?php endif; ?>
62-
<?php if (($block->getVar("gallery/caption"))): ?>
63-
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ?>,
64-
<?php endif; ?>
50+
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ? 'true' : 'false' ?>,
51+
"keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ? 'true' : 'false' ?>,
52+
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ? 'true' : 'false' ?>,
53+
"allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ? 'true' : 'false' ?>,
54+
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ? 'true' : 'false' ?>,
6555
"width": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'width') ?>",
6656
"thumbwidth": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_small', 'width') ?>",
6757
<?php if ($block->getImageAttribute('product_page_image_small', 'height') || $block->getImageAttribute('product_page_image_small', 'width')): ?>
@@ -76,28 +66,18 @@
7666
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/transition/duration") ?>,
7767
<?php endif; ?>
7868
"transition": "<?= /* @escapeNotVerified */ $block->getVar("gallery/transition/effect") ?>",
79-
<?php if (($block->getVar("gallery/navarrows"))): ?>
80-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ?>,
81-
<?php endif; ?>
69+
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ? 'true' : 'false' ?>,
8270
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navtype") ?>",
8371
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navdir") ?>"
8472
},
8573
"fullscreen": {
8674
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/nav") ?>",
87-
<?php if ($block->getVar("gallery/fullscreen/loop")): ?>
88-
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ?>,
89-
<?php endif; ?>
75+
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ? 'true' : 'false' ?>,
9076
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navdir") ?>",
91-
<?php if ($block->getVar("gallery/transition/navarrows")): ?>
92-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ?>,
93-
<?php endif; ?>
77+
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ? 'true' : 'false' ?>,
9478
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navtype") ?>",
95-
<?php if ($block->getVar("gallery/fullscreen/arrows")): ?>
96-
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ?>,
97-
<?php endif; ?>
98-
<?php if ($block->getVar("gallery/fullscreen/caption")): ?>
99-
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ?>,
100-
<?php endif; ?>
79+
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ? 'true' : 'false' ?>,
80+
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ? 'true' : 'false' ?>,
10181
<?php if ($block->getVar("gallery/fullscreen/transition/duration")): ?>
10282
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/transition/duration") ?>,
10383
<?php endif; ?>

app/code/Magento/CatalogInventory/i18n/en_US.csv

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ Inventory,Inventory
5555
"Only X left Threshold","Only X left Threshold"
5656
"Display Products Availability in Stock on Storefront","Display Products Availability in Stock on Storefront"
5757
"Product Stock Options","Product Stock Options"
58-
"
59-
Please note that these settings apply to individual items in the cart, not to the entire cart.
60-
","
61-
Please note that these settings apply to individual items in the cart, not to the entire cart.
62-
"
58+
"Please note that these settings apply to individual items in the cart, not to the entire cart.","Please note that these settings apply to individual items in the cart, not to the entire cart."
6359
"Manage Stock","Manage Stock"
6460
Backorders,Backorders
6561
"Maximum Qty Allowed in Shopping Cart","Maximum Qty Allowed in Shopping Cart"

app/code/Magento/CustomerImportExport/Model/Import/Customer.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -378,19 +378,11 @@ protected function _prepareDataForUpdate(array $rowData)
378378
$this->_newCustomers[$emailInLowercase][$rowData[self::COLUMN_WEBSITE]] = $entityId;
379379
}
380380

381-
$entityRow = [
382-
'group_id' => empty($rowData['group_id']) ? self::DEFAULT_GROUP_ID : $rowData['group_id'],
383-
'store_id' => empty($rowData[self::COLUMN_STORE]) ? 0 : $this->_storeCodeToId[$rowData[self::COLUMN_STORE]],
384-
'created_at' => $createdAt->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT),
385-
'updated_at' => $now->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT),
386-
'entity_id' => $entityId,
387-
];
388-
389381
// password change/set
390382
if (isset($rowData['password']) && strlen($rowData['password'])) {
391383
$rowData['password_hash'] = $this->_customerModel->hashPassword($rowData['password']);
392384
}
393-
385+
$entityRow = ['entity_id' => $entityId];
394386
// attribute values
395387
foreach (array_intersect_key($rowData, $this->_attributes) as $attributeCode => $value) {
396388
$attributeParameters = $this->_attributes[$attributeCode];
@@ -429,12 +421,21 @@ protected function _prepareDataForUpdate(array $rowData)
429421

430422
if ($newCustomer) {
431423
// create
424+
$entityRow['group_id'] = empty($rowData['group_id']) ? self::DEFAULT_GROUP_ID : $rowData['group_id'];
425+
$entityRow['store_id'] = empty($rowData[self::COLUMN_STORE])
426+
? \Magento\Store\Model\Store::DEFAULT_STORE_ID : $this->_storeCodeToId[$rowData[self::COLUMN_STORE]];
427+
$entityRow['created_at'] = $createdAt->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT);
428+
$entityRow['updated_at'] = $now->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT);
432429
$entityRow['website_id'] = $this->_websiteCodeToId[$rowData[self::COLUMN_WEBSITE]];
433430
$entityRow['email'] = $emailInLowercase;
434431
$entityRow['is_active'] = 1;
435432
$entitiesToCreate[] = $entityRow;
436433
} else {
437434
// edit
435+
$entityRow['updated_at'] = $now->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT);
436+
if (!empty($rowData[self::COLUMN_STORE])) {
437+
$entityRow['store_id'] = $this->_storeCodeToId[$rowData[self::COLUMN_STORE]];
438+
}
438439
$entitiesToUpdate[] = $entityRow;
439440
}
440441

app/code/Magento/Payment/Model/Method/AbstractMethod.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66

77
namespace Magento\Payment\Model\Method;
88

9+
use Magento\Framework\App\ObjectManager;
910
use Magento\Framework\DataObject;
1011
use Magento\Payment\Model\InfoInterface;
1112
use Magento\Payment\Model\MethodInterface;
1213
use Magento\Payment\Observer\AbstractDataAssignObserver;
1314
use Magento\Quote\Api\Data\PaymentMethodInterface;
1415
use Magento\Sales\Model\Order\Payment;
16+
use Magento\Directory\Helper\Data as DirectoryHelper;
1517

1618
/**
1719
* Payment method abstract model
@@ -194,6 +196,11 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
194196
*/
195197
protected $logger;
196198

199+
/**
200+
* @var DirectoryHelper
201+
*/
202+
private $directory;
203+
197204
/**
198205
* @param \Magento\Framework\Model\Context $context
199206
* @param \Magento\Framework\Registry $registry
@@ -205,6 +212,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
205212
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
206213
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
207214
* @param array $data
215+
* @param DirectoryHelper $directory
208216
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
209217
*/
210218
public function __construct(
@@ -217,7 +225,8 @@ public function __construct(
217225
\Magento\Payment\Model\Method\Logger $logger,
218226
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
219227
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
220-
array $data = []
228+
array $data = [],
229+
DirectoryHelper $directory = null
221230
) {
222231
parent::__construct(
223232
$context,
@@ -231,6 +240,7 @@ public function __construct(
231240
$this->_paymentData = $paymentData;
232241
$this->_scopeConfig = $scopeConfig;
233242
$this->logger = $logger;
243+
$this->directory = $directory ?: ObjectManager::getInstance()->get(DirectoryHelper::class);
234244
$this->initializeData($data);
235245
}
236246

@@ -584,11 +594,14 @@ public function validate()
584594
} else {
585595
$billingCountry = $paymentInfo->getQuote()->getBillingAddress()->getCountryId();
586596
}
597+
$billingCountry = $billingCountry ?: $this->directory->getDefaultCountry();
598+
587599
if (!$this->canUseForCountry($billingCountry)) {
588600
throw new \Magento\Framework\Exception\LocalizedException(
589601
__('You can\'t use the payment type you selected to make payments to the billing country.')
590602
);
591603
}
604+
592605
return $this;
593606
}
594607

app/code/Magento/Paypal/Controller/Express/AbstractExpress/PlaceOrder.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\Paypal\Controller\Express\AbstractExpress;
99

10+
use Magento\Framework\Exception\LocalizedException;
1011
use Magento\Paypal\Model\Api\ProcessableException as ApiProcessableException;
1112

1213
/**
@@ -118,15 +119,27 @@ public function execute()
118119
return;
119120
} catch (ApiProcessableException $e) {
120121
$this->_processPaypalApiError($e);
122+
} catch (LocalizedException $e) {
123+
$this->processException($e, $e->getRawMessage());
121124
} catch (\Exception $e) {
122-
$this->messageManager->addExceptionMessage(
123-
$e,
124-
__('We can\'t place the order.')
125-
);
126-
$this->_redirect('*/*/review');
125+
$this->processException($e, 'We can\'t place the order.');
127126
}
128127
}
129128

129+
/**
130+
* Process exception.
131+
*
132+
* @param \Exception $exception
133+
* @param string $message
134+
*
135+
* @return void
136+
*/
137+
private function processException(\Exception $exception, string $message): void
138+
{
139+
$this->messageManager->addExceptionMessage($exception, __($message));
140+
$this->_redirect('*/*/review');
141+
}
142+
130143
/**
131144
* Process PayPal API's processable errors
132145
*

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,9 @@ public function place($token, $shippingMethodCode = null)
809809
case \Magento\Sales\Model\Order::STATE_PROCESSING:
810810
case \Magento\Sales\Model\Order::STATE_COMPLETE:
811811
case \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW:
812-
$this->orderSender->send($order);
812+
if (!$order->getEmailSent()) {
813+
$this->orderSender->send($order);
814+
}
813815
$this->_checkoutSession->start();
814816
break;
815817
default:
@@ -897,7 +899,12 @@ protected function _setExportedAddressData($address, $exportedAddress)
897899
{
898900
// Exported data is more priority if we came from Express Checkout button
899901
$isButton = (bool)$this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_BUTTON);
900-
if (!$isButton) {
902+
903+
// Since country is required field for billing and shipping address,
904+
// we consider the address information to be empty if country is empty.
905+
$isEmptyAddress = ($address->getCountryId() === null);
906+
907+
if (!$isButton && !$isEmptyAddress) {
901908
return;
902909
}
903910

app/code/Magento/Review/Block/Product/ReviewRenderer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class ReviewRenderer extends \Magento\Framework\View\Element\Template implements
1818
* @var array
1919
*/
2020
protected $_availableTemplates = [
21-
self::FULL_VIEW => 'helper/summary.phtml',
22-
self::SHORT_VIEW => 'helper/summary_short.phtml',
21+
self::FULL_VIEW => 'Magento_Review::helper/summary.phtml',
22+
self::SHORT_VIEW => 'Magento_Review::helper/summary_short.phtml',
2323
];
2424

2525
/**

app/code/Magento/Review/view/frontend/templates/view.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<div class="actions">
5050
<div class="secondary">
5151
<a class="action back" href="<?= $block->escapeUrl($block->getBackUrl()) ?>">
52-
<span><?= $block->escapeHtml(__('Back to Product Reviews')) ?></a></span>
52+
<span><?= $block->escapeHtml(__('Back to Product Reviews')) ?></span>
5353
</a>
5454
</div>
5555
</div>

0 commit comments

Comments
 (0)