-
Notifications
You must be signed in to change notification settings - Fork 4
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 #9 from WebStollenPaymentTeam/main
v1.9.1
- Loading branch information
Showing
11 changed files
with
341 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Plugin\ws5_mollie\Migrations; | ||
|
||
use JTL\Plugin\Migration; | ||
use JTL\Update\IMigration; | ||
|
||
class Migration20240919161400 extends Migration implements IMigration | ||
{ | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function up() | ||
{ | ||
$this->execute('CREATE INDEX idx_composite_with_order ON xplugin_ws5_mollie_queue (`dDone`, `bLock`, `cType`, `dCreated` DESC);'); | ||
} | ||
|
||
public function down() | ||
{ | ||
// No need to change since 'xplugin_ws5_mollie_orders' is removed in Migration where it is created, and we don't support downgrading of Plugins | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script type="text/javascript"> | ||
{if isset($wsQueueURL)}{literal} | ||
$(function() { | ||
fetch({/literal}'{$wsQueueURL}{literal}', { | ||
method: 'POST', | ||
headers: { | ||
'X-Requested-With': 'XMLHttpRequest' | ||
}, | ||
credentials: 'omit', | ||
}) | ||
.then(response => { | ||
if (!response.ok) { | ||
throw new Error('Network response was not ok'); | ||
} | ||
return response.json(); // If the response is JSON | ||
}) | ||
.catch(error => { | ||
console.error('Error:', error); | ||
}); | ||
}); | ||
{/literal}{/if} | ||
</script> |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Plugin\ws5_mollie\lib; | ||
|
||
use JTL\Cron\Job; | ||
use JTL\Cron\JobInterface; | ||
use JTL\Cron\QueueEntry; | ||
use Plugin\ws5_mollie\lib\Model\QueueModel; | ||
|
||
class CleanupCronJob extends Job | ||
{ | ||
public function start(QueueEntry $queueEntry): JobInterface | ||
{ | ||
parent::start($queueEntry); | ||
|
||
try { | ||
$this->logger->debug('Mollie Queue Cleanup'); | ||
ifndef('MOLLIE_DISABLE_USER_CLEANUP', false); | ||
if (!MOLLIE_DISABLE_USER_CLEANUP) { | ||
QueueModel::cleanUp(); | ||
} | ||
|
||
PluginHelper::cleanupPaymentLogs(); | ||
|
||
} catch (\Exception $e) { | ||
$this->logger->debug('Mollie Queue Exception: ' . $e->getMessage()); | ||
} | ||
|
||
$this->setFinished(true); | ||
return $this; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright 2021 WebStollen GmbH | ||
* @link https://www.webstollen.de | ||
*/ | ||
|
||
namespace Plugin\ws5_mollie\lib\Hook; | ||
|
||
use Exception; | ||
use JTL\Shop; | ||
use Plugin\ws5_mollie\lib\Model\QueueModel; | ||
use Plugin\ws5_mollie\lib\PluginHelper; | ||
use WS\JTL5\V1_0_16\Hook\AbstractHook; | ||
|
||
class FrontendHook extends AbstractHook | ||
{ | ||
/** | ||
* @param array $args_arr | ||
* @throws Exception | ||
*/ | ||
public static function execute($args_arr = []): void | ||
{ | ||
try { | ||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') { | ||
return; | ||
} | ||
|
||
// Reset CreditCard-Token after Order! | ||
if ( | ||
($key = sprintf('kPlugin_%d_creditcard', PluginHelper::getPlugin()->getID())) | ||
&& array_key_exists($key, $_SESSION) && !array_key_exists('Zahlungsart', $_SESSION) | ||
) { | ||
unset($_SESSION[$key]); | ||
} | ||
|
||
// append queue script | ||
if (PluginHelper::getSetting('queue') === 'async') { | ||
Shop::Smarty()->assign('wsQueueURL', Shop::getURL() . '/ws5_mollie/queue'); | ||
pq('body')->append(Shop::Smarty()->fetch(PluginHelper::getPlugin()->getPaths()->getFrontendPath() . 'template/queue.tpl', false)); | ||
} | ||
} catch (Exception $e) { | ||
} | ||
} | ||
} |
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.