Skip to content

Commit

Permalink
YK-6 Web inschrijving + extra cijfers en buttons op het dashboard.
Browse files Browse the repository at this point in the history
  • Loading branch information
koencaerels committed Oct 3, 2023
1 parent fddeea4 commit a64e7d4
Show file tree
Hide file tree
Showing 27 changed files with 822 additions and 176 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ class AddFederation
private function __construct(
protected string $code,
protected string $name,
protected int $yearlySubscriptionFee,
protected int $yearlySubscriptionFee,
protected string $publicLabel,
)
{
) {
}

// —————————————————————————————————————————————————————————————————————————
Expand Down Expand Up @@ -63,5 +62,4 @@ public function getPublicLabel(): string
{
return $this->publicLabel;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public function go(AddFederation $command): bool
$command->getName(),
$command->getYearlySubscriptionFee(),
$command->getPublicLabel()

);
$this->federationRepo->save($model);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ class ChangeFederation
// —————————————————————————————————————————————————————————————————————————

private function __construct(
protected int $id,
protected int $id,
protected string $code,
protected string $name,
protected int $yearlySubscriptionFee,
protected int $yearlySubscriptionFee,
protected string $publicLabel,
)
{
) {
}

// —————————————————————————————————————————————————————————————————————————
Expand Down Expand Up @@ -70,5 +69,4 @@ public function getPublicLabel(): string
{
return $this->publicLabel;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public function go(MemberExtendSubscription $command): \stdClass
throw new \Exception('Membership extension command is not valid.');
}

$extraTraining = false;
if (3 === $command->getNumberOfTraining()) {
$extraTraining = true;
}

// -- make a subscription
$subscription = Subscription::make(
$this->subscriptionRepository->nextIdentity(),
Expand All @@ -76,7 +81,7 @@ public function go(MemberExtendSubscription $command): \stdClass
Gender::from($command->getGender()),
SubscriptionType::from($command->getType()),
$command->getNumberOfTraining(),
$command->isExtraTraining(),
$extraTraining,
$command->isNewMember(),
$command->isReductionFamily(),
$command->isJudogiBelt(),
Expand All @@ -99,6 +104,7 @@ public function go(MemberExtendSubscription $command): \stdClass

$subscription->setMember($member);
$subscription->changeStatus(SubscriptionStatus::AWAITING_PAYMENT);
$subscription->calculate();
$this->subscriptionRepository->save($subscription);

// -- make some subscription lines -----------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public function go(NewMemberSubscription $command): \stdClass

// -- make a subscription --------------------------------------------------------------------------------------

$extraTraining = false;
if (3 === $command->getNumberOfTraining()) {
$extraTraining = true;
}

$subscription = Subscription::make(
$this->subscriptionRepository->nextIdentity(),
$command->getContactFirstname(),
Expand All @@ -83,7 +88,7 @@ public function go(NewMemberSubscription $command): \stdClass
Gender::from($command->getGender()),
SubscriptionType::from($command->getType()),
$command->getNumberOfTraining(),
$command->isExtraTraining(),
$extraTraining,
$command->isNewMember(),
$command->isReductionFamily(),
$command->isJudogiBelt(),
Expand Down Expand Up @@ -114,6 +119,7 @@ public function go(NewMemberSubscription $command): \stdClass
);

// -- flush the subscription and get the database id via the uuid
$subscription->calculate();
$this->subscriptionRepository->save($subscription);
$this->entityManager->flush();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,216 @@

class NewMemberWebSubscription
{
// —————————————————————————————————————————————————————————————————————————
// Constructor
// —————————————————————————————————————————————————————————————————————————

private function __construct(
protected string $type,
protected int $federationId,
protected int $locationId,

protected string $contactFirstname,
protected string $contactLastname,
protected string $contactEmail,
protected string $contactPhone,

protected string $addressStreet,
protected string $addressNumber,
protected string $addressBox,
protected string $addressZip,
protected string $addressCity,

protected string $firstname,
protected string $lastname,
protected string $nationalRegisterNumber,
protected \DateTimeImmutable $dateOfBirth,
protected string $gender,

protected bool $memberSubscriptionIsHalfYear,
protected int $numberOfTraining,
protected bool $isExtraTraining,
protected bool $isNewMember,
protected bool $isReductionFamily,

protected float $total,
protected string $remarks,

protected bool $isJudogiBelt,
protected string $honeyPot,
) {
}

// —————————————————————————————————————————————————————————————————————————
// Hydrate from a json command
// —————————————————————————————————————————————————————————————————————————

/**
* @throws \Exception
*/
public static function hydrateFromJson($json): self
{
return new self(
trim($json->type),
intval($json->federationId),
intval($json->locationId),
trim($json->contactFirstname),
trim($json->contactLastname),
trim($json->contactEmail),
trim($json->contactPhone),
trim($json->addressStreet),
trim($json->addressNumber),
trim($json->addressBox),
trim($json->addressZip),
trim($json->addressCity),
trim($json->firstname),
trim($json->lastname),
trim($json->nationalRegisterNumber),
new \DateTimeImmutable($json->dateOfBirth),
trim($json->gender),
boolval($json->memberSubscriptionIsHalfYear),
intval($json->numberOfTraining),
boolval($json->isExtraTraining),
boolval($json->isNewMember),
boolval($json->isReductionFamily),
floatval($json->total),
trim($json->remarks),
boolval($json->isJudogiBelt),
trim($json->honeyPot),
);
}

// —————————————————————————————————————————————————————————————————————————
// Getters
// —————————————————————————————————————————————————————————————————————————

public function getType(): string
{
return $this->type;
}

public function getFederationId(): int
{
return $this->federationId;
}

public function getLocationId(): int
{
return $this->locationId;
}

public function getContactFirstname(): string
{
return $this->contactFirstname;
}

public function getContactLastname(): string
{
return $this->contactLastname;
}

public function getContactEmail(): string
{
return $this->contactEmail;
}

public function getContactPhone(): string
{
return $this->contactPhone;
}

public function getAddressStreet(): string
{
return $this->addressStreet;
}

public function getAddressNumber(): string
{
return $this->addressNumber;
}

public function getAddressBox(): string
{
return $this->addressBox;
}

public function getAddressZip(): string
{
return $this->addressZip;
}

public function getAddressCity(): string
{
return $this->addressCity;
}

public function getFirstname(): string
{
return $this->firstname;
}

public function getLastname(): string
{
return $this->lastname;
}

public function getNationalRegisterNumber(): string
{
return $this->nationalRegisterNumber;
}

public function getDateOfBirth(): \DateTimeImmutable
{
return $this->dateOfBirth;
}

public function getGender(): string
{
return $this->gender;
}

public function getNumberOfTraining(): int
{
return $this->numberOfTraining;
}

public function isExtraTraining(): bool
{
return $this->isExtraTraining;
}

public function isNewMember(): bool
{
return $this->isNewMember;
}

public function isReductionFamily(): bool
{
return $this->isReductionFamily;
}

public function getTotal(): float
{
return $this->total;
}

public function getRemarks(): string
{
return $this->remarks;
}

public function isJudogiBelt(): bool
{
return $this->isJudogiBelt;
}

public function isMemberSubscriptionIsHalfYear(): bool
{
return $this->memberSubscriptionIsHalfYear;
}

public function getHoneyPot(): string
{
return $this->honeyPot;
}
}
Loading

0 comments on commit a64e7d4

Please sign in to comment.