Skip to content

Commit 785ebad

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MC-6353
2 parents 98de601 + d354290 commit 785ebad

File tree

83 files changed

+2391
-863
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2391
-863
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,42 @@
1+
# Magento_Authorizenet module
2+
13
The Magento_Authorizenet module implements the integration with the Authorize.Net payment gateway and makes the latter available as a payment method in Magento.
4+
5+
## Extensibility
6+
7+
Extension developers can interact with the Magento_Authorizenet module. For more information about the Magento extension mechanism, see [Magento plug-ins](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html).
8+
9+
[The Magento dependency injection mechanism](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/depend-inj.html) enables you to override the functionality of the Magento_Authorizenet module.
10+
11+
### Events
12+
13+
This module dispatches the following events:
14+
15+
- `checkout_directpost_placeOrder` event in the `\Magento\Authorizenet\Controller\Directpost\Payment\Place::placeCheckoutOrder()` method. Parameters:
16+
- `result` is a data object (`\Magento\Framework\DataObject` class).
17+
- `action` is a controller object (`\Magento\Authorizenet\Controller\Directpost\Payment\Place`).
18+
19+
- `order_cancel_after` event in the `\Magento\Authorizenet\Model\Directpost::declineOrder()` method. Parameters:
20+
- `order` is an order object (`\Magento\Sales\Model\Order` class).
21+
22+
23+
This module observes the following events:
24+
25+
- `checkout_submit_all_after` event in the `Magento\Authorizenet\Observer\SaveOrderAfterSubmitObserver` file.
26+
- `checkout_directpost_placeOrder` event in the `Magento\Authorizenet\Observer\AddFieldsToResponseObserver` file.
27+
28+
For information about events in Magento 2, see [Events and observers](http://devdocs.magento.com/guides/v2.3/extension-dev-guide/events-and-observers.html#events).
29+
30+
### Layouts
31+
32+
This module introduces the following layouts and layout handles in the `view/adminhtml/layout` directory:
33+
34+
- `adminhtml_authorizenet_directpost_payment_redirect`
35+
36+
This module introduces the following layouts and layout handles in the `view/frontend/layout` directory:
37+
38+
- `authorizenet_directpost_payment_backendresponse`
39+
- `authorizenet_directpost_payment_redirect`
40+
- `authorizenet_directpost_payment_response`
41+
42+
For more information about layouts in Magento 2, see the [Layout documentation](https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/layout-overview.html).

app/code/Magento/Captcha/Observer/CheckContactUsFormObserver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Magento\Framework\App\Request\DataPersistorInterface;
1010
use Magento\Framework\App\ObjectManager;
1111

12+
/**
13+
* Class CheckContactUsFormObserver
14+
*/
1215
class CheckContactUsFormObserver implements ObserverInterface
1316
{
1417
/**
@@ -76,7 +79,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
7679
/** @var \Magento\Framework\App\Action\Action $controller */
7780
$controller = $observer->getControllerAction();
7881
if (!$captcha->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))) {
79-
$this->messageManager->addError(__('Incorrect CAPTCHA.'));
82+
$this->messageManager->addErrorMessage(__('Incorrect CAPTCHA.'));
8083
$this->getDataPersistor()->set($formId, $controller->getRequest()->getPostValue());
8184
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
8285
$this->redirect->redirect($controller->getResponse(), 'contact/index/index');

app/code/Magento/Captcha/Observer/CheckForgotpasswordObserver.php

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

88
use Magento\Framework\Event\ObserverInterface;
99

10+
/**
11+
* Class CheckForgotpasswordObserver
12+
*/
1013
class CheckForgotpasswordObserver implements ObserverInterface
1114
{
1215
/**
@@ -69,7 +72,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
6972
/** @var \Magento\Framework\App\Action\Action $controller */
7073
$controller = $observer->getControllerAction();
7174
if (!$captchaModel->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))) {
72-
$this->messageManager->addError(__('Incorrect CAPTCHA'));
75+
$this->messageManager->addErrorMessage(__('Incorrect CAPTCHA'));
7376
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
7477
$this->redirect->redirect($controller->getResponse(), '*/*/forgotpassword');
7578
}

