-
Notifications
You must be signed in to change notification settings - Fork 3
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 #19 from payrexx/bugfix/PP-10834
bugfix/PP-10834: Testing Our Actual Plugin Version With Our Prestashop Plugin
- Loading branch information
Showing
14 changed files
with
232 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<module> | ||
<name>payrexx</name> | ||
<displayName><![CDATA[Payrexx]]></displayName> | ||
<version><![CDATA[1.4.8]]></version> | ||
<description><![CDATA[Accept payments using Payrexx Payment gateway]]></description> | ||
<author><![CDATA[Payrexx]]></author> | ||
<tab><![CDATA[payments_gateways]]></tab> | ||
<confirmUninstall><![CDATA[Are you sure you want to uninstall?]]></confirmUninstall> | ||
<is_configurable>1</is_configurable> | ||
<need_instance>1</need_instance> | ||
<limited_countries></limited_countries> | ||
</module> |
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Payrexx Payment Gateway. | ||
* | ||
* @author Payrexx <[email protected]> | ||
* @copyright 2023 Payrexx | ||
* @copyright 2024 Payrexx | ||
* @license MIT License | ||
*/ | ||
include_once _PS_MODULE_DIR_ . 'payrexx/src/Models/PayrexxPaymentMethod.php'; | ||
|
@@ -40,7 +40,7 @@ public function __construct() | |
|
||
$paymentMethod = $this->loadObject(true); | ||
foreach (['country', 'currency', 'customer_group'] as $fieldName) { | ||
$this->fields_value[$fieldName . '[]'] = unserialize($paymentMethod->$fieldName); | ||
$this->fields_value[$fieldName . '[]'] = json_decode($paymentMethod->$fieldName, true); | ||
} | ||
$configPaymentMethods = PayrexxConfig::getPaymentMethods(); | ||
$pageTitle = $this->l($configPaymentMethods[$paymentMethod->pm]); | ||
|
@@ -89,7 +89,7 @@ public function __construct() | |
'desc' => 'Leave empty accepts payment for all currency', | ||
'options' => [ | ||
'query' => Currency::getCurrencies(false, false), | ||
'id' => 'id', | ||
'id' => 'id_currency', | ||
'name' => 'name', | ||
], | ||
], | ||
|
@@ -126,8 +126,8 @@ public function __construct() | |
public function display() | ||
{ | ||
// show saved messages | ||
if ($this->context->cookie->__isset('redirect_errors') && | ||
$this->context->cookie->__get('redirect_errors') != '') { | ||
if ($this->context->cookie->__isset('redirect_errors') | ||
&& $this->context->cookie->__get('redirect_errors') != '') { | ||
$this->errors = array_merge( | ||
[ | ||
$this->context->cookie->__get('redirect_errors'), | ||
|
@@ -152,14 +152,14 @@ public function postProcess() | |
|
||
// Country | ||
$postCountry = !Tools::getIsset('country') ? [] : Tools::getValue('country'); | ||
$_POST['country'] = serialize($postCountry); | ||
$_POST['country'] = json_encode($postCountry); | ||
|
||
// currency | ||
$postCurrency = !Tools::getIsset('currency') ? [] : Tools::getValue('currency'); | ||
$_POST['currency'] = serialize($postCurrency); | ||
$_POST['currency'] = json_encode($postCurrency); | ||
|
||
$postCustomerGroup = !Tools::getIsset('customer_group') ? [] : Tools::getValue('customer_group'); | ||
$_POST['customer_group'] = serialize($postCustomerGroup); | ||
$_POST['customer_group'] = json_encode($postCustomerGroup); | ||
|
||
parent::postProcess(); | ||
} | ||
|
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Payrexx Payment Gateway. | ||
* | ||
* @author Payrexx <[email protected]> | ||
* @copyright 2023 Payrexx | ||
* @copyright 2024 Payrexx | ||
* @license MIT License | ||
*/ | ||
if (!defined('_PS_VERSION_')) { | ||
|
@@ -14,6 +14,13 @@ | |
use Payrexx\PayrexxPaymentGateway\Service\PayrexxApiService; | ||
use PrestaShop\PrestaShop\Core\Payment\PaymentOption; | ||
|
||
if (!class_exists(PayrexxConfig::class)) { | ||
$autoloadLocation = __DIR__ . '/vendor/autoload.php'; | ||
if (file_exists($autoloadLocation)) { | ||
require_once $autoloadLocation; | ||
} | ||
} | ||
|
||
class Payrexx extends PaymentModule | ||
{ | ||
/** | ||
|
@@ -24,7 +31,7 @@ public function __construct() | |
$this->name = 'payrexx'; | ||
$this->tab = 'payments_gateways'; | ||
$this->module_key = '0c4dbfccbd85dd948fd9a13d5a4add90'; | ||
$this->version = '1.4.7'; | ||
$this->version = '1.4.8'; | ||
$this->author = 'Payrexx'; | ||
$this->is_eu_compatible = 1; | ||
$this->ps_versions_compliancy = ['min' => '1.7']; | ||
|
@@ -44,10 +51,10 @@ public function __construct() | |
public function install() | ||
{ | ||
// Install default | ||
if (!parent::install() || | ||
!$this->installDb() || | ||
!$this->registerHook('paymentOptions') || | ||
!$this->registerHook('actionFrontControllerSetMedia') | ||
if (!parent::install() | ||
|| !$this->installDb() | ||
|| !$this->registerHook('paymentOptions') | ||
|| !$this->registerHook('actionFrontControllerSetMedia') | ||
) { | ||
return false; | ||
} | ||
|
@@ -329,6 +336,7 @@ public function hookPaymentOptions($params) | |
// Additional payment methods | ||
$this->loadTranslationsInUi(); | ||
$action = $this->context->link->getModuleLink($this->name, 'payrexx'); | ||
$paymentMethods = []; | ||
foreach ($this->getPaymentMethodsList(true) as $paymentMethod) { | ||
if (!$this->allowedPaymentMethodToPay($paymentMethod)) { | ||
continue; | ||
|
@@ -373,17 +381,17 @@ public function hookPaymentOptions($params) | |
*/ | ||
public function allowedPaymentMethodToPay(array $paymentMethod): bool | ||
{ | ||
$allowedCountries = unserialize($paymentMethod['country']); | ||
$allowedCurrencies = unserialize($paymentMethod['currency']); | ||
$allowedCustomerGroups = unserialize($paymentMethod['customer_group']); | ||
$allowedCountries = json_decode($paymentMethod['country'], true); | ||
$allowedCurrencies = json_decode($paymentMethod['currency'], true); | ||
$allowedCustomerGroups = json_decode($paymentMethod['customer_group'], true); | ||
if (!empty($allowedCountries) && !in_array($this->context->country->id, $allowedCountries)) { | ||
return false; | ||
} | ||
if (!empty($allowedCurrencies) && !in_array($this->context->currency->id, $allowedCurrencies)) { | ||
return false; | ||
} | ||
if (!empty($allowedCustomerGroups) && | ||
empty(array_intersect( | ||
if (!empty($allowedCustomerGroups) | ||
&& empty(array_intersect( | ||
$this->context->customer->getGroups(), | ||
$allowedCustomerGroups | ||
)) | ||
|
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
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
Oops, something went wrong.