Server IP : 162.0.217.223 / Your IP : 216.73.216.168 Web Server : LiteSpeed System : Linux premium269.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : mypckeys ( 1539) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/mypckeys/www/wp-content/plugins/woo-stripe-payment/src/Webhooks/ |
Upload File : |
<?php namespace PaymentPlugins\Stripe\Webhooks; class DeferredWebhookHandler { public function initialize() { add_action( 'wc_stripe_process_deferred_webhook', [ $this, 'process' ], 10, 2 ); } public function process( $type, $order_id ) { switch ( $type ) { case 'payment_intent.succeeded': $order = wc_get_order( absint( $order_id ) ); if ( $order ) { $payment_gateways = WC()->payment_gateways()->payment_gateways(); /** * @var \WC_Payment_Gateway_Stripe $payment_method */ $payment_method = $payment_gateways[ $order->get_payment_method() ] ?? null; if ( $payment_method ) { // The order has already been processed, exit here. if ( $payment_method->has_order_lock( $order ) || $order->get_date_paid() ) { return; } $payment_method->set_order_lock( $order ); $result = $payment_method->payment_object->process_payment( $order ); if ( ! is_wp_error( $result ) && $result->complete_payment ) { $payment_method->payment_object->payment_complete( $order, $result->charge ); } } } break; } } }