From 1c17795687d98e4dce352b12fb7fd6dab2ff3ffd Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 5 Jul 2022 14:09:50 +0200 Subject: [PATCH] round shipment quote net value to 2 decimal digits this should help us prevent rounding errors downstream when converting back to net in odoo (SYS#6033) --- composer.json | 2 +- src/Core/Checkout/Cart/Delivery/SmcDeliveryProcessor.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cb33ff4..951dd57 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "sysmocom/shopware6-shipcloud-live", "description": "shipcloud live quote pluging", - "version": "0.0.3", + "version": "0.0.4", "type": "shopware-platform-plugin", "license": "AGPL-3.0-or-later", "authors": [ diff --git a/src/Core/Checkout/Cart/Delivery/SmcDeliveryProcessor.php b/src/Core/Checkout/Cart/Delivery/SmcDeliveryProcessor.php index 6732246..517f670 100644 --- a/src/Core/Checkout/Cart/Delivery/SmcDeliveryProcessor.php +++ b/src/Core/Checkout/Cart/Delivery/SmcDeliveryProcessor.php @@ -202,7 +202,7 @@ class SmcDeliveryProcessor implements CartProcessorInterface, CartDataCollectorI $transport_insurance = (0.0035 * $value); /* convert into a gross price, as API returns net */ - $quote_eur_gross = ($quote_eur + $margin + $transport_insurance); + $quote_eur_gross = round($quote_eur + $margin + $transport_insurance), 2); if ($context->getTaxState() === CartPrice::TAX_STATE_GROSS) { /* FIXME: don't use static 19% but destination country specific rate */ $quote_eur_gross = $quote_eur_gross * 1.19;