From 55fdcec28af5a0a6f842b0e8433596b8e83fea34 Mon Sep 17 00:00:00 2001 From: jakubpolomsky Date: Tue, 23 May 2017 08:59:14 +0200 Subject: [PATCH 1/3] #5 use magento methods to calculate prices --- Model/AbstractPayment.php | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/Model/AbstractPayment.php b/Model/AbstractPayment.php index 906cbf4..8843b23 100644 --- a/Model/AbstractPayment.php +++ b/Model/AbstractPayment.php @@ -196,14 +196,8 @@ public function initPaymentByCart(CheckoutCart $cart, $urls, \Magento\Framework\ $bitem->setDescription($item->getProduct()->getName()); $bitem->setImageUrl($baseUrl . "pub/media/catalog/product" . $item->getProduct()->getImage()); $bitem->setName($item->getProduct()->getName()); - $bitem->setUnitGrossAmount(number_format($item->getPrice(), $precision, '.', '')); - $bitem->setUnitNetAmount( - number_format( - number_format($item->getPrice(), $precision, '.', '') - number_format( - $item->getTaxAmount(), $precision, '.', '' - ), $precision, '.', '' - ) - ); + $bitem->setUnitGrossAmount(number_format($item->getPriceInclTax(), $precision, '.', '')); + $bitem->setUnitNetAmount(number_format($item->getPrice(), $precision, '.', '')); $bitem->setUnitTaxAmount(number_format($item->getTaxAmount(), $precision, '.', '')); $bitem->setUnitTaxRate(number_format($item->getTaxPercent(), $precision, '.', '')); $basket->addItem($bitem, (int)$item->getQty()); @@ -216,16 +210,10 @@ public function initPaymentByCart(CheckoutCart $cart, $urls, \Magento\Framework\ $bitem->setName('shipping'); $bitem->setDescription($quote->getShippingAddress()->getShippingDescription()); $bitem->setUnitGrossAmount( - number_format($quote->getShippingAddress()->getShippingAmount(), $precision, '.', '') + number_format($quote->getShippingAddress()->getShippingInclTax(), $precision, '.', '') ); $bitem->setUnitNetAmount( - number_format( - number_format( - $quote->getShippingAddress()->getShippingAmount(), $precision, '.', '' - ) - number_format( - $quote->getShippingAddress()->getShippingTaxAmount(), $precision, '.', '' - ), $precision, '.', '' - ) + number_format($quote->getShippingAddress()->getShippingAmount(), $precision, '.', '') ); $bitem->setUnitTaxAmount( number_format($quote->getShippingAddress()->getShippingTaxAmount(), $precision, '.', '') From e2ca32bf626bc3226d50a59bb881aa271482f356 Mon Sep 17 00:00:00 2001 From: jakubpolomsky Date: Wed, 24 May 2017 12:28:38 +0200 Subject: [PATCH 2/3] #5 search for financialInstitution in the right place --- Model/Payment/Eps.php | 2 +- Model/Payment/Ideal.php | 2 +- composer.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Model/Payment/Eps.php b/Model/Payment/Eps.php index d2cfb18..2eb856c 100644 --- a/Model/Payment/Eps.php +++ b/Model/Payment/Eps.php @@ -60,7 +60,7 @@ public function assignData(\Magento\Framework\DataObject $data) /** @var \Magento\Quote\Model\Quote\Payment $infoInstance */ $infoInstance = $this->getInfoInstance(); - $infoInstance->setAdditionalInformation('financialInstitution', $data->getData('financialInstitution')); + $infoInstance->setAdditionalInformation('financialInstitution', $data->getDataByPath('additional_data/financialInstitution')); return $this; } diff --git a/Model/Payment/Ideal.php b/Model/Payment/Ideal.php index e4d6400..3d1f119 100644 --- a/Model/Payment/Ideal.php +++ b/Model/Payment/Ideal.php @@ -60,7 +60,7 @@ public function assignData(\Magento\Framework\DataObject $data) /** @var \Magento\Quote\Model\Quote\Payment $infoInstance */ $infoInstance = $this->getInfoInstance(); - $infoInstance->setAdditionalInformation('financialInstitution', $data->getData('financialInstitution')); + $infoInstance->setAdditionalInformation('financialInstitution', $data->getDataByPath('additional_data/financialInstitution')); return $this; } diff --git a/composer.json b/composer.json index 610fea6..79d7fb4 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "magento/module-sales": "*", "magento/module-payment": "*", "magento/module-quote": "*", - "wirecard/checkout-client-library": "3.3.2" + "wirecard/checkout-client-library": "3.3.4" }, "autoload": { "files": [ From 16875403d7942afd9c01deb778150a311318e72b Mon Sep 17 00:00:00 2001 From: jakubpolomsky Date: Wed, 24 May 2017 12:36:02 +0200 Subject: [PATCH 3/3] #5 update version number --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 79d7fb4..481d895 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "wirecard/magento2-wcs", "description": "Wirecard Checkout Seamless", "type": "magento2-module", - "version": "1.0.2", + "version": "1.0.3", "license": [ "MIT" ],