Skip to content

Commit

Permalink
Merge pull request #6 from Plasma-Platform/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
utrain-tm authored Aug 28, 2019
2 parents b1ba682 + 43a367e commit 10710c2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Create an Order
$order = new \API2Client\Entities\Order ();

$order->setProjectId (0);
$order->setAmount (144);
$order->setAmount (174);
$order->setBonusesAmount (0);

$billingInfo = new \API2Client\Entities\Order\BillingInfo ();
Expand Down Expand Up @@ -131,10 +131,11 @@ $order->addProductInfo ($productInfo2);

$externalProduct = new \API2Client\Entities\Order\ProductInfo ();

$externalProduct->setProductId (0);
$externalProduct->setPrice (33);
$externalProduct->setName ('Headspace Journey Subscription');
$externalProduct->setType ('external');
$externalProduct->setProductId (0);
$externalProduct->setPrice (33);
$externalProduct->setFinalPrice (30);
$externalProduct->setName ('Headspace Journey Subscription');
$externalProduct->setType ('external');

$order->addProductInfo ($externalProduct);

Expand Down
22 changes: 22 additions & 0 deletions src/API2Client/Entities/Order/ProductInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ class ProductInfo
*/
protected $price;

/**
* @var float
*/
protected $finalPrice;

/** @var boolean */
protected $exclusive;

Expand Down Expand Up @@ -84,6 +89,22 @@ public function getAdditionalInfo ()
return $this->additionalInfo;
}

/**
* @param float $finalPrice
*/
public function setFinalPrice ($finalPrice)
{
$this->finalPrice = $finalPrice;
}

/**
* @return float
*/
public function getFinalPrice ()
{
return $this->finalPrice != null ? $this->finalPrice : $this->getPrice() ;
}

/**
* @param float $price
*/
Expand Down Expand Up @@ -195,6 +216,7 @@ public function toArray ()
'discountCodeList' => $this->getDiscountCodeList (),
'name' => $this->getName (),
'price' => $this->getPrice (),
'finalPrice' => $this->getFinalPrice (),
'productId' => $this->getProductId () ? $this->getProductId () : 0,
'type' => $this->getType (),
);
Expand Down
1 change: 1 addition & 0 deletions src/API2Client/Setters/OrderItemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function create ($data)
$productInfo = new ProductInfo ();
$productInfo->setName ($this->getValue ('name', $product, ''));
$productInfo->setPrice ($this->getValue ('price', $product, 0));
$productInfo->setFinalPrice ($this->getValue ('finalPrice', $product));
$productInfo->setProductId ($this->getValue ('productId', $product, 0));
$productInfo->setType ($this->getValue ('type', $product, ''));

Expand Down

0 comments on commit 10710c2

Please sign in to comment.