Commit 429344c9 authored by attilak's avatar attilak

Add item id into openinvoice line items

Shipping and discount line item ids as well
parent 47d5b826
......@@ -432,7 +432,9 @@ class Redirect extends \Magento\Payment\Block\Form
$count = 0;
$currency = $this->_order->getOrderCurrencyCode();
foreach ($this->_order->getAllVisibleItems() as $item) {
/** @var $item \Magento\Sales\Model\Order\Item */
++$count;
$numberOfItems = (int)$item->getQtyOrdered();
......@@ -446,7 +448,8 @@ class Redirect extends \Magento\Payment\Block\Form
$item->getPriceInclTax(),
$item->getTaxPercent(),
$numberOfItems,
$this->_order->getPayment()
$this->_order->getPayment(),
$item->getId()
);
}
......@@ -469,7 +472,8 @@ class Redirect extends \Magento\Payment\Block\Form
$itemVatAmount,
$itemVatPercentage,
$numberOfItems,
$this->_order->getPayment()
$this->_order->getPayment(),
"discount"
);
}
......
......@@ -115,7 +115,8 @@ class CaptureDataBuilder implements BuilderInterface
$invoiceItem->getPriceInclTax(),
$invoiceItem->getTaxPercent(),
$numberOfItems,
$payment
$payment,
$invoiceItem->getId()
);
}
......
......@@ -203,7 +203,8 @@ class RefundDataBuilder implements BuilderInterface
$refundItem->getPriceInclTax(),
$refundItem->getTaxPercent(),
$numberOfItems,
$payment
$payment,
$refundItem->getId()
);
}
......
......@@ -1099,6 +1099,7 @@ class Data extends AbstractHelper
* @param $taxPercent
* @param $numberOfItems
* @param $payment
* @param null $itemId
* @return mixed
*/
public function createOpenInvoiceLineItem(
......@@ -1111,7 +1112,8 @@ class Data extends AbstractHelper
$priceInclTax,
$taxPercent,
$numberOfItems,
$payment
$payment,
$itemId = null
) {
$description = str_replace("\n", '', trim($name));
$itemAmount = $this->formatAmount($price, $currency);
......@@ -1135,7 +1137,8 @@ class Data extends AbstractHelper
$itemVatAmount,
$itemVatPercentage,
$numberOfItems,
$payment
$payment,
$itemId
);
}
......@@ -1187,7 +1190,8 @@ class Data extends AbstractHelper
$itemVatAmount,
$itemVatPercentage,
$numberOfItems,
$payment
$payment,
"shipping"
);
}
......@@ -1222,7 +1226,8 @@ class Data extends AbstractHelper
* @param $itemVatPercentage
* @param $numberOfItems
* @param $payment
* @return
* @param null|int $itemId optional
* @return mixed
*/
public function getOpenInvoiceLineData(
$formFields,
......@@ -1233,9 +1238,16 @@ class Data extends AbstractHelper
$itemVatAmount,
$itemVatPercentage,
$numberOfItems,
$payment
$payment,
$itemId = null
) {
$linename = "line" . $count;
// item id is optional
if ($itemId) {
$formFields['openinvoicedata.' . $linename . '.itemId '] = $itemId;
}
$formFields['openinvoicedata.' . $linename . '.currencyCode'] = $currencyCode;
$formFields['openinvoicedata.' . $linename . '.description'] = $description;
$formFields['openinvoicedata.' . $linename . '.itemAmount'] = $itemAmount;
......
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