Skip to content

Commit 66c6ced

Browse files
committed
Merge remote-tracking branch 'mainline/2.4-develop' into MC-36526
2 parents ff103b2 + 6cb92ae commit 66c6ced

File tree

20 files changed

+699
-111
lines changed

20 files changed

+699
-111
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Setup\Patch\Data;
8+
9+
use Magento\Catalog\Setup\CategorySetup;
10+
use Magento\Catalog\Setup\CategorySetupFactory;
11+
use Magento\Framework\Setup\ModuleDataSetupInterface;
12+
use Magento\Framework\Setup\Patch\DataPatchInterface;
13+
14+
/**
15+
* Reorder Short Description/Description Product Attributes
16+
*/
17+
class UpdateProductDescriptionOrder implements DataPatchInterface
18+
{
19+
/**
20+
* @var ModuleDataSetupInterface
21+
*/
22+
private $moduleDataSetup;
23+
24+
/**
25+
* @var CategorySetupFactory
26+
*/
27+
private $categorySetupFactory;
28+
29+
/**
30+
* @param ModuleDataSetupInterface $moduleDataSetup
31+
* @param CategorySetupFactory $categorySetupFactory
32+
*/
33+
public function __construct(
34+
ModuleDataSetupInterface $moduleDataSetup,
35+
CategorySetupFactory $categorySetupFactory
36+
) {
37+
$this->moduleDataSetup = $moduleDataSetup;
38+
$this->categorySetupFactory = $categorySetupFactory;
39+
}
40+
41+
/**
42+
* @inheritdoc
43+
*/
44+
public function apply()
45+
{
46+
/** @var CategorySetup $categorySetup */
47+
$categorySetup = $this->categorySetupFactory->create(['setup' => $this->moduleDataSetup]);
48+
$entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
49+
50+
// Content
51+
$categorySetup->updateAttribute(
52+
$entityTypeId,
53+
'short_description',
54+
'frontend_label',
55+
'Short Description',
56+
100
57+
);
58+
$categorySetup->updateAttribute(
59+
$entityTypeId,
60+
'description',
61+
'frontend_label',
62+
'Description',
63+
110
64+
);
65+
66+
return $this;
67+
}
68+
69+
/**
70+
* @inheritdoc
71+
*/
72+
public static function getDependencies()
73+
{
74+
return [
75+
UpdateMediaAttributesBackendTypes::class,
76+
];
77+
}
78+
79+
/**
80+
* @inheritdoc
81+
*/
82+
public function getAliases()
83+
{
84+
return [];
85+
}
86+
}

app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<actionGroup ref="FillMainProductFormActionGroup" stepKey="fillBasicProductInfo" />
3333

3434
<click selector="{{AdminProductFormSection.contentTab}}" stepKey="clickContentTab" />
35+
<scrollTo selector="{{ProductDescriptionWYSIWYGToolbarSection.showHideBtn}}" y="-150" x="0" stepKey="scrollToDescription" />
3536
<waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.TinyMCE4}}" stepKey="waitForDescription" />
3637
<click selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertImageIcon}}" stepKey="clickInsertImageIcon1" />
3738
<click selector="{{ProductDescriptionWYSIWYGToolbarSection.Browse}}" stepKey="clickBrowse1" />
@@ -67,7 +68,7 @@
6768
<fillField selector="{{ProductDescriptionWYSIWYGToolbarSection.ImageDescription}}" userInput="{{ImageUpload1.content}}" stepKey="fillImageDescription1" />
6869
<fillField selector="{{ProductDescriptionWYSIWYGToolbarSection.Height}}" userInput="{{ImageUpload1.height}}" stepKey="fillImageHeight1" />
6970
<click selector="{{ProductDescriptionWYSIWYGToolbarSection.OkBtn}}" stepKey="clickOkBtn1" />
70-
<scrollTo selector="{{ProductDescriptionWYSIWYGToolbarSection.TinyMCE4}}" stepKey="scrollToTinyMCE4" />
71+
<scrollTo selector="{{ProductShortDescriptionWYSIWYGToolbarSection.showHideBtn}}" y="-150" x="0" stepKey="scrollToTinyMCE4" />
7172
<click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertImageIcon}}" stepKey="clickInsertImageIcon2" />
7273
<click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.Browse}}" stepKey="clickBrowse2" />
7374
<waitForLoadingMaskToDisappear stepKey="waitForLoading13"/>

