Skip to content

Commit 36ef499

Browse files
author
Andy Pieters
committed
Fixed notice in product tax calculation
1 parent 67f0659 commit 36ef499

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Transaction.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,12 @@ public static function start($options = array())
103103
if (isset($options['products'])) {
104104
foreach ((array)$options['products'] as $product) {
105105
$taxClass = 'N';
106+
$taxPercentage = 0;
106107
if (isset($product['tax'])) {
107108
$taxClass = Helper::calculateTaxClass($product['price'], $product['tax']);
109+
$taxPercentage = round(Helper::calculateTaxPercentage($product['price'], $product['tax']));
108110
}
109111

110-
$taxPercentage = round(Helper::calculateTaxPercentage($product['price'], $product['tax']));
111112
if (isset($product['vatPercentage']) && is_numeric($product['vatPercentage'])) {
112113
$taxPercentage = round($product['vatPercentage'], 2);
113114
$taxClass = Helper::calculateTaxClass(100 + $taxPercentage, $taxPercentage);

0 commit comments

Comments
 (0)