Skip to content

Commit

Permalink
2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dyd committed Jun 13, 2023
1 parent f362d4a commit c25e491
Show file tree
Hide file tree
Showing 1,211 changed files with 39,578 additions and 8,162 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Before merging the PR make sure the following are checked:
[2]: http://www.php-fig.org/psr/psr-2/
[3]: https://github.com/airbnb/javascript
[4]: http://codeguide.co/
[5]: http://doc.prestashop.com/display/PS16/SQL+Guidelines
[5]: http://doc.prestashop.com/display/PS16/SQL+Guidelines
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
.idea
.DS_Store
vendor/*
!modules/ecomprocessing/lib/genesis/vendor/*

!vendor/composer
!vendor/autoload.php
!vendor/index.php
!vendor/genesisgateway
.php-cs-fixer.cache
*.zip
bin/check-standards
9 changes: 9 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

$config = new PrestaShop\CodingStandards\CsFixer\Config();

/** @var \Symfony\Component\Finder\Finder $finder */
$finder = $config->setUsingCache(true)->getFinder();
$finder->in(__DIR__)->exclude('vendor');

return $config;
2 changes: 1 addition & 1 deletion .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<rule ref="PSR2" />

<exclude-pattern>*/genesis/*</exclude-pattern>
<exclude-pattern>*/backward_compatibility/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/translations/*</exclude-pattern>
</ruleset>
2 changes: 1 addition & 1 deletion .phpmd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
<rule ref="rulesets/unusedcode.xml"/>

<exclude-pattern>*/genesis/*</exclude-pattern>
<exclude-pattern>*/backward_compatibility/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/translations/*</exclude-pattern>
</ruleset>
15 changes: 2 additions & 13 deletions ...rd_compatibility/PrestaShopCollection.php → LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
/**
* Copyright (C) 2018 E-Comprocessing Ltd.
* Copyright (C) 2015-2022 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
Expand All @@ -13,16 +12,6 @@
* GNU General Public License for more details.
*
* @author E-Comprocessing
* @copyright 2018 E-Comprocessing Ltd.
* @copyright 2015-2023 E-Comprocessing Ltd.
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
*/

/**
* Class PrestaShopCollection
*
* Alias for Collection (missing in 1.5)
*/
class PrestaShopCollection extends Collection
{

}
62 changes: 30 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,27 @@ This is a Payment Module for Prestashop that gives you the ability to process pa
Requirements
------------

* Prestashop 1.6.x - 1.7.x (Tested up to __1.7.8__)
* [GenesisPHP v1.21.2](https://github.com/GenesisGateway/genesis_php/releases/tag/1.21.2) - (Integrated in Module)
* PCI-certified server in order to use ```E-Comprocessing Direct```
* 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)

GenesisPHP Requirements
------------

