Skip to content

Commit

Permalink
COMDEVNL-1788 -- Fixed tax class issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Pradeep committed Feb 19, 2019
1 parent 4eb2891 commit c7a2ab2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions catalog/controller/payment/mollie/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public function payment()
$tax_rates = $this->tax->getRates($orderProduct['price'], $productDetails['tax_class_id']);
$rates = $this->getTaxRate($tax_rates);
//Since Mollie only supports VAT so '$rates' must contains only one(VAT) rate.
$vatRate = $rates[0];
$vatRate = isset($rates[0]) ? $rates[0] : 0;

$total = $orderProduct['total'] + ($orderProduct['tax'] * $orderProduct['quantity']);
$vatAmount = $total * ( $vatRate / (100 + $vatRate));
Expand All @@ -276,7 +276,7 @@ public function payment()
$taxClass = $this->session->data['shipping_method']['tax_class_id'];
$tax_rates = $this->tax->getRates($cost, $taxClass);
$rates = $this->getTaxRate($tax_rates);
$vatRate = $rates[0];
$vatRate = isset($rates[0]) ? $rates[0] : 0;
$costWithTax = $this->tax->calculate($cost, $taxClass, $this->config->get('config_tax'));
$shippingVATAmount = $costWithTax * ( $vatRate / (100 + $vatRate));
$lineForShipping[] = array(
Expand Down Expand Up @@ -311,7 +311,7 @@ public function payment()

$tax_rates = $this->tax->getRates($coupon['value'], $taxClass);
$rates = $this->getTaxRate($tax_rates);
$vatRate = $rates[0];
$vatRate = isset($rates[0]) ? $rates[0] : 0;
$unitPriceWithTax = $this->tax->calculate($coupon['value'], $taxClass, $this->config->get('config_tax'));
$couponVATAmount = $unitPriceWithTax * ( $vatRate / (100 + $vatRate));
$lineForCoupon[] = array(
Expand Down Expand Up @@ -361,6 +361,10 @@ public function payment()
}
}

if(!isset($vatRate) || empty($vatRate)) {
$vatRate = 0;
}

$unitPriceWithTax = $this->tax->calculate($rewardPoints['value'], $taxClass, $this->config->get('config_tax'));
$rewardVATAmount = $unitPriceWithTax * ( $vatRate / (100 + $vatRate));

Expand Down Expand Up @@ -399,7 +403,7 @@ public function payment()

$tax_rates = $this->tax->getRates($orderTotals['value'], $taxClass);
$rates = $this->getTaxRate($tax_rates);
$vatRate = $rates[0];
$vatRate = isset($rates[0]) ? $rates[0] : 0;
$unitPriceWithTax = $this->tax->calculate($orderTotals['value'], $taxClass, $this->config->get('config_tax'));
$totalsVATAmount = $unitPriceWithTax * ( $vatRate / (100 + $vatRate));

Expand Down

0 comments on commit c7a2ab2

Please sign in to comment.