Skip to content

Commit

Permalink
YK-81 - Ingeven type betaling.
Browse files Browse the repository at this point in the history
  • Loading branch information
koencaerels committed Jul 11, 2024
1 parent 1f2a5d2 commit a181734
Show file tree
Hide file tree
Showing 30 changed files with 2,102 additions and 1,358 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ public function import(): bool

$dto = new \stdClass();
$dto->firstName = (string) $worksheet->getCellByColumnAndRow(2, $row)->getValue();
$dto->lastName = mb_strtoupper($worksheet->getCellByColumnAndRow(1, $row)->getValue());
$dto->lastName = mb_strtoupper((string) $worksheet->getCellByColumnAndRow(1, $row)->getValue());
$dto->dateOfBirth = Date::excelToDateTimeObject($worksheet->getCellByColumnAndRow(4, $row)->getValue())->format(\DateTimeInterface::ATOM);
$dto->nationalNumber = (string) $worksheet->getCellByColumnAndRow(5, $row)->getValue();
$dto->street = (string) $worksheet->getCellByColumnAndRow(3, $row)->getValue();
$dto->city = $worksheet->getCellByColumnAndRow(6, $row)->getValue();
$dto->city = (string) $worksheet->getCellByColumnAndRow(6, $row)->getValue();
$dto->postalCode = (string) $worksheet->getCellByColumnAndRow(7, $row)->getValue();
$dto->contactPhone = (string) $worksheet->getCellByColumnAndRow(8, $row)->getValue();
$dto->contactEmail = (string) $worksheet->getCellByColumnAndRow(9, $row)->getValue();
$dto->gender = Gender::X;
$dto->location = $this->locationRepository->getById(LocationMapping::getLocationId($worksheet->getCellByColumnAndRow(26, $row)->getValue()));
$dto->grade = $this->gradeRepository->getById(GradeMapping::getGradeId($worksheet->getCellByColumnAndRow(25, $row)->getValue()));
$dto->location = $this->locationRepository->getById(LocationMapping::getLocationId((string) $worksheet->getCellByColumnAndRow(26, $row)->getValue()));
$dto->grade = $this->gradeRepository->getById(GradeMapping::getGradeId((string) $worksheet->getCellByColumnAndRow(25, $row)->getValue()));
$dto->sporta = (bool) $worksheet->getCellByColumnAndRow(23, $row)->getValue();
$dto->jv = (bool) $worksheet->getCellByColumnAndRow(24, $row)->getValue();
if ($dto->sporta) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,24 @@ class MarkSubscriptionAsPayed

private function __construct(
protected int $id,
protected string $type,
) {
}

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

public static function make(int $subscriptionId): self
public static function make(int $subscriptionId, string $type): self
{
return new self($subscriptionId);
return new self($subscriptionId, $type);
}

public static function hydrateFromJson(\stdClass $json): self
{
return new self(
$json->id,
$json->type
);
}

Expand All @@ -48,4 +50,9 @@ public function getId(): int
{
return $this->id;
}

