diff --git a/src/sale/Sale.php b/src/sale/Sale.php index 81db5463..538f0afb 100755 --- a/src/sale/Sale.php +++ b/src/sale/Sale.php @@ -129,9 +129,9 @@ public function setId($id) $this->id = $id; } - public function getData() + public function getData(): ?array { - return $this->data; + return !empty($this->data) ? $this->data : null; } public function jsonSerialize(): array diff --git a/src/sale/SaleCreationDto.php b/src/sale/SaleCreationDto.php index 81a2a85f..144b6d50 100644 --- a/src/sale/SaleCreationDto.php +++ b/src/sale/SaleCreationDto.php @@ -28,4 +28,6 @@ class SaleCreationDto public $closeTime; public $data; + + public $reason; } diff --git a/src/sale/SaleFactory.php b/src/sale/SaleFactory.php index 5a90c7fb..fcd725f2 100644 --- a/src/sale/SaleFactory.php +++ b/src/sale/SaleFactory.php @@ -23,7 +23,7 @@ class SaleFactory implements SaleFactoryInterface */ public function create(SaleCreationDto $dto) { - $sale = new Sale($dto->id, $dto->target, $dto->customer, $dto->plan, $dto->time); + $sale = new Sale($dto->id, $dto->target, $dto->customer, $dto->plan, $dto->time, $dto->data); if ($dto->closeTime !== null) { $sale->close($dto->closeTime); diff --git a/src/sale/SaleInterface.php b/src/sale/SaleInterface.php index 0c706aaa..843104db 100644 --- a/src/sale/SaleInterface.php +++ b/src/sale/SaleInterface.php @@ -62,9 +62,9 @@ public function getTime(); public function getCloseTime(): ?DateTimeImmutable; /** - * @return string|array|null + * @return array|null */ - public function getData(); + public function getData(): ?array; /** * @param DateTimeImmutable $time