From ae0f56e30bc5ce8312d8ab5ac7766e09fa231c40 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Wed, 16 Aug 2023 15:48:45 +0200 Subject: [PATCH] Update renewal order status to completed --- modules/ppcp-webhooks/src/Handler/PaymentSaleCompleted.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/ppcp-webhooks/src/Handler/PaymentSaleCompleted.php b/modules/ppcp-webhooks/src/Handler/PaymentSaleCompleted.php index 7442c7a55..0596ed154 100644 --- a/modules/ppcp-webhooks/src/Handler/PaymentSaleCompleted.php +++ b/modules/ppcp-webhooks/src/Handler/PaymentSaleCompleted.php @@ -94,9 +94,12 @@ class PaymentSaleCompleted implements RequestHandler { foreach ( $subscriptions as $subscription ) { $transaction_id = wc_clean( wp_unslash( $request['resource']['id'] ?? '' ) ); if ( $transaction_id && is_string( $transaction_id ) ) { + $this->logger->info( 'Creating renewal order from PAYMENT.SALE.COMPLETED webhook handler' ); $renewal_order = wcs_create_renewal_order( $subscription ); if ( is_a( $renewal_order, WC_Order::class ) ) { + $renewal_order->payment_complete(); $this->update_transaction_id( $transaction_id, $renewal_order, $this->logger ); + $this->logger->info( 'Updating status completed and transaction id from PAYMENT.SALE.COMPLETED webhook handler' ); } } }