-
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 #20 from payrexx/bugfix/PP-10834
bugfix/PP-10834: Testing Our Actual Plugin Version With Our Prestashop Plugin
- Loading branch information
Showing
4 changed files
with
38 additions
and
35 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,14 @@ | ||
# Apache 2.2 | ||
<IfModule !mod_authz_core.c> | ||
<Files *.php> | ||
order allow,deny | ||
deny from all | ||
</Files> | ||
</IfModule> | ||
|
||
# Apache 2.4 | ||
<IfModule mod_authz_core.c> | ||
<Files *.php> | ||
Require all denied | ||
</Files> | ||
</IfModule> |
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* needs please refer to http://www.prestashop.com for more information. | ||
* | ||
* @author Payrexx <[email protected]> | ||
* @copyright 2023 Payrexx | ||
* @copyright 2024 Payrexx | ||
* @license MIT License | ||
*/ | ||
|
||
|
@@ -15,7 +15,6 @@ | |
exit; | ||
} | ||
|
||
use Configuration; | ||
use Payrexx\Models\Request\SignatureCheck; | ||
use Payrexx\Models\Response\Gateway; | ||
use Payrexx\Models\Response\Transaction; | ||
|
@@ -29,9 +28,9 @@ class PayrexxApiService | |
|
||
public function __construct() | ||
{ | ||
$this->instanceName = Configuration::get('PAYREXX_INSTANCE_NAME'); | ||
$this->apiKey = Configuration::get('PAYREXX_API_SECRET'); | ||
$this->platform = Configuration::get('PAYREXX_PLATFORM'); | ||
$this->instanceName = \Configuration::get('PAYREXX_INSTANCE_NAME'); | ||
$this->apiKey = \Configuration::get('PAYREXX_API_SECRET'); | ||
$this->platform = \Configuration::get('PAYREXX_PLATFORM'); | ||
} | ||
|
||
/** | ||
|
@@ -160,8 +159,8 @@ public function createPayrexxGateway( | |
$gateway->setReferenceId($cart->id); | ||
$gateway->setSkipResultPage(true); | ||
|
||
if (Configuration::get('PAYREXX_LOOK_AND_FEEL_ID')) { | ||
$gateway->setLookAndFeelProfile(Configuration::get('PAYREXX_LOOK_AND_FEEL_ID')); | ||
if (\Configuration::get('PAYREXX_LOOK_AND_FEEL_ID')) { | ||
$gateway->setLookAndFeelProfile(\Configuration::get('PAYREXX_LOOK_AND_FEEL_ID')); | ||
} | ||
|
||
$gateway->addField('title', ''); | ||
|
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,14 +3,12 @@ | |
* Payrexx Payment Gateway. | ||
* | ||
* @author Payrexx <[email protected]> | ||
* @copyright 2023 Payrexx | ||
* @copyright 2024 Payrexx | ||
* @license MIT License | ||
*/ | ||
|
||
namespace Payrexx\PayrexxPaymentGateway\Service; | ||
|
||
use Db; | ||
|
||
if (!defined('_PS_VERSION_')) { | ||
exit; | ||
} | ||
|
@@ -28,7 +26,7 @@ public function insertGatewayInfo($idCart, $idGateway, $paymentMethod) | |
if (empty($idCart) || empty($idGateway)) { | ||
return false; | ||
} | ||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->execute(' | ||
return \Db::getInstance(_PS_USE_SQL_SLAVE_)->execute(' | ||
INSERT INTO `' . _DB_PREFIX_ . 'payrexx_gateway` (`id_cart`, `id_gateway`, `pm`) | ||
VALUES (' . (int) $idCart . ',' . (int) $idGateway . ',\'' . $paymentMethod . '\')' | ||
. ' ON DUPLICATE KEY UPDATE id_gateway = ' . (int) $idGateway | ||
|
@@ -46,7 +44,7 @@ public function getCartGatewayId($idCart) | |
return null; | ||
} | ||
|
||
return (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' | ||
return (int) \Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' | ||
SELECT id_gateway FROM `' . _DB_PREFIX_ . 'payrexx_gateway` | ||
WHERE id_cart = ' . (int) $idCart | ||
); | ||
|
@@ -61,7 +59,7 @@ public function getGatewayCartId($idGateway) | |
return null; | ||
} | ||
|
||
return (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' | ||
return (int) \Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' | ||
SELECT id_cart FROM `' . _DB_PREFIX_ . 'payrexx_gateway` | ||
WHERE id_gateway = ' . (int) $idGateway | ||
); | ||
|
@@ -77,7 +75,7 @@ public function getPaymentMethodByCartId($idCart): string | |
return ''; | ||
} | ||
|
||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' | ||
return \Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' | ||
SELECT pm FROM `' . _DB_PREFIX_ . 'payrexx_gateway` | ||
WHERE id_cart = ' . (int) $idCart | ||
); | ||
|
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,20 +3,12 @@ | |
* Payrexx Payment Gateway. | ||
* | ||
* @author Payrexx <[email protected]> | ||
* @copyright 2023 Payrexx | ||
* @copyright 2024 Payrexx | ||
* @license MIT License | ||
*/ | ||
|
||
namespace Payrexx\PayrexxPaymentGateway\Service; | ||
|
||
use Cart; | ||
use Configuration; | ||
use Context; | ||
use Customer; | ||
use Db; | ||
use Module; | ||
use OrderHistory; | ||
|
||
if (!defined('_PS_VERSION_')) { | ||
exit; | ||
} | ||
|
@@ -50,10 +42,10 @@ public function createOrder( | |
$paymentMethod, | ||
array $extraVars = [] | ||
) { | ||
$payrexxModule = Module::getInstanceByName('payrexx'); | ||
$cart = new Cart($cartId); | ||
$customer = new Customer($cart->id_customer); | ||
$statusId = (int) Configuration::get($prestaStatus); | ||
$payrexxModule = \Module::getInstanceByName('payrexx'); | ||
$cart = new \Cart($cartId); | ||
$customer = new \Customer($cart->id_customer); | ||
$statusId = (int) \Configuration::get($prestaStatus); | ||
|
||
$payrexxModule->validateOrder( | ||
(int) $cart->id, | ||
|
@@ -66,7 +58,7 @@ public function createOrder( | |
false, | ||
$customer->secure_key | ||
); | ||
$context = Context::getContext(); | ||
$context = \Context::getContext(); | ||
$context->cart = $cart; | ||
} | ||
|
||
|
@@ -108,13 +100,13 @@ public function transitionAllowed($newStatus, $oldStatusId) | |
{ | ||
switch ($newStatus) { | ||
case self::PS_STATUS_ERROR: | ||
return !in_array($oldStatusId, [(int) Configuration::get(self::PS_STATUS_PAYMENT), (int) Configuration::get(self::PS_STATUS_REFUND)]); | ||
return !in_array($oldStatusId, [(int) \Configuration::get(self::PS_STATUS_PAYMENT), (int) \Configuration::get(self::PS_STATUS_REFUND)]); | ||
case self::PS_STATUS_REFUND: | ||
return in_array($oldStatusId, [(int) Configuration::get(self::PS_STATUS_PAYMENT), (int) Configuration::get(self::PS_STATUS_REFUND)]); | ||
return in_array($oldStatusId, [(int) \Configuration::get(self::PS_STATUS_PAYMENT), (int) \Configuration::get(self::PS_STATUS_REFUND)]); | ||
case self::PS_STATUS_PAYMENT: | ||
return $oldStatusId !== (int) Configuration::get(self::PS_STATUS_PAYMENT); | ||
return $oldStatusId !== (int) \Configuration::get(self::PS_STATUS_PAYMENT); | ||
case self::PS_STATUS_BANKWIRE: | ||
return $oldStatusId !== (int) Configuration::get(self::PS_STATUS_BANKWIRE); | ||
return $oldStatusId !== (int) \Configuration::get(self::PS_STATUS_BANKWIRE); | ||
} | ||
} | ||
|
||
|
@@ -125,8 +117,8 @@ public function transitionAllowed($newStatus, $oldStatusId) | |
*/ | ||
public function updateOrderStatus($prestaStatus, $order) | ||
{ | ||
$orderHistory = new OrderHistory(); | ||
$prestaStatusId = Configuration::get($prestaStatus); | ||
$orderHistory = new \OrderHistory(); | ||
$prestaStatusId = \Configuration::get($prestaStatus); | ||
|
||
$orderHistory->id_order = (int) $order->id; | ||
$orderHistory->changeIdOrderState($prestaStatusId, $order, true); | ||
|
@@ -145,7 +137,7 @@ public function getCartGatewayId($id_cart) | |
return 0; | ||
} | ||
|
||
return (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' | ||
return (int) \Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' | ||
SELECT id_gateway FROM `' . _DB_PREFIX_ . 'payrexx_gateway` | ||
WHERE id_cart = ' . (int) $id_cart); | ||
} | ||
|