Reduction of amount for siblings implemented

This commit is contained in:
2026-04-25 22:31:38 +02:00
parent 8348f677a5
commit 21be212129
11 changed files with 68 additions and 8 deletions

View File

@@ -74,6 +74,7 @@ class EventResource extends JsonResource{
$returnArray['nameShort'] = substr($returnArray['nameShort'], 8, 13) . '...';
}
$returnArray['siblingReduction'] = $this->event->sibling_reduction ?? true;
$returnArray['costUnit'] = new CostUnitResource($this->event->costUnit()->first())->toArray(true);
$returnArray['solidarityPayment'] = $this->event->participation_fee_type === ParticipationFeeType::PARTICIPATION_FEE_TYPE_SOLIDARITY;
$returnArray['payPerDay'] = $this->event->pay_per_day;
@@ -301,7 +302,8 @@ class EventResource extends JsonResource{
string $participationType,
string $feeType,
DateTime $arrival,
DateTime $departure
DateTime $departure,
bool $hasSibling
) : Amount {
$fee = collect([
$this->event->participationFee1,
@@ -324,6 +326,10 @@ class EventResource extends JsonResource{
$basicFee = $basicFee->multiply($days);
}
if ($hasSibling && $this->event->sibling_reduction) {
$basicFee = $basicFee->multiply(0.5);
}
return $basicFee;
}
}