Skip to content

Commit 57a3eca

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MC-19242
2 parents f159eef + 31a6cd7 commit 57a3eca

File tree

168 files changed

+4358
-9224
lines changed

Some content is hidden

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

168 files changed

+4358
-9224
lines changed
Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,38 @@
1-
AdvancedSearch module introduces advanced search functionality and provides interfaces that allow to implement this functionality by 3rd party search engines
1+
# Magento_AdvancedSearch module
2+
The Magento_AdvancedSearch module introduces advanced search functionality and provides interfaces that allow third-party search engines to implement this functionality.
3+
4+
## Installation details
5+
6+
Before disabling or uninstalling this module, note that the following modules depends on this module:
7+
- Magento_Elasticsearch
8+
- Magento_Elasticsearch6
9+
10+
For information about module installation in Magento 2, see [Enable or disable modules](https://devdocs.magento.com/guides/v2.3/install-gde/install/cli/install-cli-subcommands-enable.html).
11+
12+
## Extensibility
13+
14+
Extension developers can interact with the Magento_AdvancedSearch 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).
15+
16+
[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_AdvancedSearch module.
17+
18+
### Events
19+
20+
This module observes the following event:
21+
22+
- `catalogsearch_query_save_after` in the `Magento\AdvancedSearch\Model\Recommendations\SaveSearchQueryRelationsObserver` file.
23+
24+
For information about an event in Magento 2, see [Events and observers](http://devdocs.magento.com/guides/v2.3/extension-dev-guide/events-and-observers.html#events).
25+
26+
### Layouts
27+
28+
The module interacts with the following layout handles in the `view/adminhtml/layout` directory:
29+
30+
- `catalog_search_block`
31+
- `catalog_search_edit`
32+
- `catalog_search_relatedgrid`
33+
34+
The module interacts with the following layout handles in the `view/frontend/layout` directory:
35+
36+
- `catalogsearch_result_index`
37+
38+
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).
Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,48 @@
1-
This component is designed to provide response for client who launched the bulk operation as soon as possible and postpone handling of operations moving them to background handler.
1+
# Magento_AsynchronousOperations module
2+
3+
This component is designed to provide a response for a client that launched the bulk operation as soon as possible and postpone handling of operations moving them to the background handler.
4+
5+
## Installation details
6+
7+
The Magento_AsynchronousOperations module creates the following tables in the database:
8+
9+
- `magento_bulk`
10+
- `magento_operation`
11+
- `magento_acknowledged_bulk`
12+
13+
Before disabling or uninstalling this module, note that the following modules depends on this module:
14+
15+
- Magento_WebapiAsync
16+
17+
For information about module installation in Magento 2, see [Enable or disable modules](https://devdocs.magento.com/guides/v2.3/install-gde/install/cli/install-cli-subcommands-enable.html).
18+
19+
## Extensibility
20+
21+
Extension developers can interact with the Magento_AsynchronousOperations 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).
22+
23+
[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_AsynchronousOperations module.
24+
25+
### Layouts
26+
27+
This module introduces the following layouts and layout handles in the `view/adminhtml/layout` directory:
28+
29+
- `bulk_bulk_details`
30+
- `bulk_bulk_details_modal`
31+
- `bulk_index_index`
32+
33+
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).
34+
35+
### UI components
36+
37+
You can extend Magento_AsynchronousOperations module using the following configuration files in the `view/adminhtml/ui_component/` directory:
38+
39+
- `bulk_details_form`
40+
- `bulk_details_form_modal`
41+
- `bulk_listing`
42+
- `failed_operation_listing`
43+
- `failed_operation_modal_listing`
44+
- `notification_area`
45+
- `retriable_operation_listing`
46+
- `retriable_operation_modal_listing`
47+
48+
For information about UI components in Magento 2, see [Overview of UI components](https://devdocs.magento.com/guides/v2.3/ui_comp_guide/bk-ui_comps.html).
Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
# Authorization
1+
# Magento_Authorization module
22

3-
**Authorization** enables management of access control list roles and
4-
rules in the application.
3+
The Magento_Authorization module enables management of access control list roles and rules in the application.
4+
5+
## Installation details
6+
7+
The Magento_AdminNotification module creates the following tables in the database:
8+
9+
- `authorization_role`
10+
- `authorization_rule`
11+
12+
Before disabling or uninstalling this module, note that the Magento_GraphQl module depends on this module.
13+
14+
For information about module installation in Magento 2, see [Enable or disable modules](https://devdocs.magento.com/guides/v2.3/install-gde/install/cli/install-cli-subcommands-enable.html).
15+
16+
## Extensibility
17+
18+
Extension developers can interact with the Magento_Authorization 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).
19+
20+
[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_Authorization module.

app/code/Magento/AuthorizenetAcceptjs/Gateway/Command/RefundTransactionStrategyCommand.php

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,45 @@ public function execute(array $commandSubject): void
5959
* @param array $commandSubject
6060
* @return string
6161
* @throws CommandException
62+
* @throws \Magento\Framework\Exception\NotFoundException
6263
*/
6364
private function getCommand(array $commandSubject): string
6465
{
6566
$details = $this->commandPool->get('get_transaction_details')
6667
->execute($commandSubject)
6768
->get();
6869

69-
if ($details['transaction']['transactionStatus'] === 'capturedPendingSettlement') {
70+
if ($this->canVoid($details, $commandSubject)) {
7071
return self::VOID;
71-
} elseif ($details['transaction']['transactionStatus'] !== 'settledSuccessfully') {
72+
}
73+
74+
if ($details['transaction']['transactionStatus'] !== 'settledSuccessfully') {
7275
throw new CommandException(__('This transaction cannot be refunded with its current status.'));
7376
}
7477

7578
return self::REFUND;
7679
}
80+
81+
/**
82+
* Checks if void command can be performed.
83+
*
84+
* @param array $details
85+
* @param array $commandSubject
86+
* @return bool
87+
* @throws CommandException
88+
*/
89+
private function canVoid(array $details, array $commandSubject) :bool
90+
{
91+
if ($details['transaction']['transactionStatus'] === 'capturedPendingSettlement') {
92+
if ((float) $details['transaction']['authAmount'] !== (float) $commandSubject['amount']) {
93+
throw new CommandException(
94+
__('The transaction has not been settled, a partial refund is not yet available.')
95+
);
96+
}
97+
98+
return true;
99+
}
100+
101+
return false;
102+
}
77103
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\AuthorizenetAcceptjs\Gateway\Response;
9+
10+
use Magento\Sales\Model\Order\Payment;
11+
12+
/**
13+
* Determines that parent transaction should be close for partial refund operation.
14+
*/
15+
class ClosePartialTransactionHandler extends CloseTransactionHandler
16+
{
17+
/**
18+
* Whether parent transaction should be closed.
19+
*
20+
* @param Payment $payment
21+
* @return bool
22+
*/
23+
public function shouldCloseParentTransaction(Payment $payment)
24+
{
25+
return !(bool)$payment->getCreditmemo()->getInvoice()->canRefund();
26+
}
27+
}

app/code/Magento/AuthorizenetAcceptjs/Gateway/Response/CloseTransactionHandler.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,19 @@ public function handle(array $handlingSubject, array $response): void
4747

4848
if ($payment instanceof Payment) {
4949
$payment->setIsTransactionClosed($this->closeTransaction);
50-
$payment->setShouldCloseParentTransaction(true);
50+
$payment->setShouldCloseParentTransaction($this->shouldCloseParentTransaction($payment));
5151
}
5252
}
53+
54+
/**
55+
* Whether parent transaction should be closed.
56+
*
57+
* @param Payment $payment
58+
* @return bool
59+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
60+
*/
61+
public function shouldCloseParentTransaction(Payment $payment)
62+
{
63+
return true;
64+
}
5365
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,29 @@
1+
# Magento_AuthorizenetAcceptjs module
2+
13
The Magento_AuthorizenetAcceptjs module implements the integration with the Authorize.Net payment gateway and makes the latter available as a payment method in Magento.
4+
5+
## Installation details
6+
7+
Before disabling or uninstalling this module, note that the `Magento_AuthorizenetCardinal` module depends on this module.
8+
9+
For information about module installation in Magento 2, see [Enable or disable modules](https://devdocs.magento.com/guides/v2.3/install-gde/install/cli/install-cli-subcommands-enable.html).
10+
11+
## Structure
12+
13+
`Gateway/` - the directory that contains payment gateway command interfaces and service classes.
14+
15+
For information about typical file structure of a module in Magento 2, see [Module file structure](http://devdocs.magento.com/guides/v2.3/extension-dev-guide/build/module-file-structure.html#module-file-structure).
16+
17+
## Extensibility
18+
19+
Extension developers can interact with the Magento_AuthorizenetAcceptjs 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).
20+
21+
[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_AuthorizenetAcceptjs module.
22+
23+
### Events
24+
25+
This module observes the following events:
26+
27+
- `payment_method_assign_data_authorizenet_acceptjs` event in the `Magento\AuthorizenetAcceptjs\Observer\DataAssignObserver` file.
28+
29+
For information about an event in Magento 2, see [Events and observers](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/events-and-observers.html#events).

app/code/Magento/AuthorizenetAcceptjs/Test/Unit/Gateway/Command/RefundTransactionStrategyCommandTest.php

Lines changed: 96 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,75 @@ public function testCommandWillVoidWhenTransactionIsPendingSettlement()
6262
->method('execute');
6363

6464
$this->commandPoolMock->method('get')
65-
->willReturnMap([
66-
['get_transaction_details', $this->transactionDetailsCommandMock],
67-
['void', $this->commandMock]
68-
]);
65+
->willReturnMap(
66+
[
67+
[
68+
'get_transaction_details',
69+
$this->transactionDetailsCommandMock
70+
],
71+
[
72+
'void',
73+
$this->commandMock
74+
]
75+
]
76+
);
6977

7078
$this->transactionResultMock->method('get')
71-
->willReturn([
72-
'transaction' => [
73-
'transactionStatus' => 'capturedPendingSettlement'
79+
->willReturn(
80+
[
81+
'transaction' => [
82+
'transactionStatus' => 'capturedPendingSettlement',
83+
'authAmount' => '20.19',
84+
]
7485
]
75-
]);
86+
);
7687

7788
$buildSubject = [
78-
'foo' => '123'
89+
'foo' => '123',
90+
'amount' => '20.19',
91+
];
92+
93+
$this->transactionDetailsCommandMock->expects($this->once())
94+
->method('execute')
95+
->with($buildSubject)
96+
->willReturn($this->transactionResultMock);
97+
98+
$this->command->execute($buildSubject);
99+
}
100+
101+
/**
102+
* @expectedException \Magento\Payment\Gateway\Command\CommandException
103+
* @expectedExceptionMessage The transaction has not been settled, a partial refund is not yet available.
104+
*/
105+
public function testCommandWillThrowExceptionWhenVoidTransactionIsPartial()
106+
{
107+
// Assert command is executed
108+
$this->commandMock->expects($this->never())
109+
->method('execute');
110+
111+
$this->commandPoolMock->method('get')
112+
->willReturnMap(
113+
[
114+
[
115+
'get_transaction_details',
116+
$this->transactionDetailsCommandMock
117+
],
118+
]
119+
);
120+
121+
$this->transactionResultMock->method('get')
122+
->willReturn(
123+
[
124+
'transaction' => [
125+
'transactionStatus' => 'capturedPendingSettlement',
126+
'authAmount' => '20.19',
127+
]
128+
]
129+
);
130+
131+
$buildSubject = [
132+
'foo' => '123',
133+
'amount' => '10.19',
79134
];
80135

81136
$this->transactionDetailsCommandMock->expects($this->once())
@@ -93,17 +148,27 @@ public function testCommandWillRefundWhenTransactionIsSettled()
93148
->method('execute');
94149

95150
$this->commandPoolMock->method('get')
96-
->willReturnMap([
97-
['get_transaction_details', $this->transactionDetailsCommandMock],
98-
['refund_settled', $this->commandMock]
99-
]);
151+
->willReturnMap(
152+
[
153+
[
154+
'get_transaction_details',
155+
$this->transactionDetailsCommandMock
156+
],
157+
[
158+
'refund_settled',
159+
$this->commandMock
160+
]
161+
]
162+
);
100163

101164
$this->transactionResultMock->method('get')
102-
->willReturn([
103-
'transaction' => [
104-
'transactionStatus' => 'settledSuccessfully'
165+
->willReturn(
166+
[
167+
'transaction' => [
168+
'transactionStatus' => 'settledSuccessfully'
169+
]
105170
]
106-
]);
171+
);
107172

108173
$buildSubject = [
109174
'foo' => '123'
@@ -128,16 +193,23 @@ public function testCommandWillThrowExceptionWhenTransactionIsInInvalidState()
128193
->method('execute');
129194

130195
$this->commandPoolMock->method('get')
131-
->willReturnMap([
132-
['get_transaction_details', $this->transactionDetailsCommandMock],
133-
]);
196+
->willReturnMap(
197+
[
198+
[
199+
'get_transaction_details',
200+
$this->transactionDetailsCommandMock
201+
],
202+
]
203+
);
134204

135205
$this->transactionResultMock->method('get')
136-
->willReturn([
137-
'transaction' => [
138-
'transactionStatus' => 'somethingIsWrong'
206+
->willReturn(
207+
[
208+
'transaction' => [
209+
'transactionStatus' => 'somethingIsWrong'
210+
]
139211
]
140-
]);
212+
);
141213

142214
$buildSubject = [
143215
'foo' => '123'

0 commit comments

Comments
 (0)