public function getType(): string
{
return $this->type;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ public function go(MarkSubscriptionAsPayed $command): bool
$subscription = $this->subscriptionRepository->getById($command->getId());

if (SubscriptionStatus::AWAITING_PAYMENT === $subscription->getStatus()) {
$type = SubscriptionPaymentType::from($command->getType());
$subscription->changeStatus(SubscriptionStatus::PAYED);
$subscription->setPaymentTypeInfo(SubscriptionPaymentType::TRANSFER);
$subscription->setPaymentTypeInfo($type);
$this->subscriptionRepository->save($subscription);
$result = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
// Handler
// —————————————————————————————————————————————————————————————————————————

public function go(MarkSubscriptionAsPayedFromMollie $command): int|null
public function go(MarkSubscriptionAsPayedFromMollie $command): ?int
{
$result = false;
$subscription = $this->subscriptionRepository->findByPaymentId($command->getPaymentId());
Expand Down
6 changes: 3 additions & 3 deletions application/YoshiKan/Domain/Model/Member/MemberRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public function findByNameOrDateOfBirth(string $firstname, string $lastname, \Da
public function search(
string $keyword = '',
int $yearOfBirth = 0,
Location $location = null,
Grade $grade = null,
?Location $location = null,
?Grade $grade = null,
int $minYearOfBirth = 0,
int $maxYearOfBirth = 0,
bool $isActive = null,
?bool $isActive = null,
): array;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ enum SubscriptionPaymentType: string
{
case TRANSFER = 'overschrijving';
case MOLLIE = 'mollie';
case CASH = 'cash';
case CONTANT = 'contant';
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ public function findByNameOrDateOfBirth(string $firstname, string $lastname, \Da
public function search(
string $keyword = '',
int $yearOfBirth = 0,
Location $location = null,
Grade $grade = null,
?Location $location = null,
?Grade $grade = null,
int $minYearOfBirth = 0,
int $maxYearOfBirth = 0,
bool $isActive = null,
?bool $isActive = null,
): array {
$q = $this->createQueryBuilder('t')->andWhere('0 = 0');
if (0 != mb_strlen(trim($keyword))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
van volgende referentie
"<strong>YKS-{{ subscription.id }} {{ subscription.lastname }} {{ subscription.firstname }}</strong>".
Zo kunnen we je betaling snel identificeren.
<br>Je kunt het bedrag ook contant betalen tijdens één van de volgende trainingen.
</p>
{% if (subscription.paymentLink is not empty) %}
<p>
Of betaal online via deze Mollie-link:
<a href="{{ subscription.paymentLink }}" target="_blank">{{ subscription.paymentLink }}</a>.
</p>
{% endif %}
{# {% if (subscription.paymentLink is not empty) %}#}
{# <p>#}
{# Of betaal online via deze Mollie-link:#}
{# <a href="{{ subscription.paymentLink }}" target="_blank">{{ subscription.paymentLink }}</a>.#}
{# </p>#}
{# {% endif %}#}
<p>
Wanneer we je betaling hebben ontvangen, zullen we je officieel
inschrijven en krijg je toegang tot al onze trainingen en evenementen.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
verzoeken wij je vriendelijk om een bedrag van <strong>{{ subscription.total }} €</strong> over te maken naar
het volgende bankrekeningnummer: <strong>BE37 7330 0101 8328</strong> met vermelding van de referentie
<strong>"YKS-{{ subscription.id }} {{ subscription.lastname }} {{ subscription.firstname }}"</strong>.
<br>Je kunt het bedrag ook contant betalen tijdens één van de volgende trainingen.
</p>
{% if (subscription.paymentLink is not empty) %}
<p>
Of betaal online via deze Mollie-link:
<a href="{{ subscription.paymentLink }}" target="_blank">{{ subscription.paymentLink }}</a>.
</p>
{% endif %}
{# {% if (subscription.paymentLink is not empty) %}#}
{# <p>#}
{# Of betaal online via deze Mollie-link:#}
{# <a href="{{ subscription.paymentLink }}" target="_blank">{{ subscription.paymentLink }}</a>.#}
{# </p>#}
{# {% endif %}#}
<p>
Als {{ subscription.firstname }} niet langer lid wenst te zijn, geef dan ons een seintje. Alvast bedankt.
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
van volgende referentie
"<strong>YKS-{{ subscription.id }} {{ subscription.lastname }} {{ subscription.firstname }}</strong>".
Zo kunnen we je betaling snel identificeren.
<br>Je kunt het bedrag ook contant betalen tijdens één van de volgende trainingen.
</p>
{% if (subscription.paymentLink is not empty) %}
<p>
Of betaal online via deze Mollie-link:
<a href="{{ subscription.paymentLink }}" target="_blank">{{ subscription.paymentLink }}</a>.
</p>
{% endif %}
{# {% if (subscription.paymentLink is not empty) %}#}
{# <p>#}
{# Of betaal online via deze Mollie-link:#}
{# <a href="{{ subscription.paymentLink }}" target="_blank">{{ subscription.paymentLink }}</a>.#}
{# </p>#}
{# {% endif %}#}
<p>
Wanneer we je betaling hebben ontvangen, zullen we je officieel
inschrijven en krijg je toegang tot al onze trainingen en evenementen.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
<br>{{ subscription.remarks | nl2br }}
</p>
{% endif %}

<p>
<strong>Totaal: {{ subscription.total }} €</strong>
<br>Gelieve bovenstaand bedrag over te schrijven
<br>op rekeningnummer BE37 7330 0101 8328 (BIC KREDBEBB)
<br>met als referentie: "YKS-{{ subscription.id }}
{{ subscription.firstname }} {{ subscription.lastname }}".
<br>Je kunt het bedrag ook contant betalen tijdens één van de volgende trainingen.
</p>
<p>
Alvast bedankt.
Expand Down
Loading

0 comments on commit a181734

Please sign in to comment.