Overview
  • Package
  • Class
  • Tree
  • Todo

Packages

  • AddonValue
    • Interfaces
  • ApiV2Controllers
  • Category
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • Customer
    • Address
    • Country
    • CountryZone
    • Interfaces
    • Validation
    • ValueObjects
  • Email
    • Collections
    • Entities
    • Exceptions
    • Interfaces
    • Repository
    • ValueObjects
  • Http
    • Collections
    • Exceptions
    • Factories
    • Interfaces
    • ValueObjects
  • Loaders
    • CrossCuttingLoader
    • GXCoreLoader
    • Interfaces
  • None
  • Order
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Repositories
    • Storages
    • ValueObjects
  • Product
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • ProductModule
    • Collections
    • Deleter
    • Entities
    • Factories
    • Interface
    • Interfaces
    • Reader
    • Repositories
    • Writer
  • Shared
    • Exceptions
    • FileSystem
    • Interfaces
    • Storage
    • Types
  • Statistics
    • Interfaces
  • UserConfiguration
    • Interfaces
    • Repository

Classes

  • AbstractAddonValueServiceFactory
  • AbstractAddonValueStorage
  • AbstractApiV2Controller
  • AbstractCategoryServiceFactory
  • AbstractCollection
  • AbstractCustomerFactory
  • AbstractCustomerServiceFactory
  • AbstractFileStorage
  • AbstractHttpContextFactory
  • AbstractHttpViewControllerRegistryFactory
  • AbstractImagesApiV2Controller
  • AbstractOrderServiceFactory
  • AbstractProductAttributeServiceFactory
  • AbstractProductServiceFactory
  • AddonValueService
  • AddonValueServiceFactory
  • AddonValueStorageFactory
  • AddressBlock
  • AddressBookService
  • AddressClass
  • AddressesApiV2Controller
  • AddressFormatProvider
  • AdminHttpViewController
  • AdminPageHttpControllerResponse
  • Asset
  • AssetCollection
  • AttachmentCollection
  • AttachmentName
  • AttachmentPath
  • AttachmentsApiV2Controller
  • AttachmentsHandler
  • BoolType
  • CategoriesApiV2Controller
  • Category
  • CategoryAddonValueStorage
  • CategoryFactory
  • CategoryIconsApiV2Controller
  • CategoryImagesApiV2Controller
  • CategoryListItem
  • CategoryListItemCollection
  • CategoryListProvider
  • CategoryListProviderFactory
  • CategoryObjectService
  • CategoryReadService
  • CategoryRepository
  • CategoryRepositoryDeleter
  • CategoryRepositoryReader
  • CategoryRepositoryWriter
  • CategoryServiceFactory
  • CategorySettings
  • CategorySettingsRepository
  • CategorySettingsRepositoryReader
  • CategorySettingsRepositoryWriter
  • CategoryWriteService
  • ContactCollection
  • ContactName
  • ContactType
  • CountriesApiV2Controller
  • CountryService
  • CrossCuttingLoader
  • CurrencyCode
  • Customer
  • CustomerAccountInputValidator
  • CustomerAddress
  • CustomerAddressDeleter
  • CustomerAddressInputValidator
  • CustomerAddressReader
  • CustomerAddressRepository
  • CustomerAddressWriter
  • CustomerB2BStatus
  • CustomerCallNumber
  • CustomerCity
  • CustomerCompany
  • CustomerCountry
  • CustomerCountryIso2
  • CustomerCountryIso3
  • CustomerCountryName
  • CustomerCountryReader
  • CustomerCountryRepository
  • CustomerCountryZone
  • CustomerCountryZoneIsoCode
  • CustomerCountryZoneName
  • CustomerCountryZoneReader
  • CustomerCountryZoneRepository
  • CustomerDateOfBirth
  • CustomerDeleter
  • CustomerEmail
  • CustomerFactory
  • CustomerFirstname
  • CustomerGender
  • CustomerInputValidator
  • CustomerInputValidatorSettings
  • CustomerLastname
  • CustomerNumber
  • CustomerPassword
  • CustomerPostcode
  • CustomerReader
  • CustomerReadService
  • CustomerRegistrationInputValidatorService
  • CustomerRepository
  • CustomersApiV2Controller
  • CustomerService
  • CustomerServiceFactory
  • CustomerServiceSettings
  • CustomerStatusInformation
  • CustomerStatusProvider
  • CustomerStreet
  • CustomerSuburb
  • CustomerVatNumber
  • CustomerWriter
  • CustomerWriteService
  • DecimalType
  • DefaultApiV2Controller
  • EditableCollection
  • EditableKeyValueCollection
  • Email
  • EmailAddress
  • EmailAttachment
  • EmailCollection
  • EmailContact
  • EmailContent
  • EmailDeleter
  • EmailFactory
  • EmailReader
  • EmailRepository
  • EmailsApiV2Controller
  • EmailService
  • EmailStringType
  • EmailSubject
  • EmailWriter
  • EmptyCurrencyCode
  • EmptyDateTime
  • EmptyLanguageCode
  • EmptyOrderItemDownloadInformation
  • EmptyProductImage
  • EnvCategoryServiceSettings
  • EnvironmentHttpContextFactory
  • EnvironmentHttpViewControllerRegistryFactory
  • EnvProductImageFileStorageSettings
  • ExistingDirectory
  • ExistingFile
  • FilenameStringType
  • GXCoreLoader
  • GXCoreLoaderSettings
  • GXEngineOrder
  • GXEngineProduct
  • HttpApiV2Controller
  • HttpContext
  • HttpContextReader
  • HttpControllerResponse
  • HttpDispatcher
  • HttpResponseProcessor
  • HttpService
  • HttpServiceFactory
  • HttpViewController
  • HttpViewControllerFactory
  • HttpViewControllerRegistry
  • IdCollection
  • IdType
  • ImageFileStorage
  • IntType
  • JsonHttpControllerResponse
  • KeyValueCollection
  • LanguageCode
  • LegacyProductImageProcessing
  • MailerAdapter
  • NonEmptyStringType
  • OrderAddonValueStorage
  • OrderFactory
  • OrderItem
  • OrderItemAddonValueStorage
  • OrderItemAttribute
  • OrderItemAttributeCollection
  • OrderItemAttributeFactory
  • OrderItemAttributeRepository
  • OrderItemAttributeRepositoryDeleter
  • OrderItemAttributeRepositoryFactory
  • OrderItemAttributeRepositoryReader
  • OrderItemAttributeRepositoryWriter
  • OrderItemCollection
  • OrderItemDownloadInformation
  • OrderItemFactory
  • OrderItemProperty
  • OrderItemPropertyFactory
  • OrderItemPropertyRepository
  • OrderItemPropertyRepositoryDeleter
  • OrderItemPropertyRepositoryReader
  • OrderItemPropertyRepositoryWriter
  • OrderItemRepository
  • OrderItemRepositoryDeleter
  • OrderItemRepositoryReader
  • OrderItemRepositoryWriter
  • OrderListGenerator
  • OrderListItem
  • OrderListItemCollection
  • OrderObjectService
  • OrderPaymentType
  • OrderReadService
  • OrderRepository
  • OrderRepositoryDeleter
  • OrderRepositoryReader
  • OrderRepositoryWriter
  • OrdersApiV2Controller
  • OrderServiceFactory
  • OrderServiceSettings
  • OrderShippingType
  • OrdersHistoryApiV2Controller
  • OrdersItemsApiV2Controller
  • OrdersItemsAttributesApiV2Controller
  • OrderStatusHistoryListItem
  • OrderStatusHistoryListItemCollection
  • OrderStatusHistoryStorage
  • OrdersTotalsApiV2Controller
  • OrderTotal
  • OrderTotalCollection
  • OrderTotalFactory
  • OrderTotalRepository
  • OrderTotalRepositoryDeleter
  • OrderTotalRepositoryReader
  • OrderTotalRepositoryWriter
  • OrderWriteService
  • ProductAddonValueStorage
  • ProductAttribute
  • ProductAttributeCollection
  • ProductAttributeFactory
  • ProductAttributeObjectService
  • ProductAttributeRepository
  • ProductAttributeRepositoryDeleter
  • ProductAttributeRepositoryReader
  • ProductAttributeRepositoryWriter
  • ProductAttributeService
  • ProductAttributeServiceFactory
  • ProductCategoryLinker
  • ProductFactory
  • ProductImage
  • ProductImageCollection
  • ProductImageContainer
  • ProductImageContainerRepository
  • ProductImageFileStorage
  • ProductImagesApiV2Controller
  • ProductListItem
  • ProductListItemCollection
  • ProductListProvider
  • ProductListProviderFactory
  • ProductObjectService
  • ProductPermissionSetter
  • ProductReadService
  • ProductRepository
  • ProductRepositoryDeleter
  • ProductRepositoryReader
  • ProductRepositoryWriter
  • ProductsApiV2Controller
  • ProductServiceFactory
  • ProductSettings
  • ProductSettingsRepository
  • ProductSettingsRepositoryReader
  • ProductSettingsRepositoryWriter
  • ProductsLinksApiV2Controller
  • ProductWriteService
  • RedirectHttpControllerResponse
  • StaticCrossCuttingLoader
  • StaticGXCoreLoader
  • StatisticsService
  • StoredCategory
  • StoredOrderItem
  • StoredOrderItemAttribute
  • StoredOrderItemAttributeCollection
  • StoredOrderItemCollection
  • StoredOrderItemProperty
  • StoredOrderTotal
  • StoredOrderTotalCollection
  • StoredProduct
  • StoredProductAttribute
  • StoredProductAttributeCollection
  • StringCollection
  • StringType
  • UserConfigurationReader
  • UserConfigurationService
  • UserConfigurationWriter
  • VatNumberValidator
  • WritableDirectory
  • WritableFile
  • YetAnotherLanguageProvider
  • ZonesApiV2Controller

