Skip to content

Commit 3ade686

Browse files
author
Anna Bukatar
committed
ACP2E-1155: Refunding Issue Rest API
1 parent 0caaf0f commit 3ade686

File tree

3 files changed

+12
-33
lines changed

3 files changed

+12
-33
lines changed

app/code/Magento/Sales/Model/Order/Invoice/Validation/CanRefund.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
class CanRefund implements ValidatorInterface
1818
{
19-
use \Magento\Sales\Model\Order\Validation\CanRefundTrait;
20-
2119
/**
2220
* @var OrderPaymentRepositoryInterface
2321
*/
@@ -91,8 +89,13 @@ private function isPaymentAllowRefund(InvoiceInterface $invoice)
9189
*/
9290
private function isGrandTotalEnoughToRefund(InvoiceInterface $entity)
9391
{
92+
$isAllowedZeroGrandTotal = $this->objectManager->get(ScopeConfigInterface::class)->getValue(
93+
'sales/zerograndtotal_creditmemo/allow_zero_grandtotal',
94+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
95+
);
96+
9497
return abs($entity->getBaseGrandTotal() - $entity->getBaseTotalRefunded()) >= .0001 ||
95-
$this->isAllowZeroGrandTotal();
98+
$isAllowedZeroGrandTotal;
9699
}
97100

98101
/**

app/code/Magento/Sales/Model/Order/Validation/CanRefund.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
class CanRefund implements ValidatorInterface
1515
{
16-
use \Magento\Sales\Model\Order\Validation\CanRefundTrait;
17-
1816
/**
1917
* @var PriceCurrencyInterface
2018
*/
@@ -69,8 +67,13 @@ public function validate($entity)
6967
*/
7068
private function isTotalPaidEnoughForRefund(OrderInterface $order)
7169
{
70+
$isAllowedZeroGrandTotal = $this->objectManager->get(ScopeConfigInterface::class)->getValue(
71+
'sales/zerograndtotal_creditmemo/allow_zero_grandtotal',
72+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
73+
);
74+
7275
return !abs($this->priceCurrency->round($order->getTotalPaid()) - $order->getTotalRefunded()) < .0001 ||
7376
$order->getTotalPaid() == 0 &&
74-
$this->isAllowZeroGrandTotal();
77+
$isAllowedZeroGrandTotal;
7578
}
7679
}

app/code/Magento/Sales/Model/Order/Validation/CanRefundTrait.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)