when order is created with payment token the status of the newly created order is COMPLETED already

This commit is contained in:
David Remer 2020-07-28 09:21:27 +03:00
parent 5cd1de2446
commit 2af06b180e

View file

@ -131,15 +131,12 @@ class RenewalHandler
private function captureOrder(Order $order, \WC_Order $wcOrder)
{
if ($order->intent() === 'CAPTURE') {
$order = $this->orderEndpoint->capture($order);
if ($order->status()->is(OrderStatus::COMPLETED)) {
$wcOrder->update_status(
'processing',
__('Payment received.', 'woocommerce-paypal-commerce-gateway')
);
\WC_Subscriptions_Manager::process_subscription_payments_on_order($wcOrder);
}
if ($order->intent() === 'CAPTURE' && $order->status()->is(OrderStatus::COMPLETED)) {
$wcOrder->update_status(
'processing',
__('Payment received.', 'woocommerce-paypal-commerce-gateway')
);
\WC_Subscriptions_Manager::process_subscription_payments_on_order($wcOrder);
}
if ($order->intent() === 'AUTHORIZE') {