app/code/Magento/Captcha/Observer/CheckUserCreateObserver.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
use Magento\Framework\Event\ObserverInterface;
99

10+
/**
11+
* Class CheckUserCreateObserver
12+
*
13+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
14+
*/
1015
class CheckUserCreateObserver implements ObserverInterface
1116
{
1217
/**
@@ -86,7 +91,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
8691
/** @var \Magento\Framework\App\Action\Action $controller */
8792
$controller = $observer->getControllerAction();
8893
if (!$captchaModel->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))) {
89-
$this->messageManager->addError(__('Incorrect CAPTCHA'));
94+
$this->messageManager->addErrorMessage(__('Incorrect CAPTCHA'));
9095
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
9196
$this->_session->setCustomerFormData($controller->getRequest()->getPostValue());
9297
$url = $this->_urlManager->getUrl('*/*/create', ['_nosecret' => true]);

app/code/Magento/Captcha/Observer/CheckUserEditObserver.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
use Magento\Framework\App\Config\ScopeConfigInterface;
1212

1313
/**
14-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
14+
* Class CheckUserEditObserver
15+
*
16+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1517
*/
1618
class CheckUserEditObserver implements ObserverInterface
1719
{
18-
/**
19-
* Form ID
20-
*/
2120
const FORM_ID = 'user_edit';
2221

2322
/**
@@ -96,7 +95,8 @@ public function __construct(
9695
* Check Captcha On Forgot Password Page
9796
*
9897
* @param \Magento\Framework\Event\Observer $observer
99-
* @return $this
98+
* @return $this|void
99+
* @throws \Magento\Framework\Exception\SessionException
100100
*/
101101
public function execute(\Magento\Framework\Event\Observer $observer)
102102
{
@@ -119,9 +119,9 @@ public function execute(\Magento\Framework\Event\Observer $observer)
119119
'The account is locked. Please wait and try again or contact %1.',
120120
$this->scopeConfig->getValue('contact/email/recipient_email')
121121
);
122-
$this->messageManager->addError($message);
122+
$this->messageManager->addErrorMessage($message);
123123
}
124-
$this->messageManager->addError(__('Incorrect CAPTCHA'));
124+
$this->messageManager->addErrorMessage(__('Incorrect CAPTCHA'));
125125
$this->actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
126126
$this->redirect->redirect($controller->getResponse(), '*/*/edit');
127127
}

app/code/Magento/Captcha/Observer/CheckUserForgotPasswordBackendObserver.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
use Magento\Framework\Event\ObserverInterface;
99

10+
/**
11+
* Class CheckUserForgotPasswordBackendObserver
12+
*
13+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
14+
*/
1015
class CheckUserForgotPasswordBackendObserver implements ObserverInterface
1116
{
1217
/**
@@ -76,7 +81,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
7681
) {
7782
$this->_session->setEmail((string)$controller->getRequest()->getPost('email'));
7883
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
79-
$this->messageManager->addError(__('Incorrect CAPTCHA'));
84+
$this->messageManager->addErrorMessage(__('Incorrect CAPTCHA'));
8085
$controller->getResponse()->setRedirect(
8186
$controller->getUrl('*/*/forgotpassword', ['_nosecret' => true])
8287
);

app/code/Magento/Captcha/Observer/CheckUserLoginObserver.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
namespace Magento\Captcha\Observer;
88

9+
use Magento\Customer\Api\CustomerRepositoryInterface;
910
use Magento\Customer\Model\AuthenticationInterface;
1011
use Magento\Framework\Event\ObserverInterface;
1112
use Magento\Framework\Exception\NoSuchEntityException;
12-
use Magento\Customer\Api\CustomerRepositoryInterface;
1313

