Skip to content

Commit 70b6a9e

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into set-guest-email-mutation
# Conflicts: # app/code/Magento/QuoteGraphQl/etc/schema.graphqls
2 parents ed0dd32 + aec044d commit 70b6a9e

File tree

304 files changed

+8096
-3854
lines changed

Some content is hidden

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

304 files changed

+8096
-3854
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ Tests:
785785
* Refactored controller actions in the Product area
786786
* Moved commands cache.php, indexer.php, log.php, test.php, compiler.php, singletenant\_compiler.php, generator.php, pack.php, deploy.php and file\_assembler.php to the new bin/magento CLI framework
787787
* Data Migration Tool
788-
* The Data Migraiton Tool is published in the separate [repository](https://github.com/magento/data-migration-tool-ce "Data Migration Tool repository")
788+
* The Data Migration Tool is published in the separate [repository](https://github.com/magento/data-migration-tool-ce "Data Migration Tool repository")
789789
* Fixed bugs
790790
* Fixed an issue where error appeared during placing order with virtual product
791791
* Fixed an issue where billing and shipping sections didn't contain address information on order print

app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingButtonTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<title value="AdvancedReportingButtonTest"/>
1414
<description value="Test log in to AdvancedReporting and tests AdvancedReportingButtonTest"/>
1515
<testCaseId value="MC-14800"/>
16+
<skip>
17+
<issueId value="MC-14800" />
18+
</skip>
1619
<severity value="CRITICAL"/>
1720
<group value="analytics"/>
1821
<group value="mtf_migrated"/>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertAdminSuccessLoginActionGroup">
12+
<waitForElementVisible selector="{{AdminHeaderSection.adminUserAccountText}}" stepKey="waitForAdminAccountTextVisible" />
13+
</actionGroup>
14+
</actionGroups>
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="AssertMessageOnAdminLoginActionGroup">
12+
<arguments>
13+
<argument name="message" type="string" defaultValue="The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later." />
14+
<argument name="messageType" type="string" defaultValue="error" />
15+
</arguments>
16+
<see userInput="{{message}}" selector="{{AdminLoginMessagesSection.messageByType(messageType)}}" stepKey="verifyMessage" />
17+
</actionGroup>
18+
</actionGroups>
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="LoginAdminWithCredentialsActionGroup">
12+
<arguments>
13+
<argument name="adminUser" type="string" />
14+
<argument name="adminPassword" type="string" />
15+
</arguments>
16+
<amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}" stepKey="navigateToAdmin"/>
17+
<fillField selector="{{AdminLoginFormSection.username}}" userInput="{{adminUser}}" stepKey="fillUsername"/>
18+
<fillField selector="{{AdminLoginFormSection.password}}" userInput="{{adminPassword}}" stepKey="fillPassword"/>
19+
<click selector="{{AdminLoginFormSection.signIn}}" stepKey="clickLogin"/>
20+
<closeAdminNotification stepKey="closeAdminNotification"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="LoginAsAdmin">
1212
<arguments>
13-
<argument name="adminUser" defaultValue="_ENV"/>
13+
<argument name="adminUser" type="entity" defaultValue="DefaultAdminUser"/>
1414
</arguments>
1515
<amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin"/>
16-
<fillField selector="{{AdminLoginFormSection.username}}" userInput="{{adminUser.MAGENTO_ADMIN_USERNAME}}" stepKey="fillUsername"/>
17-
<fillField selector="{{AdminLoginFormSection.password}}" userInput="{{adminUser.MAGENTO_ADMIN_PASSWORD}}" stepKey="fillPassword"/>
16+
<fillField selector="{{AdminLoginFormSection.username}}" userInput="{{adminUser.username}}" stepKey="fillUsername"/>
17+
<fillField selector="{{AdminLoginFormSection.password}}" userInput="{{adminUser.password}}" stepKey="fillPassword"/>
1818
<click selector="{{AdminLoginFormSection.signIn}}" stepKey="clickLogin"/>
1919
<closeAdminNotification stepKey="closeAdminNotification"/>
2020
</actionGroup>

app/code/Magento/Backend/Test/Mftf/Section/AdminHeaderSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminHeaderSection">
1212
<element name="pageTitle" type="text" selector=".page-header h1.page-title"/>
13+
<element name="adminUserAccountText" type="text" selector=".page-header .admin-user-account-text" />
1314
</section>
1415
</sections>
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="AdminLoginMessagesSection">
12+
<element name="messageByType" type="block" selector=".login-content .messages .message-{{messageType}}" parameterized="true" />
13+
</section>
14+
</sections>
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
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\Braintree\Model\Multishipping;
9+
10+
use Magento\Braintree\Gateway\Command\GetPaymentNonceCommand;
11+
use Magento\Braintree\Model\Ui\ConfigProvider;
12+
use Magento\Braintree\Observer\DataAssignObserver;
13+
use Magento\Braintree\Model\Ui\PayPal\ConfigProvider as PaypalConfigProvider;
14+
use Magento\Multishipping\Model\Checkout\Type\Multishipping\PlaceOrderInterface;
15+
use Magento\Sales\Api\Data\OrderInterface;
16+
use Magento\Sales\Api\Data\OrderPaymentExtensionInterface;
17+
use Magento\Sales\Api\Data\OrderPaymentExtensionInterfaceFactory;
18+
use Magento\Sales\Api\Data\OrderPaymentInterface;
19+
use Magento\Sales\Api\OrderManagementInterface;
20+
use Magento\Vault\Api\Data\PaymentTokenInterface;
21+
22+
/**
23+
* Order payments processing for multishipping checkout flow.
24+
*
25+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
26+
*/
27+
class PlaceOrder implements PlaceOrderInterface
28+
{
29+
/**
30+
* @var OrderManagementInterface
31+
*/
32+
private $orderManagement;
33+
34+
/**
35+
* @var OrderPaymentExtensionInterfaceFactory
36+
*/
37+
private $paymentExtensionFactory;
38+
39+
/**
40+
* @var GetPaymentNonceCommand
41+
*/
42+
private $getPaymentNonceCommand;
43+
44+
/**
45+
* @param OrderManagementInterface $orderManagement
46+
* @param OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory
47+
* @param GetPaymentNonceCommand $getPaymentNonceCommand
48+
*/
49+
public function __construct(
50+
OrderManagementInterface $orderManagement,
51+
OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory,
52+
GetPaymentNonceCommand $getPaymentNonceCommand
53+
) {
54+
$this->orderManagement = $orderManagement;
55+
$this->paymentExtensionFactory = $paymentExtensionFactory;
56+
$this->getPaymentNonceCommand = $getPaymentNonceCommand;
57+
}
58+
59+
/**
60+
* @inheritdoc
61+
*/
62+
public function place(array $orderList): array
63+
{
64+
if (empty($orderList)) {
65+
return [];
66+
}
67+
68+
$errorList = [];
69+
$firstOrder = $this->orderManagement->place(array_shift($orderList));
70+
// get payment token from first placed order
71+
$paymentToken = $this->getPaymentToken($firstOrder);
72+
73+
foreach ($orderList as $order) {
74+
try {
75+
/** @var OrderInterface $order */
76+
$orderPayment = $order->getPayment();
77+
$this->setVaultPayment($orderPayment, $paymentToken);
78+
$this->orderManagement->place($order);
79+
} catch (\Exception $e) {
80+
$incrementId = $order->getIncrementId();
81+
$errorList[$incrementId] = $e;
82+
}
83+
}
84+
85+
return $errorList;
86+
}
87+
88+
/**
89+
* Sets vault payment method.
90+
*
91+
* @param OrderPaymentInterface $orderPayment
92+
* @param PaymentTokenInterface $paymentToken
93+
* @return void
94+
*/
95+
private function setVaultPayment(OrderPaymentInterface $orderPayment, PaymentTokenInterface $paymentToken): void
96+
{
97+
$vaultMethod = $this->getVaultPaymentMethod(
98+
$orderPayment->getMethod()
99+
);
100+
$orderPayment->setMethod($vaultMethod);
101+
102+
$publicHash = $paymentToken->getPublicHash();
103+
$customerId = $paymentToken->getCustomerId();
104+
$result = $this->getPaymentNonceCommand->execute(
105+
['public_hash' => $publicHash, 'customer_id' => $customerId]
106+
)
107+
->get();
108+
109+
$orderPayment->setAdditionalInformation(
110+
DataAssignObserver::PAYMENT_METHOD_NONCE,
111+
$result['paymentMethodNonce']
112+
);
113+
$orderPayment->setAdditionalInformation(
114+
PaymentTokenInterface::PUBLIC_HASH,
115+
$publicHash
116+
);
117+
$orderPayment->setAdditionalInformation(
118+
PaymentTokenInterface::CUSTOMER_ID,
119+
$customerId
120+
);
121+
}
122+
123+
/**
124+
* Returns vault payment method.
125+
*
126+
* For placing sequence of orders, we need to replace the original method on the vault method.
127+
*
128+
* @param string $method
129+
* @return string
130+
*/
131+
private function getVaultPaymentMethod(string $method): string
132+
{
133+
$vaultPaymentMap = [
134+
ConfigProvider::CODE => ConfigProvider::CC_VAULT_CODE,
135+
PaypalConfigProvider::PAYPAL_CODE => PaypalConfigProvider::PAYPAL_VAULT_CODE
136+
];
137+
138+
return $vaultPaymentMap[$method] ?? $method;
139+
}
140+
141+
/**
142+
* Returns payment token.
143+
*
144+
* @param OrderInterface $order
145+
* @return PaymentTokenInterface
146+
* @throws \BadMethodCallException
147+
*/
148+
private function getPaymentToken(OrderInterface $order): PaymentTokenInterface
149+
{
150+
$orderPayment = $order->getPayment();
151+
$extensionAttributes = $this->getExtensionAttributes($orderPayment);
152+
$paymentToken = $extensionAttributes->getVaultPaymentToken();
153+
154+
if ($paymentToken === null) {
155+
throw new \BadMethodCallException('Vault Payment Token should be defined for placed order payment.');
156+
}
157+
158+
return $paymentToken;
159+
}
160+
161+
/**
162+
* Gets payment extension attributes.
163+
*
164+
* @param OrderPaymentInterface $payment
165+
* @return OrderPaymentExtensionInterface
166+
*/
167+
private function getExtensionAttributes(OrderPaymentInterface $payment): OrderPaymentExtensionInterface
168+
{
169+
$extensionAttributes = $payment->getExtensionAttributes();
170+
if (null === $extensionAttributes) {
171+
$extensionAttributes = $this->paymentExtensionFactory->create();
172+
$payment->setExtensionAttributes($extensionAttributes);
173+
}
174+
175+
return $extensionAttributes;
176+
}
177+
}

app/code/Magento/Braintree/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"magento/module-quote": "*",
2222
"magento/module-sales": "*",
2323
"magento/module-ui": "*",
24-
"magento/module-vault": "*"
24+
"magento/module-vault": "*",
25+
"magento/module-multishipping": "*"
2526
},
2627
"suggest": {
2728
"magento/module-checkout-agreements": "*",

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<paymentInfoKeys>cc_type,cc_number,avsPostalCodeResponseCode,avsStreetAddressResponseCode,cvvResponseCode,processorAuthorizationCode,processorResponseCode,processorResponseText,liabilityShifted,liabilityShiftPossible,riskDataId,riskDataDecision</paymentInfoKeys>
4343
<avs_ems_adapter>Magento\Braintree\Model\AvsEmsCodeMapper</avs_ems_adapter>
4444
<cvv_ems_adapter>Magento\Braintree\Model\CvvEmsCodeMapper</cvv_ems_adapter>
45-
<group>braintree</group>
45+
<group>braintree_group</group>
4646
</braintree>
4747
<braintree_paypal>
4848
<model>BraintreePayPalFacade</model>
@@ -68,7 +68,7 @@
6868
<privateInfoKeys>processorResponseCode,processorResponseText,paymentId</privateInfoKeys>
6969
<paymentInfoKeys>processorResponseCode,processorResponseText,paymentId,payerEmail</paymentInfoKeys>
7070
<supported_locales>en_US,en_GB,en_AU,da_DK,fr_FR,fr_CA,de_DE,zh_HK,it_IT,nl_NL,no_NO,pl_PL,es_ES,sv_SE,tr_TR,pt_BR,ja_JP,id_ID,ko_KR,pt_PT,ru_RU,th_TH,zh_CN,zh_TW</supported_locales>
71-
<group>braintree</group>
71+
<group>braintree_group</group>
7272
</braintree_paypal>
7373
<braintree_cc_vault>
7474
<model>BraintreeCreditCardVaultFacade</model>
@@ -78,7 +78,7 @@
7878
<tokenFormat>Magento\Braintree\Model\InstantPurchase\CreditCard\TokenFormatter</tokenFormat>
7979
<additionalInformation>Magento\Braintree\Model\InstantPurchase\PaymentAdditionalInformationProvider</additionalInformation>
8080
</instant_purchase>
81-
<group>braintree</group>
81+
<group>braintree_group</group>
8282
</braintree_cc_vault>
8383
<braintree_paypal_vault>
8484
<model>BraintreePayPalVaultFacade</model>
@@ -88,7 +88,7 @@
8888
<tokenFormat>Magento\Braintree\Model\InstantPurchase\PayPal\TokenFormatter</tokenFormat>
8989
<additionalInformation>Magento\Braintree\Model\InstantPurchase\PaymentAdditionalInformationProvider</additionalInformation>
9090
</instant_purchase>
91-
<group>braintree</group>
91+
<group>braintree_group</group>
9292
</braintree_paypal_vault>
9393
</payment>
9494
</default>

app/code/Magento/Braintree/etc/frontend/di.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,12 @@
6161
<argument name="resolver" xsi:type="object">Magento\Braintree\Model\LocaleResolver</argument>
6262
</arguments>
6363
</type>
64+
<type name="Magento\Multishipping\Model\Checkout\Type\Multishipping\PlaceOrderPool">
65+
<arguments>
66+
<argument name="services" xsi:type="array">
67+
<item name="braintree" xsi:type="string">Magento\Braintree\Model\Multishipping\PlaceOrder</item>
68+
<item name="braintree_paypal" xsi:type="string">Magento\Braintree\Model\Multishipping\PlaceOrder</item>
69+
</argument>
70+
</arguments>
71+
</type>
6472
</config>

app/code/Magento/Braintree/etc/payment.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@
88
<payment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Payment:etc/payment.xsd">
1010
<groups>
11-
<group id="braintree">
11+
<group id="braintree_group">
1212
<label>Braintree</label>
1313
</group>
1414
</groups>
15+
<methods>
16+
<method name="braintree">
17+
<allow_multiple_address>1</allow_multiple_address>
18+
</method>
19+
<method name="braintree_paypal">
20+
<allow_multiple_address>1</allow_multiple_address>
21+
</method>
22+
</methods>
1523
</payment>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
10+
<body>
11+
<referenceBlock name="checkout_billing">
12+
<arguments>
13+
<argument name="form_templates" xsi:type="array">
14+
<item name="braintree" xsi:type="string">Magento_Braintree::multishipping/form.phtml</item>
15+
<item name="braintree_paypal" xsi:type="string">Magento_Braintree::multishipping/form_paypal.phtml</item>
16+
</argument>
17+
</arguments>
18+
</referenceBlock>
19+
</body>
20+
</page>

0 commit comments

Comments
 (0)