From aa90d90ba5213538c5474c659de05cfdb602b68e Mon Sep 17 00:00:00 2001 From: Christian Proske Date: Mon, 6 Dec 2021 12:05:09 +0100 Subject: [PATCH] fix #95 --- Migrations/Migration20211206112100.php | 3 --- lib/Checkout/AbstractCheckout.php | 25 +++++++++++++------------ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Migrations/Migration20211206112100.php b/Migrations/Migration20211206112100.php index f209760..54760c7 100644 --- a/Migrations/Migration20211206112100.php +++ b/Migrations/Migration20211206112100.php @@ -14,11 +14,9 @@ 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() @@ -26,7 +24,6 @@ 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 diff --git a/lib/Checkout/AbstractCheckout.php b/lib/Checkout/AbstractCheckout.php index 74f0405..dab7cf5 100644 --- a/lib/Checkout/AbstractCheckout.php +++ b/lib/Checkout/AbstractCheckout.php @@ -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 * */ @@ -279,9 +279,9 @@ public function getAPI(): MollieAPI /** * @param null|mixed $hash * - * @throws ServiceNotFoundException * @throws Exception * @throws CircularReferenceException + * @throws ServiceNotFoundException * @return void * */ @@ -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); @@ -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 @@ -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) @@ -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 @@ -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) { @@ -780,11 +786,6 @@ public function getDescription(): string ], $descTemplate); } - /** - * @return $this - */ - abstract protected function updateOrderNumber(); - /** * @param Order|Payment $model * @return $this;