-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Unify config var * Separate form validation * Add class to create the webhooks * Remove unnecessary validations * Remove duplicate code
- Loading branch information
1 parent
078e1f8
commit 62b4d3b
Showing
8 changed files
with
129 additions
and
294 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,29 @@ | ||
<?php | ||
|
||
/** | ||
* NOTICE OF LICENSE | ||
* Title : Conekta Card Payment Gateway for Prestashop | ||
* Author : Conekta.io | ||
* URL : https://www.conekta.io/es/docs/plugins/prestashop. | ||
* PHP Version 7.0.0 | ||
* Conekta File Doc Comment | ||
* | ||
* @author Conekta <[email protected]> | ||
* @copyright 2012-2023 Conekta | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* | ||
* @category Conekta | ||
* | ||
* @version GIT: @2.3.6@ | ||
* | ||
* @see https://conekta.com/ | ||
*/ | ||
require_once dirname(__FILE__) . '/../../model/Database.php'; | ||
class ConektaNotificationsModuleFrontController extends ModuleFrontController | ||
{ | ||
public const ORDER_CANCELED = 6; | ||
|
||
public const ORDER_REFUNDED = 7; | ||
|
||
public $auth = false; | ||
|
||
public $ajax; | ||
|
@@ -99,7 +121,7 @@ private function orderCanceled($orderID) | |
{ | ||
Db::getInstance()->Execute( | ||
'UPDATE ' . _DB_PREFIX_ | ||
. 'orders SET current_state = ' . ORDER_CANCELED . ' WHERE id_order = ' | ||
. 'orders SET current_state = ' . self::ORDER_CANCELED . ' WHERE id_order = ' | ||
. pSQL($orderID) | ||
); | ||
} | ||
|
@@ -113,7 +135,7 @@ private function orderRefunded($orderID) | |
{ | ||
Db::getInstance()->Execute( | ||
'UPDATE ' . _DB_PREFIX_ | ||
. 'orders SET current_state = ' . ORDER_REFUNDED . ' WHERE id_order = ' | ||
. 'orders SET current_state = ' . self::ORDER_REFUNDED . ' WHERE id_order = ' | ||
. pSQL($orderID) | ||
); | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,22 @@ | ||
<?php | ||
/** | ||
* NOTICE OF LICENSE | ||
* Title : Conekta Card Payment Gateway for Prestashop | ||
* Author : Conekta.io | ||
* URL : https://www.conekta.io/es/docs/plugins/prestashop. | ||
* PHP Version 7.0.0 | ||
* Conekta File Doc Comment | ||
* | ||
* @author Conekta <[email protected]> | ||
* @copyright 2012-2023 Conekta | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* | ||
* @category Conekta | ||
* | ||
* @version GIT: @2.3.6@ | ||
* | ||
* @see https://conekta.com/ | ||
*/ | ||
|
||
namespace Conekta\Payments\UseCases; | ||
|
||
|
@@ -21,8 +39,13 @@ class CreateWebhook | |
|
||
public const MaxFailedAttempts = 5; | ||
|
||
public function __invoke(string $privateKey, string $isoCode, string $pluginVersion, $conektaMode): bool | ||
{ | ||
public function __invoke( | ||
bool $conektaMode, | ||
string $privateKey, | ||
string $isoCode, | ||
string $pluginVersion, | ||
string $oldWebhook | ||
): bool { | ||
Conekta::setApiKey($privateKey); | ||
Conekta::setPlugin('Prestashop'); | ||
Conekta::setApiVersion('2.0.0'); | ||
|
@@ -32,10 +55,9 @@ public function __invoke(string $privateKey, string $isoCode, string $pluginVers | |
$events = ['events' => ['order.paid', 'order.expired']]; | ||
|
||
$newWebhook = Tools::safeOutput(Tools::getValue(self::webhookSetting)); | ||
$oldWebhook = Tools::safeOutput(Configuration::get(self::webhookSetting)); | ||
Configuration::deleteByName(self::webhookErrorSetting); | ||
|
||
if ($newWebhook === $oldWebhook) { | ||
if ($oldWebhook === $newWebhook) { | ||
return true; | ||
} | ||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,22 @@ | ||
<?php | ||
/** | ||
* NOTICE OF LICENSE | ||
* Title : Conekta Card Payment Gateway for Prestashop | ||
* Author : Conekta.io | ||
* URL : https://www.conekta.io/es/docs/plugins/prestashop. | ||
* PHP Version 7.0.0 | ||
* Conekta File Doc Comment | ||
* | ||
* @author Conekta <[email protected]> | ||
* @copyright 2012-2023 Conekta | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* | ||
* @category Conekta | ||
* | ||
* @version GIT: @2.3.6@ | ||
* | ||
* @see https://conekta.com/ | ||
*/ | ||
|
||
namespace Conekta\Payments\UseCases; | ||
|
||
|
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