Skip to content

Commit

Permalink
Merge branch 'fix/PIWOO-327-Order-is-not-canceled' into release/7.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaymo committed Oct 26, 2023
2 parents 760a501 + c82b9db commit e1ca262
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion src/Payment/PaymentModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,18 @@ public function cancelOrderOnExpiryDate()
foreach ($classNames as $gateway) {
$gatewayName = strtolower($gateway) . '_settings';
$gatewaySettings = get_option($gatewayName);

if (empty($gatewaySettings["activate_expiry_days_setting"]) || $gatewaySettings["activate_expiry_days_setting"] === 'no') {
continue;
}

$heldDuration = isset($gatewaySettings) && isset($gatewaySettings['order_dueDate']) ? $gatewaySettings['order_dueDate'] : 0;

if ($heldDuration < 1) {
continue;
}
$heldDurationInSeconds = $heldDuration * 60;
if ($gateway === 'mollie_wc_gateway_bankTransfer') {
if ($gateway === 'Mollie_WC_Gateway_Banktransfer') {
$durationInHours = absint($heldDuration) * 24;
$durationInMinutes = $durationInHours * 60;
$heldDurationInSeconds = $durationInMinutes * 60;
Expand Down Expand Up @@ -474,6 +479,12 @@ public function cancelOrderAtMollie($order_id)
*/
public function handleExpiryDateCancelation($paymentMethods)
{
add_action(
'init',
[$this, 'cancelOrderOnExpiryDate'],
11,
2
);
if (!$this->IsExpiryDateEnabled($paymentMethods)) {
as_unschedule_action('mollie_woocommerce_cancel_unpaid_orders');
return;
Expand Down
6 changes: 3 additions & 3 deletions src/Settings/General/MollieGeneralSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,14 @@ public function gatewayFormFields(
'order_dueDate' => [
'title' => sprintf(__('Expiry time', 'mollie-payments-for-woocommerce')),
'type' => 'number',
'custom_attributes' => ['step' => '1', 'min' => '10', 'max' => '526000'],
'description' => sprintf(
__(
'Number of MINUTES after the order will expire and will be canceled at Mollie and WooCommerce. A value of 0 means no expiry time will be considered.',
'Number of MINUTES after the order will expire and will be canceled at Mollie and WooCommerce.',
'mollie-payments-for-woocommerce'
)
),
'custom_attributes' => ['step' => '1', 'min' => '0', 'max' => '526000'],
'default' => '0',
'default' => '10',
'desc_tip' => false,
],
];
Expand Down

0 comments on commit e1ca262

Please sign in to comment.