From abd4c171dc47de896841285788e0687883250b61 Mon Sep 17 00:00:00 2001 From: David Remer Date: Tue, 25 Aug 2020 11:58:02 +0300 Subject: [PATCH] when order is already payed through webhook, return success in gateway --- .../ppcp-wc-gateway/src/Gateway/PayPalGateway.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules.local/ppcp-wc-gateway/src/Gateway/PayPalGateway.php b/modules.local/ppcp-wc-gateway/src/Gateway/PayPalGateway.php index ff8ca6096..95a36dad8 100644 --- a/modules.local/ppcp-wc-gateway/src/Gateway/PayPalGateway.php +++ b/modules.local/ppcp-wc-gateway/src/Gateway/PayPalGateway.php @@ -122,6 +122,16 @@ class PayPalGateway extends \WC_Payment_Gateway return null; } + /** + * If the WC_Order is payed through the approved webhook. + */ + if (isset($_REQUEST['ppcp-resume-order']) && $wcOrder->has_status('processing')) { + return [ + 'result' => 'success', + 'redirect' => $this->get_return_url($wcOrder), + ]; + } + if ($this->orderProcessor->process($wcOrder, $woocommerce)) { return [ 'result' => 'success',