Skip to content

Commit 45ec553

Browse files
author
Vitaliy Boyko
committed
Merge branches '2.3-develop' and 'GraphQl-812-testAddVariationFromAnotherConfigurableProductToCart' of github.com:magento/graphql-ce into GraphQl-812-testAddVariationFromAnotherConfigurableProductToCart
# Conflicts: # dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php
2 parents 2f7b1d9 + ebee07a commit 45ec553

File tree

168 files changed

+3691
-599
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

+3691
-599
lines changed

app/code/Magento/AmqpStore/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
# Amqp Store
1+
# Magento_AmqpStore module
22

3-
**AmqpStore** provides ability to specify store before publish messages with Amqp.
3+
The Magento_AmqpStore module provides the ability to specify a store before publishing messages with the Advanced Message Queuing Protocol (AMQP).
4+
5+
## Extensibility
6+
7+
Extension developers can interact with the Magento_AmqpStore module using plugins. 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_AmqpStore module.
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).

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'

app/code/Magento/AuthorizenetAcceptjs/etc/config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<can_capture_partial>0</can_capture_partial>
2525
<can_authorize>1</can_authorize>
2626
<can_refund>1</can_refund>
27+
<can_refund_partial_per_invoice>1</can_refund_partial_per_invoice>
2728
<can_capture>1</can_capture>
2829
<can_void>1</can_void>
2930
<can_accept_payment>1</can_accept_payment>

app/code/Magento/AuthorizenetAcceptjs/etc/di.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,7 @@
206206
<arguments>
207207
<argument name="handlers" xsi:type="array">
208208
<item name="transaction_id" xsi:type="string">Magento\AuthorizenetAcceptjs\Gateway\Response\TransactionIdHandler</item>
209-
<item name="close_parent_transaction" xsi:type="string">Magento\AuthorizenetAcceptjs\Gateway\Response\CloseParentTransactionHandler</item>
210-
<item name="close_transaction" xsi:type="string">Magento\AuthorizenetAcceptjs\Gateway\Response\CloseTransactionHandler</item>
209+
<item name="close_transaction" xsi:type="string">Magento\AuthorizenetAcceptjs\Gateway\Response\ClosePartialTransactionHandler</item>
211210
</argument>
212211
</arguments>
213212
</virtualType>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ Authorize.net,Authorize.net
1919
"ccLast4","Last 4 Digits of Card"
2020
"There was an error while trying to process the refund.","There was an error while trying to process the refund."
2121
"This transaction cannot be refunded with its current status.","This transaction cannot be refunded with its current status."
22+
"The transaction has not been settled, a partial refund is not yet available.","The transaction has not been settled, a partial refund is not yet available."
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
The AuthorizenetCardinal module provides a possibility to enable 3-D Secure 2.0 support for AuthorizenetAcceptjs payment integration.
1+
# Magento_AuthorizenetCardinal module
2+
3+
Use the Magento_AuthorizenetCardinal module to enable 3D Secure 2.0 support for AuthorizenetAcceptjs payment integrations.
4+
5+
## Structure
6+
7+
`Gateway/` - the directory that contains payment gateway command interfaces and service classes.
8+
9+
For information about typical file structure of a module in Magento 2, see [Module file structure](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/build/module-file-structure.html#module-file-structure).
10+
11+
## Extensibility
12+
13+
Extension developers can interact with the Magento_AuthorizenetCardinal 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).
14+
15+
[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_AuthorizenetCardinal module.
16+
17+
### Events
18+
19+
This module observes the following events:
20+
21+
- `payment_method_assign_data_authorizenet_acceptjs` event in the `Magento\AuthorizenetCardinal\Observer\DataAssignObserver` file.
22+
23+
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).

0 commit comments

Comments
 (0)