Skip to content

Commit a817d76

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into mtf-eol-pr
2 parents 06a67d1 + 75cf826 commit a817d76

File tree

55 files changed

+1327
-330
lines changed

Some content is hidden

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

55 files changed

+1327
-330
lines changed

app/code/Magento/Backend/App/Request/BackendValidator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ private function createException(
146146
$exception = new InvalidRequestException($response);
147147
} else {
148148
//For regular requests.
149+
$startPageUrl = $this->backendUrl->getStartupPageUrl();
149150
$response = $this->redirectFactory->create()
150-
->setUrl($this->backendUrl->getStartupPageUrl());
151+
->setUrl($this->backendUrl->getUrl($startPageUrl));
151152
$exception = new InvalidRequestException(
152153
$response,
153154
[

app/code/Magento/CatalogGraphQl/etc/graphql/di.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,15 @@
3838
</item>
3939
<item name="customizable_options" xsi:type="array">
4040
<item name="field" xsi:type="string">CustomizableFieldOption</item>
41+
<item name="date" xsi:type="string">CustomizableDateOption</item>
4142
<item name="date_time" xsi:type="string">CustomizableDateOption</item>
43+
<item name="time" xsi:type="string">CustomizableDateOption</item>
4244
<item name="file" xsi:type="string">CustomizableFileOption</item>
4345
<item name="area" xsi:type="string">CustomizableAreaOption</item>
4446
<item name="drop_down" xsi:type="string">CustomizableDropDownOption</item>
47+
<item name="multiple" xsi:type="string">CustomizableMultipleOption</item>
4548
<item name="radio" xsi:type="string">CustomizableRadioOption</item>
49+
<item name="checkbox" xsi:type="string">CustomizableCheckboxOption</item>
4650
</item>
4751
</argument>
4852
</arguments>

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,19 @@ type CustomizableDropDownValue @doc(description: "CustomizableDropDownValue defi
323323
sort_order: Int @doc(description: "The order in which the option is displayed")
324324
}
325325

326+
type CustomizableMultipleOption implements CustomizableOptionInterface @doc(description: "CustomizableMultipleOption contains information about a multiselect that is defined as part of a customizable option") {
327+
value: [CustomizableMultipleValue] @doc(description: "An array that defines the set of options for a multiselect")
328+
}
329+
330+
type CustomizableMultipleValue @doc(description: "CustomizableMultipleValue defines the price and sku of a product whose page contains a customized multiselect") {
331+
option_type_id: Int @doc(description: "The ID assigned to the value")
332+
price: Float @doc(description: "The price assigned to this option")
333+
price_type: PriceTypeEnum @doc(description: "FIXED, PERCENT, or DYNAMIC")
334+
sku: String @doc(description: "The Stock Keeping Unit for this option")
335+
title: String @doc(description: "The display name for this option")
336+
sort_order: Int @doc(description: "The order in which the option is displayed")
337+
}
338+
326339
type CustomizableFieldOption implements CustomizableOptionInterface @doc(description: "CustomizableFieldOption contains information about a text field that is defined as part of a customizable option") {
327340
value: CustomizableFieldValue @doc(description: "An object that defines a text field")
328341
product_sku: String @doc(description: "The Stock Keeping Unit of the base product")
@@ -407,6 +420,19 @@ type CustomizableRadioValue @doc(description: "CustomizableRadioValue defines t
407420
sort_order: Int @doc(description: "The order in which the radio button is displayed")
408421
}
409422

423+
type CustomizableCheckboxOption implements CustomizableOptionInterface @doc(description: "CustomizableCheckbbixOption contains information about a set of checkbox values that are defined as part of a customizable option") {
424+
value: [CustomizableCheckboxValue] @doc(description: "An array that defines a set of checkbox values")
425+
}
426+
427+
type CustomizableCheckboxValue @doc(description: "CustomizableCheckboxValue defines the price and sku of a product whose page contains a customized set of checkbox values") {
428+
option_type_id: Int @doc(description: "The ID assigned to the value")
429+
price: Float @doc(description: "The price assigned to this option")
430+
price_type: PriceTypeEnum @doc(description: "FIXED, PERCENT, or DYNAMIC")
431+
sku: String @doc(description: "The Stock Keeping Unit for this option")
432+
title: String @doc(description: "The display name for this option")
433+
sort_order: Int @doc(description: "The order in which the checkbox value is displayed")
434+
}
435+
410436
type VirtualProduct implements ProductInterface, CustomizableProductInterface @doc(description: "A virtual product is non-tangible product that does not require shipping and is not kept in inventory") {
411437
}
412438

app/code/Magento/GoogleAnalytics/Block/Ga.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ public function getPageName()
7575
}
7676

7777
/**
78-
* Render regular page tracking javascript code
78+
* Render regular page tracking javascript code.
79+
*
7980
* The custom "page name" may be set from layout or somewhere else. It must start from slash.
8081
*
8182
* @param string $accountId

app/code/Magento/GoogleAnalytics/Helper/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ public function isGoogleAnalyticsAvailable($store = null)
4646
*/
4747
public function isAnonymizedIpActive($store = null)
4848
{
49-
return $this->scopeConfig->getValue(self::XML_PATH_ANONYMIZE, ScopeInterface::SCOPE_STORE, $store);
49+
return (bool)$this->scopeConfig->getValue(self::XML_PATH_ANONYMIZE, ScopeInterface::SCOPE_STORE, $store);
5050
}
5151
}

app/code/Magento/Paypal/Controller/Express/AbstractExpress/ShippingOptionsCallback.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@
66
*/
77
namespace Magento\Paypal\Controller\Express\AbstractExpress;
88

9-
class ShippingOptionsCallback extends \Magento\Paypal\Controller\Express\AbstractExpress
9+
use Magento\Framework\App\CsrfAwareActionInterface;
10+
use Magento\Paypal\Controller\Express\AbstractExpress;
11+
use Magento\Framework\App\Request\InvalidRequestException;
12+
use Magento\Framework\App\RequestInterface;
13+
14+
/**
15+
* Returns shipping rates by server-to-server request from PayPal.
16+
*
17+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
18+
*/
19+
class ShippingOptionsCallback extends AbstractExpress implements CsrfAwareActionInterface
1020
{
1121
/**
1222
* @var \Magento\Quote\Api\CartRepositoryInterface
@@ -65,4 +75,21 @@ public function execute()
6575
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
6676
}
6777
}
78+
79+
/**
80+
* @inheritDoc
81+
*/
82+
public function createCsrfValidationException(
83+
RequestInterface $request
84+
): ?InvalidRequestException {
85+
return null;
86+
}
87+
88+
/**
89+
* @inheritDoc
90+
*/
91+
public function validateForCsrf(RequestInterface $request): ?bool
92+
{
93+
return true;
94+
}
6895
}

app/code/Magento/Paypal/Model/Express/Checkout.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,7 @@ protected static function cmpShippingOptions(DataObject $option1, DataObject $op
10761076
*/
10771077
protected function _matchShippingMethodCode(Address $address, $selectedCode)
10781078
{
1079+
$address->collectShippingRates();
10791080
$options = $this->_prepareShippingOptions($address, false);
10801081
foreach ($options as $option) {
10811082
if ($selectedCode === $option['code'] // the proper case as outlined in documentation

app/code/Magento/QuoteGraphQl/Model/Cart/AssignBillingAddressToCart.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
use Magento\Framework\Exception\NoSuchEntityException;
1212
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1313
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
14+
use Magento\Quote\Api\Data\AddressInterface;
1415
use Magento\Quote\Api\Data\CartInterface;
1516
use Magento\Quote\Api\BillingAddressManagementInterface;
16-
use Magento\Quote\Model\Quote\Address as QuoteAddress;
1717

1818
/**
1919
* Set billing address for a specified shopping cart
@@ -38,22 +38,22 @@ public function __construct(
3838
* Assign billing address to cart
3939
*
4040
* @param CartInterface $cart
41-
* @param QuoteAddress $billingAddress
41+
* @param AddressInterface $billingAddress
4242
* @param bool $useForShipping
4343
* @throws GraphQlInputException
4444
* @throws GraphQlNoSuchEntityException
4545
*/
4646
public function execute(
4747
CartInterface $cart,
48-
QuoteAddress $billingAddress,
48+
AddressInterface $billingAddress,
4949
bool $useForShipping
5050
): void {
5151
try {
5252
$this->billingAddressManagement->assign($cart->getId(), $billingAddress, $useForShipping);
5353
} catch (NoSuchEntityException $e) {
54-
throw new GraphQlNoSuchEntityException(__($e->getMessage()));
54+
throw new GraphQlNoSuchEntityException(__($e->getMessage()), $e);
5555
} catch (LocalizedException $e) {
56-
throw new GraphQlInputException(__($e->getMessage()));
56+
throw new GraphQlInputException(__($e->getMessage()), $e);
5757
}
5858
}
5959
}

app/code/Magento/QuoteGraphQl/Model/Cart/AssignShippingAddressToCart.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
use Magento\Framework\Exception\NoSuchEntityException;
1212
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1313
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
14+
use Magento\Quote\Api\Data\AddressInterface;
1415
use Magento\Quote\Api\Data\CartInterface;
15-
use Magento\Quote\Model\Quote\Address as QuoteAddress;
1616
use Magento\Quote\Model\ShippingAddressManagementInterface;
1717

1818
/**
@@ -38,20 +38,20 @@ public function __construct(
3838
* Assign shipping address to cart
3939
*
4040
* @param CartInterface $cart
41-
* @param QuoteAddress $shippingAddress
41+
* @param AddressInterface $shippingAddress
4242
* @throws GraphQlInputException
4343
* @throws GraphQlNoSuchEntityException
4444
*/
4545
public function execute(
4646
CartInterface $cart,
47-
QuoteAddress $shippingAddress
47+
AddressInterface $shippingAddress
4848
): void {
4949
try {
5050
$this->shippingAddressManagement->assign($cart->getId(), $shippingAddress);
5151
} catch (NoSuchEntityException $e) {
52-
throw new GraphQlNoSuchEntityException(__($e->getMessage()));
52+
throw new GraphQlNoSuchEntityException(__($e->getMessage()), $e);
5353
} catch (LocalizedException $e) {
54-
throw new GraphQlInputException(__($e->getMessage()));
54+
throw new GraphQlInputException(__($e->getMessage()), $e);
5555
}
5656
}
5757
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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\QuoteGraphQl\Model\Cart;
9+
10+
use Magento\Checkout\Api\Data\ShippingInformationInterface;
11+
use Magento\Checkout\Api\Data\ShippingInformationInterfaceFactory;
12+
use Magento\Checkout\Api\ShippingInformationManagementInterface;
13+
use Magento\Framework\Exception\LocalizedException;
14+
use Magento\Framework\Exception\NoSuchEntityException;
15+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
16+
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
17+
use Magento\Quote\Api\Data\AddressInterface;
18+
use Magento\Quote\Api\Data\CartInterface;
19+
20+
/**
21+
* Assign shipping method to cart
22+
*/
23+
class AssignShippingMethodToCart
24+
{
25+
/**
26+
* @var ShippingInformationInterfaceFactory
27+
*/
28+
private $shippingInformationFactory;
29+
30+
/**
31+
* @var ShippingInformationManagementInterface
32+
*/
33+
private $shippingInformationManagement;
34+
35+
/**
36+
* @param ShippingInformationInterfaceFactory $shippingInformationFactory
37+
* @param ShippingInformationManagementInterface $shippingInformationManagement
38+
*/
39+
public function __construct(
40+
ShippingInformationInterfaceFactory $shippingInformationFactory,
41+
ShippingInformationManagementInterface $shippingInformationManagement
42+
) {
43+
$this->shippingInformationFactory = $shippingInformationFactory;
44+
$this->shippingInformationManagement = $shippingInformationManagement;
45+
}
46+
47+
/**
48+
* Assign shipping method to cart
49+
*
50+
* @param CartInterface $cart
51+
* @param AddressInterface $quoteAddress
52+
* @param string $carrierCode
53+
* @param string $methodCode
54+
* @throws GraphQlInputException
55+
* @throws GraphQlNoSuchEntityException
56+
*/
57+
public function execute(
58+
CartInterface $cart,
59+
AddressInterface $quoteAddress,
60+
string $carrierCode,
61+
string $methodCode
62+
): void {
63+
/** @var ShippingInformationInterface $shippingInformation */
64+
$shippingInformation = $this->shippingInformationFactory->create([
65+
'data' => [
66+
/* If the address is not a shipping address (but billing) the system will find the proper shipping
67+
address for the selected cart and set the information there (actual for single shipping address) */
68+
ShippingInformationInterface::SHIPPING_ADDRESS => $quoteAddress,
69+
ShippingInformationInterface::SHIPPING_CARRIER_CODE => $carrierCode,
70+
ShippingInformationInterface::SHIPPING_METHOD_CODE => $methodCode,
71+
],
72+
]);
73+
74+
try {
75+
$this->shippingInformationManagement->saveAddressInformation($cart->getId(), $shippingInformation);
76+
} catch (NoSuchEntityException $e) {
77+
throw new GraphQlNoSuchEntityException(__($e->getMessage()), $e);
78+
} catch (LocalizedException $e) {
79+
throw new GraphQlInputException(__($e->getMessage()), $e);
80+
}
81+
}
82+
}

0 commit comments

Comments
 (0)