123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Checkout\Model\Session;
- /**
- * Test if checkout session valid for success action
- *
- * @api
- * @since 100.0.2
- */
- class SuccessValidator
- {
- /**
- * @var \Magento\Checkout\Model\Session
- */
- protected $checkoutSession;
- /**
- * @param \Magento\Checkout\Model\Session $checkoutSession
- * @codeCoverageIgnore
- */
- public function __construct(
- \Magento\Checkout\Model\Session $checkoutSession
- ) {
- $this->checkoutSession = $checkoutSession;
- }
- /**
- * @return bool
- */
- public function isValid()
- {
- if (!$this->checkoutSession->getLastSuccessQuoteId()) {
- return false;
- }
- if (!$this->checkoutSession->getLastQuoteId() || !$this->checkoutSession->getLastOrderId()) {
- return false;
- }
- return true;
- }
- }
|