-
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.
SRSImport now checks for alreadyu existing users, and if those users …
…are not in state paid||approved, then it deletes their Participant and creates new Ist Participant on them.
- Loading branch information
Showing
5 changed files
with
158 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace kissj\Participant\Ist; | ||
use DateTimeImmutable; | ||
use kissj\Event\Event; | ||
use kissj\Participant\Participant; | ||
use kissj\Participant\ParticipantRepository; | ||
use kissj\Participant\ParticipantRole; | ||
use kissj\Payment\Payment; | ||
use kissj\Payment\PaymentRepository; | ||
use kissj\Payment\PaymentStatus; | ||
use kissj\User\User; | ||
|
||
|
||
readonly class IstService | ||
{ | ||
|
||
public function __construct( | ||
private ParticipantRepository $participantRepository, | ||
private PaymentRepository $paymentRepository, | ||
) { | ||
} | ||
|
||
/** | ||
* @param array<string> $preferredPosition | ||
*/ | ||
public function createIstPayment ( | ||
User $user, | ||
Event $event, | ||
string $contingent, | ||
string $firstName, | ||
string $lastName, | ||
string $nickname, | ||
string $permanentResidence, | ||
string $telephoneNumber, | ||
string $email, | ||
string $scoutUnit, | ||
DateTimeImmutable $birthDate, | ||
string $healthProblems, | ||
string $medicaments, | ||
string $psychicalHealthProblems, | ||
string $foodPreferences, | ||
DateTimeImmutable $arrivalDate, | ||
string $skills, | ||
array $preferredPosition, | ||
bool $printedHandbook, | ||
string $notes, | ||
DateTimeImmutable $registrationCloseDate, | ||
DateTimeImmutable $registrationApproveDate, | ||
?DateTimeImmutable $registrationPayDate, | ||
string $variableSymbol, | ||
int $price, | ||
PaymentStatus $paymentStatus, | ||
string $accountNumber, | ||
string $iban, | ||
string $swift, | ||
DateTimeImmutable $due, | ||
): Participant { | ||
$participant = new Participant(); | ||
$participant->user = $user; | ||
$participant->role = ParticipantRole::Ist; | ||
$participant->contingent = $contingent; | ||
$participant->firstName = $firstName; | ||
$participant->lastName = $lastName; | ||
$participant->nickname = $nickname; | ||
$participant->permanentResidence = $permanentResidence; | ||
$participant->telephoneNumber = $telephoneNumber; | ||
$participant->email = $email; | ||
$participant->scoutUnit = $scoutUnit; | ||
$participant->birthDate = $birthDate; | ||
$participant->healthProblems = $healthProblems; | ||
$participant->medicaments = $medicaments; | ||
$participant->psychicalHealthProblems = $psychicalHealthProblems; | ||
$participant->foodPreferences = $foodPreferences; | ||
$participant->arrivalDate = $arrivalDate; | ||
$participant->skills = $skills; | ||
$participant->preferredPosition = $preferredPosition; | ||
$participant->printedHandbook = $printedHandbook; | ||
$participant->notes = $notes; | ||
$participant->registrationCloseDate = $registrationCloseDate; | ||
$participant->registrationApproveDate = $registrationApproveDate; | ||
$participant->registrationPayDate = $registrationPayDate; | ||
|
||
$this->participantRepository->persist($participant); | ||
|
||
$payment = new Payment(); | ||
$payment->variableSymbol = $variableSymbol; | ||
$payment->price = (string)$price; | ||
$payment->currency = 'Kč'; | ||
$payment->status = $paymentStatus; | ||
$payment->purpose = 'fee'; | ||
$payment->accountNumber = $accountNumber; | ||
$payment->iban = $iban; | ||
$payment->swift = $swift; | ||
$payment->due = $due; | ||
$payment->note = $event->slug . ' ' . $participant->getFullName(); | ||
$payment->participant = $participant; | ||
|
||
$this->paymentRepository->persist($payment); | ||
|
||
return $participant; | ||
} | ||
} |
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