Skip to content

Commit

Permalink
Send dueDate to Mollie.
Browse files Browse the repository at this point in the history
  • Loading branch information
inpsyde-maticluznar committed Aug 2, 2023
1 parent ca24145 commit 1d641fa
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Payment/MolliePayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function getPaymentRequestData($order, $customerId, $voucherDefaultCatego
$storeCustomer = $settingsHelper->shouldStoreCustomer();

$gateway = wc_get_payment_gateway_by_order($order);
$gatewaySettings = property_exists($gateway, "settings") ? $gateway->settings : [];

if (!$gateway || !($gateway instanceof MolliePaymentGateway)) {
return ['result' => 'failure'];
Expand Down Expand Up @@ -122,6 +123,19 @@ public function getPaymentRequestData($order, $customerId, $voucherDefaultCatego
$encodedApplePayToken = json_encode($applePayToken);
$paymentRequestData['applePayPaymentToken'] = $encodedApplePayToken;
}

if (
$gateway->id === "mollie_wc_gateway_banktransfer" &&
!empty($gatewaySettings["activate_expiry_days_setting"]) &&
$gatewaySettings["activate_expiry_days_setting"] === 'yes' &&
!empty($gatewaySettings["order_dueDate"]) &&
is_numeric($gatewaySettings["order_dueDate"])
) {
$dueDateTimestamp = time() + (intval($gatewaySettings["order_dueDate"]) * 24 * 60 * 60);
// https://docs.mollie.com/reference/v2/payments-api/create-payment#bank-transfer
$paymentRequestData["dueDate"] = date("Y-m-d", $dueDateTimestamp);
}

return $paymentRequestData;
}

Expand Down

0 comments on commit 1d641fa

Please sign in to comment.