Skip to content

Commit a36a806

Browse files
committed
Merge branch '2.3-develop' of https://github.com/magento/magento2ce into EPAM-PR-35
2 parents 01e70db + 664a673 commit a36a806

File tree

85 files changed

+2939
-392
lines changed

Some content is hidden

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

85 files changed

+2939
-392
lines changed

app/code/Magento/BundleGraphQl/Model/Resolver/Options/Collection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function __construct(
6161
* Add parent id/sku pair to use for option filter at fetch time.
6262
*
6363
* @param int $parentId
64+
* @param int $parentEntityId
6465
* @param string $sku
6566
*/
6667
public function addParentFilterData(int $parentId, int $parentEntityId, string $sku) : void

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ private function isUniqueAdminValues(array $optionsValues, array $deletedOptions
163163
{
164164
$adminValues = [];
165165
foreach ($optionsValues as $optionKey => $values) {
166-
if (!(isset($deletedOptions[$optionKey]) and $deletedOptions[$optionKey] === '1')) {
166+
if (!(isset($deletedOptions[$optionKey]) && $deletedOptions[$optionKey] === '1')) {
167167
$adminValues[] = reset($values);
168168
}
169169
}

app/code/Magento/CatalogGraphQl/Model/Category/LevelCalculator.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@
1515
*/
1616
class LevelCalculator
1717
{
18+
/**
19+
* @var ResourceConnection
20+
*/
21+
private $resourceConnection;
22+
23+
/**
24+
* @var Category
25+
*/
26+
private $resourceCategory;
27+
1828
/**
1929
* @param ResourceConnection $resourceConnection
2030
* @param Category $resourceCategory
@@ -39,6 +49,7 @@ public function calculate(int $rootCategoryId) : int
3949
$select = $connection->select()
4050
->from($this->resourceConnection->getTableName('catalog_category_entity'), 'level')
4151
->where($this->resourceCategory->getLinkField() . " = ?", $rootCategoryId);
52+
4253
return (int) $connection->fetchOne($select);
4354
}
4455
}

app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" />
3737
<!--see Insert Widget button disabled-->
3838
<see selector="{{WidgetSection.InsertWidgetBtnDisabled}}" userInput="Insert Widget" stepKey="seeInsertWidgetDisabled" />
39-
<!--see Cancel button enabed-->
39+
<!--see Cancel button enabled-->
4040
<see selector="{{WidgetSection.CancelBtnEnabled}}" userInput="Cancel" stepKey="seeCancelBtnEnabled" />
4141
<!--Select "Widget Type"-->
4242
<selectOption selector="{{WidgetSection.WidgetType}}" userInput="CMS Page Link" stepKey="selectCMSPageLink" />

app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" />
4343
<!--see Insert Widget button disabled-->
4444
<see selector="{{WidgetSection.InsertWidgetBtnDisabled}}" userInput="Insert Widget" stepKey="seeInsertWidgetDisabled" />
45-
<!--see Cancel button enabed-->
45+
<!--see Cancel button enabled-->
4646
<see selector="{{WidgetSection.CancelBtnEnabled}}" userInput="Cancel" stepKey="seeCancelBtnEnabled" />
4747
<!--Select "Widget Type"-->
4848
<selectOption selector="{{WidgetSection.WidgetType}}" userInput="Catalog Products List" stepKey="selectCatalogProductsList" />

app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<waitForPageLoad stepKey="wait2"/>
4242
<!--see Insert Widget button disabled-->
4343
<see selector="{{WidgetSection.InsertWidgetBtnDisabled}}" userInput="Insert Widget" stepKey="seeInsertWidgetDisabled" />
44-
<!--see Cancel button enabed-->
44+
<!--see Cancel button enabled-->
4545
<see selector="{{WidgetSection.CancelBtnEnabled}}" userInput="Cancel" stepKey="seeCancelBtnEnabled" />
4646
<!--Select "Widget Type"-->
4747
<selectOption selector="{{WidgetSection.WidgetType}}" userInput="Recently Compared Products" stepKey="selectRecentlyComparedProducts" />

app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" />
4141
<!--see Insert Widget button disabled-->
4242
<see selector="{{WidgetSection.InsertWidgetBtnDisabled}}" userInput="Insert Widget" stepKey="seeInsertWidgetDisabled" />
43-
<!--see Cancel button enabed-->
43+
<!--see Cancel button enabled-->
4444
<see selector="{{WidgetSection.CancelBtnEnabled}}" userInput="Cancel" stepKey="seeCancelBtnEnabled" />
4545
<!--Select "Widget Type"-->
4646
<selectOption selector="{{WidgetSection.WidgetType}}" userInput="Recently Viewed Products" stepKey="selectRecentlyViewedProducts" />

app/code/Magento/ConfigurableProductGraphQl/Model/ConfigurableProductTypeResolver.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,25 @@
88
namespace Magento\ConfigurableProductGraphQl\Model;
99

1010
use Magento\Framework\GraphQl\Query\Resolver\TypeResolverInterface;
11+
use Magento\ConfigurableProduct\Model\Product\Type\Configurable as Type;
1112

1213
/**
13-
* {@inheritdoc}
14+
* @inheritdoc
1415
*/
1516
class ConfigurableProductTypeResolver implements TypeResolverInterface
1617
{
1718
/**
18-
* {@inheritdoc}
19+
* Configurable product type resolver code
1920
*/
20-
public function resolveType(array $data) : string
21+
const TYPE_RESOLVER = 'ConfigurableProduct';
22+
23+
/**
24+
* @inheritdoc
25+
*/
26+
public function resolveType(array $data): string
2127
{
22-
if (isset($data['type_id']) && $data['type_id'] == 'configurable') {
23-
return 'ConfigurableProduct';
28+
if (isset($data['type_id']) && $data['type_id'] == Type::TYPE_CODE) {
29+
return self::TYPE_RESOLVER;
2430
}
2531
return '';
2632
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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\CustomerGraphQl\Model\Customer;
9+
10+
use Magento\Customer\Api\AccountManagementInterface;
11+
use Magento\Customer\Api\Data\CustomerInterface;
12+
use Magento\Customer\Api\Data\CustomerInterfaceFactory;
13+
use Magento\Framework\Api\DataObjectHelper;
14+
use Magento\Framework\Exception\LocalizedException;
15+
use Magento\Framework\Exception\NoSuchEntityException;
16+
use Magento\Store\Model\StoreManagerInterface;
17+
18+
/**
19+
* Class CreateAccount creates new customer account
20+
*/
21+
class CreateAccount
22+
{
23+
/**
24+
* @var DataObjectHelper
25+
*/
26+
private $dataObjectHelper;
27+
28+
/**
29+
* @var CustomerInterfaceFactory
30+
*/
31+
private $customerFactory;
32+
33+
/**
34+
* @var AccountManagementInterface
35+
*/
36+
private $accountManagement;
37+
38+
/**
39+
* @var StoreManagerInterface
40+
*/
41+
private $storeManager;
42+
43+
/**
44+
* @param DataObjectHelper $dataObjectHelper
45+
* @param CustomerInterfaceFactory $customerFactory
46+
* @param StoreManagerInterface $storeManager
47+
* @param AccountManagementInterface $accountManagement
48+
*/
49+
public function __construct(
50+
DataObjectHelper $dataObjectHelper,
51+
CustomerInterfaceFactory $customerFactory,
52+
StoreManagerInterface $storeManager,
53+
AccountManagementInterface $accountManagement
54+
) {
55+
$this->dataObjectHelper = $dataObjectHelper;
56+
$this->customerFactory = $customerFactory;
57+
$this->accountManagement = $accountManagement;
58+
$this->storeManager = $storeManager;
59+
}
60+
61+
/**
62+
* Creates new customer account
63+
*
64+
* @param array $args
65+
* @return CustomerInterface
66+
* @throws LocalizedException
67+
* @throws NoSuchEntityException
68+
*/
69+
public function execute(array $args): CustomerInterface
70+
{
71+
$customerDataObject = $this->customerFactory->create();
72+
$this->dataObjectHelper->populateWithArray(
73+
$customerDataObject,
74+
$args['input'],
75+
CustomerInterface::class
76+
);
77+
$store = $this->storeManager->getStore();
78+
$customerDataObject->setWebsiteId($store->getWebsiteId());
79+
$customerDataObject->setStoreId($store->getId());
80+
81+
$password = array_key_exists('password', $args['input']) ? $args['input']['password'] : null;
82+
83+
return $this->accountManagement->createAccount($customerDataObject, $password);
84+
}
85+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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\CustomerGraphQl\Model\Customer;
9+
10+
use Magento\Customer\Api\Data\CustomerInterface;
11+
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
12+
use Magento\Authorization\Model\UserContextInterface;
13+
14+
/**
15+
* Set up user context after creating new customer account
16+
*/
17+
class SetUpUserContext
18+
{
19+
/**
20+
* Set up user context after creating new customer account
21+
*
22+
* @param ContextInterface $context
23+
* @param CustomerInterface $customer
24+
*/
25+
public function execute(ContextInterface $context, CustomerInterface $customer)
26+
{
27+
$context->setUserId((int)$customer->getId());
28+
$context->setUserType(UserContextInterface::USER_TYPE_CUSTOMER);
29+
}
30+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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\CustomerGraphQl\Model\Resolver;
9+
10+
use Magento\CustomerGraphQl\Model\Customer\ChangeSubscriptionStatus;
11+
use Magento\CustomerGraphQl\Model\Customer\CreateAccount;
12+
use Magento\CustomerGraphQl\Model\Customer\CustomerDataProvider;
13+
use Magento\CustomerGraphQl\Model\Customer\SetUpUserContext;
14+
use Magento\Framework\Exception\State\InputMismatchException;
15+
use Magento\Framework\GraphQl\Config\Element\Field;
16+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
17+
use Magento\Framework\GraphQl\Query\ResolverInterface;
18+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
19+
use Magento\Framework\Validator\Exception as ValidatorException;
20+
21+
/**
22+
* Create customer account resolver
23+
*/
24+
class CreateCustomer implements ResolverInterface
25+
{
26+
/**
27+
* @var CustomerDataProvider
28+
*/
29+
private $customerDataProvider;
30+
31+
/**
32+
* @var ChangeSubscriptionStatus
33+
*/
34+
private $changeSubscriptionStatus;
35+
36+
/**
37+
* @var CreateAccount
38+
*/
39+
private $createAccount;
40+
41+
/**
42+
* @var SetUpUserContext
43+
*/
44+
private $setUpUserContext;
45+
46+
/**
47+
* @param CustomerDataProvider $customerDataProvider
48+
* @param ChangeSubscriptionStatus $changeSubscriptionStatus
49+
* @param SetUpUserContext $setUpUserContext
50+
* @param CreateAccount $createAccount
51+
*/
52+
public function __construct(
53+
CustomerDataProvider $customerDataProvider,
54+
ChangeSubscriptionStatus $changeSubscriptionStatus,
55+
SetUpUserContext $setUpUserContext,
56+
CreateAccount $createAccount
57+
) {
58+
$this->customerDataProvider = $customerDataProvider;
59+
$this->changeSubscriptionStatus = $changeSubscriptionStatus;
60+
$this->createAccount = $createAccount;
61+
$this->setUpUserContext = $setUpUserContext;
62+
}
63+
64+
/**
65+
* @inheritdoc
66+
*/
67+
public function resolve(
68+
Field $field,
69+
$context,
70+
ResolveInfo $info,
71+
array $value = null,
72+
array $args = null
73+
) {
74+
if (!isset($args['input']) || !is_array($args['input']) || empty($args['input'])) {
75+
throw new GraphQlInputException(__('"input" value should be specified'));
76+
}
77+
try {
78+
$customer = $this->createAccount->execute($args);
79+
$customerId = (int)$customer->getId();
80+
$this->setUpUserContext->execute($context, $customer);
81+
if (array_key_exists('is_subscribed', $args['input'])) {
82+
if ($args['input']['is_subscribed']) {
83+
$this->changeSubscriptionStatus->execute($customerId, true);
84+
}
85+
}
86+
$data = $this->customerDataProvider->getCustomerById($customerId);
87+
} catch (ValidatorException $e) {
88+
throw new GraphQlInputException(__($e->getMessage()));
89+
} catch (InputMismatchException $e) {
90+
throw new GraphQlInputException(__($e->getMessage()));
91+
}
92+
93+
return ['customer' => $data];
94+
}
95+
}

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ type Query {
88
type Mutation {
99
generateCustomerToken(email: String!, password: String!): CustomerToken @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\GenerateCustomerToken") @doc(description:"Retrieve the customer token")
1010
changeCustomerPassword(currentPassword: String!, newPassword: String!): Customer @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\ChangePassword") @doc(description:"Changes the password for the logged-in customer")
11-
updateCustomer (input: UpdateCustomerInput!): UpdateCustomerOutput @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\UpdateCustomer") @doc(description:"Update the customer's personal information")
11+
createCustomer (input: CustomerInput!): CustomerOutput @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\CreateCustomer") @doc(description:"Create customer account")
12+
updateCustomer (input: CustomerInput!): CustomerOutput @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\UpdateCustomer") @doc(description:"Update the customer's personal information")
1213
revokeCustomerToken: RevokeCustomerTokenOutput @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\RevokeCustomerToken") @doc(description:"Revoke the customer token")
1314
createCustomerAddress(input: CustomerAddressInput!): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\CreateCustomerAddress") @doc(description: "Create customer address")
1415
updateCustomerAddress(id: Int!, input: CustomerAddressInput): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\UpdateCustomerAddress") @doc(description: "Update customer address")
@@ -50,15 +51,21 @@ type CustomerToken {
5051
token: String @doc(description: "The customer token")
5152
}
5253

53-
input UpdateCustomerInput {
54-
firstname: String
55-
lastname: String
56-
email: String
57-
password: String
58-
is_subscribed: Boolean
54+
input CustomerInput {
55+
prefix: String @doc(description: "An honorific, such as Dr., Mr., or Mrs.")
56+
firstname: String @doc(description: "The customer's first name")
57+
middlename: String @doc(description: "The customer's middle name")
58+
lastname: String @doc(description: "The customer's family name")
59+
suffix: String @doc(description: "A value such as Sr., Jr., or III")
60+
email: String @doc(description: "The customer's email address. Required")
61+
dob: String @doc(description: "The customer's date of birth")
62+
taxvat: String @doc(description: "The customer's Tax/VAT number (for corporate customers)")
63+
gender: Int @doc(description: "The customer's gender(Male - 1, Female - 2)")
64+
password: String @doc(description: "The customer's password")
65+
is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter")
5966
}
6067

61-
type UpdateCustomerOutput {
68+
type CustomerOutput {
6269
customer: Customer!
6370
}
6471

@@ -365,4 +372,4 @@ enum CountryCodeEnum @doc(description: "The list of countries codes") {
365372
YE @doc(description: "Yemen")
366373
ZM @doc(description: "Zambia")
367374
ZW @doc(description: "Zimbabwe")
368-
}
375+
}

app/code/Magento/Paypal/Controller/Transparent/RequestSecureToken.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function execute()
8383
/** @var Quote $quote */
8484
$quote = $this->sessionManager->getQuote();
8585

86-
if (!$quote or !$quote instanceof Quote) {
86+
if (!$quote || !$quote instanceof Quote) {
8787
return $this->getErrorResponse();
8888
}
8989

@@ -107,6 +107,8 @@ public function execute()
107107
}
108108

109109
/**
110+
* Get error response.
111+
*
110112
* @return Json
111113
*/
112114
private function getErrorResponse()

app/code/Magento/Quote/Model/Quote.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ public function getAllItems()
13991399
{
14001400
$items = [];
14011401
foreach ($this->getItemsCollection() as $item) {
1402-
/** @var \Magento\Quote\Model\ResourceModel\Quote\Item $item */
1402+
/** @var \Magento\Quote\Model\Quote\Item $item */
14031403
if (!$item->isDeleted()) {
14041404
$items[] = $item;
14051405
}

0 commit comments

Comments
 (0)