From 36ef499be0ee45e35229b44cf300344713138624 Mon Sep 17 00:00:00 2001 From: Andy Pieters Date: Wed, 14 Feb 2018 11:05:21 +0100 Subject: [PATCH] Fixed notice in product tax calculation --- src/Transaction.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Transaction.php b/src/Transaction.php index b06385c3..dd715186 100644 --- a/src/Transaction.php +++ b/src/Transaction.php @@ -103,11 +103,12 @@ public static function start($options = array()) if (isset($options['products'])) { foreach ((array)$options['products'] as $product) { $taxClass = 'N'; + $taxPercentage = 0; if (isset($product['tax'])) { $taxClass = Helper::calculateTaxClass($product['price'], $product['tax']); + $taxPercentage = round(Helper::calculateTaxPercentage($product['price'], $product['tax'])); } - $taxPercentage = round(Helper::calculateTaxPercentage($product['price'], $product['tax'])); if (isset($product['vatPercentage']) && is_numeric($product['vatPercentage'])) { $taxPercentage = round($product['vatPercentage'], 2); $taxClass = Helper::calculateTaxClass(100 + $taxPercentage, $taxPercentage);