Skip to content

Commit

Permalink
Set dueDate when active_expiry_days_setting is activated.
Browse files Browse the repository at this point in the history
  • Loading branch information
inpsyde-maticluznar committed Sep 13, 2023
1 parent 068d53a commit 3add968
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/PaymentMethods/Banktransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,12 @@ public function addPaymentArguments(array $args, WC_Order $order)
$expiry_date = date("Y-m-d", strtotime(sprintf('+%s days', $expiry_days)));

// Add dueDate at the correct location
if (isset($args['payment'])) {
$args['payment']['dueDate'] = $expiry_date;
} else {
$args['dueDate'] = $expiry_date;
if($this->isExpiredDateSettingActivated()) {
if (isset($args['payment'])) {
$args['payment']['dueDate'] = $expiry_date;
} else {
$args['dueDate'] = $expiry_date;
}
}
$email = (ctype_space($order->get_billing_email())) ? null
: $order->get_billing_email();
Expand All @@ -114,7 +116,6 @@ public function addPaymentArguments(array $args, WC_Order $order)
return $args;
}

//TODO is this needed??
public function isExpiredDateSettingActivated()
{
$expiryDays = $this->getProperty(
Expand Down

0 comments on commit 3add968

Please sign in to comment.