Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 88e5cda

Browse files
authored
Merge pull request #3575 from magento-tsg/2.2-develop-pr66
[TSG] Backporting for 2.2 (pr66) (2.2.8)
2 parents a5df627 + 794b3b0 commit 88e5cda

File tree

38 files changed

+687
-295
lines changed

38 files changed

+687
-295
lines changed

app/code/Magento/Authorizenet/Model/Directpost.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,7 @@ protected function declineOrder(\Magento\Sales\Model\Order $order, $message = ''
832832
->void($response);
833833
}
834834
$order->registerCancellation($message)->save();
835+
$this->_eventManager->dispatch('order_cancel_after', ['order' => $order ]);
835836
} catch (\Exception $e) {
836837
//quiet decline
837838
$this->getPsrLogger()->critical($e);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="CustomerLogoutStorefrontByMenuItemsActionGroup">
12+
<conditionalClick selector="{{StorefrontPanelHeaderSection.customerWelcome}}"
13+
dependentSelector="{{StorefrontPanelHeaderSection.customerWelcomeMenu}}"
14+
visible="false"
15+
stepKey="clickHeaderCustomerMenuButton" />
16+
<click selector="{{StorefrontPanelHeaderSection.customerLogoutLink}}" stepKey="clickSignOutButton" />
17+
</actionGroup>
18+
</actionGroups>

app/code/Magento/Customer/Test/Mftf/Section/StorefrontPanelHeaderSection.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
-->
88

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontPanelHeaderSection">
1212
<element name="createAnAccountLink" type="select" selector=".panel.header li:nth-child(3)"/>
13+
<element name="customerWelcome" type="text" selector=".panel.header .customer-welcome"/>
14+
<element name="customerWelcomeMenu" type="text" selector=".panel.header .customer-welcome .customer-menu"/>
15+
<element name="customerLogoutLink" type="text" selector=".panel.header .customer-welcome .customer-menu .authorization-link a" timeout="30"/>
1316
<element name="welcomeMessage" type="text" selector=".greet.welcome span"/>
1417
<element name="notYouLink" type="button" selector=".greet.welcome span a"/>
1518
</section>

app/code/Magento/ImportExport/Controller/Adminhtml/Import/Start.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77

88
use Magento\ImportExport\Controller\Adminhtml\ImportResult as ImportResultController;
99
use Magento\Framework\Controller\ResultFactory;
10+
use Magento\ImportExport\Model\Import;
1011

12+
/**
13+
* Controller responsible for initiating the import process.
14+
*/
1115
class Start extends ImportResultController
1216
{
1317
/**
@@ -62,6 +66,11 @@ public function execute()
6266

6367
$this->importModel->setData($data);
6468
$errorAggregator = $this->importModel->getErrorAggregator();
69+
$errorAggregator->initValidationStrategy(
70+
$this->importModel->getData(Import::FIELD_NAME_VALIDATION_STRATEGY),
71+
$this->importModel->getData(Import::FIELD_NAME_ALLOWED_ERROR_COUNT)
72+
);
73+
6574
try {
6675
$this->importModel->importSource();
6776
} catch (\Exception $e) {

app/code/Magento/Newsletter/view/adminhtml/templates/preview/iframeswitcher.phtml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@
1616
</div>
1717
<?php endif;?>
1818
</div>
19-
<iframe name="preview_iframe" id="preview_iframe" frameborder="0" title="<?= $block->escapeHtmlAttr(__('Preview')) ?>" width="100%"></iframe>
19+
<iframe
20+
name="preview_iframe"
21+
id="preview_iframe"
22+
frameborder="0"
23+
title="<?= $block->escapeHtmlAttr(__('Preview')) ?>"
24+
width="100%"
25+
sandbox="allow-forms allow-pointer-lock allow-scripts">
26+
</iframe>
2027
<?= $block->getChildHtml('preview_form') ?>
2128
</div>
2229

app/code/Magento/Persistent/Block/Header/Additional.php

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
*/
66
namespace Magento\Persistent\Block\Header;
77

8+
use Magento\Framework\App\ObjectManager;
9+
use Magento\Framework\Serialize\Serializer\Json;
10+
use Magento\Persistent\Helper\Data;
11+
812
/**
913
* Remember Me block
1014
*
@@ -30,27 +34,46 @@ class Additional extends \Magento\Framework\View\Element\Html\Link
3034
protected $customerRepository;
3135

3236
/**
33-
* Constructor
34-
*
37+
* @var string
38+
*/
39+
protected $_template = 'Magento_Persistent::additional.phtml';
40+
41+
/**
42+
* @var Json
43+
*/
44+
private $jsonSerializer;
45+
46+
/**
47+
* @var Data
48+
*/
49+
private $persistentHelper;
50+
51+
/**
3552
* @param \Magento\Framework\View\Element\Template\Context $context
3653
* @param \Magento\Customer\Helper\View $customerViewHelper
3754
* @param \Magento\Persistent\Helper\Session $persistentSessionHelper
3855
* @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository
3956
* @param array $data
57+
* @param Json|null $jsonSerializer
58+
* @param Data|null $persistentHelper
4059
*/
4160
public function __construct(
4261
\Magento\Framework\View\Element\Template\Context $context,
4362
\Magento\Customer\Helper\View $customerViewHelper,
4463
\Magento\Persistent\Helper\Session $persistentSessionHelper,
4564
\Magento\Customer\Api\CustomerRepositoryInterface $customerRepository,
46-
array $data = []
65+
array $data = [],
66+
Json $jsonSerializer = null,
67+
Data $persistentHelper = null
4768
) {
4869
$this->isScopePrivate = true;
4970
$this->_customerViewHelper = $customerViewHelper;
5071
$this->_persistentSessionHelper = $persistentSessionHelper;
5172
$this->customerRepository = $customerRepository;
5273
parent::__construct($context, $data);
5374
$this->_isScopePrivate = true;
75+
$this->jsonSerializer = $jsonSerializer ?: ObjectManager::getInstance()->get(Json::class);
76+
$this->persistentHelper = $persistentHelper ?: ObjectManager::getInstance()->get(Data::class);
5477
}
5578

5679
/**
@@ -64,17 +87,25 @@ public function getHref()
6487
}
6588

6689
/**
67-
* Render additional header html
90+
* @return int
91+
*/
92+
public function getCustomerId()
93+
{
94+
return $this->_persistentSessionHelper->getSession()->getCustomerId();
95+
}
96+
97+
/**
98+
* Get persistent config.
6899
*
69100
* @return string
70101
*/
71-
protected function _toHtml()
102+
public function getConfig()
72103
{
73-
if ($this->_persistentSessionHelper->getSession()->getCustomerId()) {
74-
return '<span><a ' . $this->getLinkAttributes() . ' >' . __('Not you?')
75-
. '</a></span>';
76-
}
77-
78-
return '';
104+
return
105+
$this->jsonSerializer->serialize(
106+
[
107+
'expirationLifetime' => $this->persistentHelper->getLifeTime(),
108+
]
109+
);
79110
}
80111
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Persistent\CustomerData;
8+
9+
use Magento\Customer\Api\CustomerRepositoryInterface;
10+
use Magento\Customer\CustomerData\SectionSourceInterface;
11+
use Magento\Customer\Helper\View;
12+
use Magento\Persistent\Helper\Session;
13+
14+
/**
15+
* Customer persistent section
16+
*/
17+
class Persistent implements SectionSourceInterface
18+
{
19+
/**
20+
* @var Session
21+
*/
22+
private $persistentSession;
23+
24+
/**
25+
* @var View
26+
*/
27+
private $customerViewHelper;
28+
29+
/**
30+
* @var CustomerRepositoryInterface
31+
*/
32+
private $customerRepository;
33+
34+
/**
35+
* @param Session $persistentSession
36+
* @param View $customerViewHelper
37+
* @param CustomerRepositoryInterface $customerRepository
38+
*/
39+
public function __construct(
40+
Session $persistentSession,
41+
View $customerViewHelper,
42+
CustomerRepositoryInterface $customerRepository
43+
) {
44+
$this->persistentSession = $persistentSession;
45+
$this->customerViewHelper = $customerViewHelper;
46+
$this->customerRepository = $customerRepository;
47+
}
48+
49+
/**
50+
* Get data
51+
*
52+
* @return array
53+
*/
54+
public function getSectionData()
55+
{
56+
if (!$this->persistentSession->isPersistent()) {
57+
return [];
58+
}
59+
60+
$customerId = $this->persistentSession->getSession()->getCustomerId();
61+
if (!$customerId) {
62+
return [];
63+
}
64+
65+
$customer = $this->customerRepository->getById($customerId);
66+
67+
return [
68+
'fullname' => $this->customerViewHelper->getCustomerName($customer),
69+
];
70+
}
71+
}

app/code/Magento/Persistent/Model/Observer.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,8 @@ public function __construct(
8686
*/
8787
public function emulateWelcomeBlock($block)
8888
{
89-
$customerName = $this->_customerViewHelper->getCustomerName(
90-
$this->customerRepository->getById($this->_persistentSession->getSession()->getCustomerId())
91-
);
89+
$block->setWelcome('&nbsp;');
9290

93-
$this->_applyAccountLinksPersistentData();
94-
$welcomeMessage = __('Welcome, %1!', $customerName);
95-
$block->setWelcome($welcomeMessage);
9691
return $this;
9792
}
9893

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Persistent\Model\Plugin;
7+
8+
/**
9+
* Plugin for Magento\Framework\App\Http\Context to create new page cache variation for persistent session.
10+
*/
11+
class PersistentCustomerContext
12+
{
13+
/**
14+
* Persistent session
15+
*
16+
* @var \Magento\Persistent\Helper\Session
17+
*/
18+
private $persistentSession;
19+
20+
/**
21+
* @param \Magento\Persistent\Helper\Session $persistentSession
22+
*/
23+
public function __construct(
24+
\Magento\Persistent\Helper\Session $persistentSession
25+
) {
26+
$this->persistentSession = $persistentSession;
27+
}
28+
29+
/**
30+
* @param \Magento\Framework\App\Http\Context $subject
31+
* @return mixed
32+
*/
33+
public function beforeGetVaryString(\Magento\Framework\App\Http\Context $subject)
34+
{
35+
if ($this->persistentSession->isPersistent()) {
36+
$subject->setValue('PERSISTENT', 1, 0);
37+
}
38+
}
39+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="CustomerLoginOnStorefrontWithRememberMeChecked" extends="CustomerLoginOnStorefront">
12+
<checkOption selector="{{StorefrontCustomerSignInFormSection.rememberMe}}"
13+
before="clickSignInAccountButton"
14+
stepKey="checkRememberMe"/>
15+
</actionGroup>
16+
17+
<actionGroup name="CustomerLoginOnStorefrontWithRememberMeUnChecked" extends="CustomerLoginOnStorefront">
18+
<uncheckOption selector="{{StorefrontCustomerSignInFormSection.rememberMe}}"
19+
before="clickSignInAccountButton"
20+
stepKey="unCheckRememberMe"/>
21+
</actionGroup>
22+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="StorefrontCustomerSignInFormSection">
12+
<element name="rememberMe" type="checkbox" selector="[name='persistent_remember_me']"/>
13+
</section>
14+
</sections>

0 commit comments

Comments
 (0)