mirror of
https://github.com/bdnugget/magento2.git
synced 2026-11-07 09:17:35 +00:00
46 lines
958 B
PHP
46 lines
958 B
PHP
<?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;
|
|
}
|
|
}
|