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-braintree
Controller
Paypal
SaveShippingMethod.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Braintree\Controller\Paypal
;
7
8
use
Magento\Checkout\Model\Session
;
9
use
Magento\Framework\View\Result\Page
;
10
use
Magento\Framework\App\Action\Context
;
11
use
Magento\Framework\Controller\ResultFactory
;
12
use
Magento\Braintree\Gateway\Config\PayPal\Config
;
13
use
Magento\Braintree\Model\Paypal\Helper\ShippingMethodUpdater
;
14
18
class
SaveShippingMethod
extends
AbstractAction
19
{
23
private
$shippingMethodUpdater;
24
33
public
function
__construct
(
34
Context
$context,
35
Config
$config
,
36
Session
$checkoutSession
,
37
ShippingMethodUpdater
$shippingMethodUpdater
38
) {
39
parent::__construct($context,
$config
,
$checkoutSession
);
40
$this->shippingMethodUpdater = $shippingMethodUpdater;
41
}
42
46
public
function
execute
()
47
{
48
$isAjax = $this->
getRequest
()->getParam(
'isAjax'
);
49
$quote
= $this->checkoutSession->getQuote();
50
51
try
{
52
$this->
validateQuote
(
$quote
);
53
54
$this->shippingMethodUpdater->execute(
55
$this->
getRequest
()->getParam(
'shipping_method'
),
56
$quote
57
);
58
59
if
($isAjax) {
61
$response
= $this->resultFactory->create(
ResultFactory::TYPE_PAGE
);
62
$layout =
$response
->addHandle(
'paypal_express_review_details'
)->getLayout();
63
64
$response
= $layout->getBlock(
'page.block'
)->toHtml();
65
$this->
getResponse
()->setBody(
$response
);
66
67
return
;
68
}
69
}
catch
(\Exception $e) {
70
$this->messageManager->addExceptionMessage($e, $e->getMessage());
71
}
72
73
$path
= $this->_url->getUrl(
'*/*/review'
, [
'_secure'
=>
true
]);
74
75
if
($isAjax) {
76
$this->
getResponse
()->setBody(sprintf(
'<script>window.location.href = "%s";</script>'
,
$path
));
77
78
return
;
79
}
80
81
$this->
_redirect
(
$path
);
82
}
83
}
$response
$response
Definition:
404.php:11
Magento\Framework\App\Action\Action\_redirect
_redirect($path, $arguments=[])
Definition:
Action.php:167
Magento\Framework\App\Action\AbstractAction\getResponse
getResponse()
Definition:
AbstractAction.php:70
Magento\Framework\View\Result\Page
Definition:
Page.php:30
Magento\Braintree\Gateway\Config\PayPal\Config
Definition:
Config.php:14
$quote
$quote
Definition:
paypal_quote.php:17
Magento\Checkout\Model\Session
Definition:
SuccessValidator.php:6
Magento\Framework\Controller\ResultFactory
Definition:
ResultFactory.php:17
Magento\Braintree\Controller\Paypal\AbstractAction\$config
$config
Definition:
AbstractAction.php:25
Magento\Framework\App\Action\AbstractAction\getRequest
getRequest()
Definition:
AbstractAction.php:60
Magento\Framework\App\ActionInterface\execute
execute()
Magento\Braintree\Controller\Paypal\AbstractAction\$checkoutSession
$checkoutSession
Definition:
AbstractAction.php:30
Magento\Braintree\Controller\Paypal\SaveShippingMethod\__construct
__construct(Context $context, Config $config, Session $checkoutSession, ShippingMethodUpdater $shippingMethodUpdater)
Definition:
SaveShippingMethod.php:33
Magento\Braintree\Controller\Paypal
Definition:
AbstractAction.php:7
Magento\Braintree\Model\Paypal\Helper\ShippingMethodUpdater
Definition:
ShippingMethodUpdater.php:15
Magento\Braintree\Controller\Paypal\AbstractAction\validateQuote
validateQuote($quote)
Definition:
AbstractAction.php:74
Magento\Framework\Controller\ResultFactory\TYPE_PAGE
const TYPE_PAGE
Definition:
ResultFactory.php:27
Magento\Braintree\Controller\Paypal\SaveShippingMethod
Definition:
SaveShippingMethod.php:18
Magento\Checkout\Model\Session
Definition:
Session.php:17
Magento\Framework\App\Action\Context
Definition:
Context.php:24
Magento\Framework\App\ResourceConnection\Config
Definition:
Config.php:14
Magento\Braintree\Controller\Paypal\AbstractAction
Definition:
AbstractAction.php:20
$path
$path
Definition:
import_with_filesystem_images.php:14