Skip to content

Commit

Permalink
fix #93
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Proske committed Dec 3, 2021
1 parent 63e1826 commit 972fa72
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
5 changes: 4 additions & 1 deletion lib/Checkout/AbstractCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ public static function sendReminders(): void
return;
}

$remindables = Shop::Container()->getDB()->executeQueryPrepared("SELECT kId FROM xplugin_ws5_mollie_orders WHERE dReminder IS NULL AND dCreated < NOW() - INTERVAL :d HOUR AND cStatus IN ('created','open', 'expired', 'failed', 'canceled')", [
$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 :d MINUTE AND cStatus IN ('created','open', 'expired', 'failed', 'canceled')", [
':d' => $reminder
], 2);
foreach ($remindables as $remindable) {
Expand All @@ -544,6 +544,9 @@ public static function sendReminder($kId): bool

// filter paid and storno
if (!$order->kBestellung || (int)$order->cStatus > BESTELLUNG_STATUS_IN_BEARBEITUNG || (int)$order->cStatus < 0) {
$order->dReminder = date('Y-m-d H:i:s');
$order->save();

return true;
}
$oBestellung = new Bestellung($order->kBestellung);
Expand Down
4 changes: 2 additions & 2 deletions lib/Checkout/OrderCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class OrderCheckout extends AbstractCheckout
*/
public function create(array $paymentOptions = []): Order
{
if ($this->getModel()->orderId) {
if ($this->getModel()->cOrderId) {
try {
$this->order = $this->getAPI()->getClient()->orders->get($this->getModel()->orderId, ['embed' => 'payments']);
$this->order = $this->getAPI()->getClient()->orders->get($this->getModel()->cOrderId, ['embed' => 'payments']);
if (in_array($this->order->status, [OrderStatus::STATUS_COMPLETED, OrderStatus::STATUS_PAID, OrderStatus::STATUS_AUTHORIZED, OrderStatus::STATUS_PENDING], true)) {
throw new RuntimeException(self::Plugin('ws5_mollie')->getLocalization()->getTranslation('errAlreadyPaid'));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Checkout/PaymentCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PaymentCheckout extends AbstractCheckout
*/
public function create(array $paymentOptions = []): Payment
{
if ($this->getModel()->orderId) {
if ($this->getModel()->cOrderId) {
try {
$this->payment = $this->getAPI()->getClient()->payments->get($this->getModel()->cOrderId);
if ($this->payment->status === PaymentStatus::STATUS_OPEN) {
Expand Down
3 changes: 1 addition & 2 deletions lib/Hook/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ public static function headPostGet(): void
if (self::Plugin('ws5_mollie')->getConfig()->getValue('resetMethod') !== 'on') {
$options['method'] = $checkout->getModel()->cMethod;
}

$mollie = $checkout->create($options); // Order::repayOrder($orderModel->getOrderId(), $options, $api);
$mollie = $checkout->create($options);
$url = $mollie->getCheckoutUrl();

header('Location: ' . $url);
Expand Down

0 comments on commit 972fa72

Please sign in to comment.