-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from Invertus/SV-28/thecheckout
TheCheckout compatibility
- Loading branch information
Showing
9 changed files
with
470 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
*NOTICE OF LICENSE | ||
* | ||
*This source file is subject to the Open Software License (OSL 3.0) | ||
*that is bundled with this package in the file LICENSE.txt. | ||
*It is also available through the world-wide-web at this URL: | ||
*http://opensource.org/licenses/osl-3.0.php | ||
*If you did not receive a copy of the license and are unable to | ||
*obtain it through the world-wide-web, please send an email | ||
*to [email protected] so we can send you a copy immediately. | ||
* | ||
*DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
*versions in the future. If you wish to customize PrestaShop for your | ||
*needs please refer to http://www.prestashop.com for more information. | ||
* | ||
*@author INVERTUS UAB www.invertus.eu <[email protected]> | ||
*@copyright SIX Payment Services | ||
*@license SIX Payment Services | ||
*/ | ||
|
||
namespace Invertus\SaferPay\Provider; | ||
|
||
use Invertus\SaferPay\Config\SaferPayConfig; | ||
|
||
if (!defined('_PS_VERSION_')) { | ||
exit; | ||
} | ||
|
||
class OpcModulesProvider | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function get() | ||
{ | ||
foreach (SaferPayConfig::OPC_MODULE_LIST as $opcModule){ | ||
if (\Module::isInstalled($opcModule) && \Module::isEnabled($opcModule)) { | ||
return $opcModule; | ||
} | ||
} | ||
|
||
return ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
*NOTICE OF LICENSE | ||
* | ||
*This source file is subject to the Open Software License (OSL 3.0) | ||
*that is bundled with this package in the file LICENSE.txt. | ||
*It is also available through the world-wide-web at this URL: | ||
*http://opensource.org/licenses/osl-3.0.php | ||
*If you did not receive a copy of the license and are unable to | ||
*obtain it through the world-wide-web, please send an email | ||
*to [email protected] so we can send you a copy immediately. | ||
* | ||
*DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
*versions in the future. If you wish to customize PrestaShop for your | ||
*needs please refer to http://www.prestashop.com for more information. | ||
* | ||
*@author INVERTUS UAB www.invertus.eu <[email protected]> | ||
*@copyright SIX Payment Services | ||
*@license SIX Payment Services | ||
*/ | ||
|
||
namespace Invertus\SaferPay\Validation; | ||
|
||
use Invertus\SaferPay\Provider\OpcModulesProvider; | ||
use FrontController; | ||
|
||
if (!defined('_PS_VERSION_')) { | ||
exit; | ||
} | ||
|
||
class ValidateIsAssetsRequired | ||
{ | ||
private $opcModulesProvider; | ||
|
||
public function __construct(OpcModulesProvider $opcModulesProvider) | ||
{ | ||
$this->opcModulesProvider = $opcModulesProvider; | ||
} | ||
|
||
/** | ||
* It returns true if it's an OPC controller or an OrderController with products in the cart. Otherwise, it returns false. | ||
*/ | ||
public function run(FrontController $controller) | ||
{ | ||
$isOrderController = $controller instanceof \OrderControllerCore | ||
|| $controller instanceof \ModuleFrontController && isset($controller->php_self) && $controller->php_self === 'order'; | ||
|
||
if (!empty($this->opcModulesProvider->get($controller))) { | ||
return $isOrderController && !empty(\Context::getContext()->cart->getProducts()); | ||
} | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.