@@ -895,7 +895,7 @@ |
||
| 895 | 895 | } |
| 896 | 896 | |
| 897 | 897 | if ( 'requires_payment_method' === $intent->status && isset( $intent->last_payment_error ) |
| 898 | - && 'authentication_required' === $intent->last_payment_error->code ) { |
|
| 898 | + && 'authentication_required' === $intent->last_payment_error->code ) { |
|
| 899 | 899 | $level3_data = $this->get_level3_data_from_order( $order ); |
| 900 | 900 | $intent = WC_Stripe_API::request_with_level3_data( |
| 901 | 901 | array( |
@@ -163,7 +163,7 @@ |
||
| 163 | 163 | && preg_match( '/^[rs]k_test_/', $this->secret_key ); |
| 164 | 164 | } else { |
| 165 | 165 | return preg_match( '/^pk_live_/', $this->publishable_key ) |
| 166 | - && preg_match( '/^[rs]k_live_/', $this->secret_key ); |
|
| 166 | + && preg_match( '/^[rs]k_live_/', $this->secret_key ); |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
@@ -123,10 +123,10 @@ |
||
| 123 | 123 | // in includes/abstracts/abstract-wc-stripe-payment-gateway.php |
| 124 | 124 | if ( $this->testmode ) { |
| 125 | 125 | return preg_match( '/^pk_test_/', $this->publishable_key ) |
| 126 | - && preg_match( '/^[rs]k_test_/', $this->secret_key ); |
|
| 126 | + && preg_match( '/^[rs]k_test_/', $this->secret_key ); |
|
| 127 | 127 | } else { |
| 128 | 128 | return preg_match( '/^pk_live_/', $this->publishable_key ) |
| 129 | - && preg_match( '/^[rs]k_live_/', $this->secret_key ); |
|
| 129 | + && preg_match( '/^[rs]k_live_/', $this->secret_key ); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
@@ -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 | } |