diff -Nuar a/vendor/magento/module-company/Plugin/Company/Model/EmailNotification.php b/vendor/magento/module-company/Plugin/Company/Model/EmailNotification.php new file mode 100644 index 000000000..55dc2458d --- /dev/null +++ b/vendor/magento/module-company/Plugin/Company/Model/EmailNotification.php @@ -0,0 +1,90 @@ +companyEmailSender = $companyEmailSender; + $this->urlBuilder = $urlBuilder; + $this->customerRepository = $customerRepository; + } + + /** + * Notifying customer after creating company account through API + * + * @param Save $subject + * @param CompanyInterface $company + * @return CompanyInterface + * @throws LocalizedException + * @throws NoSuchEntityException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterSave( + Save $subject, + CompanyInterface $company + ): CompanyInterface { + if ($company) { + $customerData = $this->customerRepository + ->getById( + $company->getSuperUserId() + ); + $companyUrl = $this->urlBuilder + ->getUrl( + 'company/index/edit', + ['id' => $company->getEntityId()] + ); + $this->companyEmailSender->sendAdminNotificationEmail( + $customerData, + $company->getCompanyName(), + $companyUrl + ); + } + return $company; + } +} diff -Nuar a/vendor/magento/module-company/etc/webapi_rest/di.xml b/vendor/magento/module-company/etc/webapi_rest/di.xml index 0d79ebcde..4880eed90 100644 --- a/vendor/magento/module-company/etc/webapi_rest/di.xml +++ b/vendor/magento/module-company/etc/webapi_rest/di.xml @@ -12,4 +12,7 @@ + + + diff -Nuar a/vendor/magento/module-company/etc/webapi_soap/di.xml b/vendor/magento/module-company/etc/webapi_soap/di.xml new file mode 100644 index 000000000..8d84cb1c2 --- /dev/null +++ b/vendor/magento/module-company/etc/webapi_soap/di.xml @@ -0,0 +1,12 @@ + + + + + + +