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