-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added approving participants into v3 API + deleted old CEJ24 stuff
- Loading branch information
1 parent
b668ec3
commit 47d94fa
Showing
11 changed files
with
131 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace kissj\Participant\Admin; | ||
|
||
use kissj\AbstractController; | ||
use kissj\Event\Event; | ||
use kissj\Participant\ParticipantException; | ||
use kissj\Participant\ParticipantRepository; | ||
use kissj\Participant\ParticipantService; | ||
use Psr\Http\Message\ResponseInterface as Response; | ||
use Psr\Http\Message\ServerRequestInterface as Request; | ||
|
||
class AdminJsonController extends AbstractController | ||
{ | ||
public function __construct( | ||
private readonly ParticipantService $participantService, | ||
private readonly ParticipantRepository $participantRepository, | ||
) { | ||
} | ||
|
||
public function approveParticipant( | ||
Response $response, | ||
Event $event, | ||
int $participantId, | ||
): Response { | ||
$participant = $this->participantRepository->getParticipantById($participantId, $event); | ||
|
||
try { | ||
$participant = $this->participantService->approveRegistration($participant); | ||
} catch (ParticipantException $e) { | ||
return $this->getJsonResponseFromException($response, $e); | ||
} | ||
|
||
return $this->getResponseWithJson( | ||
$response, | ||
[ | ||
'userStatus' => $participant->getUserButNotNull()->status->value, | ||
] | ||
); | ||
} | ||
|
||
public function changeAdminNote( | ||
Request $request, | ||
Response $response, | ||
Event $event, | ||
int $participantId, | ||
): Response { | ||
$participant = $this->participantRepository->getParticipantById($participantId, $event); | ||
|
||
$this->participantService->setAdminNote( | ||
$participant, | ||
$this->getParameterFromBody($request, 'adminNote'), | ||
); | ||
|
||
return $this->getResponseWithJson($response, ['adminNote' => $participant->adminNote]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace kissj\Participant; | ||
|
||
use kissj\TranslatableException; | ||
|
||
class ParticipantException extends TranslatableException | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
src/Templates/translatable/emails/payment-cs-contingent-info.twig
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace kissj; | ||
|
||
use Exception; | ||
|
||
class TranslatableException extends Exception | ||
{ | ||
public function __construct( | ||
readonly public string $translationKey, | ||
readonly public int $httpStatus = 400, | ||
) { | ||
parent::__construct($translationKey); | ||
} | ||
} |