We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit bab015da authored by cyattilakiss's avatar cyattilakiss Committed by GitHub

Merge pull request #449 from Adyen/PW-1313

Fix Klarna line item values
parents 6bd4f125 2e7b4239
...@@ -102,7 +102,7 @@ class CaptureDataBuilder implements BuilderInterface ...@@ -102,7 +102,7 @@ class CaptureDataBuilder implements BuilderInterface
// The latest invoice will contain only the selected items(and quantities) for the (partial) capture // The latest invoice will contain only the selected items(and quantities) for the (partial) capture
$latestInvoice = $invoices->getLastItem(); $latestInvoice = $invoices->getLastItem();
foreach ($latestInvoice->getItemsCollection() as $invoiceItem) { foreach ($latestInvoice->getItems() as $invoiceItem) {
++$count; ++$count;
$numberOfItems = (int)$invoiceItem->getQty(); $numberOfItems = (int)$invoiceItem->getQty();
$formFields = $this->adyenHelper->createOpenInvoiceLineItem( $formFields = $this->adyenHelper->createOpenInvoiceLineItem(
...@@ -113,7 +113,7 @@ class CaptureDataBuilder implements BuilderInterface ...@@ -113,7 +113,7 @@ class CaptureDataBuilder implements BuilderInterface
$currency, $currency,
$invoiceItem->getTaxAmount(), $invoiceItem->getTaxAmount(),
$invoiceItem->getPriceInclTax(), $invoiceItem->getPriceInclTax(),
$invoiceItem->getTaxPercent(), $invoiceItem->getOrderItem()->getTaxPercent(),
$numberOfItems, $numberOfItems,
$payment, $payment,
$invoiceItem->getId() $invoiceItem->getId()
......
...@@ -219,15 +219,15 @@ class CheckoutDataBuilder implements BuilderInterface ...@@ -219,15 +219,15 @@ class CheckoutDataBuilder implements BuilderInterface
foreach ($this->quote->getAllVisibleItems() as $item) { foreach ($this->quote->getAllVisibleItems() as $item) {
$numberOfItems = (int)$item->getQtyOrdered(); $numberOfItems = (int)$item->getQty();
// Summarize the discount amount item by item // Summarize the discount amount item by item
$discountAmount += $item->getDiscountAmount(); $discountAmount += $item->getDiscountAmount();
$priceExcludingTax = $item->getPriceInclTax() - $item->getTaxAmount(); $formattedPriceExcludingTax = $this->adyenHelper->formatAmount($item->getPrice(), $currency);
$formattedPriceExcludingTax = $this->adyenHelper->formatAmount($priceExcludingTax, $currency);
$formattedTaxAmount = $this->adyenHelper->formatAmount($item->getTaxAmount(), $currency); $taxAmount = $item->getPrice() * ($item->getTaxPercent() / 100);
$formattedTaxAmount = $this->adyenHelper->formatAmount($taxAmount, $currency);
$formattedTaxPercentage = $item->getTaxPercent() * 100; $formattedTaxPercentage = $item->getTaxPercent() * 100;
$formFields['lineItems'][] = [ $formFields['lineItems'][] = [
...@@ -236,7 +236,7 @@ class CheckoutDataBuilder implements BuilderInterface ...@@ -236,7 +236,7 @@ class CheckoutDataBuilder implements BuilderInterface
'amountExcludingTax' => $formattedPriceExcludingTax, 'amountExcludingTax' => $formattedPriceExcludingTax,
'taxAmount' => $formattedTaxAmount, 'taxAmount' => $formattedTaxAmount,
'description' => $item->getName(), 'description' => $item->getName(),
'quantity' => $item->getQty(), 'quantity' => $numberOfItems,
'taxCategory' => $item->getProduct()->getAttributeText('tax_class_id'), 'taxCategory' => $item->getProduct()->getAttributeText('tax_class_id'),
'taxPercentage' => $formattedTaxPercentage 'taxPercentage' => $formattedTaxPercentage
]; ];
......
...@@ -177,7 +177,10 @@ class RefundDataBuilder implements BuilderInterface ...@@ -177,7 +177,10 @@ class RefundDataBuilder implements BuilderInterface
return $result; return $result;
} }
/**
* @param \Magento\Payment\Model\InfoInterface $payment
* @return array|mixed
*/
protected function getOpenInvoiceData($payment) protected function getOpenInvoiceData($payment)
{ {
$formFields = []; $formFields = [];
...@@ -185,11 +188,11 @@ class RefundDataBuilder implements BuilderInterface ...@@ -185,11 +188,11 @@ class RefundDataBuilder implements BuilderInterface
$currency = $payment->getOrder()->getOrderCurrencyCode(); $currency = $payment->getOrder()->getOrderCurrencyCode();
/** /**
* Magento\Sales\Model\Order\Creditmemo * @var \Magento\Sales\Model\Order\Creditmemo $creditMemo
*/ */
$creditMemo = $payment->getCreditMemo(); $creditMemo = $payment->getCreditMemo();
foreach ($creditMemo->getAllItems() as $refundItem) { foreach ($creditMemo->getItems() as $refundItem) {
++$count; ++$count;
$numberOfItems = (int)$refundItem->getQty(); $numberOfItems = (int)$refundItem->getQty();
...@@ -201,7 +204,7 @@ class RefundDataBuilder implements BuilderInterface ...@@ -201,7 +204,7 @@ class RefundDataBuilder implements BuilderInterface
$currency, $currency,
$refundItem->getTaxAmount(), $refundItem->getTaxAmount(),
$refundItem->getPriceInclTax(), $refundItem->getPriceInclTax(),
$refundItem->getTaxPercent(), $refundItem->getOrderItem()->getTaxPercent(),
$numberOfItems, $numberOfItems,
$payment, $payment,
$refundItem->getId() $refundItem->getId()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment