58 \
Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
60 \
Magento\Sales\Model\
Order\ItemFactory $orderItemFactory,
74 $this->_orderItemFactory = $orderItemFactory;
117 $this->_orderItem =
$item;
129 if ($this->_orderItem ===
null) {
169 public function register()
173 $qty = $this->processQty();
177 $orderItem->setDiscountTaxCompensationRefunded(
180 $orderItem->setBaseDiscountTaxCompensationRefunded(
195 private function processQty()
199 if ($orderItem->getIsQtyDecimal()) {
204 $qty = $qty > 0 ? $qty : 0;
205 if ($this->isQtyAvailable($qty,
$orderItem)) {
208 throw new \Magento\Framework\Exception\LocalizedException(
209 __(
'We found an invalid quantity to refund item "%1".', $this->
getName())
219 $qty = $this->processQty();
227 $this->
getOrderItem()->setDiscountTaxCompensationRefunded(
245 $orderItemQtyInvoiced =
$orderItem->getQtyInvoiced();
249 $rowTotalInclTax =
$orderItem->getRowTotalInclTax();
250 $baseRowTotalInclTax =
$orderItem->getBaseRowTotalInclTax();
252 $qty = $this->processQty();
253 if (!$this->
isLast() && $orderItemQtyInvoiced > 0 && $qty >= 0) {
254 $availableQty = $orderItemQtyInvoiced -
$orderItem->getQtyRefunded();
255 $rowTotal =
$creditmemo->roundPrice($rowTotal / $availableQty * $qty);
256 $baseRowTotal =
$creditmemo->roundPrice($baseRowTotal / $availableQty * $qty,
'base');
261 if ($rowTotalInclTax && $baseRowTotalInclTax) {
264 $creditmemo->roundPrice($rowTotalInclTax / $orderItemQty * $qty,
'including')
267 $creditmemo->roundPrice($baseRowTotalInclTax / $orderItemQty * $qty,
'including_base')
281 $qty = $this->processQty();
282 if ((
string)(
double)$qty == (
string)(
double)
$orderItem->getQtyToRefund()) {
setBaseDiscountAmount($amount)
setRowTotalInclTax($amount)
getWeeeTaxAppliedAmount()
_getExtensionAttributes()
const WEEE_TAX_APPLIED_ROW_AMOUNT
const WEEE_TAX_DISPOSITION
getBaseWeeeTaxRowDisposition()
setWeeeTaxAppliedRowAmount($amount)
setBaseDiscountTaxCompensationAmount($amount)
const BASE_WEEE_TAX_APPLIED_AMOUNT
getBaseWeeeTaxAppliedRowAmnt()
setOrderItem(\Magento\Sales\Model\Order\Item $item)
setWeeeTaxAppliedAmount($amount)
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
setWeeeTaxDisposition($weeeTaxDisposition)
setBasePriceInclTax($amount)
setBaseTaxAmount($amount)
setBaseRowTotalInclTax($amount)
const BASE_ROW_TOTAL_INCL_TAX
setExtensionAttributes(\Magento\Sales\Api\Data\CreditmemoItemExtensionInterface $extensionAttributes)
getBaseWeeeTaxAppliedAmount()
getBaseDiscountTaxCompensationAmount()
getDiscountTaxCompensationAmount()
const BASE_WEEE_TAX_DISPOSITION
getWeeeTaxAppliedRowAmount()
setBaseWeeeTaxAppliedRowAmnt($amnt)
setBaseWeeeTaxRowDisposition($baseWeeeTaxRowDisposition)
setBaseWeeeTaxDisposition($baseWeeeTaxDisposition)
const BASE_PRICE_INCL_TAX
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
setWeeeTaxApplied($weeeTaxApplied)
getDiscountTaxCompensationRefunded()
const DISCOUNT_TAX_COMPENSATION_AMOUNT
getBaseWeeeTaxDisposition()
const BASE_DISCOUNT_AMOUNT
const WEEE_TAX_APPLIED_AMOUNT
getWeeeTaxRowDisposition()
setWeeeTaxRowDisposition($weeeTaxRowDisposition)
getData($key='', $index=null)
setCreditmemo(\Magento\Sales\Model\Order\Creditmemo $creditmemo)
const BASE_DISCOUNT_TAX_COMPENSATION_AMOUNT
setDescription($description)
setDiscountTaxCompensationAmount($amount)
setData($key, $value=null)
const BASE_WEEE_TAX_APPLIED_ROW_AMNT
setAdditionalData($additionalData)
const WEEE_TAX_ROW_DISPOSITION
setDiscountAmount($amount)
setBaseWeeeTaxAppliedAmount($amount)
const BASE_WEEE_TAX_ROW_DISPOSITION
if(!isset($_GET['name'])) $name