app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<see selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertImageBtn}}" userInput="Insert Image..." stepKey="seeInsertImage1"/>
4545
<dontSee selector="{{TinyMCESection.InsertWidgetBtn}}" stepKey="insertWidget1" />
4646
<dontSee selector="{{TinyMCESection.InsertVariableBtn}}" stepKey="insertVariable1" />
47-
<scrollTo selector="{{ProductDescriptionWYSIWYGToolbarSection.showHideBtn}}" stepKey="scrollToDesShowHideBtn2" />
47+
<scrollTo selector="{{ProductShortDescriptionWYSIWYGToolbarSection.showHideBtn}}" y="-150" x="0" stepKey="scrollToDesShowHideBtn2" />
4848
<click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.showHideBtn}}" stepKey="clickShowHideBtn2" />
4949
<waitForElementVisible selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertImageBtn}}" stepKey="waitForInsertImage2" />
5050
<see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertImageBtn}}" userInput="Insert Image..." stepKey="seeInsertImage2"/>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="StorefrontGoToCustomerOrderDetailsPageActionGroup">
12+
<annotations>
13+
<description>Navigate to storefront order details page</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="orderId" type="string"/>
17+
<argument name="orderNumber" type="string"/>
18+
</arguments>
19+
<amOnPage url="{{StorefrontCustomerOrderViewPage.url(orderId)}}" stepKey="goToOrdersPage"/>
20+
<waitForPageLoad stepKey="waitForPageLoad"/>
21+
<waitForText selector="{{StorefrontCustomerAccountMainSection.pageTitle}}" userInput="{{orderNumber}}" stepKey="verifyOrderNo"/>
22+
</actionGroup>
23+
</actionGroups>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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="StorefrontVerifyCustomerOrderDataActionGroup">
12+
<annotations>
13+
<description>Verify a customer's order details on the view order page on the storefront</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="createdDate" type="string"/>
17+
<argument name="productName" type="string"/>
18+
<argument name="grandTotal" type="string"/>
19+
<argument name="orderPlacedBy" type="string"/>
20+
<argument name="paymentMethod" type="string"/>
21+
</arguments>
22+
<waitForText selector="{{StorefrontCustomerOrderViewSection.paymentMethod}}" userInput="{{paymentMethod}}" stepKey="storefrontVerifyPaymentMethod"/>
23+
<waitForText selector="{{StorefrontCustomerOrderViewSection.createdDate}}" userInput="{{createdDate}}" stepKey="storefrontVerifyOrderCreatedDate"/>
24+
<waitForText selector="{{StorefrontCustomerOrderViewSection.orderPlacedBy}}" userInput="{{orderPlacedBy}}" stepKey="storefrontVerifyOrderPlacedBy"/>
25+
<waitForText selector="{{StorefrontCustomerOrderViewSection.productName}}" userInput="{{productName}}" stepKey="storefrontVerifyProductName"/>
26+
<waitForText selector="{{StorefrontCustomerOrderViewSection.grandTotal}}" userInput="{{grandTotal}}" stepKey="storefrontVerifyGrandTotal"/>
27+
28+
</actionGroup>
29+
</actionGroups>

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerOrderViewSection.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,9 @@
1818
<element name="billingAddress" type="text" selector=".box.box-order-billing-address"/>
1919
<element name="orderStatusInGrid" type="text" selector="//td[contains(.,'{{orderId}}')]/../td[contains(.,'{{status}}')]" parameterized="true"/>
2020
<element name="pager" type="block" selector=".pager"/>
21+
<element name="createdDate" type="text" selector=".block-order-details-comments .comment-date"/>
22+
<element name="orderPlacedBy" type="text" selector=".block-order-details-comments .comment-content"/>
23+
<element name="productName" type="text" selector="//td[@data-th='Product Name']"/>
24+
<element name="grandTotal" type="text" selector="//tr[@class='grand_total']//td[@data-th='Grand Total']"/>
2125
</section>
2226
</sections>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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\PaypalGraphQl\Model\Plugin\Cart\PayflowPro;
9+
10+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
11+
use Magento\Paypal\Model\Config;
12+
use Magento\Quote\Model\Quote;
13+
use Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderPool;
14+
use Magento\Sales\Model\Order\Payment\Repository as PaymentRepository;
15+
use Magento\PaypalGraphQl\Observer\PayflowProSetCcData;
16+
17+
/**
18+
* Set additionalInformation on payment for PayflowPro method
19+
*/
20+
class SetPaymentMethodOnCart
21+
{
22+
/**
23+
* @var PaymentRepository
24+
*/
25+
private $paymentRepository;
26+
27+
/**
28+
* @var AdditionalDataProviderPool
29+
*/
30+
private $additionalDataProviderPool;
31+
32+
/**
33+
* @param PaymentRepository $paymentRepository
34+
* @param AdditionalDataProviderPool $additionalDataProviderPool
35+
*/
36+
public function __construct(
37+
PaymentRepository $paymentRepository,
38+
AdditionalDataProviderPool $additionalDataProviderPool
39+
) {
40+
$this->paymentRepository = $paymentRepository;
41+
$this->additionalDataProviderPool = $additionalDataProviderPool;
42+
}
43+
44+
/**
45+
* Set redirect URL paths on payment additionalInformation
46+
*
47+
* @param \Magento\QuoteGraphQl\Model\Cart\SetPaymentMethodOnCart $subject
48+
* @param mixed $result
49+
* @param Quote $cart
50+
* @param array $paymentData
51+
* @return void
52+
* @throws GraphQlInputException
53+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
54+
*/
55+
public function afterExecute(
56+
\Magento\QuoteGraphQl\Model\Cart\SetPaymentMethodOnCart $subject,
57+
$result,
58+
Quote $cart,
59+
array $paymentData
60+
): void {
61+
$paymentData = $this->additionalDataProviderPool->getData(Config::METHOD_PAYFLOWPRO, $paymentData);
62+
$cartCustomerId = (int)$cart->getCustomerId();
63+
if ($cartCustomerId === 0 &&
64+
array_key_exists(PayflowProSetCcData::IS_ACTIVE_PAYMENT_TOKEN_ENABLER, $paymentData)) {
65+
$payment = $cart->getPayment();
66+
$payment->unsAdditionalInformation(PayflowProSetCcData::IS_ACTIVE_PAYMENT_TOKEN_ENABLER);
67+
$payment->save();
68+
}
69+
}
70+
}