* PHP version 5.5.9 or newer
* PHP Extensions:
* [BCMath](https://php.net/bcmath)
* [CURL](https://php.net/curl) (required, only if you use the curl network interface)
* [Filter](https://php.net/filter)
* [Hash](https://php.net/hash)
* [XMLReader](https://php.net/xmlreader)
* [XMLWriter](https://php.net/xmlwriter)
* [BCMath](https://php.net/bcmath)
* [CURL](https://php.net/curl) (required, only if you use the curl network interface)
* [Filter](https://php.net/filter)
* [Hash](https://php.net/hash)
* [XMLReader](https://php.net/xmlreader)
* [XMLWriter](https://php.net/xmlwriter)
* [JSON](https://www.php.net/manual/en/book.json)
* [OpenSSL](https://www.php.net/manual/en/book.openssl.php)

Installation (Manual)
------------
* Upload the contents of folder (excluding ```README.md```) to the ```<root>``` folder of your Prestashop installation
* Create a folder, named `ecomprocessing` under `modules` folder of your PrestaShop installation
* Upload the contents of the main folder to the newly created folder
* Login into your ```Prestashop Admin Panel```
* Navigate to ```Modules``` -> ```Payment```
* Locate ```E-Comprocessing Payment Gateway``` in the list and click ```Install```
Expand All @@ -37,7 +39,19 @@ Installation (Upload via Admin Panel)
__Recommended if you do not have FTP account to upload the plugin code directly to your Prestashop__

* Download the Source code of the Plugin as zip file
* Decompress the zip archive and create a new archive of the folder ```ecomprocessing```, which is inside of ```modules``` folder
* Decompress the zip archive

**Option 1:**

* Rename the folder to `ecomprocessing`
* Compress `ecomprocessing` folder as `ecomprocessing.zip`

**Option 2: /only on Linux or macOS/**

* Start your favourite shell, navigate to decompressed files and execute `composer pack`

**Common actions:**

* Login into your ```Prestashop Admin Panel```
* Navigate to ```Modules and Services``` in the main menu
* Click the button ```Upload a module``` or ```Add a new module``` (depending on the version of Prestashop) and choose the manually created ```zip``` file.
Expand All @@ -46,36 +60,19 @@ __Recommended if you do not have FTP account to upload the plugin code directly
* You can find the new payment methods in the ```Checkout``` section in your Store Front
* Clear the cache via ```Advanced Parameters``` -> ```Performance``` -> ```Clear cache```

__Note__: If you have payment restrictions in place, you'll have to add the newly installed payment method to the ```Currencies``` / ```Countries``` / ```Groups``` you wish to appear on.

Enable PrestaShop SSL
Installation (Upload via Admin Panel)
------------
This steps should be followed if you wish to use the ```E-Comprocessing Direct``` Method.

* Ensure you have installed a valid __SSL Certificate__ on your __PCI-DSS Certified__ Web Server and you have configured your __Virtual Host__ properly.
* Login to your PrestaShop Admin Panel
* Navigate to ```Shop Parameters``` -> ```General```
* Click the link ```Please click here to check if your shop supports HTTPS``` near to the ```Enable SSL``` option
* Set ```Enable SSL``` to __Yes__
* Click ```Save```
* Set ```Enable SSL on all pages``` to __Yes__
* Click again the ```Save``` button
* It is recommended to add a __Rewrite Rule__ from ```http``` to ```https``` or to add a __Permanent Redirect__ to ```https``` in your virtual host

_Note_: If you have trouble with your credentials or terminal configuration, get in touch with our [support] team
__Note__: If you have payment restrictions in place, you'll have to add the newly installed payment method to the ```Currencies``` / ```Countries``` / ```Groups``` you wish to appear on.

You're now ready to process payments through our gateway.

__Note__: If you have trouble with your credentials or terminal configuration, get in touch with our [support] team

[support]: mailto:tech-support@e-comprocessing.com

Supported Transactions
------------
* ```E-Comprocessing Direct``` Payment Method
* __Authorize__
* __Authorize (3D-Secure)__
* __Sale__
* __Sale (3D-Secure)__

* ```E-Comprocessing Checkout``` Payment Method
* __Apple Pay__
* __Argencard__
Expand Down Expand Up @@ -118,6 +115,7 @@ Supported Transactions
* __Neteller__
* __Online Banking__
* __Interac Combined Pay-in (CPI)__
* __Bancontact (BTC)__
* __OXXO__
* __P24__
* __Pago Facil__
Expand Down
29 changes: 29 additions & 0 deletions bin/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* Copyright (C) 2015-2022 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 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');

header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');

header('Location: ../');
exit;
21 changes: 21 additions & 0 deletions bin/pack
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash --login

[ -f ecomprocessing.zip ] && rm ecomprocessing.zip
composer install --no-dev
[ ! -L ecomprocessing ] && ln -s "$(pwd)" ecomprocessing
zip -r ecomprocessing \
ecomprocessing/classes \
ecomprocessing/controllers \
ecomprocessing/translations \
ecomprocessing/vendor/composer \
ecomprocessing/vendor/genesisgateway \
ecomprocessing/vendor/autoload.php \
ecomprocessing/vendor/index.php \
ecomprocessing/views \
ecomprocessing/composer.* \
ecomprocessing/ecomprocessing.php \
ecomprocessing/logo.png \
ecomprocessing/index.php \
ecomprocessing/config.xml \
-x "*/.*"
[ -L ecomprocessing ] && rm ecomprocessing
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* @copyright 2018 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;
}
Expand All @@ -36,27 +35,27 @@ class EcomprocessingConsumer extends ObjectModel
* @see ObjectModel::$definition
*/
public static $definition = [
'table' => 'ecomprocessing_consumers',
'table' => 'ecomprocessing_consumers',
'primary' => 'id',
'fields' => [
'fields' => [
'merchant_username' => [
'type' => self::TYPE_STRING,
'type' => self::TYPE_STRING,
'validate' => 'isString',
'required' => true,
'size' => 40
'size' => 40,
],
'customer_email' => [
'type' => self::TYPE_STRING,
'customer_email' => [
'type' => self::TYPE_STRING,
'validate' => 'isEmail',
'required' => true
'required' => true,
],
'consumer_id' => [
'type' => self::TYPE_INT,
'consumer_id' => [
'type' => self::TYPE_INT,
'validate' => 'isUnsignedId',
'required' => true
'required' => true,
],
'date_add' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],
'date_upd' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],
'date_add' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],
'date_upd' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],
],
];

Expand All @@ -71,7 +70,7 @@ class EcomprocessingConsumer extends ObjectModel
public function add($autodate = true, $nullValues = false)
{
if (parent::add($autodate, $nullValues)) {
Hook::exec('actionEComprocessingAddConsumer', ['ecomprocessingAddConsumer' => $this]);
Hook::exec('actionEcomprocessingAddConsumer', ['ecomprocessingAddConsumer' => $this]);

return true;
}
Expand Down Expand Up @@ -106,11 +105,15 @@ public static function getConsumerId($merchantUsername, $customerEmail)
*/
public static function createConsumer($merchantUsername, $customerEmail, $consumerId)
{
if (self::getConsumerId($merchantUsername, $customerEmail)) {
return true;
}

$consumer = new static();

$consumer->merchant_username = $merchantUsername;
$consumer->customer_email = $customerEmail;
$consumer->consumer_id = $consumerId;
$consumer->customer_email = $customerEmail;
$consumer->consumer_id = $consumerId;

return $consumer->add();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* @copyright 2018 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;
}
Expand All @@ -42,7 +41,7 @@ class EcomprocessingInstall
'displayAdminOrder',
'displayOrderDetail',
'paymentOptions',
'backOfficeHeader',
'displayBackOfficeHeader',
];

/**
Expand All @@ -51,7 +50,7 @@ class EcomprocessingInstall
* @var string[]
*/
private $skippable17Hooks = [
'payment'
'payment',
];

/**
Expand Down Expand Up @@ -170,8 +169,7 @@ public function registerHooks($instance)
{
foreach ($this->hooks as $hook) {
if (version_compare(_PS_VERSION_, '1.7', '>=') &&
in_array($hook, $this->skippable17Hooks)
) {
in_array($hook, $this->skippable17Hooks)) {
continue;
}

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

if (!$instance->unregisterHook($hook)) {
$this->status = false;
throw new PrestaShopException('Module Uninstall: Hook (' . $hook . ') can\'t be unregistered!');
Expand All @@ -253,6 +256,7 @@ public function dropKeys($instance)

/**
* Return the status of all processed methods
*
* @return bool
*/
public function isSuccessful()
Expand Down
Loading

0 comments on commit c25e491

Please sign in to comment.