Connect contact forms with buspro api
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user