Skip to content

Commit

Permalink
Merge pull request #136 from mollie/9.0.5
Browse files Browse the repository at this point in the history
9.0.5 -- Bugfix
  • Loading branch information
maximj authored Feb 21, 2019
2 parents a2b1344 + 4f5340b commit 8de490a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# Changelog #

#### Changes in release 9.0.5
+ Fixed notice error when shipping method is used that isn't linked to a tax class.
+ Fixed update functionality.

#### Changes in release 9.0.4
+ Added conditional checking for OC 1.5, so OCMod checks are not attempted on a version that doesn't support it.

Expand Down
2 changes: 1 addition & 1 deletion admin/controller/payment/mollie/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ function update()
//save tmp file
$temp_file = MOLLIE_TMP . "/mollieUpdate.zip";
$handle = fopen($temp_file, "w+");
$content = $client->get($info["zipball_url"], false, false);
$content = $client->get($info["assets"][0]["browser_download_url"], false, false);
fwrite($handle, $content);
fclose($handle);

Expand Down
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
2 changes: 1 addition & 1 deletion catalog/controller/payment/mollie/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class MollieHelper
{
const PLUGIN_VERSION = "9.0.4";
const PLUGIN_VERSION = "9.0.5";

// All available modules. These should correspond to the Mollie_API_Object_Method constants.
const MODULE_NAME_BANKTRANSFER = "banktransfer";
Expand Down
3 changes: 2 additions & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ echo "3/5 Unzip temporary zip to upload dir..."
unzip -q temp.zip -d upload
echo "4/5 Create opencart installable zip..."
rm mollie-opencart-2.3-and-up.ocmod.zip
rm mollie-opencart-1.5-and-up.vqmod.zip
zip -9 -rq mollie-opencart-1.5-and-up.vqmod.zip upload LICENSE readme.md -x *.git* *.DS_Store

echo "5/5 Cleanup..."
rm -rf ./upload
rm -rf ./temp.zip

echo "Done!"
echo "Done!"

0 comments on commit 8de490a

Please sign in to comment.