Files
shipping-portal/app/Classes/Modules/Transactions/DataTransferObjects/TransactionDetailObject.php
T
2024-04-07 09:27:09 +08:00

99 lines
1.9 KiB
PHP

<?php
namespace App\Classes\Modules\Transactions\DataTransferObjects;
use App\Classes\General\Interfaces\DataTransferObject;
class TransactionDetailObject implements DataTransferObject
{
/** @var string|null */
private $reference;
/** @var string|null */
private $name;
/** @var float|null */
private $quantity;
/** @var float|null */
private $price;
/** @var float|null */
private $taxPercentage;
/**
* TransactionDetailObject constructor.
* @param string $reference
* @param string $name
* @param float $quantity
* @param float $price
* @param float $taxPercentage
*/
public function __construct(?string $reference, ?string $name , ?float $quantity, ?float $price, ?float $taxPercentage)
{
$this->reference = $reference;
$this->name = $name;
$this->quantity = $quantity;
$this->price = $price;
$this->taxPercentage = $taxPercentage;
}
/**
* @return string
*/
public function getReference(): ?string
{
return $this->reference;
}
/**
* @return string
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @return float
*/
public function getQuantity(): ?float
{
return $this->quantity;
}
/**
* @return float
*/
public function getPrice(): ?float
{
return $this->price;
}
/**
* @return float
*/
public function getAmount(): float
{
return ($this->getQuantity() * $this->getPrice()) + $this->getTaxAmount();
}
/**
* @return float
*/
public function getTaxPercentage(): ?float
{
return $this->taxPercentage;
}
/**
* @return float
*/
public function getTaxAmount(): float
{
return ($this->getQuantity() * $this->getPrice()) * $this->getTaxPercentage() / 100;
}
}