Comparacion con valor base
This commit is contained in:
@ -22,10 +22,13 @@ class Reservation extends Common\Ideal\Model
|
||||
public function withCommission(): float
|
||||
{
|
||||
$base = 0;
|
||||
foreach ($this->units as $unit) {
|
||||
foreach ($this->units as &$unit) {
|
||||
$unitBase = $unit->value;
|
||||
foreach ($this->promotions as $promotion) {
|
||||
$base += $promotion->activate()->reverse($unit['unit'], $unit['value'], $this->broker);
|
||||
$unitBase = $promotion->activate()->reverse($unit->unit, $unitBase, $this->broker);
|
||||
}
|
||||
$unit->base = $unitBase;
|
||||
$base += $unitBase;
|
||||
}
|
||||
return $base;
|
||||
}
|
||||
|
||||
@ -251,6 +251,9 @@ class Reservation extends Ideal\Service\API
|
||||
return $this->stateRepository->fetchByReservation($reservation_id);
|
||||
})
|
||||
);
|
||||
foreach ($model->units as &$unit) {
|
||||
$unit->unit = $this->unitService->getById($unit->unit->id);
|
||||
}
|
||||
$model->buyer = $this->personaService->getById($model->buyer->rut);
|
||||
return $model;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user