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 2e7b4239 authored by attilak's avatar attilak

Fix Klarna line item values

parent 6bd4f125
......@@ -102,7 +102,7 @@ class CaptureDataBuilder implements BuilderInterface
// The latest invoice will contain only the selected items(and quantities) for the (partial) capture
$latestInvoice = $invoices->getLastItem();
foreach ($latestInvoice->getItemsCollection() as $invoiceItem) {
foreach ($latestInvoice->getItems() as $invoiceItem) {
++$count;
$numberOfItems = (int)$invoiceItem->getQty();
$formFields = $this->adyenHelper->createOpenInvoiceLineItem(
......@@ -113,7 +113,7 @@ class CaptureDataBuilder implements BuilderInterface
$currency,
$invoiceItem->getTaxAmount(),
$invoiceItem->getPriceInclTax(),
$invoiceItem->getTaxPercent(),
$invoiceItem->getOrderItem()->getTaxPercent(),
$numberOfItems,
$payment,
$invoiceItem->getId()
......
......@@ -219,15 +219,15 @@ class CheckoutDataBuilder implements BuilderInterface
foreach ($this->quote->getAllVisibleItems() as $item) {
$numberOfItems = (int)$item->getQtyOrdered();
$numberOfItems = (int)$item->getQty();
// Summarize the discount amount item by item
$discountAmount += $item->getDiscountAmount();
$priceExcludingTax = $item->getPriceInclTax() - $item->getTaxAmount();
$formattedPriceExcludingTax = $this->adyenHelper->formatAmount($priceExcludingTax, $currency);
$formattedPriceExcludingTax = $this->adyenHelper->formatAmount($item->getPrice(), $currency);
$formattedTaxAmount = $this->adyenHelper->formatAmount($item->getTaxAmount(), $currency);
$taxAmount = $item->getPrice() * ($item->getTaxPercent() / 100);
$formattedTaxAmount = $this->adyenHelper->formatAmount($taxAmount, $currency);
$formattedTaxPercentage = $item->getTaxPercent() * 100;
$formFields['lineItems'][] = [
......@@ -236,7 +236,7 @@ class CheckoutDataBuilder implements BuilderInterface
'amountExcludingTax' => $formattedPriceExcludingTax,
'taxAmount' => $formattedTaxAmount,
'description' => $item->getName(),
'quantity' => $item->getQty(),
'quantity' => $numberOfItems,
'taxCategory' => $item->getProduct()->getAttributeText('tax_class_id'),
'taxPercentage' => $formattedTaxPercentage
];
......
......@@ -177,7 +177,10 @@ class RefundDataBuilder implements BuilderInterface
return $result;
}
/**
* @param \Magento\Payment\Model\InfoInterface $payment
* @return array|mixed
*/
protected function getOpenInvoiceData($payment)
{
$formFields = [];
......@@ -185,11 +188,11 @@ class RefundDataBuilder implements BuilderInterface
$currency = $payment->getOrder()->getOrderCurrencyCode();
/**
* Magento\Sales\Model\Order\Creditmemo
* @var \Magento\Sales\Model\Order\Creditmemo $creditMemo
*/
$creditMemo = $payment->getCreditMemo();
foreach ($creditMemo->getAllItems() as $refundItem) {
foreach ($creditMemo->getItems() as $refundItem) {
++$count;
$numberOfItems = (int)$refundItem->getQty();
......@@ -201,7 +204,7 @@ class RefundDataBuilder implements BuilderInterface
$currency,
$refundItem->getTaxAmount(),
$refundItem->getPriceInclTax(),
$refundItem->getTaxPercent(),
$refundItem->getOrderItem()->getTaxPercent(),
$numberOfItems,
$payment,
$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