Skip to content

Commit

Permalink
2.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dyd committed Aug 8, 2023
1 parent c25e491 commit 1812cc4
Show file tree
Hide file tree
Showing 116 changed files with 3,457 additions and 398 deletions.
28 changes: 13 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
GEM
remote: http://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
faraday (1.0.1)
multipart-post (>= 1.2, < 3)
gitlab (4.14.0)
httparty (~> 0.14, >= 0.14.0)
terminal-table (~> 1.5, >= 1.5.1)
httparty (0.18.1)
mime-types (~> 3.0)
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0704)
mini_mime (1.1.2)
multi_xml (0.6.0)
multipart-post (2.1.1)
octokit (4.21.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
multipart-post (2.3.0)
octokit (4.25.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
pronto (0.9.5)
gitlab (~> 4.0, >= 4.0.0)
httparty (>= 0.13.7)
Expand All @@ -30,18 +28,18 @@ GEM
pronto (~> 0.9.0)
pronto-phpmd (0.4.0)
pronto (~> 0.9.0)
public_suffix (4.0.6)
public_suffix (4.0.7)
rainbow (2.2.2)
rake
rake (13.0.6)
rugged (0.99.0)
sawyer (0.8.2)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
faraday (>= 0.17.3, < 3)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thor (0.19.4)
unicode-display_width (1.7.0)
unicode-display_width (1.8.0)

PLATFORMS
ruby
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ This is a Payment Module for Prestashop that gives you the ability to process pa
Requirements
------------

* Prestashop 1.6.x - 8.0.x (Tested up to __8.0.0__)
* [GenesisPHP v1.21.6](https://github.com/GenesisGateway/genesis_php/releases/tag/1.21.6) - (Integrated in Module)
* Prestashop 1.6.x - 8.1.x (Tested up to __8.1.0__)
* [GenesisPHP v1.21.11](https://github.com/GenesisGateway/genesis_php/releases/tag/1.21.11) - (Integrated in Module)
* [Composer v2.5.5](https://github.com/composer/composer/releases/tag/2.5.5)

GenesisPHP Requirements
------------
Expand Down
2 changes: 0 additions & 2 deletions bin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* @copyright 2015-2022 E-Comprocessing Ltd.
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
*/


header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

Expand Down
8 changes: 4 additions & 4 deletions classes/EcomprocessingInstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ protected static function updateConsumersSchema()
public function registerHooks($instance)
{
foreach ($this->hooks as $hook) {
if (version_compare(_PS_VERSION_, '1.7', '>=') &&
in_array($hook, $this->skippable17Hooks)) {
if (version_compare(_PS_VERSION_, '1.7', '>=')
&& in_array($hook, $this->skippable17Hooks)) {
continue;
}

Expand Down Expand Up @@ -225,8 +225,8 @@ protected function dropConsumersSchema()
public function dropHooks($instance)
{
foreach ($this->hooks as $hook) {
if (version_compare(_PS_VERSION_, '1.7', '>=') &&
in_array($hook, $this->skippable17Hooks)) {
if (version_compare(_PS_VERSION_, '1.7', '>=')
&& in_array($hook, $this->skippable17Hooks)) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions classes/EcomprocessingThreeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ public static function getShippingIndicator($cart, $invoice, $shipping, $isGuest
if (!$isGuest) {
$indicator = ShippingIndicators::STORED_ADDRESS;

if ($cart->id_address_invoice === $cart->id_address_delivery &&
self::areAddressesSame($invoice, $shipping)) {
if ($cart->id_address_invoice === $cart->id_address_delivery
&& self::areAddressesSame($invoice, $shipping)) {
$indicator = ShippingIndicators::SAME_AS_BILLING;
}
}
Expand Down
4 changes: 2 additions & 2 deletions classes/EcomprocessingTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ protected static function canRefund($transaction)
*/
protected static function canVoid($transaction)
{
return \Genesis\API\Constants\Transaction\Types::canVoid($transaction['type']) &&
static::isApprovedTransaction($transaction);
return \Genesis\API\Constants\Transaction\Types::canVoid($transaction['type'])
&& static::isApprovedTransaction($transaction);
}

/**
Expand Down
12 changes: 6 additions & 6 deletions classes/EcomprocessingTransactionProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ public static function pay($data)
->setShippingCountry($data->shipping->country);
}

if (isset($data->url) &&
\Genesis\API\Constants\Transaction\Types::is3D($data->transaction_type)) {
if (isset($data->url)
&& \Genesis\API\Constants\Transaction\Types::is3D($data->transaction_type)) {
$genesis
->request()
->setNotificationUrl($data->url->notification)
Expand Down Expand Up @@ -313,8 +313,8 @@ public static function capture($data)
->setAmount($data['amount'])
->setCurrency($data['currency']);

if ($data['transaction_type'] === \Genesis\API\Constants\Transaction\Types::KLARNA_AUTHORIZE &&
$data['items'] instanceof \Genesis\API\Request\Financial\Alternatives\Klarna\Items) {
if ($data['transaction_type'] === \Genesis\API\Constants\Transaction\Types::KLARNA_AUTHORIZE
&& $data['items'] instanceof \Genesis\API\Request\Financial\Alternatives\Klarna\Items) {
$genesis
->request()
->setItems($data['items']);
Expand Down Expand Up @@ -349,8 +349,8 @@ public static function refund($data)
->setAmount($data['amount'])
->setCurrency($data['currency']);

if ($data['transaction_type'] === \Genesis\API\Constants\Transaction\Types::KLARNA_CAPTURE &&
$data['items'] instanceof \Genesis\API\Request\Financial\Alternatives\Klarna\Items) {
if ($data['transaction_type'] === \Genesis\API\Constants\Transaction\Types::KLARNA_CAPTURE
&& $data['items'] instanceof \Genesis\API\Request\Financial\Alternatives\Klarna\Items) {
$genesis
->request()
->setItems($data['items']);
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ecomprocessing/prestashop-ecp-plugin",
"description": "E-Comprocessing Payment Gateway for Prestashop",
"type": "prestashop-module",
"version": "2.0.2",
"version": "2.0.4",
"license": "GPL-2.0",
"config": {
"prepend-autoloader": false
Expand All @@ -16,7 +16,7 @@
],
"minimum-stability": "stable",
"require": {
"genesisgateway/genesis_php": "1.21.6"
"genesisgateway/genesis_php": "1.21.11"
},
"require-dev": {
"prestashop/php-dev-tools": "^4.3",
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>ecomprocessing</name>
<displayName><![CDATA[E-Comprocessing Payment Gateway]]></displayName>
<version><![CDATA[2.0.2]]></version>
<version><![CDATA[2.0.4]]></version>
<description><![CDATA[Accept payments through E-Comprocessing Payment Gateway - Genesis]]></description>
<author><![CDATA[E-Comprocessing Ltd.]]></author>
<tab><![CDATA[payments_gateways]]></tab>
Expand Down
60 changes: 60 additions & 0 deletions controllers/front/frame.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* Copyright (C) 2018-2023 E-Comprocessing Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* @author E-Comprocessing
* @copyright 2018-2023 E-Comprocessing Ltd.
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}

/**
* Class EcomprocessingFrameModuleFrontController
*
* Break frames jail Controller
*/
class EcomprocessingFrameModuleFrontController extends ModuleFrontController
{
/**
* Used to break iframe and redirect to the url
*
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();

$url = rawurldecode(Tools::getValue('url'));

$this->context->smarty->assign('url', $this->sanitizeRedirectUrl($url), true);
$this->setTemplate('module:ecomprocessing/views/templates/front/redirect-helper.tpl');
}

/**
* Check for malicious redirects
*
* @return bool
*/
private function sanitizeRedirectUrl($url)
{
$shopUrl = Tools::getShopDomainSsl(true);
$parsedShopUrl = parse_url($shopUrl);
$parsedUrl = parse_url($url);

return ($parsedUrl && isset($parsedUrl['host']) && $parsedUrl['host'] === $parsedShopUrl['host']) ?
$url :
$shopUrl;
}
}
8 changes: 4 additions & 4 deletions controllers/front/redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public function initContent()
*/
protected function shouldRestoreCustomerCart()
{
return Tools::getValue('restore') === 'cart' ||
in_array(
return Tools::getValue('restore') === 'cart'
|| in_array(
Tools::getValue('action'),
$this->actionsToRestoreCart
);
Expand All @@ -108,8 +108,8 @@ protected function getOrderUrl()
*/
protected function isOrderProcessTypeOPC()
{
return defined('PS_ORDER_PROCESS_OPC') &&
Configuration::get('PS_ORDER_PROCESS_TYPE') == PS_ORDER_PROCESS_OPC;
return defined('PS_ORDER_PROCESS_OPC')
&& Configuration::get('PS_ORDER_PROCESS_TYPE') == PS_ORDER_PROCESS_OPC;
}

/**
Expand Down
25 changes: 14 additions & 11 deletions controllers/front/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class EcomprocessingValidationModuleFrontController extends ModuleFrontControlle
public $module;

/**
* @see FrontControlwler::initContent()
* @see FrontController::initContent()
*/
public function initContent()
{
Expand Down Expand Up @@ -64,22 +64,25 @@ public function validateCheckout()
// Send transaction
$url = $this->module->doCheckout();

if (isset($url)) {
Tools::redirect($url);
} else {
if (version_compare(_PS_VERSION_, '1.7', '<')) {
Tools::redirect(
$this->context->link->getModuleLink($this->module->name, 'checkout')
);
} else {
$this->module->redirectToPage(
if (!isset($url)) {
$url = (version_compare(_PS_VERSION_, '1.7', '<')) ?
$this->context->link->getModuleLink($this->module->name, 'checkout') :
$this->module->getPageLink(
'order.php',
[
'step' => 3,
'select_payment_option' => Tools::getValue('select_payment_option'),
]
);
}
$url = $this->module->isIframeEnabled() ? $this->module->getIframeControllerUrl($url) : $url;
}

if ($this->module->isIframeEnabled()) {
$this->ajaxRender(json_encode(['redirect' => $url]));

exit;
}

Tools::redirect($url);
}
}
Loading

0 comments on commit 1812cc4

Please sign in to comment.