Initial xentral_oss_20.3.c9ffacf
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Modules\FiskalyApi\Transaction\Payment;
|
||||
|
||||
abstract class BasePayment
|
||||
{
|
||||
/** @var string */
|
||||
private $paymentType;
|
||||
/** @var float */
|
||||
private $amount;
|
||||
|
||||
/**
|
||||
* BasePayment constructor.
|
||||
*
|
||||
* @param string $paymentType
|
||||
* @param float $amount
|
||||
*/
|
||||
protected function __construct(string $paymentType, float $amount)
|
||||
{
|
||||
$this->paymentType = $paymentType;
|
||||
$this->amount = $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPaymentType(): string {
|
||||
return $this->paymentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getAmount(): float {
|
||||
return $this->amount;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Modules\FiskalyApi\Transaction\Payment;
|
||||
|
||||
final class CashPayment extends BasePayment
|
||||
{
|
||||
public function __construct(float $amount)
|
||||
{
|
||||
parent::__construct('CASH', $amount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Modules\FiskalyApi\Transaction\Payment;
|
||||
|
||||
final class NonCashPayment extends BasePayment
|
||||
{
|
||||
public function __construct(float $amount)
|
||||
{
|
||||
parent::__construct('NON_CASH', $amount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Modules\FiskalyApi\Transaction\Payment;
|
||||
|
||||
final class OrderLineItem
|
||||
{
|
||||
/** @var float $quantity */
|
||||
private $quantity;
|
||||
|
||||
/** @var string $text */
|
||||
private $text;
|
||||
|
||||
/** @var float $pricePerUnit */
|
||||
private $pricePerUnit;
|
||||
|
||||
public function __construct(float $quantity, string $text, float $pricePerUnit)
|
||||
{
|
||||
$this->quantity = $quantity;
|
||||
$this->text = $text;
|
||||
$this->pricePerUnit = $pricePerUnit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getQuantity(): string
|
||||
{
|
||||
return number_format($this->quantity, 2, '.', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $quantity
|
||||
*/
|
||||
public function setQuantity(float $quantity): void
|
||||
{
|
||||
$this->quantity = $quantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getText(): string
|
||||
{
|
||||
return mb_substr($this->text, 0, 255);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
*/
|
||||
public function setText(string $text): void
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPricePerUnit(): string
|
||||
{
|
||||
return number_format($this->pricePerUnit, 2, '.', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $pricePerUnit
|
||||
*/
|
||||
public function setPricePerUnit(float $pricePerUnit): void
|
||||
{
|
||||
$this->pricePerUnit = $pricePerUnit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user