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-inventory
Model
Plugin
Order
Validation
InvoiceRefundCreationArguments.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\SalesInventory\Model\Plugin\Order\Validation
;
7
8
use
Magento\Sales\Api\Data\InvoiceInterface
;
9
use
Magento\Sales\Model\Order\Validation\RefundInvoiceInterface
;
10
use
Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface
;
11
use
Magento\Sales\Api\Data\CreditmemoInterface
;
12
use
Magento\Sales\Api\Data\OrderInterface
;
13
use
Magento\SalesInventory\Model\Order\ReturnValidator
;
14
use
Magento\Sales\Model\ValidatorResultInterface
;
15
19
class
InvoiceRefundCreationArguments
20
{
24
private
$returnValidator;
25
30
public
function
__construct
(
31
ReturnValidator
$returnValidator
32
) {
33
$this->returnValidator = $returnValidator;
34
}
35
52
public
function
afterValidate(
53
RefundInvoiceInterface
$refundInvoiceValidator,
54
ValidatorResultInterface
$validationResults,
55
InvoiceInterface
$invoice
,
56
OrderInterface
$order
,
57
CreditmemoInterface
$creditmemo
,
58
array
$items
= [],
59
$isOnline =
false
,
60
$notify =
false
,
61
$appendComment =
false
,
62
\
Magento
\Sales\Api\Data\
CreditmemoCommentCreationInterface
$comment =
null
,
63
\
Magento
\Sales\Api\Data\
CreditmemoCreationArgumentsInterface
$arguments
=
null
64
) {
65
if
($this->isReturnToStockItems(
$arguments
)) {
66
return
$validationResults;
67
}
68
70
$returnToStockItems =
$arguments
->getExtensionAttributes()->getReturnToStockItems();
71
$validationMessage = $this->returnValidator->validate($returnToStockItems,
$creditmemo
);
72
if
($validationMessage) {
73
$validationResults->
addMessage
($validationMessage);
74
}
75
76
return
$validationResults;
77
}
78
83
private
function
isReturnToStockItems(
$arguments
)
84
{
85
return
$arguments
===
null
86
||
$arguments
->getExtensionAttributes() ===
null
87
||
$arguments
->getExtensionAttributes()->getReturnToStockItems() ===
null
;
88
}
89
}
Magento\SalesInventory\Model\Plugin\Order\Validation
Definition:
InvoiceRefundCreationArguments.php:6
Magento\Sales\Api\Data\CreditmemoInterface
Definition:
CreditmemoInterface.php:18
Magento\Sales\Api\Data\InvoiceInterface
Definition:
InvoiceInterface.php:15
$creditmemo
$creditmemo
Definition:
order_express_with_invoice_and_creditmemo.php:16
$order
$order
Definition:
order.php:55
Magento\Sales\Api\Data\OrderInterface
Definition:
OrderInterface.php:17
Magento\Sales\Api\Data\CreditmemoCommentCreationInterface
Definition:
CreditmemoCommentCreationInterface.php:16
$invoice
$invoice
Definition:
partial_invoice.php:22
Magento
Magento\SalesInventory\Model\Plugin\Order\Validation\InvoiceRefundCreationArguments\__construct
__construct(ReturnValidator $returnValidator)
Definition:
InvoiceRefundCreationArguments.php:30
Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface
Definition:
CreditmemoCreationArgumentsInterface.php:14
$arguments
$arguments
Definition:
final_price.phtml:24
Magento\SalesInventory\Model\Order\ReturnValidator
Definition:
ReturnValidator.php:17
Magento\SalesInventory\Model\Plugin\Order\Validation\InvoiceRefundCreationArguments
Definition:
InvoiceRefundCreationArguments.php:19
Magento\Sales\Model\ValidatorResultInterface\addMessage
addMessage($message)
Magento\Sales\Model\Order\Validation\RefundInvoiceInterface
Definition:
RefundInvoiceInterface.php:19
Magento\Sales\Model\ValidatorResultInterface
Definition:
ValidatorResultInterface.php:13
$items
$items
Definition:
order_rollback.php:21