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-paypal
Controller
Adminhtml
Billing
Agreement
Cancel.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Paypal\Controller\Adminhtml\Billing\Agreement
;
8
9
class
Cancel
extends
\Magento\Paypal\Controller\Adminhtml\Billing\Agreement
10
{
16
const
ADMIN_RESOURCE
=
'Magento_Paypal::actions_manage'
;
17
23
public
function
execute
()
24
{
25
$agreementModel = $this->
_initBillingAgreement
();
26
27
if
($agreementModel && $agreementModel->canCancel()) {
28
try
{
29
$agreementModel->cancel();
30
$this->messageManager->addSuccessMessage(
31
__
(
'You canceled the billing agreement.'
)
32
);
33
$this->
_redirect
(
'paypal/*/view'
, [
'_current'
=>
true
]);
34
return
;
35
}
catch
(\
Magento
\Framework\
Exception
\
LocalizedException
$e) {
36
$this->messageManager->addExceptionMessage(
37
$e,
38
$e->getMessage()
39
);
40
}
catch
(\
Exception
$e) {
41
$this->messageManager->addExceptionMessage(
42
$e,
43
__
(
'We can\'t cancel the billing agreement.'
)
44
);
45
}
46
$this->
_redirect
(
'paypal/*/view'
, [
'_current'
=>
true
]);
47
}
48
return
$this->
_redirect
(
'paypal/*/'
);
49
}
50
}
Magento\Framework\Exception\LocalizedException
Definition:
LocalizedException.php:17
Magento\Backend\App\AbstractAction\_redirect
_redirect($path, $arguments=[])
Definition:
AbstractAction.php:316
Magento\Paypal\Controller\Adminhtml\Billing\Agreement\Cancel
Definition:
Cancel.php:9
Magento\Paypal\Controller\Adminhtml\Billing\Agreement
Definition:
Agreement.php:11
__
__()
Definition:
__.php:13
Magento\Paypal\Controller\Adminhtml\Billing\Agreement\Cancel\execute
execute()
Definition:
Cancel.php:23
Magento\Catalog\Model\Product\Exception
Definition:
Exception.php:14
Magento\Paypal\Controller\Adminhtml\Billing\Agreement\Cancel\ADMIN_RESOURCE
const ADMIN_RESOURCE
Definition:
Cancel.php:16
Magento
Magento\Paypal\Controller\Adminhtml\Billing\Agreement
Definition:
CancelTest.php:6
Magento\Paypal\Controller\Adminhtml\Billing\Agreement\_initBillingAgreement
_initBillingAgreement()
Definition:
Agreement.php:42