Capture the order only if the intent is capture

This commit is contained in:
Mészáros Róbert 2020-04-13 11:25:01 +03:00
parent 717b7d1689
commit f4fd1d8b7d

View file

@ -84,7 +84,9 @@ class WcGateway extends \WC_Payment_Gateway
}
$order = $this->patchOrder($wcOrder, $order);
$order = $this->endpoint->capture($order);
if($order->intent() === 'CAPTURE') {
$order = $this->endpoint->capture($order);
}
$wcOrder->update_status('on-hold', __('Awaiting payment.', 'woocommerce-paypal-gateway'));
if ($order->status()->is(OrderStatus::COMPLETED)) {