38 private $validatorFactory;
43 private $addressFactory;
80 $customer = $this->accountManagement->createAccountWithPasswordHash(
86 if (!
$quote->getBillingAddress()->getId() &&
$customer->getDefaultBilling()) {
87 $quote->getBillingAddress()->importCustomerAddressData(
88 $this->customerAddressRepository->getById(
$customer->getDefaultBilling())
90 $quote->getBillingAddress()->setCustomerAddressId(
$customer->getDefaultBilling());
92 if (!
$quote->getShippingAddress()->getSameAsBilling()
93 && !
$quote->getBillingAddress()->getId()
96 $quote->getShippingAddress()->importCustomerAddressData(
97 $this->customerAddressRepository->getById(
$customer->getDefaultShipping())
99 $quote->getShippingAddress()->setCustomerAddressId(
$customer->getDefaultShipping());
113 if (
$quote->getBillingAddress()->getCustomerAddressId()) {
114 $addresses[] = $this->customerAddressRepository->getById(
115 $quote->getBillingAddress()->getCustomerAddressId()
118 if (
$quote->getShippingAddress()->getCustomerAddressId()) {
119 $addresses[] = $this->customerAddressRepository->getById(
120 $quote->getShippingAddress()->getCustomerAddressId()
125 $validator = $this->validatorFactory->createValidator(
'customer_address',
'save');
126 $addressModel = $this->addressFactory->create();
127 $addressModel->updateData(
$address);
128 if (!$validator->isValid($addressModel)) {
129 throw new \Magento\Framework\Validator\Exception(
132 $validator->getMessages()
$customerAddressRepository
validateAddresses(QuoteEntity $quote)
__construct(CustomerRepository $customerRepository, CustomerAddressRepository $customerAddressRepository, AccountManagement $accountManagement, \Magento\Framework\Validator\Factory $validatorFactory=null, \Magento\Customer\Model\AddressFactory $addressFactory=null)
populateCustomerInfo(QuoteEntity $quote)