Skip to content

Commit

Permalink
EET: implement urceno_cerp_zuct and cerp_zuct attributes (#70)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Eliáš <jan.elias@residit.com>
  • Loading branch information
PavelJurasek and abcdefghresidit committed Sep 6, 2020
1 parent 11774a1 commit 35546ae
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Api/Entity/PaymentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ public static function create($data, $validators = [])
'dan2' => 'taxReducedRateFirst',
'zakl_dan3' => 'taxBaseReducedRateSecond',
'dan3' => 'taxReducedRateSecond',
'urceno_cerp_zuct' => 'subsequentDrawing',
'cerp_zuct' => 'subsequentlyDrawn',
], $data['eet']);

$eetSum = $eet->getSum();
Expand All @@ -196,7 +198,9 @@ public static function create($data, $validators = [])
+ $eet->getTaxBaseReducedRateFirst()
+ $eet->getTaxReducedRateFirst()
+ $eet->getTaxBaseReducedRateSecond()
+ $eet->getTaxReducedRateSecond();
+ $eet->getTaxReducedRateSecond()
+ $eet->getSubsequentDrawing()
+ $eet->getSubsequentlyDrawn();

if ($validators[self::V_PRICES] === TRUE) {
if (number_format($eetSum, 8) !== number_format($eetTotal, 8)) {
Expand Down
30 changes: 30 additions & 0 deletions src/Api/Objects/Eet.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class Eet extends AbstractObject
/** @var string */
public $currency;

/** @var float|null */
public $subsequentDrawing;

/** @var float|null */
public $subsequentlyDrawn;

/**
* @return float
*/
Expand Down Expand Up @@ -162,6 +168,22 @@ public function getTaxBaseNoVat()
return $this->taxBaseNoVat;
}

/**
* @return float|null
*/
public function getSubsequentDrawing()
{
return $this->subsequentDrawing;
}

/**
* @return float|null
*/
public function getSubsequentlyDrawn()
{
return $this->subsequentlyDrawn;
}

/**
* @param float $sum
* @return void
Expand Down Expand Up @@ -279,6 +301,14 @@ public function toArray()
$data['dan3'] = $this->getTaxReducedRateSecondInCents();
}

if ($this->getSubsequentDrawing() !== NULL) {
$data['urceno_cerp_zuct'] = $this->getSubsequentDrawing();
}

if ($this->getSubsequentlyDrawn() !== NULL) {
$data['cerp_zuct'] = $this->getSubsequentlyDrawn();
}

return $data;
}

Expand Down

0 comments on commit 35546ae

Please sign in to comment.