Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/code/Magento/Customer/Model/Plugin/UpdateCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function beforeSave(
) {
$customer = $this->getUpdatedCustomer($customerRepository->getById($customerId), $customer);
} elseif ($customerId && in_array($userType, [UserContextInterface::USER_TYPE_ADMIN,
UserContextInterface::USER_TYPE_INTEGRATION], true)
UserContextInterface::USER_TYPE_INTEGRATION], true)
) {
$customer = $this->getUpdatedCustomer($customerRepository->getById($customerId), $customer);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\CustomerGraphQl\Model\Customer;

use Magento\CustomerGraphQl\Api\ValidateCustomerDataInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\Validator\EmailAddress as EmailAddressValidator;

/**
* Customer data validation used during customer account creation and updating
*/
class ValidateCustomerData
{
/**
* Get allowed/required customer attributes
*
* @var GetAllowedCustomerAttributes
*/
private $getAllowedCustomerAttributes;

/**
* @var EmailAddressValidator
*/
private $emailAddressValidator;

/**
* @var ValidateCustomerDataInterface[]
*/
private $validators = [];

/**
* ValidateCustomerData constructor.
*
* @param GetAllowedCustomerAttributes $getAllowedCustomerAttributes
* @param EmailAddressValidator $emailAddressValidator
* @param array $validators
*/
public function __construct(
GetAllowedCustomerAttributes $getAllowedCustomerAttributes,
EmailAddressValidator $emailAddressValidator,
$validators = []
) {
$this->getAllowedCustomerAttributes = $getAllowedCustomerAttributes;
$this->emailAddressValidator = $emailAddressValidator;
$this->validators = $validators;
}

/**
* Validate customer data
*
* @param array $customerData
* @throws GraphQlInputException
* @throws LocalizedException
* @throws NoSuchEntityException
*/
public function execute(array $customerData)
{
/** @var ValidateCustomerDataInterface $validator */
foreach ($this->validators as $validator) {
$validator->execute($customerData);
}
}
}
1 change: 0 additions & 1 deletion app/code/Magento/Integration/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,3 @@ OAuth,OAuth
"We couldn't find any records.","We couldn't find any records."
Status,Status
"Invalid Identity Link URL", "Invalid Identity Link URL"
"Invalid Identity Link URL", "Invalid Identity Link URL"
2 changes: 0 additions & 2 deletions app/code/Magento/Quote/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,3 @@ Carts,Carts
"Identity type not found","Identity type not found"
"Invalid order backpressure limit config","Invalid order backpressure limit config"
"Please check input parameters.","Please check input parameters."
"Please check input parameters.","Please check input parameters."
"Please check input parameters.","Please check input parameters."
1 change: 0 additions & 1 deletion app/design/adminhtml/Magento/backend/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -550,4 +550,3 @@ Dashboard,Dashboard
"Invalid data type","Invalid data type"
"Invalid value provided for attribute %1","Invalid value provided for attribute %1"
"Invalid data type","Invalid data type"
"Invalid data type","Invalid data type"
2 changes: 0 additions & 2 deletions app/design/frontend/Magento/blank/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -440,5 +440,3 @@ Test,Test
test,test
Two,Two
"Invalid data type","Invalid data type"
"Invalid data type","Invalid data type"
"Invalid data type","Invalid data type"