Skip to content

Commit

Permalink
Merge branch 2.3-develop into ENGCOM-4678-magento-magento2-22147
Browse files Browse the repository at this point in the history
  • Loading branch information
magento-engcom-team committed Apr 15, 2019
2 parents 8fe7ee8 + 810780b commit 1b025ad
Show file tree
Hide file tree
Showing 327 changed files with 10,344 additions and 4,529 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ Tests:
* Refactored controller actions in the Product area
* 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
* Data Migration Tool
* The Data Migraiton Tool is published in the separate [repository](https://github.com/magento/data-migration-tool-ce "Data Migration Tool repository")
* The Data Migration Tool is published in the separate [repository](https://github.com/magento/data-migration-tool-ce "Data Migration Tool repository")
* Fixed bugs
* Fixed an issue where error appeared during placing order with virtual product
* Fixed an issue where billing and shipping sections didn't contain address information on order print
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting-edge, feature-rich eCommerce solution that gets results.

## Magento System Requirements
[Magento System Requirements](https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements2.html).
[Magento System Requirements](https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements.html).

## Install Magento

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<title value="AdvancedReportingButtonTest"/>
<description value="Test log in to AdvancedReporting and tests AdvancedReportingButtonTest"/>
<testCaseId value="MC-14800"/>
<skip>
<issueId value="MC-14800" />
</skip>
<severity value="CRITICAL"/>
<group value="analytics"/>
<group value="mtf_migrated"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*/
namespace Magento\Backend\Controller\Adminhtml\Dashboard;

use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\App\Action\HttpPostActionInterface;

/**
* Get most viewed products controller.
*/
class ProductsViewed extends AjaxBlock implements HttpGetActionInterface
class ProductsViewed extends AjaxBlock implements HttpPostActionInterface
{
/**
* Gets most viewed products list
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertAdminSuccessLoginActionGroup">
<waitForElementVisible selector="{{AdminHeaderSection.adminUserAccountText}}" stepKey="waitForAdminAccountTextVisible" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertMessageOnAdminLoginActionGroup">
<arguments>
<argument name="message" type="string" defaultValue="The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later." />
<argument name="messageType" type="string" defaultValue="error" />
</arguments>
<see userInput="{{message}}" selector="{{AdminLoginMessagesSection.messageByType(messageType)}}" stepKey="verifyMessage" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="LoginAdminWithCredentialsActionGroup">
<arguments>
<argument name="adminUser" type="string" />
<argument name="adminPassword" type="string" />
</arguments>
<amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}" stepKey="navigateToAdmin"/>
<fillField selector="{{AdminLoginFormSection.username}}" userInput="{{adminUser}}" stepKey="fillUsername"/>
<fillField selector="{{AdminLoginFormSection.password}}" userInput="{{adminPassword}}" stepKey="fillPassword"/>
<click selector="{{AdminLoginFormSection.signIn}}" stepKey="clickLogin"/>
<closeAdminNotification stepKey="closeAdminNotification"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="LoginAsAdmin">
<arguments>
<argument name="adminUser" defaultValue="_ENV"/>
<argument name="adminUser" type="entity" defaultValue="DefaultAdminUser"/>
</arguments>
<amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin"/>
<fillField selector="{{AdminLoginFormSection.username}}" userInput="{{adminUser.MAGENTO_ADMIN_USERNAME}}" stepKey="fillUsername"/>
<fillField selector="{{AdminLoginFormSection.password}}" userInput="{{adminUser.MAGENTO_ADMIN_PASSWORD}}" stepKey="fillPassword"/>
<fillField selector="{{AdminLoginFormSection.username}}" userInput="{{adminUser.username}}" stepKey="fillUsername"/>
<fillField selector="{{AdminLoginFormSection.password}}" userInput="{{adminUser.password}}" stepKey="fillPassword"/>
<click selector="{{AdminLoginFormSection.signIn}}" stepKey="clickLogin"/>
<closeAdminNotification stepKey="closeAdminNotification"/>
</actionGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="SetWebsiteCountryOptionsToDefaultActionGroup">
<conditionalClick selector="{{CountryOptionsSection.countryOptions}}" dependentSelector="{{CountryOptionsSection.countryOptionsOpen}}" visible="false" stepKey="clickOnStoreInformation3"/>
<waitForElementVisible selector="{{CountryOptionsSection.topDestinations}}" stepKey="waitCheckboxToBeVisible3"/>
<checkOption selector="{{CountryOptionsSection.generalCountryAllowInherit}}" stepKey="setToDefault1"/>
<checkOption selector="{{CountryOptionsSection.generalCountryDefaultInherit}}" stepKey="setToDefault2"/>
<click selector="{{ContentManagementSection.Save}}" stepKey="saveDefaultConfig"/>
<waitForPageLoad stepKey="waitForSavingSystemConfiguration"/>
<see userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminHeaderSection">
<element name="pageTitle" type="text" selector=".page-header h1.page-title"/>
<element name="adminUserAccountText" type="text" selector=".page-header .admin-user-account-text" />
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminLoginMessagesSection">
<element name="messageByType" type="block" selector=".login-content .messages .message-{{messageType}}" parameterized="true" />
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="CountryOptionsSection">
<element name="allowedCountries" type="select" selector="#general_country_allow"/>
<element name="notAllowedCountry" type="button" selector="#general_country_allow option:not([selected])"/>
<element name="generalCountryAllowInherit" type="checkbox" selector="#general_country_allow_inherit"/>
<element name="generalCountryDefaultInherit" type="checkbox" selector="#general_country_default_inherit"/>
<element name="generalCountryDefault" type="select" selector="#general_country_default"/>
</section>
</sections>
177 changes: 177 additions & 0 deletions app/code/Magento/Braintree/Model/Multishipping/PlaceOrder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Braintree\Model\Multishipping;

use Magento\Braintree\Gateway\Command\GetPaymentNonceCommand;
use Magento\Braintree\Model\Ui\ConfigProvider;
use Magento\Braintree\Observer\DataAssignObserver;
use Magento\Braintree\Model\Ui\PayPal\ConfigProvider as PaypalConfigProvider;
use Magento\Multishipping\Model\Checkout\Type\Multishipping\PlaceOrderInterface;
use Magento\Sales\Api\Data\OrderInterface;
use Magento\Sales\Api\Data\OrderPaymentExtensionInterface;
use Magento\Sales\Api\Data\OrderPaymentExtensionInterfaceFactory;
use Magento\Sales\Api\Data\OrderPaymentInterface;
use Magento\Sales\Api\OrderManagementInterface;
use Magento\Vault\Api\Data\PaymentTokenInterface;

/**
* Order payments processing for multishipping checkout flow.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class PlaceOrder implements PlaceOrderInterface
{
/**
* @var OrderManagementInterface
*/
private $orderManagement;

/**
* @var OrderPaymentExtensionInterfaceFactory
*/
private $paymentExtensionFactory;

/**
* @var GetPaymentNonceCommand
*/
private $getPaymentNonceCommand;

/**
* @param OrderManagementInterface $orderManagement
* @param OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory
* @param GetPaymentNonceCommand $getPaymentNonceCommand
*/
public function __construct(
OrderManagementInterface $orderManagement,
OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory,
GetPaymentNonceCommand $getPaymentNonceCommand
) {
$this->orderManagement = $orderManagement;
$this->paymentExtensionFactory = $paymentExtensionFactory;
$this->getPaymentNonceCommand = $getPaymentNonceCommand;
}

/**
* @inheritdoc
*/
public function place(array $orderList): array
{
if (empty($orderList)) {
return [];
}

$errorList = [];
$firstOrder = $this->orderManagement->place(array_shift($orderList));
// get payment token from first placed order
$paymentToken = $this->getPaymentToken($firstOrder);

foreach ($orderList as $order) {
try {
/** @var OrderInterface $order */
$orderPayment = $order->getPayment();
$this->setVaultPayment($orderPayment, $paymentToken);
$this->orderManagement->place($order);
} catch (\Exception $e) {
$incrementId = $order->getIncrementId();
$errorList[$incrementId] = $e;
}
}

return $errorList;
}

/**
* Sets vault payment method.
*
* @param OrderPaymentInterface $orderPayment
* @param PaymentTokenInterface $paymentToken
* @return void
*/
private function setVaultPayment(OrderPaymentInterface $orderPayment, PaymentTokenInterface $paymentToken): void
{
$vaultMethod = $this->getVaultPaymentMethod(
$orderPayment->getMethod()
);
$orderPayment->setMethod($vaultMethod);

$publicHash = $paymentToken->getPublicHash();
$customerId = $paymentToken->getCustomerId();
$result = $this->getPaymentNonceCommand->execute(
['public_hash' => $publicHash, 'customer_id' => $customerId]
)
->get();

$orderPayment->setAdditionalInformation(
DataAssignObserver::PAYMENT_METHOD_NONCE,
$result['paymentMethodNonce']
);
$orderPayment->setAdditionalInformation(
PaymentTokenInterface::PUBLIC_HASH,
$publicHash
);
$orderPayment->setAdditionalInformation(
PaymentTokenInterface::CUSTOMER_ID,
$customerId
);
}

/**
* Returns vault payment method.
*
* For placing sequence of orders, we need to replace the original method on the vault method.
*
* @param string $method
* @return string
*/
private function getVaultPaymentMethod(string $method): string
{
$vaultPaymentMap = [
ConfigProvider::CODE => ConfigProvider::CC_VAULT_CODE,
PaypalConfigProvider::PAYPAL_CODE => PaypalConfigProvider::PAYPAL_VAULT_CODE
];

return $vaultPaymentMap[$method] ?? $method;
}

/**
* Returns payment token.
*
* @param OrderInterface $order
* @return PaymentTokenInterface
* @throws \BadMethodCallException
*/
private function getPaymentToken(OrderInterface $order): PaymentTokenInterface
{
$orderPayment = $order->getPayment();
$extensionAttributes = $this->getExtensionAttributes($orderPayment);
$paymentToken = $extensionAttributes->getVaultPaymentToken();

if ($paymentToken === null) {
throw new \BadMethodCallException('Vault Payment Token should be defined for placed order payment.');
}

return $paymentToken;
}

/**
* Gets payment extension attributes.
*
* @param OrderPaymentInterface $payment
* @return OrderPaymentExtensionInterface
*/
private function getExtensionAttributes(OrderPaymentInterface $payment): OrderPaymentExtensionInterface
{
$extensionAttributes = $payment->getExtensionAttributes();
if (null === $extensionAttributes) {
$extensionAttributes = $this->paymentExtensionFactory->create();
$payment->setExtensionAttributes($extensionAttributes);
}

return $extensionAttributes;
}
}
3 changes: 2 additions & 1 deletion app/code/Magento/Braintree/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"magento/module-quote": "*",
"magento/module-sales": "*",
"magento/module-ui": "*",
"magento/module-vault": "*"
"magento/module-vault": "*",
"magento/module-multishipping": "*"
},
"suggest": {
"magento/module-checkout-agreements": "*",
Expand Down
Loading

0 comments on commit 1b025ad

Please sign in to comment.