Interfaces

  • AddonValueContainerInterface
  • AddonValueServiceInterface
  • AddonValueStorageFactoryInterface
  • AddressBlockInterface
  • AddressBookServiceInterface
  • AddressClassInterface
  • AddressFormatProviderInterface
  • AssetCollectionInterface
  • AssetInterface
  • AttachmentCollectionInterface
  • AttachmentNameInterface
  • AttachmentPathInterface
  • AttachmentsHandlerInterface
  • CategoryFactoryInterface
  • CategoryInterface
  • CategoryListProviderFactoryInterface
  • CategoryListProviderInterface
  • CategoryObjectServiceInterface
  • CategoryReadServiceInterface
  • CategoryRepositoryDeleterInterface
  • CategoryRepositoryInterface
  • CategoryRepositoryReaderInterface
  • CategoryRepositoryWriterInterface
  • CategoryServiceSettingsInterface
  • CategorySettingsInterface
  • CategorySettingsRepositoryInterface
  • CategorySettingsRepositoryReaderInterface
  • CategorySettingsRepositoryWriterInterface
  • CategoryWriteServiceInterface
  • ContactCollectionInterface
  • ContactNameInterface
  • ContactTypeInterface
  • ContentViewInterface
  • CountryServiceInterface
  • CrossCuttingLoaderInterface
  • CrossCuttingObjectInterface
  • CustomerAccountInputValidatorInterface
  • CustomerAddressDeleterInterface
  • CustomerAddressInputValidatorInterface
  • CustomerAddressInterface
  • CustomerAddressReaderInterface
  • CustomerAddressRepositoryInterface
  • CustomerAddressWriterInterface
  • CustomerB2BStatusInterface
  • CustomerCallNumberInterface
  • CustomerCityInterface
  • CustomerCompanyInterface
  • CustomerCountryInterface
  • CustomerCountryIso2Interface
  • CustomerCountryIso3Interface
  • CustomerCountryNameInterface
  • CustomerCountryReaderInterface
  • CustomerCountryRepositoryInterface
  • CustomerCountryZoneInterface
  • CustomerCountryZoneIsoCodeInterface
  • CustomerCountryZoneNameInterface
  • CustomerCountryZoneReaderInterface
  • CustomerCountryZoneRepositoryInterface
  • CustomerDeleterInterface
  • CustomerEmailInterface
  • CustomerFirstnameInterface
  • CustomerGenderInterface
  • CustomerInputValidatorInterface
  • CustomerInputValidatorSettingsInterface
  • CustomerInterface
  • CustomerLastnameInterface
  • CustomerNumberInterface
  • CustomerPasswordInterface
  • CustomerPostcodeInterface
  • CustomerReaderInterface
  • CustomerReadServiceInterface
  • CustomerRegistrationInputValidatorServiceInterface
  • CustomerRepositoryInterface
  • CustomerServiceInterface
  • CustomerServiceSettingsInterface
  • CustomerStatusProviderInterface
  • CustomerStreetInterface
  • CustomerSuburbInterface
  • CustomerVatNumberInterface
  • CustomerWriterInterface
  • CustomerWriteServiceInterface
  • EmailAddressInterface
  • EmailAttachmentInterface
  • EmailCollectionInterface
  • EmailContactInterface
  • EmailContentInterface
  • EmailDeleterInterface
  • EmailFactoryInterface
  • EmailInterface
  • EmailReaderInterface
  • EmailRepositoryInterface
  • EmailServiceInterface
  • EmailSubjectInterface
  • EmailWriterInterface
  • GXCoreLoaderInterface
  • GXCoreLoaderSettingsInterface
  • HttpContextInterface
  • HttpContextReaderInterface
  • HttpControllerResponseInterface
  • HttpDispatcherInterface
  • HttpResponseProcessorInterface
  • HttpServiceFactoryInterface
  • HttpServiceInterface
  • HttpViewControllerFactoryInterface
  • HttpViewControllerInterface
  • HttpViewControllerRegistryInterface
  • IdInterface
  • LanguageProviderInterface
  • MailerAdapterInterface
  • OrderFactoryInterface
  • OrderInterface
  • OrderItemAttributeFactoryInterface
  • OrderItemAttributeInterface
  • OrderItemAttributeRepositoryDeleterInterface
  • OrderItemAttributeRepositoryFactoryInterface
  • OrderItemAttributeRepositoryInterface
  • OrderItemAttributeRepositoryReaderInterface
  • OrderItemAttributeRepositoryWriterInterface
  • OrderItemFactoryInterface
  • OrderItemInterface
  • OrderItemPropertyFactoryInterface
  • OrderItemPropertyRepositoryDeleterInterface
  • OrderItemPropertyRepositoryReaderInterface
  • OrderItemPropertyRepositoryWriterInterface
  • OrderItemRepositoryDeleterInterface
  • OrderItemRepositoryInterface
  • OrderItemRepositoryReaderInterface
  • OrderItemRepositoryWriterInterface
  • OrderListGeneratorInterface
  • OrderObjectServiceInterface
  • OrderPaymentTypeInterface
  • OrderReadServiceInterface
  • OrderRepositoryDeleterInterface
  • OrderRepositoryInterface
  • OrderRepositoryReaderInterface
  • OrderRepositoryWriterInterface
  • OrderServiceSettingsInterface
  • OrderShippingTypeInterface
  • OrderStatusHistoryReaderInterface
  • OrderStatusHistoryWriterInterface
  • OrderTotalFactoryInterface
  • OrderTotalInterface
  • OrderTotalRepositoryDeleterInterface
  • OrderTotalRepositoryInterface
  • OrderTotalRepositoryReaderInterface
  • OrderTotalRepositoryWriterInterface
  • OrderWriteServiceInterface
  • ProductAttributeFactoryInterface
  • ProductAttributeInterface
  • ProductAttributeObjectServiceInterface
  • ProductAttributeRepositoryDeleterInterface
  • ProductAttributeRepositoryInterface
  • ProductAttributeRepositoryReaderInterface
  • ProductAttributeRepositoryWriterInterface
  • ProductAttributeServiceInterface
  • ProductCategoryLinkerInterface
  • ProductFactoryInterface
  • ProductImageContainerInterface
  • ProductImageContainerRepositoryInterface
  • ProductImageInterface
  • ProductImagePathsSettingsInterface
  • ProductImageProcessingInterface
  • ProductInterface
  • ProductListProviderFactoryInterface
  • ProductListProviderInterface
  • ProductObjectServiceInterface
  • ProductPermissionSetterInterface
  • ProductReadServiceInterface
  • ProductRepositoryDeleterInterface
  • ProductRepositoryInterface
  • ProductRepositoryReaderInterface
  • ProductRepositoryWriterInterface
  • ProductSettingsInterface
  • ProductSettingsRepositoryInterface
  • ProductSettingsRepositoryReaderInterface
  • ProductSettingsRepositoryWriterInterface
  • ProductWriteServiceInterface
  • StatisticsServiceInterface
  • StoredCategoryInterface
  • StoredOrderItemAttributeInterface
  • StoredOrderItemInterface
  • StoredOrderTotalInterface
  • StoredProductAttributeInterface
  • StoredProductInterface
  • UserConfigurationReaderInterface
  • UserConfigurationServiceInterface
  • UserConfigurationWriterInterface
  • VatNumberValidatorInterface

