Skip to content

Commit

Permalink
WIZ-6009 Fix Wizaplace\SDK\Pim\Product\PriceTier::getPrice (#8706)
Browse files Browse the repository at this point in the history
* WIZ-6009: Fix -théorique- du bug. Attendre vérif de GFI et valider

* WIZ-6009 remove LogicException

Co-authored-by: Roupioz <52406581+clementwizaplace@users.noreply.github.com>
  • Loading branch information
2 people authored and cyprille committed Jan 21, 2020
1 parent f034a04 commit 03c912c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 14 additions & 1 deletion src/Catalog/ProductOffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Wizaplace\SDK\Catalog;

use Wizaplace\SDK\Pim\Product\ExtendedPriceTier;
use Wizaplace\SDK\Pim\Product\ProductStatus;

class ProductOffer
Expand All @@ -22,7 +23,8 @@ class ProductOffer
private $divisions;
/** @var ProductStatus|null */
private $status;

/** @var array */
private $priceTiers;
/**
* ProductOffer constructor.
*
Expand All @@ -38,6 +40,12 @@ public function __construct(array $data)
if (isset($data['status']) && in_array($data['status'], ProductStatus::toArray())) {
$this->status = new ProductStatus($data['status']);
}

if (\array_key_exists('priceTiers', $data) && \is_array($data['priceTiers'])) {
foreach ($data['priceTiers'] as $priceTier) {
$this->addPriceTier($priceTier);
}
}
}

public function getProductId(): int
Expand All @@ -64,4 +72,9 @@ public function getStatus(): ?ProductStatus
{
return $this->status;
}

public function addPriceTier(array $priceTier): void
{
$this->priceTiers[] = new ExtendedPriceTier($priceTier);
}
}
4 changes: 2 additions & 2 deletions src/Pim/Product/PriceTier.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public function setLowerLimit(int $lowerLimit): self
return $this;
}

/** @return float */
public function getPrice(): float
/** @return null|float */
public function getPrice(): ?float
{
return $this->price;
}
Expand Down

0 comments on commit 03c912c

Please sign in to comment.