@@ -25,7 +25,7 @@ |
||
25 | 25 | 'description' => '', |
26 | 26 | 'default' => 'no', |
27 | 27 | ), |
28 | - 'activate_subscriptions_early' => array( |
|
28 | + 'activate_subscriptions_early' => array( |
|
29 | 29 | 'title' => __( 'Subscriptions Status', 'woocommerce-gateway-stripe' ), |
30 | 30 | 'label' => __( 'Make subscriptions active while waiting on the payment process to complete', 'woocommerce-gateway-stripe' ), |
31 | 31 | 'type' => 'checkbox', |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $this->title = $this->get_option( 'title' ); |
105 | 105 | $this->description = $this->get_option( 'description' ); |
106 | 106 | $this->enabled = $this->get_option( 'enabled' ); |
107 | - $this->activate_subscriptions_early = $this->get_option( 'activate_subscriptions_early' ); |
|
107 | + $this->activate_subscriptions_early = $this->get_option( 'activate_subscriptions_early' ); |
|
108 | 108 | $this->testmode = ( ! empty( $main_settings['testmode'] ) && 'yes' === $main_settings['testmode'] ) ? true : false; |
109 | 109 | $this->saved_cards = ( ! empty( $main_settings['saved_cards'] ) && 'yes' === $main_settings['saved_cards'] ) ? true : false; |
110 | 110 | $this->publishable_key = ! empty( $main_settings['publishable_key'] ) ? $main_settings['publishable_key'] : ''; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) ); |
120 | 120 | add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) ); |
121 | 121 | |
122 | - add_action( 'woocommerce_order_status_changed', array( $this, 'maybe_activate_subscriptions_early'), 10, 4 ); |
|
122 | + add_action( 'woocommerce_order_status_changed', array( $this, 'maybe_activate_subscriptions_early'), 10, 4 ); |
|
123 | 123 | |
124 | 124 | if ( WC_Stripe_Helper::is_pre_orders_exists() ) { |
125 | 125 | $this->pre_orders = new WC_Stripe_Pre_Orders_Compat(); |
@@ -422,28 +422,28 @@ discard block |
||
422 | 422 | } |
423 | 423 | } |
424 | 424 | |
425 | - /** |
|
425 | + /** |
|
426 | 426 | * Maybe activate subscriptions early during payment confirmation |
427 | - * Process can take up to 7-10 days |
|
428 | - * If order fails, subscription set to On Hold |
|
427 | + * Process can take up to 7-10 days |
|
428 | + * If order fails, subscription set to On Hold |
|
429 | 429 | * |
430 | 430 | * @param $order_id |
431 | 431 | * @param $status_from |
432 | 432 | * @param $status_to |
433 | 433 | * @param $order |
434 | 434 | */ |
435 | - function maybe_activate_subscriptions_early ( $order_id, $status_from, $status_to, $order ) { |
|
436 | - if ( 'yes' !== $this->activate_subscriptions_early || $status_to !== 'on-hold' ) { |
|
437 | - return; |
|
438 | - } |
|
435 | + function maybe_activate_subscriptions_early ( $order_id, $status_from, $status_to, $order ) { |
|
436 | + if ( 'yes' !== $this->activate_subscriptions_early || $status_to !== 'on-hold' ) { |
|
437 | + return; |
|
438 | + } |
|
439 | 439 | |
440 | - if ( ! wcs_order_contains_subscription( $order, 'any' ) || ! function_exists( 'wcs_order_contains_subscription' ) ) { |
|
441 | - return; |
|
442 | - } |
|
440 | + if ( ! wcs_order_contains_subscription( $order, 'any' ) || ! function_exists( 'wcs_order_contains_subscription' ) ) { |
|
441 | + return; |
|
442 | + } |
|
443 | 443 | |
444 | - $subscriptions = wcs_get_subscriptions_for_order( $order, array( 'order_type' => array( 'any' ) ) ); |
|
445 | - foreach( $subscriptions as $subscription ){ |
|
446 | - $subscription->update_status( 'active' ); |
|
447 | - } |
|
448 | - } |
|
444 | + $subscriptions = wcs_get_subscriptions_for_order( $order, array( 'order_type' => array( 'any' ) ) ); |
|
445 | + foreach( $subscriptions as $subscription ){ |
|
446 | + $subscription->update_status( 'active' ); |
|
447 | + } |
|
448 | + } |
|
449 | 449 | } |