Skip to content

Commit ad9f337

Browse files
author
Anna Bukatar
committed
ACP2E-1155: Refunding Issue Rest API
1 parent e56b9da commit ad9f337

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Sales\Api\OrderRepositoryInterface;
1313
use Magento\Sales\Model\Order\Invoice;
1414
use Magento\Sales\Model\ValidatorInterface;
15+
use Magento\Framework\App\ObjectManager;
1516

1617
class CanRefund implements ValidatorInterface
1718
{
@@ -27,6 +28,11 @@ class CanRefund implements ValidatorInterface
2728
*/
2829
private $orderRepository;
2930

31+
/**
32+
* @var ObjectManager
33+
*/
34+
private $objectManager;
35+
3036
/**
3137
* CanRefund constructor.
3238
*
@@ -37,6 +43,7 @@ public function __construct(
3743
OrderPaymentRepositoryInterface $paymentRepository,
3844
OrderRepositoryInterface $orderRepository
3945
) {
46+
$this->objectManager = ObjectManager::getInstance();
4047
$this->paymentRepository = $paymentRepository;
4148
$this->orderRepository = $orderRepository;
4249
}
@@ -103,7 +110,7 @@ private function canPartialRefund(MethodInterface $method, InfoInterface $paymen
103110
}
104111

105112
/**
106-
* validate if full refund is possible
113+
* Validate if full refund is possible
107114
*
108115
* @param InvoiceInterface $invoice
109116
* @param MethodInterface $method

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Sales\Model\Order\Validation;
77

8+
use Magento\Framework\App\ObjectManager;
89
use Magento\Framework\Pricing\PriceCurrencyInterface;
910
use Magento\Sales\Api\Data\OrderInterface;
1011
use Magento\Sales\Model\Order;
@@ -19,6 +20,11 @@ class CanRefund implements ValidatorInterface
1920
*/
2021
private $priceCurrency;
2122

23+
/**
24+
* @var ObjectManager
25+
*/
26+
private $objectManager;
27+
2228
/**
2329
* CanRefund constructor.
2430
*
@@ -27,6 +33,7 @@ class CanRefund implements ValidatorInterface
2733
public function __construct(
2834
PriceCurrencyInterface $priceCurrency
2935
) {
36+
$this->objectManager = ObjectManager::getInstance();
3037
$this->priceCurrency = $priceCurrency;
3138
}
3239

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
2-
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
36
namespace Magento\Sales\Model\Order\Validation;
47

5-
use Magento\Framework\App\ObjectManager;
68
use Magento\Framework\App\Config\ScopeConfigInterface;
79

810
trait CanRefundTrait
@@ -14,8 +16,7 @@ trait CanRefundTrait
1416
*/
1517
private function isAllowZeroGrandTotal()
1618
{
17-
$scopeConfig = ObjectManager::getInstance()->get(ScopeConfigInterface::class);
18-
$isAllowed = $scopeConfig->getValue(
19+
$isAllowed = $this->objectManager->get(ScopeConfigInterface::class)->getValue(
1920
'sales/zerograndtotal_creditmemo/allow_zero_grandtotal',
2021
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
2122
);

0 commit comments

Comments
 (0)