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-signifyd
Model
Guarantee
CancelGuaranteeAbility.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Signifyd\Model\Guarantee
;
7
8
use
Magento\Framework\Exception\InputException
;
9
use
Magento\Framework\Exception\NoSuchEntityException
;
10
use
Magento\Sales\Api\Data\OrderInterface
;
11
use
Magento\Sales\Api\OrderRepositoryInterface
;
12
use
Magento\Signifyd\Model\CaseManagement
;
13
17
class
CancelGuaranteeAbility
18
{
22
private
$caseManagement;
23
27
private
$orderRepository;
28
33
public
function
__construct
(
34
CaseManagement
$caseManagement,
35
OrderRepositoryInterface
$orderRepository
36
) {
37
$this->caseManagement = $caseManagement;
38
$this->orderRepository =
$orderRepository
;
39
}
40
47
public
function
isAvailable
($orderId)
48
{
49
$case
= $this->caseManagement->getByOrderId($orderId);
50
if
(
$case
===
null
) {
51
return
false
;
52
}
53
54
if
(in_array(
$case
->getGuaranteeDisposition(), [
null
, $case::GUARANTEE_CANCELED])) {
55
return
false
;
56
}
57
58
$order
= $this->getOrder($orderId);
59
if
(
null
===
$order
) {
60
return
false
;
61
}
62
63
return
true
;
64
}
65
72
private
function
getOrder($orderId)
73
{
74
try
{
75
$order
= $this->orderRepository->get($orderId);
76
}
catch
(
InputException
$e) {
77
return
null
;
78
}
catch
(NoSuchEntityException $e) {
79
return
null
;
80
}
81
82
return
$order
;
83
}
84
}
$orderRepository
$orderRepository
Definition:
order.php:69
$case
$case
Definition:
approved_case.php:24
Magento\Signifyd\Model\Guarantee\CancelGuaranteeAbility\isAvailable
isAvailable($orderId)
Definition:
CancelGuaranteeAbility.php:47
$order
$order
Definition:
order.php:55
Magento\Signifyd\Model\Guarantee\CancelGuaranteeAbility
Definition:
CancelGuaranteeAbility.php:17
Magento\Sales\Api\Data\OrderInterface
Definition:
OrderInterface.php:17
Magento\Framework\Exception\InputException
Definition:
InputException.php:17
Magento\Signifyd\Model\CaseManagement
Definition:
CaseManagement.php:21
Magento\Signifyd\Model\Guarantee\CancelGuaranteeAbility\__construct
__construct(CaseManagement $caseManagement, OrderRepositoryInterface $orderRepository)
Definition:
CancelGuaranteeAbility.php:33
Magento\Signifyd\Model\Guarantee
Definition:
CancelingServiceTest.php:6
Magento\Sales\Api\OrderRepositoryInterface
Definition:
OrderRepositoryInterface.php:17
Magento\Framework\Exception\NoSuchEntityException
Definition:
NoSuchEntityException.php:16