app/code/Magento/PaypalGraphQl/Model/Resolver/PayflowProResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ public function resolve(
126126
$this->parameters->fromString(urldecode($paypalPayload));
127127
$data = $this->parameters->toArray();
128128
try {
129-
$do = $this->dataObjectFactory->create(['data' => array_change_key_case($data, CASE_LOWER)]);
130-
$this->responseValidator->validate($do, $this->transparent);
131-
$this->transaction->savePaymentInQuote($do, $cart->getId());
129+
$response = $this->transaction->getResponseObject($data);
130+
$this->responseValidator->validate($response, $this->transparent);
131+
$this->transaction->savePaymentInQuote($response, $cart->getId());
132132
} catch (LocalizedException $exception) {
133133
$parameters['error'] = true;
134134
$parameters['error_msg'] = $exception->getMessage();
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\PaypalGraphQl\Observer;
10+
11+
use Magento\Framework\App\Config\ScopeConfigInterface;
12+
use Magento\Framework\Event\Observer;
13+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
14+
use Magento\Payment\Observer\AbstractDataAssignObserver;
15+
use Magento\Quote\Api\Data\PaymentInterface;
16+
17+
/**
18+
* Class PayflowProSetCcData set CcData to quote payment
19+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
20+
*/
21+
class PayflowProSetCcData extends AbstractDataAssignObserver
22+
{
23+
const XML_PATH_PAYMENT_PAYFLOWPRO_CC_VAULT_ACTIVE = "payment/payflowpro_cc_vault/active";
24+
const IS_ACTIVE_PAYMENT_TOKEN_ENABLER = "is_active_payment_token_enabler";
25+
26+
/**
27+
* Core store config
28+
*
29+
* @var ScopeConfigInterface
30+
*/
31+
private $scopeConfig;
32+
33+
/**
34+
* @param ScopeConfigInterface $scopeConfig
35+
*/
36+
public function __construct(
37+
ScopeConfigInterface $scopeConfig
38+
) {
39+
$this->scopeConfig = $scopeConfig;
40+
}
41+
42+
/**
43+
* Set CcData
44+
*
45+
* @param Observer $observer
46+
*
47+
* @throws GraphQlInputException
48+
*/
49+
public function execute(Observer $observer)
50+
{
51+
$dataObject = $this->readDataArgument($observer);
52+
$additionalData = $dataObject->getData(PaymentInterface::KEY_ADDITIONAL_DATA);
53+
$paymentModel = $this->readPaymentModelArgument($observer);
54+
55+
if (!isset($additionalData['cc_details'])) {
56+
return;
57+
}
58+
59+
if ($this->isPayflowProVaultEnable()) {
60+
if (!isset($additionalData[self::IS_ACTIVE_PAYMENT_TOKEN_ENABLER])) {
61+
$paymentModel->setData(self::IS_ACTIVE_PAYMENT_TOKEN_ENABLER, false);
62+
}
63+
64+
$paymentModel->setData(
65+
self::IS_ACTIVE_PAYMENT_TOKEN_ENABLER,
66+
$additionalData[self::IS_ACTIVE_PAYMENT_TOKEN_ENABLER]
67+
);
68+
} else {
69+
$paymentModel->setData(self::IS_ACTIVE_PAYMENT_TOKEN_ENABLER, false);
70+
}
71+
72+
$ccData = $additionalData['cc_details'];
73+
$paymentModel->setCcType($ccData['cc_type']);
74+
$paymentModel->setCcExpYear($ccData['cc_exp_year']);
75+
$paymentModel->setCcExpMonth($ccData['cc_exp_month']);
76+
$paymentModel->setCcLast4($ccData['cc_last_4']);
77+
}
78+
79+
/**
80+
* Check if payflowpro vault is enable
81+
*
82+
* @return bool
83+
*/
84+
private function isPayflowProVaultEnable()
85+
{
86+
return (bool)$this->scopeConfig->getValue(self::XML_PATH_PAYMENT_PAYFLOWPRO_CC_VAULT_ACTIVE);
87+
}
88+
}

app/code/Magento/PaypalGraphQl/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"magento/module-store": "*"
1717
},
1818
"suggest": {
19-
"magento/module-graph-ql": "*"
19+
"magento/module-graph-ql": "*",
20+
"magento/module-store-graph-ql": "*"
2021
},
2122
"type": "magento2-module",
2223
"license": [

0 commit comments

Comments
 (0)