Completed
Push — master ( b3f03c...7c87e6 )
by Roy
06:09
created
includes/compat/class-wc-stripe-subs-compat.php 1 patch
Spacing   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
@@ -15,19 +15,19 @@  discard block
 block discarded – undo
15 15
 	public function __construct() {
16 16
 		parent::__construct();
17 17
 
18
-		if ( class_exists( 'WC_Subscriptions_Order' ) ) {
19
-			add_action( 'woocommerce_scheduled_subscription_payment_' . $this->id, array( $this, 'scheduled_subscription_payment' ), 10, 2 );
20
-			add_action( 'wcs_resubscribe_order_created', array( $this, 'delete_resubscribe_meta' ), 10 );
21
-			add_action( 'wcs_renewal_order_created', array( $this, 'delete_renewal_meta' ), 10 );
22
-			add_action( 'woocommerce_subscription_failing_payment_method_updated_stripe', array( $this, 'update_failing_payment_method' ), 10, 2 );
18
+		if (class_exists('WC_Subscriptions_Order')) {
19
+			add_action('woocommerce_scheduled_subscription_payment_' . $this->id, array($this, 'scheduled_subscription_payment'), 10, 2);
20
+			add_action('wcs_resubscribe_order_created', array($this, 'delete_resubscribe_meta'), 10);
21
+			add_action('wcs_renewal_order_created', array($this, 'delete_renewal_meta'), 10);
22
+			add_action('woocommerce_subscription_failing_payment_method_updated_stripe', array($this, 'update_failing_payment_method'), 10, 2);
23 23
 
24 24
 			// display the credit card used for a subscription in the "My Subscriptions" table
25
-			add_filter( 'woocommerce_my_subscriptions_payment_method', array( $this, 'maybe_render_subscription_payment_method' ), 10, 2 );
25
+			add_filter('woocommerce_my_subscriptions_payment_method', array($this, 'maybe_render_subscription_payment_method'), 10, 2);
26 26
 
27 27
 			// allow store managers to manually set Stripe as the payment method on a subscription
28
-			add_filter( 'woocommerce_subscription_payment_meta', array( $this, 'add_subscription_payment_meta' ), 10, 2 );
29
-			add_filter( 'woocommerce_subscription_validate_payment_meta', array( $this, 'validate_subscription_payment_meta' ), 10, 2 );
30
-			add_filter( 'wc_stripe_display_save_payment_method_checkbox', array( $this, 'maybe_hide_save_checkbox' ) );
28
+			add_filter('woocommerce_subscription_payment_meta', array($this, 'add_subscription_payment_meta'), 10, 2);
29
+			add_filter('woocommerce_subscription_validate_payment_meta', array($this, 'validate_subscription_payment_meta'), 10, 2);
30
+			add_filter('wc_stripe_display_save_payment_method_checkbox', array($this, 'maybe_hide_save_checkbox'));
31 31
 		}
32 32
 	}
33 33
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 * @since 4.0.0
48 48
 	 * @version 4.0.0
49 49
 	 */
50
-	public function maybe_hide_save_checkbox( $display_tokenization ) {
51
-		if ( WC_Subscriptions_Cart::cart_contains_subscription() ) {
50
+	public function maybe_hide_save_checkbox($display_tokenization) {
51
+		if (WC_Subscriptions_Cart::cart_contains_subscription()) {
52 52
 			return false;
53 53
 		}
54 54
 
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	 * @param  int  $order_id
61 61
 	 * @return boolean
62 62
 	 */
63
-	public function has_subscription( $order_id ) {
64
-		return ( function_exists( 'wcs_order_contains_subscription' ) && ( wcs_order_contains_subscription( $order_id ) || wcs_is_subscription( $order_id ) || wcs_order_contains_renewal( $order_id ) ) );
63
+	public function has_subscription($order_id) {
64
+		return (function_exists('wcs_order_contains_subscription') && (wcs_order_contains_subscription($order_id) || wcs_is_subscription($order_id) || wcs_order_contains_renewal($order_id)));
65 65
 	}
66 66
 
67 67
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @return bool
72 72
 	 */
73 73
 	public function is_subs_change_payment() {
74
-		return ( isset( $_GET['pay_for_order'] ) && isset( $_GET['change_payment_method'] ) );
74
+		return (isset($_GET['pay_for_order']) && isset($_GET['change_payment_method']));
75 75
 	}
76 76
 
77 77
 	/**
@@ -80,24 +80,24 @@  discard block
 block discarded – undo
80 80
 	 * @since 4.0.4
81 81
 	 * @param int $order_id
82 82
 	 */
83
-	public function change_subs_payment_method( $order_id ) {
83
+	public function change_subs_payment_method($order_id) {
84 84
 		try {
85
-			$subscription    = wc_get_order( $order_id );
86
-			$prepared_source = $this->prepare_source( get_current_user_id(), true );
85
+			$subscription    = wc_get_order($order_id);
86
+			$prepared_source = $this->prepare_source(get_current_user_id(), true);
87 87
 			$source_object   = $prepared_source->source_object;
88 88
 
89 89
 			// Check if we don't allow prepaid credit cards.
90
-			if ( ! apply_filters( 'wc_stripe_allow_prepaid_card', true ) && $this->is_prepaid_card( $source_object ) ) {
91
-				$localized_message = __( 'Sorry, we\'re not accepting prepaid cards at this time. Your credit card has not been charge. Please try with alternative payment method.', 'woocommerce-gateway-stripe' );
92
-				throw new WC_Stripe_Exception( print_r( $source_object, true ), $localized_message );
90
+			if ( ! apply_filters('wc_stripe_allow_prepaid_card', true) && $this->is_prepaid_card($source_object)) {
91
+				$localized_message = __('Sorry, we\'re not accepting prepaid cards at this time. Your credit card has not been charge. Please try with alternative payment method.', 'woocommerce-gateway-stripe');
92
+				throw new WC_Stripe_Exception(print_r($source_object, true), $localized_message);
93 93
 			}
94 94
 
95
-			if ( empty( $prepared_source->source ) ) {
96
-				$localized_message = __( 'Payment processing failed. Please retry.', 'woocommerce-gateway-stripe' );
97
-				throw new WC_Stripe_Exception( print_r( $prepared_source, true ), $localized_message );
95
+			if (empty($prepared_source->source)) {
96
+				$localized_message = __('Payment processing failed. Please retry.', 'woocommerce-gateway-stripe');
97
+				throw new WC_Stripe_Exception(print_r($prepared_source, true), $localized_message);
98 98
 			}
99 99
 
100
-			$this->save_source_to_order( $subscription, $prepared_source );
100
+			$this->save_source_to_order($subscription, $prepared_source);
101 101
 
102 102
 			/*
103 103
 			 * Check if card 3DS is required or optional with 3DS setting.
@@ -106,41 +106,41 @@  discard block
 block discarded – undo
106 106
 			 * Note that if we need to save source, the original source must be first
107 107
 			 * attached to a customer in Stripe before it can be charged.
108 108
 			 */
109
-			if ( $this->is_3ds_required( $source_object ) ) {
109
+			if ($this->is_3ds_required($source_object)) {
110 110
 				$order    = $subscription->get_parent();
111
-				$response = $this->create_3ds_source( $order, $source_object, $subscription->get_view_order_url() );
111
+				$response = $this->create_3ds_source($order, $source_object, $subscription->get_view_order_url());
112 112
 
113
-				if ( ! empty( $response->error ) ) {
113
+				if ( ! empty($response->error)) {
114 114
 					$localized_message = $response->error->message;
115 115
 
116
-					$order->add_order_note( $localized_message );
116
+					$order->add_order_note($localized_message);
117 117
 
118
-					throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
118
+					throw new WC_Stripe_Exception(print_r($response, true), $localized_message);
119 119
 				}
120 120
 
121 121
 				// Update order meta with 3DS source.
122
-				if ( WC_Stripe_Helper::is_pre_30() ) {
123
-					update_post_meta( $order_id, '_stripe_source_id', $response->id );
122
+				if (WC_Stripe_Helper::is_pre_30()) {
123
+					update_post_meta($order_id, '_stripe_source_id', $response->id);
124 124
 				} else {
125
-					$subscription->update_meta_data( '_stripe_source_id', $response->id );
125
+					$subscription->update_meta_data('_stripe_source_id', $response->id);
126 126
 					$subscription->save();
127 127
 				}
128 128
 
129
-				WC_Stripe_Logger::log( 'Info: Redirecting to 3DS...' );
129
+				WC_Stripe_Logger::log('Info: Redirecting to 3DS...');
130 130
 
131 131
 				return array(
132 132
 					'result'   => 'success',
133
-					'redirect' => esc_url_raw( $response->redirect->url ),
133
+					'redirect' => esc_url_raw($response->redirect->url),
134 134
 				);
135 135
 			}
136 136
 
137 137
 			return array(
138 138
 				'result'   => 'success',
139
-				'redirect' => $this->get_return_url( $subscription ),
139
+				'redirect' => $this->get_return_url($subscription),
140 140
 			);
141
-		} catch ( WC_Stripe_Exception $e ) {
142
-			wc_add_notice( $e->getLocalizedMessage(), 'error' );
143
-			WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() );
141
+		} catch (WC_Stripe_Exception $e) {
142
+			wc_add_notice($e->getLocalizedMessage(), 'error');
143
+			WC_Stripe_Logger::log('Error: ' . $e->getMessage());
144 144
 		}
145 145
 	}
146 146
 
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
 	 * @param  int $order_id
150 150
 	 * @return array
151 151
 	 */
152
-	public function process_payment( $order_id, $retry = true, $force_save_source = false, $previous_error = false ) {
153
-		if ( $this->has_subscription( $order_id ) ) {
154
-			if ( $this->is_subs_change_payment() ) {
155
-				return $this->change_subs_payment_method( $order_id );
152
+	public function process_payment($order_id, $retry = true, $force_save_source = false, $previous_error = false) {
153
+		if ($this->has_subscription($order_id)) {
154
+			if ($this->is_subs_change_payment()) {
155
+				return $this->change_subs_payment_method($order_id);
156 156
 			}
157 157
 
158 158
 			// Regular payment with force customer enabled
159
-			return parent::process_payment( $order_id, $retry, true, $previous_error );
159
+			return parent::process_payment($order_id, $retry, true, $previous_error);
160 160
 		} else {
161
-			return parent::process_payment( $order_id, $retry, $force_save_source, $previous_error );
161
+			return parent::process_payment($order_id, $retry, $force_save_source, $previous_error);
162 162
 		}
163 163
 	}
164 164
 
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 * @param $amount_to_charge float The amount to charge.
169 169
 	 * @param $renewal_order WC_Order A WC_Order object created to record the renewal payment.
170 170
 	 */
171
-	public function scheduled_subscription_payment( $amount_to_charge, $renewal_order ) {
172
-		$this->process_subscription_payment( $amount_to_charge, $renewal_order, true, false );
171
+	public function scheduled_subscription_payment($amount_to_charge, $renewal_order) {
172
+		$this->process_subscription_payment($amount_to_charge, $renewal_order, true, false);
173 173
 	}
174 174
 
175 175
 	/**
@@ -183,89 +183,89 @@  discard block
 block discarded – undo
183 183
 	 * @param bool $retry Should we retry the process?
184 184
 	 * @param object $previous_error
185 185
 	 */
186
-	public function process_subscription_payment( $amount = 0.0, $renewal_order, $retry = true, $previous_error ) {
186
+	public function process_subscription_payment($amount = 0.0, $renewal_order, $retry = true, $previous_error) {
187 187
 		try {
188
-			if ( $amount * 100 < WC_Stripe_Helper::get_minimum_amount() ) {
188
+			if ($amount * 100 < WC_Stripe_Helper::get_minimum_amount()) {
189 189
 				/* translators: minimum amount */
190
-				return new WP_Error( 'stripe_error', sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe_Helper::get_minimum_amount() / 100 ) ) );
190
+				return new WP_Error('stripe_error', sprintf(__('Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe'), wc_price(WC_Stripe_Helper::get_minimum_amount() / 100)));
191 191
 			}
192 192
 
193 193
 			$order_id = WC_Stripe_Helper::is_pre_30() ? $renewal_order->id : $renewal_order->get_id();
194 194
 
195 195
 			// Get source from order
196
-			$prepared_source = $this->prepare_order_source( $renewal_order );
196
+			$prepared_source = $this->prepare_order_source($renewal_order);
197 197
 			$source_object   = $prepared_source->source_object;
198 198
 
199
-			if ( ! $prepared_source->customer ) {
200
-				return new WP_Error( 'stripe_error', __( 'Customer not found', 'woocommerce-gateway-stripe' ) );
199
+			if ( ! $prepared_source->customer) {
200
+				return new WP_Error('stripe_error', __('Customer not found', 'woocommerce-gateway-stripe'));
201 201
 			}
202 202
 
203
-			WC_Stripe_Logger::log( "Info: Begin processing subscription payment for order {$order_id} for the amount of {$amount}" );
203
+			WC_Stripe_Logger::log("Info: Begin processing subscription payment for order {$order_id} for the amount of {$amount}");
204 204
 
205 205
 			/* If we're doing a retry and source is chargeable, we need to pass
206 206
 			 * a different idempotency key and retry for success.
207 207
 			 */
208
-			if ( is_object( $source_object ) && empty( $source_object->error ) && $this->need_update_idempotency_key( $source_object, $previous_error ) ) {
209
-				add_filter( 'wc_stripe_idempotency_key', array( $this, 'change_idempotency_key' ), 10, 2 );
208
+			if (is_object($source_object) && empty($source_object->error) && $this->need_update_idempotency_key($source_object, $previous_error)) {
209
+				add_filter('wc_stripe_idempotency_key', array($this, 'change_idempotency_key'), 10, 2);
210 210
 			}
211 211
 
212
-			if ( ( $this->is_no_such_source_error( $previous_error ) || $this->is_no_linked_source_error( $previous_error ) ) && apply_filters( 'wc_stripe_use_default_customer_source', true ) ) {
212
+			if (($this->is_no_such_source_error($previous_error) || $this->is_no_linked_source_error($previous_error)) && apply_filters('wc_stripe_use_default_customer_source', true)) {
213 213
 				// Passing empty source will charge customer default.
214 214
 				$prepared_source->source = '';
215 215
 			}
216 216
 
217
-			$request            = $this->generate_payment_request( $renewal_order, $prepared_source );
217
+			$request            = $this->generate_payment_request($renewal_order, $prepared_source);
218 218
 			$request['capture'] = 'true';
219
-			$request['amount']  = WC_Stripe_Helper::get_stripe_amount( $amount, $request['currency'] );
220
-			$response           = WC_Stripe_API::request( $request );
219
+			$request['amount']  = WC_Stripe_Helper::get_stripe_amount($amount, $request['currency']);
220
+			$response           = WC_Stripe_API::request($request);
221 221
 
222
-			if ( ! empty( $response->error ) ) {
222
+			if ( ! empty($response->error)) {
223 223
 				// We want to retry.
224
-				if ( $this->is_retryable_error( $response->error ) ) {
225
-					if ( $retry ) {
224
+				if ($this->is_retryable_error($response->error)) {
225
+					if ($retry) {
226 226
 						// Don't do anymore retries after this.
227
-						if ( 5 <= $this->retry_interval ) {
228
-							return $this->process_subscription_payment( $amount, $renewal_order, false, $response->error );
227
+						if (5 <= $this->retry_interval) {
228
+							return $this->process_subscription_payment($amount, $renewal_order, false, $response->error);
229 229
 						}
230 230
 
231
-						sleep( $this->retry_interval );
231
+						sleep($this->retry_interval);
232 232
 
233 233
 						$this->retry_interval++;
234 234
 
235
-						return $this->process_subscription_payment( $amount, $renewal_order, true, $response->error );
235
+						return $this->process_subscription_payment($amount, $renewal_order, true, $response->error);
236 236
 					} else {
237
-						$localized_message = __( 'Sorry, we are unable to process your payment at this time. Please retry later.', 'woocommerce-gateway-stripe' );
238
-						$renewal_order->add_order_note( $localized_message );
239
-						throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
237
+						$localized_message = __('Sorry, we are unable to process your payment at this time. Please retry later.', 'woocommerce-gateway-stripe');
238
+						$renewal_order->add_order_note($localized_message);
239
+						throw new WC_Stripe_Exception(print_r($response, true), $localized_message);
240 240
 					}
241 241
 				}
242 242
 
243 243
 				$localized_messages = WC_Stripe_Helper::get_localized_messages();
244 244
 
245
-				if ( 'card_error' === $response->error->type ) {
246
-					$localized_message = isset( $localized_messages[ $response->error->code ] ) ? $localized_messages[ $response->error->code ] : $response->error->message;
245
+				if ('card_error' === $response->error->type) {
246
+					$localized_message = isset($localized_messages[$response->error->code]) ? $localized_messages[$response->error->code] : $response->error->message;
247 247
 				} else {
248
-					$localized_message = isset( $localized_messages[ $response->error->type ] ) ? $localized_messages[ $response->error->type ] : $response->error->message;
248
+					$localized_message = isset($localized_messages[$response->error->type]) ? $localized_messages[$response->error->type] : $response->error->message;
249 249
 				}
250 250
 
251
-				$renewal_order->add_order_note( $localized_message );
251
+				$renewal_order->add_order_note($localized_message);
252 252
 
253
-				throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
253
+				throw new WC_Stripe_Exception(print_r($response, true), $localized_message);
254 254
 			}
255 255
 
256
-			do_action( 'wc_gateway_stripe_process_payment', $response, $renewal_order );
256
+			do_action('wc_gateway_stripe_process_payment', $response, $renewal_order);
257 257
 
258
-			$this->process_response( $response, $renewal_order );
259
-		} catch ( WC_Stripe_Exception $e ) {
260
-			WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() );
258
+			$this->process_response($response, $renewal_order);
259
+		} catch (WC_Stripe_Exception $e) {
260
+			WC_Stripe_Logger::log('Error: ' . $e->getMessage());
261 261
 
262
-			do_action( 'wc_gateway_stripe_process_payment_error', $e, $renewal_order );
262
+			do_action('wc_gateway_stripe_process_payment_error', $e, $renewal_order);
263 263
 
264 264
 			/* translators: error message */
265
-			$renewal_order->update_status( 'failed' );
265
+			$renewal_order->update_status('failed');
266 266
 
267
-			if ( $renewal_order->has_status( array( 'pending', 'failed' ) ) ) {
268
-				$this->send_failed_order_email( $order_id );
267
+			if ($renewal_order->has_status(array('pending', 'failed'))) {
268
+				$this->send_failed_order_email($order_id);
269 269
 			}
270 270
 		}
271 271
 	}
@@ -276,24 +276,24 @@  discard block
 block discarded – undo
276 276
 	 * @since 3.1.0
277 277
 	 * @version 4.0.0
278 278
 	 */
279
-	public function save_source_to_order( $order, $source ) {
280
-		parent::save_source_to_order( $order, $source );
279
+	public function save_source_to_order($order, $source) {
280
+		parent::save_source_to_order($order, $source);
281 281
 
282 282
 		$order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
283 283
 
284 284
 		// Also store it on the subscriptions being purchased or paid for in the order
285
-		if ( function_exists( 'wcs_order_contains_subscription' ) && wcs_order_contains_subscription( $order_id ) ) {
286
-			$subscriptions = wcs_get_subscriptions_for_order( $order_id );
287
-		} elseif ( function_exists( 'wcs_order_contains_renewal' ) && wcs_order_contains_renewal( $order_id ) ) {
288
-			$subscriptions = wcs_get_subscriptions_for_renewal_order( $order_id );
285
+		if (function_exists('wcs_order_contains_subscription') && wcs_order_contains_subscription($order_id)) {
286
+			$subscriptions = wcs_get_subscriptions_for_order($order_id);
287
+		} elseif (function_exists('wcs_order_contains_renewal') && wcs_order_contains_renewal($order_id)) {
288
+			$subscriptions = wcs_get_subscriptions_for_renewal_order($order_id);
289 289
 		} else {
290 290
 			$subscriptions = array();
291 291
 		}
292 292
 
293
-		foreach ( $subscriptions as $subscription ) {
293
+		foreach ($subscriptions as $subscription) {
294 294
 			$subscription_id = WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id();
295
-			update_post_meta( $subscription_id, '_stripe_customer_id', $source->customer );
296
-			update_post_meta( $subscription_id, '_stripe_source_id', $source->source );
295
+			update_post_meta($subscription_id, '_stripe_customer_id', $source->customer);
296
+			update_post_meta($subscription_id, '_stripe_source_id', $source->source);
297 297
 		}
298 298
 	}
299 299
 
@@ -301,21 +301,21 @@  discard block
 block discarded – undo
301 301
 	 * Don't transfer Stripe customer/token meta to resubscribe orders.
302 302
 	 * @param int $resubscribe_order The order created for the customer to resubscribe to the old expired/cancelled subscription
303 303
 	 */
304
-	public function delete_resubscribe_meta( $resubscribe_order ) {
305
-		delete_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $resubscribe_order->id : $resubscribe_order->get_id() ), '_stripe_customer_id' );
306
-		delete_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $resubscribe_order->id : $resubscribe_order->get_id() ), '_stripe_source_id' );
304
+	public function delete_resubscribe_meta($resubscribe_order) {
305
+		delete_post_meta((WC_Stripe_Helper::is_pre_30() ? $resubscribe_order->id : $resubscribe_order->get_id()), '_stripe_customer_id');
306
+		delete_post_meta((WC_Stripe_Helper::is_pre_30() ? $resubscribe_order->id : $resubscribe_order->get_id()), '_stripe_source_id');
307 307
 		// For BW compat will remove in future
308
-		delete_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $resubscribe_order->id : $resubscribe_order->get_id() ), '_stripe_card_id' );
309
-		$this->delete_renewal_meta( $resubscribe_order );
308
+		delete_post_meta((WC_Stripe_Helper::is_pre_30() ? $resubscribe_order->id : $resubscribe_order->get_id()), '_stripe_card_id');
309
+		$this->delete_renewal_meta($resubscribe_order);
310 310
 	}
311 311
 
312 312
 	/**
313 313
 	 * Don't transfer Stripe fee/ID meta to renewal orders.
314 314
 	 * @param int $resubscribe_order The order created for the customer to resubscribe to the old expired/cancelled subscription
315 315
 	 */
316
-	public function delete_renewal_meta( $renewal_order ) {
317
-		WC_Stripe_Helper::delete_stripe_fee( $renewal_order );
318
-		WC_Stripe_Helper::delete_stripe_net( $renewal_order );
316
+	public function delete_renewal_meta($renewal_order) {
317
+		WC_Stripe_Helper::delete_stripe_fee($renewal_order);
318
+		WC_Stripe_Helper::delete_stripe_net($renewal_order);
319 319
 
320 320
 		return $renewal_order;
321 321
 	}
@@ -329,14 +329,14 @@  discard block
 block discarded – undo
329 329
 	 * @param WC_Order $renewal_order The order which recorded the successful payment (to make up for the failed automatic payment).
330 330
 	 * @return void
331 331
 	 */
332
-	public function update_failing_payment_method( $subscription, $renewal_order ) {
333
-		if ( WC_Stripe_Helper::is_pre_30() ) {
334
-			update_post_meta( $subscription->id, '_stripe_customer_id', $renewal_order->stripe_customer_id );
335
-			update_post_meta( $subscription->id, '_stripe_source_id', $renewal_order->stripe_source_id );
332
+	public function update_failing_payment_method($subscription, $renewal_order) {
333
+		if (WC_Stripe_Helper::is_pre_30()) {
334
+			update_post_meta($subscription->id, '_stripe_customer_id', $renewal_order->stripe_customer_id);
335
+			update_post_meta($subscription->id, '_stripe_source_id', $renewal_order->stripe_source_id);
336 336
 
337 337
 		} else {
338
-			update_post_meta( $subscription->get_id(), '_stripe_customer_id', $renewal_order->get_meta( '_stripe_customer_id', true ) );
339
-			update_post_meta( $subscription->get_id(), '_stripe_source_id', $renewal_order->get_meta( '_stripe_source_id', true ) );
338
+			update_post_meta($subscription->get_id(), '_stripe_customer_id', $renewal_order->get_meta('_stripe_customer_id', true));
339
+			update_post_meta($subscription->get_id(), '_stripe_source_id', $renewal_order->get_meta('_stripe_source_id', true));
340 340
 		}
341 341
 	}
342 342
 
@@ -349,21 +349,21 @@  discard block
 block discarded – undo
349 349
 	 * @param WC_Subscription $subscription An instance of a subscription object
350 350
 	 * @return array
351 351
 	 */
352
-	public function add_subscription_payment_meta( $payment_meta, $subscription ) {
353
-		$source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_source_id', true );
352
+	public function add_subscription_payment_meta($payment_meta, $subscription) {
353
+		$source_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id()), '_stripe_source_id', true);
354 354
 
355 355
 		// For BW compat will remove in future.
356
-		if ( empty( $source_id ) ) {
357
-			$source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_card_id', true );
356
+		if (empty($source_id)) {
357
+			$source_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id()), '_stripe_card_id', true);
358 358
 
359 359
 			// Take this opportunity to update the key name.
360
-			WC_Stripe_Helper::is_pre_30() ? update_post_meta( $subscription->id, '_stripe_source_id', $source_id ) : update_post_meta( $subscription->get_id(), '_stripe_source_id', $source_id );
360
+			WC_Stripe_Helper::is_pre_30() ? update_post_meta($subscription->id, '_stripe_source_id', $source_id) : update_post_meta($subscription->get_id(), '_stripe_source_id', $source_id);
361 361
 		}
362 362
 
363
-		$payment_meta[ $this->id ] = array(
363
+		$payment_meta[$this->id] = array(
364 364
 			'post_meta' => array(
365 365
 				'_stripe_customer_id' => array(
366
-					'value' => get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_customer_id', true ),
366
+					'value' => get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id()), '_stripe_customer_id', true),
367 367
 					'label' => 'Stripe Customer ID',
368 368
 				),
369 369
 				'_stripe_source_id' => array(
@@ -386,22 +386,22 @@  discard block
 block discarded – undo
386 386
 	 * @param array $payment_meta associative array of meta data required for automatic payments
387 387
 	 * @return array
388 388
 	 */
389
-	public function validate_subscription_payment_meta( $payment_method_id, $payment_meta ) {
390
-		if ( $this->id === $payment_method_id ) {
389
+	public function validate_subscription_payment_meta($payment_method_id, $payment_meta) {
390
+		if ($this->id === $payment_method_id) {
391 391
 
392
-			if ( ! isset( $payment_meta['post_meta']['_stripe_customer_id']['value'] ) || empty( $payment_meta['post_meta']['_stripe_customer_id']['value'] ) ) {
393
-				throw new Exception( __( 'A "Stripe Customer ID" value is required.', 'woocommerce-gateway-stripe' ) );
394
-			} elseif ( 0 !== strpos( $payment_meta['post_meta']['_stripe_customer_id']['value'], 'cus_' ) ) {
395
-				throw new Exception( __( 'Invalid customer ID. A valid "Stripe Customer ID" must begin with "cus_".', 'woocommerce-gateway-stripe' ) );
392
+			if ( ! isset($payment_meta['post_meta']['_stripe_customer_id']['value']) || empty($payment_meta['post_meta']['_stripe_customer_id']['value'])) {
393
+				throw new Exception(__('A "Stripe Customer ID" value is required.', 'woocommerce-gateway-stripe'));
394
+			} elseif (0 !== strpos($payment_meta['post_meta']['_stripe_customer_id']['value'], 'cus_')) {
395
+				throw new Exception(__('Invalid customer ID. A valid "Stripe Customer ID" must begin with "cus_".', 'woocommerce-gateway-stripe'));
396 396
 			}
397 397
 
398 398
 			if (
399
-				( ! empty( $payment_meta['post_meta']['_stripe_source_id']['value'] )
400
-				&& 0 !== strpos( $payment_meta['post_meta']['_stripe_source_id']['value'], 'card_' ) )
401
-				&& ( ! empty( $payment_meta['post_meta']['_stripe_source_id']['value'] )
402
-				&& 0 !== strpos( $payment_meta['post_meta']['_stripe_source_id']['value'], 'src_' ) ) ) {
399
+				( ! empty($payment_meta['post_meta']['_stripe_source_id']['value'])
400
+				&& 0 !== strpos($payment_meta['post_meta']['_stripe_source_id']['value'], 'card_'))
401
+				&& ( ! empty($payment_meta['post_meta']['_stripe_source_id']['value'])
402
+				&& 0 !== strpos($payment_meta['post_meta']['_stripe_source_id']['value'], 'src_')) ) {
403 403
 
404
-				throw new Exception( __( 'Invalid source ID. A valid source "Stripe Source ID" must begin with "src_" or "card_".', 'woocommerce-gateway-stripe' ) );
404
+				throw new Exception(__('Invalid source ID. A valid source "Stripe Source ID" must begin with "src_" or "card_".', 'woocommerce-gateway-stripe'));
405 405
 			}
406 406
 		}
407 407
 	}
@@ -414,92 +414,92 @@  discard block
 block discarded – undo
414 414
 	 * @param WC_Subscription $subscription the subscription details
415 415
 	 * @return string the subscription payment method
416 416
 	 */
417
-	public function maybe_render_subscription_payment_method( $payment_method_to_display, $subscription ) {
417
+	public function maybe_render_subscription_payment_method($payment_method_to_display, $subscription) {
418 418
 		$customer_user = WC_Stripe_Helper::is_pre_30() ? $subscription->customer_user : $subscription->get_customer_id();
419 419
 
420 420
 		// bail for other payment methods
421
-		if ( ( WC_Stripe_Helper::is_pre_30() ? $subscription->payment_method : $subscription->get_payment_method() ) !== $this->id || ! $customer_user ) {
421
+		if ((WC_Stripe_Helper::is_pre_30() ? $subscription->payment_method : $subscription->get_payment_method()) !== $this->id || ! $customer_user) {
422 422
 			return $payment_method_to_display;
423 423
 		}
424 424
 
425
-		$stripe_source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_source_id', true );
425
+		$stripe_source_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id()), '_stripe_source_id', true);
426 426
 
427 427
 		// For BW compat will remove in future.
428
-		if ( empty( $stripe_source_id ) ) {
429
-			$stripe_source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_card_id', true );
428
+		if (empty($stripe_source_id)) {
429
+			$stripe_source_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id()), '_stripe_card_id', true);
430 430
 
431 431
 			// Take this opportunity to update the key name.
432
-			WC_Stripe_Helper::is_pre_30() ? update_post_meta( $subscription->id, '_stripe_source_id', $stripe_source_id ) : update_post_meta( $subscription->get_id(), '_stripe_source_id', $stripe_source_id );
432
+			WC_Stripe_Helper::is_pre_30() ? update_post_meta($subscription->id, '_stripe_source_id', $stripe_source_id) : update_post_meta($subscription->get_id(), '_stripe_source_id', $stripe_source_id);
433 433
 		}
434 434
 
435 435
 		$stripe_customer    = new WC_Stripe_Customer();
436
-		$stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_customer_id', true );
436
+		$stripe_customer_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id()), '_stripe_customer_id', true);
437 437
 
438 438
 		// If we couldn't find a Stripe customer linked to the subscription, fallback to the user meta data.
439
-		if ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) {
439
+		if ( ! $stripe_customer_id || ! is_string($stripe_customer_id)) {
440 440
 			$user_id            = $customer_user;
441
-			$stripe_customer_id = get_user_meta( $user_id, '_stripe_customer_id', true );
442
-			$stripe_source_id   = get_user_meta( $user_id, '_stripe_source_id', true );
441
+			$stripe_customer_id = get_user_meta($user_id, '_stripe_customer_id', true);
442
+			$stripe_source_id   = get_user_meta($user_id, '_stripe_source_id', true);
443 443
 
444 444
 			// For BW compat will remove in future.
445
-			if ( empty( $stripe_source_id ) ) {
446
-				$stripe_source_id = get_user_meta( $user_id, '_stripe_card_id', true );
445
+			if (empty($stripe_source_id)) {
446
+				$stripe_source_id = get_user_meta($user_id, '_stripe_card_id', true);
447 447
 
448 448
 				// Take this opportunity to update the key name.
449
-				update_user_meta( $user_id, '_stripe_source_id', $stripe_source_id );
449
+				update_user_meta($user_id, '_stripe_source_id', $stripe_source_id);
450 450
 			}
451 451
 		}
452 452
 
453 453
 		// If we couldn't find a Stripe customer linked to the account, fallback to the order meta data.
454
-		if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) {
455
-			$stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_customer_id', true );
456
-			$stripe_source_id   = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_source_id', true );
454
+		if (( ! $stripe_customer_id || ! is_string($stripe_customer_id)) && false !== $subscription->order) {
455
+			$stripe_customer_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id()), '_stripe_customer_id', true);
456
+			$stripe_source_id   = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id()), '_stripe_source_id', true);
457 457
 
458 458
 			// For BW compat will remove in future.
459
-			if ( empty( $stripe_source_id ) ) {
460
-				$stripe_source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_card_id', true );
459
+			if (empty($stripe_source_id)) {
460
+				$stripe_source_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id()), '_stripe_card_id', true);
461 461
 
462 462
 				// Take this opportunity to update the key name.
463
-				WC_Stripe_Helper::is_pre_30() ? update_post_meta( $subscription->order->id, '_stripe_source_id', $stripe_source_id ) : update_post_meta( $subscription->get_parent_id(), '_stripe_source_id', $stripe_source_id );
463
+				WC_Stripe_Helper::is_pre_30() ? update_post_meta($subscription->order->id, '_stripe_source_id', $stripe_source_id) : update_post_meta($subscription->get_parent_id(), '_stripe_source_id', $stripe_source_id);
464 464
 			}
465 465
 		}
466 466
 
467
-		$stripe_customer->set_id( $stripe_customer_id );
467
+		$stripe_customer->set_id($stripe_customer_id);
468 468
 		$sources = $stripe_customer->get_sources();
469 469
 
470
-		if ( $sources ) {
470
+		if ($sources) {
471 471
 			$card         = false;
472 472
 			$found_source = false;
473
-			foreach ( $sources as $source ) {
474
-				if ( isset( $source->type ) && 'card' === $source->type ) {
473
+			foreach ($sources as $source) {
474
+				if (isset($source->type) && 'card' === $source->type) {
475 475
 					$card = $source->card;
476
-				} elseif ( isset( $source->object ) && 'card' === $source->object ) {
476
+				} elseif (isset($source->object) && 'card' === $source->object) {
477 477
 					$card = $source;
478 478
 				}
479 479
 
480
-				if ( $source->id === $stripe_source_id ) {
480
+				if ($source->id === $stripe_source_id) {
481 481
 					$found_source = true;
482 482
 
483
-					if ( $card ) {
483
+					if ($card) {
484 484
 						/* translators: 1) card brand 2) last 4 digits */
485
-						$payment_method_to_display = sprintf( __( 'Via %1$s card ending in %2$s', 'woocommerce-gateway-stripe' ), ( isset( $card->brand ) ? $card->brand : __( 'N/A', 'woocommerce-gateway-stripe' ) ), $card->last4 );
485
+						$payment_method_to_display = sprintf(__('Via %1$s card ending in %2$s', 'woocommerce-gateway-stripe'), (isset($card->brand) ? $card->brand : __('N/A', 'woocommerce-gateway-stripe')), $card->last4);
486 486
 					} else {
487
-						$payment_method_to_display = __( 'N/A', 'woocommerce-gateway-stripe' );
487
+						$payment_method_to_display = __('N/A', 'woocommerce-gateway-stripe');
488 488
 					}
489 489
 					break;
490 490
 				}
491 491
 			}
492 492
 
493
-			if ( ! $found_source ) {
494
-				if ( 'card' === $sources[0]->type ) {
493
+			if ( ! $found_source) {
494
+				if ('card' === $sources[0]->type) {
495 495
 					$card = $sources[0]->card;
496 496
 				}
497 497
 
498
-				if ( $card ) {
498
+				if ($card) {
499 499
 					/* translators: 1) card brand 2) last 4 digits */
500
-					$payment_method_to_display = sprintf( __( 'Via %1$s card ending in %2$s', 'woocommerce-gateway-stripe' ), ( isset( $card->brand ) ? $card->brand : __( 'N/A', 'woocommerce-gateway-stripe' ) ), $card->last4 );
500
+					$payment_method_to_display = sprintf(__('Via %1$s card ending in %2$s', 'woocommerce-gateway-stripe'), (isset($card->brand) ? $card->brand : __('N/A', 'woocommerce-gateway-stripe')), $card->last4);
501 501
 				} else {
502
-					$payment_method_to_display = __( 'N/A', 'woocommerce-gateway-stripe' );
502
+					$payment_method_to_display = __('N/A', 'woocommerce-gateway-stripe');
503 503
 				}
504 504
 			}
505 505
 		}
Please login to merge, or discard this patch.
includes/compat/class-wc-stripe-pre-orders-compat.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	public $saved_cards;
12 12
 
13 13
 	public function __construct() {
14
-		$this->saved_cards = WC_Stripe_Helper::get_settings( 'stripe', 'saved_cards' );
14
+		$this->saved_cards = WC_Stripe_Helper::get_settings('stripe', 'saved_cards');
15 15
 	}
16 16
 
17 17
 	/**
@@ -19,68 +19,68 @@  discard block
 block discarded – undo
19 19
 	 * @param  int  $order_id
20 20
 	 * @return boolean
21 21
 	 */
22
-	public function is_pre_order( $order_id ) {
23
-		return WC_Pre_Orders_Order::order_contains_pre_order( $order_id );
22
+	public function is_pre_order($order_id) {
23
+		return WC_Pre_Orders_Order::order_contains_pre_order($order_id);
24 24
 	}
25 25
 
26 26
 	/**
27 27
 	 * Remove order meta
28 28
 	 * @param object $order
29 29
 	 */
30
-	public function remove_order_source_before_retry( $order ) {
30
+	public function remove_order_source_before_retry($order) {
31 31
 		$order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
32
-		delete_post_meta( $order_id, '_stripe_source_id' );
32
+		delete_post_meta($order_id, '_stripe_source_id');
33 33
 		// For BW compat will remove in the future.
34
-		delete_post_meta( $order_id, '_stripe_card_id' );
34
+		delete_post_meta($order_id, '_stripe_card_id');
35 35
 	}
36 36
 
37 37
 	/**
38 38
 	 * Remove order meta
39 39
 	 * @param  object $order
40 40
 	 */
41
-	public function remove_order_customer_before_retry( $order ) {
41
+	public function remove_order_customer_before_retry($order) {
42 42
 		$order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
43
-		delete_post_meta( $order_id, '_stripe_customer_id' );
43
+		delete_post_meta($order_id, '_stripe_customer_id');
44 44
 	}
45 45
 
46 46
 	/**
47 47
 	 * Process the pre-order when pay upon release is used.
48 48
 	 * @param int $order_id
49 49
 	 */
50
-	public function process_pre_order( $order_id ) {
50
+	public function process_pre_order($order_id) {
51 51
 		try {
52
-			$order = wc_get_order( $order_id );
52
+			$order = wc_get_order($order_id);
53 53
 
54 54
 			// This will throw exception if not valid.
55
-			$this->validate_minimum_order_amount( $order );
55
+			$this->validate_minimum_order_amount($order);
56 56
 
57
-			$prepared_source = $this->prepare_source( get_current_user_id(), true );
57
+			$prepared_source = $this->prepare_source(get_current_user_id(), true);
58 58
 
59 59
 			// We need a source on file to continue.
60
-			if ( empty( $prepared_source->customer ) || empty( $prepared_source->source ) ) {
61
-				throw new WC_Stripe_Exception( __( 'Unable to store payment details. Please try again.', 'woocommerce-gateway-stripe' ) );
60
+			if (empty($prepared_source->customer) || empty($prepared_source->source)) {
61
+				throw new WC_Stripe_Exception(__('Unable to store payment details. Please try again.', 'woocommerce-gateway-stripe'));
62 62
 			}
63 63
 
64
-			$this->save_source_to_order( $order, $prepared_source );
64
+			$this->save_source_to_order($order, $prepared_source);
65 65
 
66 66
 			// Remove cart
67 67
 			WC()->cart->empty_cart();
68 68
 
69 69
 			// Is pre ordered!
70
-			WC_Pre_Orders_Order::mark_order_as_pre_ordered( $order );
70
+			WC_Pre_Orders_Order::mark_order_as_pre_ordered($order);
71 71
 
72 72
 			// Return thank you page redirect
73 73
 			return array(
74 74
 				'result'   => 'success',
75
-				'redirect' => $this->get_return_url( $order ),
75
+				'redirect' => $this->get_return_url($order),
76 76
 			);
77
-		} catch ( WC_Stripe_Exception $e ) {
78
-			wc_add_notice( $e->getLocalizedMessage(), 'error' );
79
-			WC_Stripe_Logger::log( 'Pre Orders Error: ' . $e->getMessage() );
77
+		} catch (WC_Stripe_Exception $e) {
78
+			wc_add_notice($e->getLocalizedMessage(), 'error');
79
+			WC_Stripe_Logger::log('Pre Orders Error: ' . $e->getMessage());
80 80
 
81 81
 			return array(
82 82
 				'result'   => 'success',
83
-				'redirect' => $order->get_checkout_payment_url( true ),
83
+				'redirect' => $order->get_checkout_payment_url(true),
84 84
 			);
85 85
 		}
86 86
 	}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param WC_Order $order
91 91
 	 * @return void
92 92
 	 */
93
-	public function process_pre_order_release_payment( $order ) {
93
+	public function process_pre_order_release_payment($order) {
94 94
 		try {
95 95
 			// Define some callbacks if the first attempt fails.
96 96
 			$retry_callbacks = array(
@@ -98,33 +98,33 @@  discard block
 block discarded – undo
98 98
 				'remove_order_customer_before_retry',
99 99
 			);
100 100
 
101
-			while ( 1 ) {
102
-				$source   = $this->prepare_order_source( $order );
103
-				$response = WC_Stripe_API::request( $this->generate_payment_request( $order, $source ) );
101
+			while (1) {
102
+				$source   = $this->prepare_order_source($order);
103
+				$response = WC_Stripe_API::request($this->generate_payment_request($order, $source));
104 104
 
105
-				if ( ! empty( $response->error ) ) {
106
-					if ( 0 === sizeof( $retry_callbacks ) ) {
107
-						throw new Exception( $response->error->message );
105
+				if ( ! empty($response->error)) {
106
+					if (0 === sizeof($retry_callbacks)) {
107
+						throw new Exception($response->error->message);
108 108
 					} else {
109
-						$retry_callback = array_shift( $retry_callbacks );
110
-						call_user_func( array( $this, $retry_callback ), $order );
109
+						$retry_callback = array_shift($retry_callbacks);
110
+						call_user_func(array($this, $retry_callback), $order);
111 111
 					}
112 112
 				} else {
113 113
 					// Successful
114
-					$this->process_response( $response, $order );
114
+					$this->process_response($response, $order);
115 115
 					break;
116 116
 				}
117 117
 			}
118
-		} catch ( Exception $e ) {
118
+		} catch (Exception $e) {
119 119
 			/* translators: error message */
120
-			$order_note = sprintf( __( 'Stripe Transaction Failed (%s)', 'woocommerce-gateway-stripe' ), $e->getMessage() );
120
+			$order_note = sprintf(__('Stripe Transaction Failed (%s)', 'woocommerce-gateway-stripe'), $e->getMessage());
121 121
 
122 122
 			// Mark order as failed if not already set,
123 123
 			// otherwise, make sure we add the order note so we can detect when someone fails to check out multiple times
124
-			if ( ! $order->has_status( 'failed' ) ) {
125
-				$order->update_status( 'failed', $order_note );
124
+			if ( ! $order->has_status('failed')) {
125
+				$order->update_status('failed', $order_note);
126 126
 			} else {
127
-				$order->add_order_note( $order_note );
127
+				$order->add_order_note($order_note);
128 128
 			}
129 129
 		}
130 130
 	}
Please login to merge, or discard this patch.
includes/admin/stripe-eps-settings.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,41 +1,41 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
6
-return apply_filters( 'wc_stripe_eps_settings',
6
+return apply_filters('wc_stripe_eps_settings',
7 7
 	array(
8 8
 		'geo_target' => array(
9
-			'description' => __( 'Relevant Payer Geography: Austria', 'woocommerce-gateway-stripe' ),
9
+			'description' => __('Relevant Payer Geography: Austria', 'woocommerce-gateway-stripe'),
10 10
 			'type'        => 'title',
11 11
 		),
12 12
 		'activation' => array(
13
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
13
+			'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'),
14 14
 			'type'        => 'title',
15 15
 		),
16 16
 		'enabled' => array(
17
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
18
-			'label'       => __( 'Enable Stripe EPS', 'woocommerce-gateway-stripe' ),
17
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
18
+			'label'       => __('Enable Stripe EPS', 'woocommerce-gateway-stripe'),
19 19
 			'type'        => 'checkbox',
20 20
 			'description' => '',
21 21
 			'default'     => 'no',
22 22
 		),
23 23
 		'title' => array(
24
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
24
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
25 25
 			'type'        => 'text',
26
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
27
-			'default'     => __( 'EPS', 'woocommerce-gateway-stripe' ),
26
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
27
+			'default'     => __('EPS', 'woocommerce-gateway-stripe'),
28 28
 			'desc_tip'    => true,
29 29
 		),
30 30
 		'description' => array(
31
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
31
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
32 32
 			'type'        => 'text',
33
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
34
-			'default'     => __( 'You will be redirected to EPS.', 'woocommerce-gateway-stripe' ),
33
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
34
+			'default'     => __('You will be redirected to EPS.', 'woocommerce-gateway-stripe'),
35 35
 			'desc_tip'    => true,
36 36
 		),
37 37
 		'webhook' => array(
38
-			'title'       => __( 'Webhook Enpoints', 'woocommerce-gateway-stripe' ),
38
+			'title'       => __('Webhook Enpoints', 'woocommerce-gateway-stripe'),
39 39
 			'type'        => 'title',
40 40
 			/* translators: webhook URL */
41 41
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/stripe-settings.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,189 +1,189 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
6
-return apply_filters( 'wc_stripe_settings',
6
+return apply_filters('wc_stripe_settings',
7 7
 	array(
8 8
 		'enabled' => array(
9
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
10
-			'label'       => __( 'Enable Stripe', 'woocommerce-gateway-stripe' ),
9
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
10
+			'label'       => __('Enable Stripe', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'checkbox',
12 12
 			'description' => '',
13 13
 			'default'     => 'no',
14 14
 		),
15 15
 		'title' => array(
16
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
16
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
17 17
 			'type'        => 'text',
18
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
19
-			'default'     => __( 'Credit Card (Stripe)', 'woocommerce-gateway-stripe' ),
18
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
19
+			'default'     => __('Credit Card (Stripe)', 'woocommerce-gateway-stripe'),
20 20
 			'desc_tip'    => true,
21 21
 		),
22 22
 		'description' => array(
23
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
23
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
24 24
 			'type'        => 'text',
25
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
26
-			'default'     => __( 'Pay with your credit card via Stripe.', 'woocommerce-gateway-stripe' ),
25
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
26
+			'default'     => __('Pay with your credit card via Stripe.', 'woocommerce-gateway-stripe'),
27 27
 			'desc_tip'    => true,
28 28
 		),
29 29
 		'webhook' => array(
30
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
30
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
31 31
 			'type'        => 'title',
32 32
 			/* translators: webhook URL */
33 33
 			'description' => $this->display_admin_settings_webhook_description(),
34 34
 		),
35 35
 		'testmode' => array(
36
-			'title'       => __( 'Test mode', 'woocommerce-gateway-stripe' ),
37
-			'label'       => __( 'Enable Test Mode', 'woocommerce-gateway-stripe' ),
36
+			'title'       => __('Test mode', 'woocommerce-gateway-stripe'),
37
+			'label'       => __('Enable Test Mode', 'woocommerce-gateway-stripe'),
38 38
 			'type'        => 'checkbox',
39
-			'description' => __( 'Place the payment gateway in test mode using test API keys.', 'woocommerce-gateway-stripe' ),
39
+			'description' => __('Place the payment gateway in test mode using test API keys.', 'woocommerce-gateway-stripe'),
40 40
 			'default'     => 'yes',
41 41
 			'desc_tip'    => true,
42 42
 		),
43 43
 		'test_publishable_key' => array(
44
-			'title'       => __( 'Test Publishable Key', 'woocommerce-gateway-stripe' ),
44
+			'title'       => __('Test Publishable Key', 'woocommerce-gateway-stripe'),
45 45
 			'type'        => 'password',
46
-			'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
46
+			'description' => __('Get your API keys from your stripe account.', 'woocommerce-gateway-stripe'),
47 47
 			'default'     => '',
48 48
 			'desc_tip'    => true,
49 49
 		),
50 50
 		'test_secret_key' => array(
51
-			'title'       => __( 'Test Secret Key', 'woocommerce-gateway-stripe' ),
51
+			'title'       => __('Test Secret Key', 'woocommerce-gateway-stripe'),
52 52
 			'type'        => 'password',
53
-			'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
53
+			'description' => __('Get your API keys from your stripe account.', 'woocommerce-gateway-stripe'),
54 54
 			'default'     => '',
55 55
 			'desc_tip'    => true,
56 56
 		),
57 57
 		'publishable_key' => array(
58
-			'title'       => __( 'Live Publishable Key', 'woocommerce-gateway-stripe' ),
58
+			'title'       => __('Live Publishable Key', 'woocommerce-gateway-stripe'),
59 59
 			'type'        => 'password',
60
-			'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
60
+			'description' => __('Get your API keys from your stripe account.', 'woocommerce-gateway-stripe'),
61 61
 			'default'     => '',
62 62
 			'desc_tip'    => true,
63 63
 		),
64 64
 		'secret_key' => array(
65
-			'title'       => __( 'Live Secret Key', 'woocommerce-gateway-stripe' ),
65
+			'title'       => __('Live Secret Key', 'woocommerce-gateway-stripe'),
66 66
 			'type'        => 'password',
67
-			'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
67
+			'description' => __('Get your API keys from your stripe account.', 'woocommerce-gateway-stripe'),
68 68
 			'default'     => '',
69 69
 			'desc_tip'    => true,
70 70
 		),
71 71
 		'inline_cc_form' => array(
72
-			'title'       => __( 'Inline Credit Card Form', 'woocommerce-gateway-stripe' ),
72
+			'title'       => __('Inline Credit Card Form', 'woocommerce-gateway-stripe'),
73 73
 			'type'        => 'checkbox',
74
-			'description' => __( 'Choose the style you want to show for your credit card form. When unchecked, the credit card form will display separate credit card number field, expiry date field and cvc field.', 'woocommerce-gateway-stripe' ),
74
+			'description' => __('Choose the style you want to show for your credit card form. When unchecked, the credit card form will display separate credit card number field, expiry date field and cvc field.', 'woocommerce-gateway-stripe'),
75 75
 			'default'     => 'no',
76 76
 			'desc_tip'    => true,
77 77
 		),
78 78
 		'statement_descriptor' => array(
79
-			'title'       => __( 'Statement Descriptor', 'woocommerce-gateway-stripe' ),
79
+			'title'       => __('Statement Descriptor', 'woocommerce-gateway-stripe'),
80 80
 			'type'        => 'text',
81
-			'description' => __( 'This may be up to 22 characters. The statement description must contain at least one letter, may not include ><"\' characters, and will appear on your customer\'s statement in capital letters.', 'woocommerce-gateway-stripe' ),
81
+			'description' => __('This may be up to 22 characters. The statement description must contain at least one letter, may not include ><"\' characters, and will appear on your customer\'s statement in capital letters.', 'woocommerce-gateway-stripe'),
82 82
 			'default'     => '',
83 83
 			'desc_tip'    => true,
84 84
 		),
85 85
 		'capture' => array(
86
-			'title'       => __( 'Capture', 'woocommerce-gateway-stripe' ),
87
-			'label'       => __( 'Capture charge immediately', 'woocommerce-gateway-stripe' ),
86
+			'title'       => __('Capture', 'woocommerce-gateway-stripe'),
87
+			'label'       => __('Capture charge immediately', 'woocommerce-gateway-stripe'),
88 88
 			'type'        => 'checkbox',
89
-			'description' => __( 'Whether or not to immediately capture the charge. When unchecked, the charge issues an authorization and will need to be captured later. Uncaptured charges expire in 7 days.', 'woocommerce-gateway-stripe' ),
89
+			'description' => __('Whether or not to immediately capture the charge. When unchecked, the charge issues an authorization and will need to be captured later. Uncaptured charges expire in 7 days.', 'woocommerce-gateway-stripe'),
90 90
 			'default'     => 'yes',
91 91
 			'desc_tip'    => true,
92 92
 		),
93 93
 		'three_d_secure' => array(
94
-			'title'       => __( '3D Secure', 'woocommerce-gateway-stripe' ),
95
-			'label'       => __( 'Require 3D Secure when applicable', 'woocommerce-gateway-stripe' ),
94
+			'title'       => __('3D Secure', 'woocommerce-gateway-stripe'),
95
+			'label'       => __('Require 3D Secure when applicable', 'woocommerce-gateway-stripe'),
96 96
 			'type'        => 'checkbox',
97
-			'description' => __( 'Some payment methods have 3D Secure feature. This is an extra security layer for your store. Choose how to handle payments when 3D Secure is recommended. Enabling would require customers to use 3D Secure when recommended.', 'woocommerce-gateway-stripe' ),
97
+			'description' => __('Some payment methods have 3D Secure feature. This is an extra security layer for your store. Choose how to handle payments when 3D Secure is recommended. Enabling would require customers to use 3D Secure when recommended.', 'woocommerce-gateway-stripe'),
98 98
 			'default'     => 'yes',
99 99
 			'desc_tip'    => true,
100 100
 		),
101 101
 		'stripe_checkout' => array(
102
-			'title'       => __( 'Stripe Checkout', 'woocommerce-gateway-stripe' ),
103
-			'label'       => __( 'Enable Stripe Checkout', 'woocommerce-gateway-stripe' ),
102
+			'title'       => __('Stripe Checkout', 'woocommerce-gateway-stripe'),
103
+			'label'       => __('Enable Stripe Checkout', 'woocommerce-gateway-stripe'),
104 104
 			'type'        => 'checkbox',
105
-			'description' => __( 'If enabled, this option shows a "pay" button and modal credit card form on the checkout, instead of credit card fields directly on the page.', 'woocommerce-gateway-stripe' ),
105
+			'description' => __('If enabled, this option shows a "pay" button and modal credit card form on the checkout, instead of credit card fields directly on the page.', 'woocommerce-gateway-stripe'),
106 106
 			'default'     => 'no',
107 107
 			'desc_tip'    => true,
108 108
 		),
109 109
 		'stripe_bitcoin' => array(
110
-			'title'       => __( 'Bitcoin Currency', 'woocommerce-gateway-stripe' ),
111
-			'label'       => __( 'Enable Bitcoin Currency', 'woocommerce-gateway-stripe' ),
110
+			'title'       => __('Bitcoin Currency', 'woocommerce-gateway-stripe'),
111
+			'label'       => __('Enable Bitcoin Currency', 'woocommerce-gateway-stripe'),
112 112
 			'type'        => 'checkbox',
113
-			'description' => __( 'If enabled, an option to accept bitcoin will show on the checkout modal. Note: Stripe Checkout needs to be enabled and store currency must be set to USD.', 'woocommerce-gateway-stripe' ),
113
+			'description' => __('If enabled, an option to accept bitcoin will show on the checkout modal. Note: Stripe Checkout needs to be enabled and store currency must be set to USD.', 'woocommerce-gateway-stripe'),
114 114
 			'default'     => 'no',
115 115
 			'desc_tip'    => true,
116 116
 		),
117 117
 		'stripe_checkout_image' => array(
118
-			'title'       => __( 'Stripe Checkout Image', 'woocommerce-gateway-stripe' ),
119
-			'description' => __( 'Optionally enter the URL to a 128x128px image of your brand or product. e.g. <code>https://yoursite.com/wp-content/uploads/2013/09/yourimage.jpg</code>', 'woocommerce-gateway-stripe' ),
118
+			'title'       => __('Stripe Checkout Image', 'woocommerce-gateway-stripe'),
119
+			'description' => __('Optionally enter the URL to a 128x128px image of your brand or product. e.g. <code>https://yoursite.com/wp-content/uploads/2013/09/yourimage.jpg</code>', 'woocommerce-gateway-stripe'),
120 120
 			'type'        => 'text',
121 121
 			'default'     => '',
122 122
 			'desc_tip'    => true,
123 123
 		),
124 124
 		'stripe_checkout_description' => array(
125
-			'title'       => __( 'Stripe Checkout Description', 'woocommerce-gateway-stripe' ),
125
+			'title'       => __('Stripe Checkout Description', 'woocommerce-gateway-stripe'),
126 126
 			'type'        => 'text',
127
-			'description' => __( 'Shows a description of your store on Stripe Modal Checkout.', 'woocommerce-gateway-stripe' ),
127
+			'description' => __('Shows a description of your store on Stripe Modal Checkout.', 'woocommerce-gateway-stripe'),
128 128
 			'default'     => '',
129 129
 			'desc_tip'    => true,
130 130
 		),
131 131
 		'payment_request' => array(
132
-			'title'       => __( 'Payment Request Buttons', 'woocommerce-gateway-stripe' ),
132
+			'title'       => __('Payment Request Buttons', 'woocommerce-gateway-stripe'),
133 133
 			/* translators: 1) br tag 2) opening anchor tag 3) closing anchor tag */
134
-			'label'       => sprintf( __( 'Enable Payment Request Buttons. (Apple Pay/Chrome Payment Request API) %1$sBy using Apple Pay, you agree to %2$s and %3$s\'s terms of service.', 'woocommerce-gateway-stripe' ), '<br />', '<a href="https://stripe.com/apple-pay/legal" target="_blank">Stripe</a>', '<a href="https://developer.apple.com/apple-pay/acceptable-use-guidelines-for-websites/" target="_blank">Apple</a>' ),
134
+			'label'       => sprintf(__('Enable Payment Request Buttons. (Apple Pay/Chrome Payment Request API) %1$sBy using Apple Pay, you agree to %2$s and %3$s\'s terms of service.', 'woocommerce-gateway-stripe'), '<br />', '<a href="https://stripe.com/apple-pay/legal" target="_blank">Stripe</a>', '<a href="https://developer.apple.com/apple-pay/acceptable-use-guidelines-for-websites/" target="_blank">Apple</a>'),
135 135
 			'type'        => 'checkbox',
136
-			'description' => __( 'If enabled, users will be able to pay using Apple Pay or Chrome Payment Request if supported by the browser.', 'woocommerce-gateway-stripe' ),
136
+			'description' => __('If enabled, users will be able to pay using Apple Pay or Chrome Payment Request if supported by the browser.', 'woocommerce-gateway-stripe'),
137 137
 			'default'     => 'yes',
138 138
 			'desc_tip'    => true,
139 139
 		),
140 140
 		'payment_request_button_type' => array(
141
-			'title'       => __( 'Payment Request Button Type', 'woocommerce-gateway-stripe' ),
142
-			'label'       => __( 'Button Type', 'woocommerce-gateway-stripe' ),
141
+			'title'       => __('Payment Request Button Type', 'woocommerce-gateway-stripe'),
142
+			'label'       => __('Button Type', 'woocommerce-gateway-stripe'),
143 143
 			'type'        => 'select',
144
-			'description' => __( 'Select the button type you would like to show.', 'woocommerce-gateway-stripe' ),
144
+			'description' => __('Select the button type you would like to show.', 'woocommerce-gateway-stripe'),
145 145
 			'default'     => 'buy',
146 146
 			'desc_tip'    => true,
147 147
 			'options'     => array(
148
-				'default' => __( 'Default', 'woocommerce-gateway-stripe' ),
149
-				'buy'     => __( 'Buy', 'woocommerce-gateway-stripe' ),
150
-				'donate'  => __( 'Donate', 'woocommerce-gateway-stripe' ),
148
+				'default' => __('Default', 'woocommerce-gateway-stripe'),
149
+				'buy'     => __('Buy', 'woocommerce-gateway-stripe'),
150
+				'donate'  => __('Donate', 'woocommerce-gateway-stripe'),
151 151
 			),
152 152
 		),
153 153
 		'payment_request_button_theme' => array(
154
-			'title'       => __( 'Payment Request Button Theme', 'woocommerce-gateway-stripe' ),
155
-			'label'       => __( 'Button Theme', 'woocommerce-gateway-stripe' ),
154
+			'title'       => __('Payment Request Button Theme', 'woocommerce-gateway-stripe'),
155
+			'label'       => __('Button Theme', 'woocommerce-gateway-stripe'),
156 156
 			'type'        => 'select',
157
-			'description' => __( 'Select the button theme you would like to show.', 'woocommerce-gateway-stripe' ),
157
+			'description' => __('Select the button theme you would like to show.', 'woocommerce-gateway-stripe'),
158 158
 			'default'     => 'dark',
159 159
 			'desc_tip'    => true,
160 160
 			'options'     => array(
161
-				'dark'          => __( 'Dark', 'woocommerce-gateway-stripe' ),
162
-				'light'         => __( 'Light', 'woocommerce-gateway-stripe' ),
163
-				'light-outline' => __( 'Light-Outline', 'woocommerce-gateway-stripe' ),
161
+				'dark'          => __('Dark', 'woocommerce-gateway-stripe'),
162
+				'light'         => __('Light', 'woocommerce-gateway-stripe'),
163
+				'light-outline' => __('Light-Outline', 'woocommerce-gateway-stripe'),
164 164
 			),
165 165
 		),
166 166
 		'payment_request_button_height' => array(
167
-			'title'       => __( 'Payment Request Button Height', 'woocommerce-gateway-stripe' ),
168
-			'label'       => __( 'Button Height', 'woocommerce-gateway-stripe' ),
167
+			'title'       => __('Payment Request Button Height', 'woocommerce-gateway-stripe'),
168
+			'label'       => __('Button Height', 'woocommerce-gateway-stripe'),
169 169
 			'type'        => 'text',
170
-			'description' => __( 'Enter the height you would like the button to be in pixels. Width will always be 100%.', 'woocommerce-gateway-stripe' ),
170
+			'description' => __('Enter the height you would like the button to be in pixels. Width will always be 100%.', 'woocommerce-gateway-stripe'),
171 171
 			'default'     => '44',
172 172
 			'desc_tip'    => true,
173 173
 		),
174 174
 		'saved_cards' => array(
175
-			'title'       => __( 'Saved Cards', 'woocommerce-gateway-stripe' ),
176
-			'label'       => __( 'Enable Payment via Saved Cards', 'woocommerce-gateway-stripe' ),
175
+			'title'       => __('Saved Cards', 'woocommerce-gateway-stripe'),
176
+			'label'       => __('Enable Payment via Saved Cards', 'woocommerce-gateway-stripe'),
177 177
 			'type'        => 'checkbox',
178
-			'description' => __( 'If enabled, users will be able to pay with a saved card during checkout. Card details are saved on Stripe servers, not on your store.', 'woocommerce-gateway-stripe' ),
178
+			'description' => __('If enabled, users will be able to pay with a saved card during checkout. Card details are saved on Stripe servers, not on your store.', 'woocommerce-gateway-stripe'),
179 179
 			'default'     => 'no',
180 180
 			'desc_tip'    => true,
181 181
 		),
182 182
 		'logging' => array(
183
-			'title'       => __( 'Logging', 'woocommerce-gateway-stripe' ),
184
-			'label'       => __( 'Log debug messages', 'woocommerce-gateway-stripe' ),
183
+			'title'       => __('Logging', 'woocommerce-gateway-stripe'),
184
+			'label'       => __('Log debug messages', 'woocommerce-gateway-stripe'),
185 185
 			'type'        => 'checkbox',
186
-			'description' => __( 'Save debug messages to the WooCommerce System Status log.', 'woocommerce-gateway-stripe' ),
186
+			'description' => __('Save debug messages to the WooCommerce System Status log.', 'woocommerce-gateway-stripe'),
187 187
 			'default'     => 'no',
188 188
 			'desc_tip'    => true,
189 189
 		),
Please login to merge, or discard this patch.
includes/admin/stripe-ideal-settings.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,45 +1,45 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
6
-return apply_filters( 'wc_stripe_ideal_settings',
6
+return apply_filters('wc_stripe_ideal_settings',
7 7
 	array(
8 8
 		'geo_target' => array(
9
-			'description' => __( 'Relevant Payer Geography: The Netherlands', 'woocommerce-gateway-stripe' ),
9
+			'description' => __('Relevant Payer Geography: The Netherlands', 'woocommerce-gateway-stripe'),
10 10
 			'type'        => 'title',
11 11
 		),
12 12
 		'guide' => array(
13
-			'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#ideal" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ),
13
+			'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#ideal" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'),
14 14
 			'type'        => 'title',
15 15
 		),
16 16
 		'activation' => array(
17
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
17
+			'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'),
18 18
 			'type'   => 'title',
19 19
 		),
20 20
 		'enabled' => array(
21
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
22
-			'label'       => __( 'Enable Stripe iDeal', 'woocommerce-gateway-stripe' ),
21
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
22
+			'label'       => __('Enable Stripe iDeal', 'woocommerce-gateway-stripe'),
23 23
 			'type'        => 'checkbox',
24 24
 			'description' => '',
25 25
 			'default'     => 'no',
26 26
 		),
27 27
 		'title' => array(
28
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
28
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
29 29
 			'type'        => 'text',
30
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
31
-			'default'     => __( 'iDeal', 'woocommerce-gateway-stripe' ),
30
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
31
+			'default'     => __('iDeal', 'woocommerce-gateway-stripe'),
32 32
 			'desc_tip'    => true,
33 33
 		),
34 34
 		'description' => array(
35
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
35
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
36 36
 			'type'        => 'text',
37
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
38
-			'default'     => __( 'You will be redirected to iDeal.', 'woocommerce-gateway-stripe' ),
37
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
38
+			'default'     => __('You will be redirected to iDeal.', 'woocommerce-gateway-stripe'),
39 39
 			'desc_tip'    => true,
40 40
 		),
41 41
 		'webhook' => array(
42
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
42
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
43 43
 			'type'        => 'title',
44 44
 			/* translators: webhook URL */
45 45
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/stripe-alipay-settings.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,45 +1,45 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
6
-return apply_filters( 'wc_stripe_alipay_settings',
6
+return apply_filters('wc_stripe_alipay_settings',
7 7
 	array(
8 8
 		'geo_target' => array(
9
-			'description' => __( 'Relevant Payer Geography: China', 'woocommerce-gateway-stripe' ),
9
+			'description' => __('Relevant Payer Geography: China', 'woocommerce-gateway-stripe'),
10 10
 			'type'        => 'title',
11 11
 		),
12 12
 		'guide' => array(
13
-			'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#alipay" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ),
13
+			'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#alipay" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'),
14 14
 			'type'        => 'title',
15 15
 		),
16 16
 		'activation' => array(
17
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
17
+			'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'),
18 18
 			'type'   => 'title',
19 19
 		),
20 20
 		'enabled' => array(
21
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
22
-			'label'       => __( 'Enable Stripe Alipay', 'woocommerce-gateway-stripe' ),
21
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
22
+			'label'       => __('Enable Stripe Alipay', 'woocommerce-gateway-stripe'),
23 23
 			'type'        => 'checkbox',
24 24
 			'description' => '',
25 25
 			'default'     => 'no',
26 26
 		),
27 27
 		'title' => array(
28
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
28
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
29 29
 			'type'        => 'text',
30
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
31
-			'default'     => __( 'Alipay', 'woocommerce-gateway-stripe' ),
30
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
31
+			'default'     => __('Alipay', 'woocommerce-gateway-stripe'),
32 32
 			'desc_tip'    => true,
33 33
 		),
34 34
 		'description' => array(
35
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
35
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
36 36
 			'type'        => 'text',
37
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
38
-			'default'     => __( 'You will be redirected to Alipay.', 'woocommerce-gateway-stripe' ),
37
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
38
+			'default'     => __('You will be redirected to Alipay.', 'woocommerce-gateway-stripe'),
39 39
 			'desc_tip'    => true,
40 40
 		),
41 41
 		'webhook' => array(
42
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
42
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
43 43
 			'type'        => 'title',
44 44
 			/* translators: webhook URL */
45 45
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/stripe-bancontact-settings.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,45 +1,45 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
6
-return apply_filters( 'wc_stripe_bancontact_settings',
6
+return apply_filters('wc_stripe_bancontact_settings',
7 7
 	array(
8 8
 		'geo_target' => array(
9
-			'description' => __( 'Relevant Payer Geography: Belgium', 'woocommerce-gateway-stripe' ),
9
+			'description' => __('Relevant Payer Geography: Belgium', 'woocommerce-gateway-stripe'),
10 10
 			'type'        => 'title',
11 11
 		),
12 12
 		'guide' => array(
13
-			'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#bancontact" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ),
13
+			'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#bancontact" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'),
14 14
 			'type'        => 'title',
15 15
 		),
16 16
 		'activation' => array(
17
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
17
+			'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'),
18 18
 			'type'   => 'title',
19 19
 		),
20 20
 		'enabled' => array(
21
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
22
-			'label'       => __( 'Enable Stripe Bancontact', 'woocommerce-gateway-stripe' ),
21
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
22
+			'label'       => __('Enable Stripe Bancontact', 'woocommerce-gateway-stripe'),
23 23
 			'type'        => 'checkbox',
24 24
 			'description' => '',
25 25
 			'default'     => 'no',
26 26
 		),
27 27
 		'title' => array(
28
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
28
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
29 29
 			'type'        => 'text',
30
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
31
-			'default'     => __( 'Bancontact', 'woocommerce-gateway-stripe' ),
30
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
31
+			'default'     => __('Bancontact', 'woocommerce-gateway-stripe'),
32 32
 			'desc_tip'    => true,
33 33
 		),
34 34
 		'description' => array(
35
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
35
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
36 36
 			'type'        => 'text',
37
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
38
-			'default'     => __( 'You will be redirected to Bancontact.', 'woocommerce-gateway-stripe' ),
37
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
38
+			'default'     => __('You will be redirected to Bancontact.', 'woocommerce-gateway-stripe'),
39 39
 			'desc_tip'    => true,
40 40
 		),
41 41
 		'webhook' => array(
42
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
42
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
43 43
 			'type'        => 'title',
44 44
 			/* translators: webhook URL */
45 45
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/stripe-p24-settings.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,41 +1,41 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
6
-return apply_filters( 'wc_stripe_p24_settings',
6
+return apply_filters('wc_stripe_p24_settings',
7 7
 	array(
8 8
 		'geo_target' => array(
9
-			'description' => __( 'Relevant Payer Geography: Poland', 'woocommerce-gateway-stripe' ),
9
+			'description' => __('Relevant Payer Geography: Poland', 'woocommerce-gateway-stripe'),
10 10
 			'type'        => 'title',
11 11
 		),
12 12
 		'activation' => array(
13
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
13
+			'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'),
14 14
 			'type'   => 'title',
15 15
 		),
16 16
 		'enabled' => array(
17
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
18
-			'label'       => __( 'Enable Stripe P24', 'woocommerce-gateway-stripe' ),
17
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
18
+			'label'       => __('Enable Stripe P24', 'woocommerce-gateway-stripe'),
19 19
 			'type'        => 'checkbox',
20 20
 			'description' => '',
21 21
 			'default'     => 'no',
22 22
 		),
23 23
 		'title' => array(
24
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
24
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
25 25
 			'type'        => 'text',
26
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
27
-			'default'     => __( 'Przelewy24 (P24)', 'woocommerce-gateway-stripe' ),
26
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
27
+			'default'     => __('Przelewy24 (P24)', 'woocommerce-gateway-stripe'),
28 28
 			'desc_tip'    => true,
29 29
 		),
30 30
 		'description' => array(
31
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
31
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
32 32
 			'type'        => 'text',
33
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
34
-			'default'     => __( 'You will be redirected to P24.', 'woocommerce-gateway-stripe' ),
33
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
34
+			'default'     => __('You will be redirected to P24.', 'woocommerce-gateway-stripe'),
35 35
 			'desc_tip'    => true,
36 36
 		),
37 37
 		'webhook' => array(
38
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
38
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
39 39
 			'type'        => 'title',
40 40
 			/* translators: webhook URL */
41 41
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/class-wc-stripe-admin-notices.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 	 * @since 4.1.0
22 22
 	 */
23 23
 	public function __construct() {
24
-		add_action( 'admin_notices', array( $this, 'admin_notices' ) );
25
-		add_action( 'wp_loaded', array( $this, 'hide_notices' ) );
24
+		add_action('admin_notices', array($this, 'admin_notices'));
25
+		add_action('wp_loaded', array($this, 'hide_notices'));
26 26
 	}
27 27
 
28 28
 	/**
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 * @since 1.0.0
32 32
 	 * @version 4.0.0
33 33
 	 */
34
-	public function add_admin_notice( $slug, $class, $message, $dismissible = false ) {
35
-		$this->notices[ $slug ] = array(
34
+	public function add_admin_notice($slug, $class, $message, $dismissible = false) {
35
+		$this->notices[$slug] = array(
36 36
 			'class'       => $class,
37 37
 			'message'     => $message,
38 38
 			'dismissible' => $dismissible,
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @version 4.0.0
47 47
 	 */
48 48
 	public function admin_notices() {
49
-		if ( ! current_user_can( 'manage_woocommerce' ) ) {
49
+		if ( ! current_user_can('manage_woocommerce')) {
50 50
 			return;
51 51
 		}
52 52
 
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
 		// All other payment methods.
57 57
 		$this->payment_methods_check_environment();
58 58
 
59
-		foreach ( (array) $this->notices as $notice_key => $notice ) {
60
-			echo '<div class="' . esc_attr( $notice['class'] ) . '" style="position:relative;">';
59
+		foreach ((array) $this->notices as $notice_key => $notice) {
60
+			echo '<div class="' . esc_attr($notice['class']) . '" style="position:relative;">';
61 61
 
62
-			if ( $notice['dismissible'] ) {
62
+			if ($notice['dismissible']) {
63 63
 			?>
64
-				<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-stripe-hide-notice', $notice_key ), 'wc_stripe_hide_notices_nonce', '_wc_stripe_notice_nonce' ) ); ?>" class="woocommerce-message-close notice-dismiss" style="position:absolute;right:1px;padding:9px;text-decoration:none;"></a>
64
+				<a href="<?php echo esc_url(wp_nonce_url(add_query_arg('wc-stripe-hide-notice', $notice_key), 'wc_stripe_hide_notices_nonce', '_wc_stripe_notice_nonce')); ?>" class="woocommerce-message-close notice-dismiss" style="position:absolute;right:1px;padding:9px;text-decoration:none;"></a>
65 65
 			<?php
66 66
 			}
67 67
 
68 68
 			echo '<p>';
69
-			echo wp_kses( $notice['message'], array( 'a' => array( 'href' => array() ) ) );
69
+			echo wp_kses($notice['message'], array('a' => array('href' => array())));
70 70
 			echo '</p></div>';
71 71
 		}
72 72
 	}
@@ -100,53 +100,53 @@  discard block
 block discarded – undo
100 100
 	 * @version 4.0.0
101 101
 	 */
102 102
 	public function stripe_check_environment() {
103
-		$show_ssl_notice  = get_option( 'wc_stripe_show_ssl_notice' );
104
-		$show_keys_notice = get_option( 'wc_stripe_show_keys_notice' );
105
-		$options          = get_option( 'woocommerce_stripe_settings' );
106
-		$testmode         = ( isset( $options['testmode'] ) && 'yes' === $options['testmode'] ) ? true : false;
107
-		$test_pub_key     = isset( $options['test_publishable_key'] ) ? $options['test_publishable_key'] : '';
108
-		$test_secret_key  = isset( $options['test_secret_key'] ) ? $options['test_secret_key'] : '';
109
-		$live_pub_key     = isset( $options['publishable_key'] ) ? $options['publishable_key'] : '';
110
-		$live_secret_key  = isset( $options['secret_key'] ) ? $options['secret_key'] : '';
111
-
112
-		if ( isset( $options['enabled'] ) && 'yes' === $options['enabled'] && empty( $show_keys_notice ) ) {
103
+		$show_ssl_notice  = get_option('wc_stripe_show_ssl_notice');
104
+		$show_keys_notice = get_option('wc_stripe_show_keys_notice');
105
+		$options          = get_option('woocommerce_stripe_settings');
106
+		$testmode         = (isset($options['testmode']) && 'yes' === $options['testmode']) ? true : false;
107
+		$test_pub_key     = isset($options['test_publishable_key']) ? $options['test_publishable_key'] : '';
108
+		$test_secret_key  = isset($options['test_secret_key']) ? $options['test_secret_key'] : '';
109
+		$live_pub_key     = isset($options['publishable_key']) ? $options['publishable_key'] : '';
110
+		$live_secret_key  = isset($options['secret_key']) ? $options['secret_key'] : '';
111
+
112
+		if (isset($options['enabled']) && 'yes' === $options['enabled'] && empty($show_keys_notice)) {
113 113
 			$secret = WC_Stripe_API::get_secret_key();
114 114
 
115
-			if ( empty( $secret ) && ! ( isset( $_GET['page'], $_GET['section'] ) && 'wc-settings' === $_GET['page'] && 'stripe' === $_GET['section'] ) ) {
115
+			if (empty($secret) && ! (isset($_GET['page'], $_GET['section']) && 'wc-settings' === $_GET['page'] && 'stripe' === $_GET['section'])) {
116 116
 				$setting_link = $this->get_setting_link();
117 117
 				/* translators: 1) link */
118
-				$this->add_admin_notice( 'keys', 'notice notice-warning', sprintf( __( 'Stripe is almost ready. To get started, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe' ), $setting_link ), true );
118
+				$this->add_admin_notice('keys', 'notice notice-warning', sprintf(__('Stripe is almost ready. To get started, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe'), $setting_link), true);
119 119
 			}
120 120
 
121 121
 			// Check if keys are entered properly per live/test mode.
122
-			if ( $testmode ) {
122
+			if ($testmode) {
123 123
 				if (
124
-					! empty( $test_pub_key ) && ! preg_match( '/^pk_test_/', $test_pub_key )
125
-					|| ( ! empty( $test_secret_key ) && ! preg_match( '/^sk_test_/', $test_secret_key )
126
-					&& ! empty( $test_secret_key ) && ! preg_match( '/^rk_test_/', $test_secret_key ) ) )
124
+					! empty($test_pub_key) && ! preg_match('/^pk_test_/', $test_pub_key)
125
+					|| ( ! empty($test_secret_key) && ! preg_match('/^sk_test_/', $test_secret_key)
126
+					&& ! empty($test_secret_key) && ! preg_match('/^rk_test_/', $test_secret_key)) )
127 127
 				{
128 128
 					$setting_link = $this->get_setting_link();
129 129
 					/* translators: 1) link */
130
-					$this->add_admin_notice( 'keys', 'notice notice-error', sprintf( __( 'Stripe is in test mode however your test keys may not be valid. Test keys start with pk_test and sk_test or rk_test. Please go to your settings and, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe' ), $setting_link ), true );
130
+					$this->add_admin_notice('keys', 'notice notice-error', sprintf(__('Stripe is in test mode however your test keys may not be valid. Test keys start with pk_test and sk_test or rk_test. Please go to your settings and, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe'), $setting_link), true);
131 131
 				}
132 132
 			} else {
133 133
 				if (
134
-					! empty( $live_pub_key ) && ! preg_match( '/^pk_live_/', $live_pub_key )
135
-					|| ( ! empty( $live_secret_key ) && ! preg_match( '/^sk_live_/', $live_secret_key )
136
-					&& ! empty( $live_secret_key ) && ! preg_match( '/^rk_live_/', $live_secret_key ) ) )
134
+					! empty($live_pub_key) && ! preg_match('/^pk_live_/', $live_pub_key)
135
+					|| ( ! empty($live_secret_key) && ! preg_match('/^sk_live_/', $live_secret_key)
136
+					&& ! empty($live_secret_key) && ! preg_match('/^rk_live_/', $live_secret_key)) )
137 137
 				{
138 138
 					$setting_link = $this->get_setting_link();
139 139
 					/* translators: 1) link */
140
-					$this->add_admin_notice( 'keys', 'notice notice-error', sprintf( __( 'Stripe is in live mode however your test keys may not be valid. Live keys start with pk_live and sk_live or rk_live. Please go to your settings and, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe' ), $setting_link ), true );
140
+					$this->add_admin_notice('keys', 'notice notice-error', sprintf(__('Stripe is in live mode however your test keys may not be valid. Live keys start with pk_live and sk_live or rk_live. Please go to your settings and, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe'), $setting_link), true);
141 141
 				}
142 142
 			}
143 143
 		}
144 144
 
145
-		if ( empty( $show_ssl_notice ) && isset( $options['enabled'] ) && 'yes' === $options['enabled'] ) {
145
+		if (empty($show_ssl_notice) && isset($options['enabled']) && 'yes' === $options['enabled']) {
146 146
 			// Show message if enabled and FORCE SSL is disabled and WordpressHTTPS plugin is not detected.
147
-			if ( ( function_exists( 'wc_site_is_https' ) && ! wc_site_is_https() ) && ( 'no' === get_option( 'woocommerce_force_ssl_checkout' ) && ! class_exists( 'WordPressHTTPS' ) ) ) {
147
+			if ((function_exists('wc_site_is_https') && ! wc_site_is_https()) && ('no' === get_option('woocommerce_force_ssl_checkout') && ! class_exists('WordPressHTTPS'))) {
148 148
 				/* translators: 1) link 2) link */
149
-				$this->add_admin_notice( 'ssl', 'notice notice-warning', sprintf( __( 'Stripe is enabled, but the <a href="%1$s">force SSL option</a> is disabled; your checkout may not be secure! Please enable SSL and ensure your server has a valid <a href="%2$s" target="_blank">SSL certificate</a> - Stripe will only work in test mode.', 'woocommerce-gateway-stripe' ), admin_url( 'admin.php?page=wc-settings&tab=checkout' ), 'https://en.wikipedia.org/wiki/Transport_Layer_Security' ), true );
149
+				$this->add_admin_notice('ssl', 'notice notice-warning', sprintf(__('Stripe is enabled, but the <a href="%1$s">force SSL option</a> is disabled; your checkout may not be secure! Please enable SSL and ensure your server has a valid <a href="%2$s" target="_blank">SSL certificate</a> - Stripe will only work in test mode.', 'woocommerce-gateway-stripe'), admin_url('admin.php?page=wc-settings&tab=checkout'), 'https://en.wikipedia.org/wiki/Transport_Layer_Security'), true);
150 150
 			}
151 151
 		}
152 152
 	}
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
 	public function payment_methods_check_environment() {
160 160
 		$payment_methods = $this->get_payment_methods();
161 161
 
162
-		foreach ( $payment_methods as $method => $class ) {
163
-			$show_notice = get_option( 'wc_stripe_show_' . strtolower( $method ) . '_notice' );
162
+		foreach ($payment_methods as $method => $class) {
163
+			$show_notice = get_option('wc_stripe_show_' . strtolower($method) . '_notice');
164 164
 			$gateway     = new $class();
165 165
 
166
-			if ( 'yes' !== $gateway->enabled || 'no' === $show_notice ) {
166
+			if ('yes' !== $gateway->enabled || 'no' === $show_notice) {
167 167
 				continue;
168 168
 			}
169 169
 
170
-			if ( ! in_array( get_woocommerce_currency(), $gateway->get_supported_currency() ) ) {
171
-				$this->add_admin_notice( $method, 'notice notice-error', sprintf( __( '%s is enabled - it requires store currency to be set to %s', 'woocommerce-gateway-stripe' ), $method, implode( ', ', $gateway->get_supported_currency() ) ), true );
170
+			if ( ! in_array(get_woocommerce_currency(), $gateway->get_supported_currency())) {
171
+				$this->add_admin_notice($method, 'notice notice-error', sprintf(__('%s is enabled - it requires store currency to be set to %s', 'woocommerce-gateway-stripe'), $method, implode(', ', $gateway->get_supported_currency())), true);
172 172
 			}
173 173
 		}
174 174
 	}
@@ -180,53 +180,53 @@  discard block
 block discarded – undo
180 180
 	 * @version 4.0.0
181 181
 	 */
182 182
 	public function hide_notices() {
183
-		if ( isset( $_GET['wc-stripe-hide-notice'] ) && isset( $_GET['_wc_stripe_notice_nonce'] ) ) {
184
-			if ( ! wp_verify_nonce( $_GET['_wc_stripe_notice_nonce'], 'wc_stripe_hide_notices_nonce' ) ) {
185
-				wp_die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce-gateway-stripe' ) );
183
+		if (isset($_GET['wc-stripe-hide-notice']) && isset($_GET['_wc_stripe_notice_nonce'])) {
184
+			if ( ! wp_verify_nonce($_GET['_wc_stripe_notice_nonce'], 'wc_stripe_hide_notices_nonce')) {
185
+				wp_die(__('Action failed. Please refresh the page and retry.', 'woocommerce-gateway-stripe'));
186 186
 			}
187 187
 
188
-			if ( ! current_user_can( 'manage_woocommerce' ) ) {
189
-				wp_die( __( 'Cheatin&#8217; huh?', 'woocommerce-gateway-stripe' ) );
188
+			if ( ! current_user_can('manage_woocommerce')) {
189
+				wp_die(__('Cheatin&#8217; huh?', 'woocommerce-gateway-stripe'));
190 190
 			}
191 191
 
192
-			$notice = wc_clean( $_GET['wc-stripe-hide-notice'] );
192
+			$notice = wc_clean($_GET['wc-stripe-hide-notice']);
193 193
 
194
-			switch ( $notice ) {
194
+			switch ($notice) {
195 195
 				case 'ssl':
196
-					update_option( 'wc_stripe_show_ssl_notice', 'no' );
196
+					update_option('wc_stripe_show_ssl_notice', 'no');
197 197
 					break;
198 198
 				case 'keys':
199
-					update_option( 'wc_stripe_show_keys_notice', 'no' );
199
+					update_option('wc_stripe_show_keys_notice', 'no');
200 200
 					break;
201 201
 				case 'Alipay':
202
-					update_option( 'wc_stripe_show_alipay_notice', 'no' );
202
+					update_option('wc_stripe_show_alipay_notice', 'no');
203 203
 					break;
204 204
 				case 'Bancontact':
205
-					update_option( 'wc_stripe_show_bancontact_notice', 'no' );
205
+					update_option('wc_stripe_show_bancontact_notice', 'no');
206 206
 					break;
207 207
 				case 'Bitcoin':
208
-					update_option( 'wc_stripe_show_bitcoin_notice', 'no' );
208
+					update_option('wc_stripe_show_bitcoin_notice', 'no');
209 209
 					break;
210 210
 				case 'EPS':
211
-					update_option( 'wc_stripe_show_eps_notice', 'no' );
211
+					update_option('wc_stripe_show_eps_notice', 'no');
212 212
 					break;
213 213
 				case 'Giropay':
214
-					update_option( 'wc_stripe_show_giropay_notice', 'no' );
214
+					update_option('wc_stripe_show_giropay_notice', 'no');
215 215
 					break;
216 216
 				case 'iDeal':
217
-					update_option( 'wc_stripe_show_ideal_notice', 'no' );
217
+					update_option('wc_stripe_show_ideal_notice', 'no');
218 218
 					break;
219 219
 				case 'Multibanco':
220
-					update_option( 'wc_stripe_show_multibanco_notice', 'no' );
220
+					update_option('wc_stripe_show_multibanco_notice', 'no');
221 221
 					break;
222 222
 				case 'P24':
223
-					update_option( 'wc_stripe_show_p24_notice', 'no' );
223
+					update_option('wc_stripe_show_p24_notice', 'no');
224 224
 					break;
225 225
 				case 'SEPA':
226
-					update_option( 'wc_stripe_show_sepa_notice', 'no' );
226
+					update_option('wc_stripe_show_sepa_notice', 'no');
227 227
 					break;
228 228
 				case 'SOFORT':
229
-					update_option( 'wc_stripe_show_sofort_notice', 'no' );
229
+					update_option('wc_stripe_show_sofort_notice', 'no');
230 230
 					break;
231 231
 			}
232 232
 		}
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
 	 * @return string Setting link
241 241
 	 */
242 242
 	public function get_setting_link() {
243
-		$use_id_as_section = function_exists( 'WC' ) ? version_compare( WC()->version, '2.6', '>=' ) : false;
243
+		$use_id_as_section = function_exists('WC') ? version_compare(WC()->version, '2.6', '>=') : false;
244 244
 
245
-		$section_slug = $use_id_as_section ? 'stripe' : strtolower( 'WC_Gateway_Stripe' );
245
+		$section_slug = $use_id_as_section ? 'stripe' : strtolower('WC_Gateway_Stripe');
246 246
 
247
-		return admin_url( 'admin.php?page=wc-settings&tab=checkout&section=' . $section_slug );
247
+		return admin_url('admin.php?page=wc-settings&tab=checkout&section=' . $section_slug);
248 248
 	}
249 249
 }
250 250
 
Please login to merge, or discard this patch.