Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-sales
Model
Order
Creditmemo
Validation
TotalsValidator.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Sales\Model\Order\Creditmemo\Validation
;
7
8
use
Magento\Framework\Pricing\PriceCurrencyInterface
;
9
use
Magento\Sales\Model\ValidatorInterface
;
10
14
class
TotalsValidator
implements
ValidatorInterface
15
{
19
private
$priceCurrency;
20
26
public
function
__construct
(
PriceCurrencyInterface
$priceCurrency)
27
{
28
$this->priceCurrency = $priceCurrency;
29
}
30
34
public
function
validate
(
$entity
)
35
{
36
$messages = [];
37
$baseOrderRefund = $this->priceCurrency->round(
38
$entity
->getOrder()->getBaseTotalRefunded() +
$entity
->getBaseGrandTotal()
39
);
40
if
($baseOrderRefund > $this->priceCurrency->round(
$entity
->getOrder()->getBaseTotalPaid())) {
41
$baseAvailableRefund =
$entity
->getOrder()->getBaseTotalPaid()
42
-
$entity
->getOrder()->getBaseTotalRefunded();
43
44
$messages[] =
__
(
45
'The most money available to refund is %1.'
,
46
$baseAvailableRefund
47
);
48
}
49
50
return
$messages;
51
}
52
}
Magento\Sales\Model\Order\Creditmemo\Validation\TotalsValidator
Definition:
TotalsValidator.php:14
__
__()
Definition:
__.php:13
Magento\Sales\Model\ValidatorInterface
Definition:
ValidatorInterface.php:14
Magento\Sales\Model\Order\Creditmemo\Validation\TotalsValidator\__construct
__construct(PriceCurrencyInterface $priceCurrency)
Definition:
TotalsValidator.php:26
Magento\Framework\Pricing\PriceCurrencyInterface
Definition:
PriceCurrencyInterface.php:15
Magento\Sales\Model\Order\Creditmemo\Validation\TotalsValidator\validate
validate($entity)
Definition:
TotalsValidator.php:34
$entity
$entity
Definition:
element.phtml:22
Magento\Sales\Model\Order\Creditmemo\Validation
Definition:
QuantityValidator.php:6