1414
/**
1515
* Check captcha on user login page observer.
@@ -64,6 +64,8 @@ class CheckUserLoginObserver implements ObserverInterface
6464
protected $authentication;
6565

6666
/**
67+
* CheckUserLoginObserver constructor.
68+
*
6769
* @param \Magento\Captcha\Helper\Data $helper
6870
* @param \Magento\Framework\App\ActionFlag $actionFlag
6971
* @param \Magento\Framework\Message\ManagerInterface $messageManager
@@ -125,8 +127,7 @@ private function getAuthentication()
125127
* Check captcha on user login page
126128
*
127129
* @param \Magento\Framework\Event\Observer $observer
128-
* @throws NoSuchEntityException
129-
* @return $this
130+
* @return $this|void
130131
*/
131132
public function execute(\Magento\Framework\Event\Observer $observer)
132133
{
@@ -143,10 +144,11 @@ public function execute(\Magento\Framework\Event\Observer $observer)
143144
try {
144145
$customer = $this->getCustomerRepository()->get($login);
145146
$this->getAuthentication()->processAuthenticationFailure($customer->getId());
147+
// phpcs:ignore Magento2.CodeAnalysis.EmptyBlock
146148
} catch (NoSuchEntityException $e) {
147149
//do nothing as customer existence is validated later in authenticate method
148150
}
149-
$this->messageManager->addError(__('Incorrect CAPTCHA'));
151+
$this->messageManager->addErrorMessage(__('Incorrect CAPTCHA'));
150152
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
151153
$this->_session->setUsername($login);
152154
$beforeUrl = $this->_session->getBeforeAuthUrl();

app/code/Magento/Captcha/Test/Unit/Observer/CheckContactUsFormObserverTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ protected function setUp()
6969
$this->messageManagerMock = $this->createMock(\Magento\Framework\Message\ManagerInterface::class);
7070
$this->redirectMock = $this->createMock(\Magento\Framework\App\Response\RedirectInterface::class);
7171
$this->captchaStringResolverMock = $this->createMock(\Magento\Captcha\Observer\CaptchaStringResolver::class);
72-
$this->sessionMock = $this->createPartialMock(\Magento\Framework\Session\SessionManager::class, ['addError']);
72+
$this->sessionMock = $this->createPartialMock(
73+
\Magento\Framework\Session\SessionManager::class,
74+
['addErrorMessage']
75+
);
7376
$this->dataPersistorMock = $this->getMockBuilder(\Magento\Framework\App\Request\DataPersistorInterface::class)
7477
->getMockForAbstractClass();
7578

@@ -116,7 +119,7 @@ public function testCheckContactUsFormWhenCaptchaIsRequiredAndValid()
116119
$this->helperMock->expects($this->any())
117120
->method('getCaptcha')
118121
->with($formId)->willReturn($this->captchaMock);
119-
$this->sessionMock->expects($this->never())->method('addError');
122+
$this->sessionMock->expects($this->never())->method('addErrorMessage');
120123

121124
$this->checkContactUsFormObserver->execute(
122125
new \Magento\Framework\Event\Observer(['controller_action' => $controller])
@@ -163,7 +166,7 @@ public function testCheckContactUsFormRedirectsCustomerWithWarningMessageWhenCap
163166
->method('getCaptcha')
164167
->with($formId)
165168
->willReturn($this->captchaMock);
166-
$this->messageManagerMock->expects($this->once())->method('addError')->with($warningMessage);
169+
$this->messageManagerMock->expects($this->once())->method('addErrorMessage')->with($warningMessage);
167170
$this->actionFlagMock->expects($this->once())
168171
->method('set')
169172
->with('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);

app/code/Magento/Captcha/Test/Unit/Observer/CheckForgotpasswordObserverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function testCheckForgotpasswordRedirects()
138138
)->will(
139139
$this->returnValue($this->_captcha)
140140
);
141-
$this->_messageManager->expects($this->once())->method('addError')->with($warningMessage);
141+
$this->_messageManager->expects($this->once())->method('addErrorMessage')->with($warningMessage);
142142
$this->_actionFlag->expects(
143143
$this->once()
144144
)->method(

app/code/Magento/Captcha/Test/Unit/Observer/CheckUserCreateObserverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function testCheckUserCreateRedirectsError()
151151
)->will(
152152
$this->returnValue($this->_captcha)
153153
);
154-
$this->_messageManager->expects($this->once())->method('addError')->with($warningMessage);
154+
$this->_messageManager->expects($this->once())->method('addErrorMessage')->with($warningMessage);
155155
$this->_actionFlag->expects(
156156
$this->once()
157157
)->method(

0 commit comments

Comments
 (0)