Skip to content

Commit

Permalink
PIWOO-422 enable capture flag and process as payment
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaymo committed Feb 23, 2024
1 parent 9190f9a commit e61d4bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/MerchantCapture/MerchantCaptureModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function run(ContainerInterface $container): bool
add_action('init', static function () use ($container) {
$pluginId = $container->get('shared.plugin_id');
$captureSettings = new MollieCaptureSettings();
if (!apply_filters('mollie_wc_gateway_enable_merchant_capture_module', false)) {
if (!apply_filters('mollie_wc_gateway_enable_merchant_capture_module', true)) {
return;
}

Expand Down
23 changes: 15 additions & 8 deletions src/Payment/PaymentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,6 @@ protected function processAsMollieOrder(
$data,
$order
);
$this->logger->debug(
json_encode($data, JSON_PRETTY_PRINT)
);
/*$data = apply_filters(
'woocommerce_mollie_wc_gateway_' . $this->gateway->id . '_args',
$data,
$order
);*/

do_action(
$this->pluginId . '_create_payment',
Expand Down Expand Up @@ -537,6 +529,21 @@ protected function processPaymentForMollie(
// PROCESS REGULAR PAYMENT AS MOLLIE ORDER
//
if ($molliePaymentType === self::PAYMENT_METHOD_TYPE_ORDER) {
// if the capture is set to manual, and this is a credit card payment, we need to create a payment instead of an order
$captureType = get_option('mollie-payments-for-woocommerce_place_payment_onhold');
if ($captureType === 'later_capture' && $this->gateway->id === 'mollie_wc_gateway_creditcard') {
$this->logger->debug(
"{$this->gateway->id}: Create payment for order {$orderId} capture set to manual",
[true]
);

$paymentObject = $this->processAsMolliePayment(
$order,
$customer_id,
$apiKey
);
return $paymentObject;
}
$this->logger->debug(
"{$this->gateway->id}: Create Mollie payment object for order {$orderId}",
[true]
Expand Down

0 comments on commit e61d4bc

Please sign in to comment.