<?php
namespace App\Controller\Tenants\Tenant1;
use App\Controller\Traits\SecurityTrait;
use App\Services\reCaptcha3ValidatorService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use App\Services\{
EntityServices\UserEntityService,
ParameterService,
Stripe\StripeService,
TenantService,
TenantFlowService
};
use App\Entity\{
User
};
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security;
class SupportController extends AbstractController
{
use SecurityTrait;
private $reCaptcha3ValidatorService;
private $stripeService;
private $userEntityService;
public function __construct(
StripeService $stripeService,
TenantService $tenantService,
TenantFlowService $tenantFlowService,
UserEntityService $userEntityService,
reCaptcha3ValidatorService $reCaptcha3ValidatorService,
ParameterService $parameterService
)
{
$this->stripeService = $stripeService->setSDK('tenant1');
$this->tenant = $tenantService->defineTenant();
$this->tenantFlowService = $tenantFlowService;
$this->userEntityService = $userEntityService;
$this->reCaptcha3ValidatorService = $reCaptcha3ValidatorService;
$this->reCaptcha3ValidatorService->setAccess(
$parameterService->getParameter($this->tenant->getSettingsArrayAssoc()['config'] ?? 'non-existent', 'reCaptcha3.secretKey'),
$parameterService->getParameter($this->tenant->getSettingsArrayAssoc()['config'] ?? 'non-existent', 'reCaptcha3.allowableScore')
);
}
/**
* @Route("/support", name="support")
*/
public function support(Request $request): Response
{
return $this->render("{$this->tenant->getRootPath()}/pages/support.html.twig", [
'rootPath' => $this->tenant->getRootPath(),
'userFields' => $this->tenant->getUserFieldsArray(),
'message' => $errorMessage ?? '',
]
+ $this->tenantFlowService->prepareTemplateArguments('signUp', $this->tenant)
+ $this->tenantFlowService->prepareTemplateArguments('menu', $this->tenant)
);
}
}