Exceptions

  • AjaxException
  • AttachmentNotFoundException
  • FileNotFoundException
  • HttpApiV2Exception
  • MissingControllerNameException
  • UnknownEnvironmentException
  1 <?php
  2 /* --------------------------------------------------------------
  3    CustomerWriteService.inc.php 2015-06-17 gm
  4    Gambio GmbH
  5    http://www.gambio.de
  6    Copyright (c) 2015 Gambio GmbH
  7    Released under the GNU General Public License (Version 2)
  8    [http://www.gnu.org/licenses/gpl-2.0.html]
  9    --------------------------------------------------------------
 10 */
 11 
 12 MainFactory::load_class('CustomerWriteServiceInterface');
 13 
 14 /**
 15  * Class CustomerWriteService
 16  *
 17  * This class provides methods for creating and deleting customer data
 18  *
 19  * @category   System
 20  * @package    Customer
 21  * @implements CustomerWriteServiceInterface
 22  */
 23 class CustomerWriteService implements CustomerWriteServiceInterface
 24 {
 25     /**
 26      * Address book service.
 27      * @var AddressBookServiceInterface
 28      */
 29     protected $addressBookService;
 30 
 31     /**
 32      * Customer repository.
 33      * @var CustomerRepositoryInterface
 34      */
 35     protected $customerRepository;
 36 
 37     /**
 38      * Customer service settings.
 39      * @var CustomerServiceSettingsInterface
 40      */
 41     protected $customerServiceSettings;
 42 
 43     /**
 44      * VAT number validator.
 45      * @var VatNumberValidatorInterface
 46      */
 47     protected $vatNumberValidator;
 48 
 49 
 50     /**
 51      * Constructor of the class CustomerService.
 52      *
 53      * @param AddressBookServiceInterface      $addressBookService      Address book service.
 54      * @param CustomerRepositoryInterface      $customerRepository      Customer repository.
 55      * @param CustomerServiceSettingsInterface $customerServiceSettings Customer service settings.
 56      * @param VatNumberValidatorInterface      $vatNumberValidator      VAT number validator.
 57      */
 58     public function __construct(AddressBookServiceInterface $addressBookService,
 59                                 CustomerRepositoryInterface $customerRepository,
 60                                 CustomerServiceSettingsInterface $customerServiceSettings,
 61                                 VatNumberValidatorInterface $vatNumberValidator)
 62     {
 63         $this->addressBookService      = $addressBookService;
 64         $this->customerRepository      = $customerRepository;
 65         $this->customerServiceSettings = $customerServiceSettings;
 66         $this->vatNumberValidator      = $vatNumberValidator;
 67     }
 68 
 69 
 70     /**
 71      * Creates a new customer with the given parameters.
 72      *
 73      * @param CustomerEmailInterface      $email           Customer's E-Mail address.
 74      * @param CustomerPasswordInterface   $password        Customer's password.
 75      * @param DateTime                    $dateOfBirth     Customer's date of birth.
 76      * @param CustomerVatNumberInterface  $vatNumber       Customer's VAT number.
 77      * @param CustomerCallNumberInterface $telephoneNumber Customer's telephone number.
 78      * @param CustomerCallNumberInterface $faxNumber       Customer's fax number.
 79      * @param AddressBlockInterface       $addressBlock    Customer's address.
 80      *
 81      * @return Customer Created customer.
 82      * @throws UnexpectedValueException On invalid arguments.
 83      *
 84      * TODO Replaced by Vat Check
 85      * TODO Rename to createNewRegistree
 86      */
 87     public function createNewRegistree(CustomerEmailInterface $email,
 88                                        CustomerPasswordInterface $password,
 89                                        DateTime $dateOfBirth,
 90                                        CustomerVatNumberInterface $vatNumber,
 91                                        CustomerCallNumberInterface $telephoneNumber,
 92                                        CustomerCallNumberInterface $faxNumber,
 93                                        AddressBlockInterface $addressBlock)
 94     {
 95         if($this->customerRepository->getRegistreeByEmail($email) != null)
 96         {
 97             throw new UnexpectedValueException('E-Mail already used in existing customer.');
 98         }
 99 
100         /* @var Customer $customer */
101         $customer = $this->customerRepository->getNewCustomer();
102         $customer->setStatusId($this->customerServiceSettings->getDefaultCustomerStatusId()); // TODO: replaced by vat check?
103 
104         $customer->setCustomerNumber(MainFactory::create('CustomerNumber', (string)$customer->getId()));
105         $customer->setGender($addressBlock->getGender());
106         $customer->setFirstname($addressBlock->getFirstname());
107         $customer->setLastname($addressBlock->getLastname());
108         $customer->setEmail($email);
109         $customer->setPassword($password);
110         $customer->setDateOfBirth($dateOfBirth);
111         $customer->setTelephoneNumber($telephoneNumber);
112         $customer->setFaxNumber($faxNumber);
113 
114         // import addressBlock data into empty default address
115         $this->addressBookService->updateAddress($addressBlock, $customer->getDefaultAddress());
116 
117         $vatNumberStatus = $this->vatNumberValidator->getVatNumberStatusCodeId($vatNumber,
118                                                                                $addressBlock->getCountry()->getId(),
119                                                                                false);
120         $customer->setVatNumber($vatNumber);
121         $customer->setVatNumberStatus($vatNumberStatus);
122 
123         $vatCustomerStatus = $this->vatNumberValidator->getCustomerStatusId($vatNumber,
124                                                                             $addressBlock->getCountry()->getId(),
125                                                                             false);
126         $customer->setStatusId($vatCustomerStatus);
127 
128         $this->customerRepository->store($customer);
129 
130         return $customer;
131     }
132 
133 
134     /**
135      * Creates a new guest account with the given parameters.
136      *
137      * @param CustomerEmailInterface      $email           Customer's E-Mail address.
138      * @param DateTime                    $dateOfBirth     Customer's date of birth.
139      * @param CustomerVatNumberInterface  $vatNumber       Customer's VAT number.
140      * @param CustomerCallNumberInterface $telephoneNumber Customer's telephone number.
141      * @param CustomerCallNumberInterface $faxNumber       Customer's fax number.
142      * @param AddressBlockInterface       $addressBlock    Customer's address.
143      *
144      * @return Customer Created guest customer.
145      * @throws UnexpectedValueException On invalid arguments.
146      */
147     public function createNewGuest(CustomerEmailInterface $email,
148                                    DateTime $dateOfBirth,
149                                    CustomerVatNumberInterface $vatNumber,
150                                    CustomerCallNumberInterface $telephoneNumber,
151                                    CustomerCallNumberInterface $faxNumber,
152                                    AddressBlockInterface $addressBlock)
153     {
154         $this->customerRepository->deleteGuestByEmail($email);
155 
156         if($this->customerRepository->getRegistreeByEmail($email) != null)
157         {
158             throw new UnexpectedValueException('E-Mail already used in existing customer.');
159         }
160 
161         /* @var Customer $customer */
162         $customer = $this->customerRepository->getNewCustomer();
163         $customer->setGuest(true);
164         $customer->setStatusId($this->customerServiceSettings->getDefaultGuestStatusId());
165 
166         $customer->setCustomerNumber(MainFactory::create('CustomerNumber', (string)$customer->getId()));
167         $customer->setGender($addressBlock->getGender());
168         $customer->setFirstname($addressBlock->getFirstname());
169         $customer->setLastname($addressBlock->getLastname());
170         $customer->setEmail($email);
171         $customer->setDateOfBirth($dateOfBirth);
172         $customer->setTelephoneNumber($telephoneNumber);
173         $customer->setFaxNumber($faxNumber);
174 
175         // import addressBlock data into empty default address
176         $this->addressBookService->updateAddress($addressBlock, $customer->getDefaultAddress());
177 
178         $vatNumberStatus = $this->vatNumberValidator->getVatNumberStatusCodeId($vatNumber,
179                                                                                $addressBlock->getCountry()->getId(),
180                                                                                true);
181         $customer->setVatNumber($vatNumber);
182         $customer->setVatNumberStatus($vatNumberStatus);
183 
184         $vatCustomerStatus = $this->vatNumberValidator->getCustomerStatusId($vatNumber,
185                                                                             $addressBlock->getCountry()->getId(), true);
186         $customer->setStatusId($vatCustomerStatus);
187 
188         $this->customerRepository->store($customer);
189 
190         return $customer;
191     }
192 
193 
194     /**
195      * Deletes the customer with the provided ID.
196      *
197      * @param IdType $customerId Customer's ID.
198      */
199     public function deleteCustomerById(IdType $customerId)
200     {
201         $this->customerRepository->deleteCustomerById($customerId);
202     }
203 
204 
205     /**
206      * Updates customer data.
207      *
208      * @param CustomerInterface $customer Customer.
209      *
210      * @return CustomerInterface Updated customer.
211      *
212      * TODO check if the new email address is used by another record
213      */
214     public function updateCustomer(CustomerInterface $customer)
215     {
216         $vatNumberStatus = $this->vatNumberValidator->getVatNumberStatusCodeId($customer->getVatNumber(),
217                                                                                $customer->getDefaultAddress()
218                                                                                         ->getCountry()
219                                                                                         ->getId(), false);
220         $customer->setVatNumberStatus($vatNumberStatus);
221         $this->customerRepository->store($customer);
222 
223         return $customer;
224     }
225 
226 }
API documentation generated by ApiGen