Reduction of amount for siblings implemented
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user