diff --git a/Model/Paymentmethod/PaymentMethod.php b/Model/Paymentmethod/PaymentMethod.php index 7238c5d7..d7138a1e 100644 --- a/Model/Paymentmethod/PaymentMethod.php +++ b/Model/Paymentmethod/PaymentMethod.php @@ -106,21 +106,23 @@ public function startTransaction(Order $order, UrlInterface $url){ foreach ($items as $item) { $arrItem = $item->toArray(); if ($arrItem['price_incl_tax'] != null) { + // taxamount is not valid, because on discount it returns the taxamount after discount + $taxAmount = $arrItem['price_incl_tax']-$arrItem['price']; $product = array( 'id' => $arrItem['product_id'], 'name' => $arrItem['name'], 'price' => $arrItem['price_incl_tax'], 'qty' => $arrItem['qty_ordered'], - 'tax' => $arrItem['tax_amount'], + 'tax' => $taxAmount, ); } $arrProducts[] = $product; } //shipping - $shippingCost = $order->getShippingAddress()->getShippingInclTax(); - $shippingTax = $order->getShippingAddress()->getShippingTaxAmount(); - $shippingDescription = $order->getShippingAddress()->getShippingDescription(); + $shippingCost = $order->getShippingInclTax(); + $shippingTax = $order->getShippingTaxAmount(); + $shippingDescription = $order->getShippingDescription(); $arrProducts[] = array( 'id' => 'shipping', @@ -131,16 +133,16 @@ public function startTransaction(Order $order, UrlInterface $url){ ); // kortingen - $discount = $order->getSubtotal() - $order->getSubtotalWithDiscount(); + $discount = $order->getDiscountAmount(); + $discountDescription = $order->getDiscountDescription(); - - if ($discount > 0) { + if ($discount != 0) { $arrProducts[] = array( 'id' => 'discount', - 'name' => __('Discount'), - 'price' => $discount * -1, + 'name' => $discountDescription, + 'price' => $discount, 'qty' => 1, - 'tax' => 0 + 'tax' => $order->getDiscountTaxCompensationAmount()*-1 ); }