|
|
@@ -257,10 +257,6 @@ class HelloAssoService extends ApiRequestService
|
|
|
{
|
|
|
$helloAssoEntity = $this->getHelloAssoEntityFor($organizationId);
|
|
|
|
|
|
- if (!$helloAssoEntity->getOrganizationSlug() || !$helloAssoEntity->getToken()) {
|
|
|
- throw new \RuntimeException('HelloAsso entity incomplete');
|
|
|
- }
|
|
|
-
|
|
|
$formType = 'Event';
|
|
|
|
|
|
$data = $this->getResource(
|
|
|
@@ -278,14 +274,6 @@ class HelloAssoService extends ApiRequestService
|
|
|
throw new \RuntimeException('Event not found');
|
|
|
}
|
|
|
|
|
|
- $organizationId = $event->getOrganization()->getId();
|
|
|
-
|
|
|
- $helloAssoEntity = $this->getHelloAssoEntityFor($organizationId);
|
|
|
-
|
|
|
- if (!$helloAssoEntity->getOrganizationSlug() || !$helloAssoEntity->getToken()) {
|
|
|
- throw new \RuntimeException('HelloAsso entity incomplete');
|
|
|
- }
|
|
|
-
|
|
|
$helloAssoFormSlug = $event->getHelloAssoSlug();
|
|
|
if (!$helloAssoFormSlug) {
|
|
|
throw new \RuntimeException('HelloAsso form slug not found');
|
|
|
@@ -294,7 +282,7 @@ class HelloAssoService extends ApiRequestService
|
|
|
return $this->getHelloAssoEventForm($organizationId, $helloAssoFormSlug);
|
|
|
}
|
|
|
|
|
|
- protected function getHelloAssoEntityFor(int $organizationId): HelloAsso
|
|
|
+ protected function getHelloAssoEntityFor(int $organizationId, bool $shallHaveToken = true): HelloAsso
|
|
|
{
|
|
|
$organization = $this->organizationRepository->find($organizationId);
|
|
|
if (!$organization) {
|
|
|
@@ -304,6 +292,9 @@ class HelloAssoService extends ApiRequestService
|
|
|
if (!$helloAssoEntity) {
|
|
|
throw new \RuntimeException('HelloAsso entity not found');
|
|
|
}
|
|
|
+ if ($shallHaveToken && (!$helloAssoEntity->getOrganizationSlug() || !$helloAssoEntity->getToken())) {
|
|
|
+ throw new \RuntimeException('HelloAsso entity incomplete');
|
|
|
+ }
|
|
|
return $helloAssoEntity;
|
|
|
}
|
|
|
|