Skip to content

Commit

Permalink
+samesite cookie control added.
Browse files Browse the repository at this point in the history
  • Loading branch information
sozgat committed Jan 28, 2021
1 parent e350ff5 commit cdb65ee
Showing 1 changed file with 44 additions and 48 deletions.
92 changes: 44 additions & 48 deletions iyzipay/iyzipay.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<?php
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 iyzico <[email protected]>
* @copyright 2018 iyzico
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of iyzico
*/
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 iyzico <[email protected]>
* @copyright 2018 iyzico
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of iyzico
*/

use PrestaShop\PrestaShop\Core\Payment\PaymentOption;

Expand Down Expand Up @@ -80,11 +80,10 @@ public function __construct()
$this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_);

$this->extra_mail_vars = array(
'{instalmentFee}' => '',
);
'{instalmentFee}' => '',
);

$this->checkAndSetCookieSameSite();

}

/**
Expand Down Expand Up @@ -121,19 +120,19 @@ public function uninstall()

include(dirname(__FILE__).'/sql/uninstall.php');

return $this->unregisterHook('footer')
&& $this->unregisterHook('backOfficeHeader')
&& $this->unregisterHook('PaymentOptions')
&& $this->unregisterHook('paymentReturn')
&& Configuration::deleteByName('iyzipay_api_type')
&& Configuration::deleteByName('iyzipay_api_key')
&& Configuration::deleteByName('iyzipay_secret_key')
&& Configuration::deleteByName('iyzipay_module_status')
&& Configuration::deleteByName('iyzipay_option_text')
&& Configuration::deleteByName('iyzipay_display')
&& Configuration::deleteByName('iyzipay_overlay_position')
&& Configuration::deleteByName('iyzipay_overlay_token')
&& parent::uninstall();
return $this->unregisterHook('footer')
&& $this->unregisterHook('backOfficeHeader')
&& $this->unregisterHook('PaymentOptions')
&& $this->unregisterHook('paymentReturn')
&& Configuration::deleteByName('iyzipay_api_type')
&& Configuration::deleteByName('iyzipay_api_key')
&& Configuration::deleteByName('iyzipay_secret_key')
&& Configuration::deleteByName('iyzipay_module_status')
&& Configuration::deleteByName('iyzipay_option_text')
&& Configuration::deleteByName('iyzipay_display')
&& Configuration::deleteByName('iyzipay_overlay_position')
&& Configuration::deleteByName('iyzipay_overlay_token')
&& parent::uninstall();
}

/**
Expand Down Expand Up @@ -343,8 +342,8 @@ private function setIyziTitle()
}

/**
* Add the CSS & JavaScript files you want to be loaded in the BO.
*/
* Add the CSS & JavaScript files you want to be loaded in the BO.
*/
public function hookBackOfficeHeader()
{

Expand Down Expand Up @@ -401,7 +400,6 @@ public function hookPaymentOptions($params)
*/
public function checkoutFormGenerate($params)
{

$this->context->cookie->totalPrice = false;
$this->context->cookie->installmentFee = false;
$this->context->cookie->iyziToken = false;
Expand Down Expand Up @@ -477,10 +475,6 @@ public function hookPaymentReturn($params)
return $this->display(__FILE__, 'views/templates/front/confirmation.tpl');
}

/**
* @return mixed
*/

private function setcookieSameSite($name, $value, $expire, $path, $domain, $secure, $httponly) {

if (PHP_VERSION_ID < 70300) {
Expand Down Expand Up @@ -514,7 +508,9 @@ private function checkAndSetCookieSameSite(){
}
}


/**
* @return mixed
*/
private function getOptionText()
{
$title = Configuration::get('iyzipay_option_text');
Expand Down Expand Up @@ -613,4 +609,4 @@ private function iyziMultipLangTitle($title, $isoCode)

return $title;
}
}
}

0 comments on commit cdb65ee

Please sign in to comment.