Skip to content

Commit

Permalink
fix #95
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Proske committed Dec 6, 2021
1 parent 559bc29 commit aa90d90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
3 changes: 0 additions & 3 deletions Migrations/Migration20211206112100.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@ class Migration20211206112100 extends Migration implements IMigration
{
public function up()
{

$this->execute('ALTER TABLE `xplugin_ws5_mollie_orders` DROP INDEX `cOrderId`;');
$this->execute('ALTER TABLE `xplugin_ws5_mollie_orders` DROP INDEX `kBestellung`;');
$this->execute('ALTER TABLE `xplugin_ws5_mollie_orders` ADD UNIQUE( `kBestellung`, `cOrderId`);');

}

public function down()
{
$this->execute('ALTER TABLE `xplugin_ws5_mollie_orders` DROP INDEX `kBestellung`;');
$this->execute('ALTER TABLE `xplugin_ws5_mollie_orders` ADD UNIQUE(`kBestellung`);');
$this->execute('ALTER TABLE `xplugin_ws5_mollie_orders` ADD UNIQUE(`cOrderId`);');

}

public function getDescription(): string
Expand Down
25 changes: 13 additions & 12 deletions lib/Checkout/AbstractCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public function __construct(Bestellung $oBestellung, MollieAPI $api = null)
* @param string $id
* @param bool $test
*
* @throws ServiceNotFoundException
* @throws CircularReferenceException
* @throws ServiceNotFoundException
* @return void
*
*/
Expand Down Expand Up @@ -279,9 +279,9 @@ public function getAPI(): MollieAPI
/**
* @param null|mixed $hash
*
* @throws ServiceNotFoundException
* @throws Exception
* @throws CircularReferenceException
* @throws ServiceNotFoundException
* @return void
*
*/
Expand Down Expand Up @@ -388,7 +388,7 @@ public function completlyPaid(): bool
{
if (
$row = Shop::Container()->getDB()->executeQueryPrepared('SELECT SUM(fBetrag) as fBetragSumme FROM tzahlungseingang WHERE kBestellung = :kBestellung', [
':kBestellung' => $this->oBestellung->kBestellung
':kBestellung' => $this->oBestellung->kBestellung
], 1)
) {
return (float)$row->fBetragSumme >= ($this->oBestellung->fGesamtsumme * $this->getBestellung()->fWaehrungsFaktor);
Expand All @@ -400,8 +400,8 @@ public function completlyPaid(): bool
/**
* @param Bestellung $oBestellung
* @param OrderModel $model
* @throws ServiceNotFoundException
* @throws CircularReferenceException
* @throws ServiceNotFoundException
* @return bool
*/
public static function makeFetchable(Bestellung $oBestellung, OrderModel $model): bool
Expand All @@ -423,8 +423,8 @@ public static function makeFetchable(Bestellung $oBestellung, OrderModel $model)
/**
* @param $msg
* @param int $level
* @throws ServiceNotFoundException
* @throws CircularReferenceException
* @throws ServiceNotFoundException
* @return $this
*/
public function Log(string $msg, $level = LOGLEVEL_NOTICE)
Expand All @@ -445,6 +445,11 @@ public function Log(string $msg, $level = LOGLEVEL_NOTICE)
return $this;
}

/**
* @return $this
*/
abstract protected function updateOrderNumber();

/**
* @param int $kBestellung
* @param bool $checkZA
Expand Down Expand Up @@ -517,8 +522,9 @@ public static function sendReminders(): void

return;
}

$remindables = Shop::Container()->getDB()->executeQueryPrepared("SELECT kId FROM xplugin_ws5_mollie_orders WHERE (dReminder IS NULL OR dReminder = '0000-00-00 00:00:00') AND dCreated > NOW() - INTERVAL 7 DAY AND dCreated < NOW() - INTERVAL :d MINUTE AND cStatus IN ('created','open', 'expired', 'failed', 'canceled')", [
// TODO: DOKU
ifndef('MOLLIE_REMINDER_LIMIT_DAYS', 7);
$remindables = Shop::Container()->getDB()->executeQueryPrepared("SELECT kId FROM xplugin_ws5_mollie_orders WHERE (dReminder IS NULL OR dReminder = '0000-00-00 00:00:00') AND dCreated > NOW() - INTERVAL " . MOLLIE_REMINDER_LIMIT_DAYS . " DAY AND dCreated < NOW() - INTERVAL :d MINUTE AND cStatus IN ('created','open', 'expired', 'failed', 'canceled')", [
':d' => $reminder
], 2);
foreach ($remindables as $remindable) {
Expand Down Expand Up @@ -780,11 +786,6 @@ public function getDescription(): string
], $descTemplate);
}

/**
* @return $this
*/
abstract protected function updateOrderNumber();

/**
* @param Order|Payment $model
* @return $this;
Expand Down

0 comments on commit aa90d90

Please sign in to comment.