30 lines
831 B
PHP
30 lines
831 B
PHP
<?php
|
|
namespace Incoviba\Model\Venta;
|
|
|
|
use DateTimeInterface;
|
|
use Incoviba\Common;
|
|
|
|
class Promotion extends Common\Ideal\Model
|
|
{
|
|
public Precio $price;
|
|
public float $amount;
|
|
public DateTimeInterface $startDate;
|
|
public DateTimeInterface $endDate;
|
|
public DateTimeInterface $validUntil;
|
|
public int $state;
|
|
|
|
protected function jsonComplement(): array
|
|
{
|
|
return [
|
|
'price_id' => $this->price->id,
|
|
'amount' => $this->amount,
|
|
'start_date' => $this->startDate->format('Y-m-d'),
|
|
'end_date' => $this->endDate->format('Y-m-d'),
|
|
'valid_until' => $this->validUntil->format('Y-m-d'),
|
|
'state' => [
|
|
'id' => $this->state,
|
|
'description' => Promotion\State::name($this->state)
|
|
]
|
|
];
|
|
}
|
|
} |