Connect contact forms with buspro api

This commit is contained in:
Björn Fromme
2019-09-09 13:54:43 +02:00
parent 5827af2b5f
commit d59748a030
14 changed files with 417 additions and 66 deletions
@@ -26,6 +26,7 @@ namespace EP\EpTheme\Controller;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpTheme\Service\BookingApiService;
use EP\EpTheme\Service\EmailService;
use EP\EpTheme\Domain\Model\Dto\ContactForm;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
@@ -40,12 +41,20 @@ class AjaxFormController extends ActionController
protected $emailService;
/**
* @param EmailService $emailService
* @var BookingApiService
*/
public function __construct(EmailService $emailService)
protected $bookingApiService;
/**
* @param EmailService $emailService
* @param BookingApiService $bookingApiService
*/
public function __construct(EmailService $emailService, BookingApiService $bookingApiService)
{
parent::__construct();
$this->emailService = $emailService;
$this->bookingApiService = $bookingApiService;
}
/**
@@ -63,6 +72,15 @@ class AjaxFormController extends ActionController
[ 'contactForm' => $contactForm ]
);
$addressData = [
'name' => $contactForm->getName(),
'vorname' => $contactForm->getFirstName(),
'email' => $contactForm->getEmail(),
'geschlecht' => $contactForm->getGender(),
];
$this->bookingApiService->registerAddress($addressData);
return json_encode($response);
}