Moved code for payment process order to subscriptions module by adding a new filter

This commit is contained in:
Daniel Hüsken 2025-01-31 08:25:03 +01:00
parent b0a5d9b3c4
commit 99ca470d3f
No known key found for this signature in database
GPG key ID: 9F732DA37FA709E8
10 changed files with 127 additions and 34 deletions

View file

@ -253,7 +253,18 @@ class AxoGateway extends WC_Payment_Gateway {
$order = $this->create_paypal_order( $wc_order, $token );
$this->order_processor->process_captured_and_authorized( $wc_order, $order );
/**
* This filter controls if the method 'precess()' from OrderProcessor will be called.
* So you can implement your own for example on subscriptions
*
* - true bool controls execution of 'OrderProcessor::precess()'
* @var $this \WC_Payment_Gateway
* @var $wc_order \WC_Order
*/
$process = apply_filters( 'woocommerce_paypal_payments_before_order_process', true, $this, $wc_order );
if ( $process ) {
$this->order_processor->process_captured_and_authorized( $wc_order, $order );
}
} catch ( Exception $exception ) {
return $this->handle_payment_failure( $wc_order, $exception );
}