Completed
Push — master ( 158d16...1af118 )
by Roy
13s queued 10s
created
includes/compat/class-wc-stripe-sepa-subs-compat.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @param float $amount
139 139
 	 * @param mixed $renewal_order
140 140
 	 * @param bool $retry Should we retry the process?
141
-	 * @param object $previous_error
141
+	 * @param boolean $previous_error
142 142
 	 */
143 143
 	public function process_subscription_payment( $amount = 0.0, $renewal_order, $retry = true, $previous_error ) {
144 144
 		try {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 	/**
243 243
 	 * Don't transfer Stripe fee/ID meta to renewal orders.
244
-	 * @param int $resubscribe_order The order created for the customer to resubscribe to the old expired/cancelled subscription
244
+	 * @param integer $renewal_order
245 245
 	 */
246 246
 	public function delete_renewal_meta( $renewal_order ) {
247 247
 		WC_Stripe_Helper::delete_stripe_fee( $renewal_order );
Please login to merge, or discard this patch.
Spacing   +136 added lines, -136 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 3.1.0
81 81
 	 * @version 4.0.0
82 82
 	 */
83
-	public function save_source_to_order( $order, $source ) {
84
-		parent::save_source_to_order( $order, $source );
83
+	public function save_source_to_order($order, $source) {
84
+		parent::save_source_to_order($order, $source);
85 85
 
86
-		$order_id  = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
86
+		$order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
87 87
 
88 88
 		// Also store it on the subscriptions being purchased or paid for in the order.
89
-		if ( function_exists( 'wcs_order_contains_subscription' ) && wcs_order_contains_subscription( $order_id ) ) {
90
-			$subscriptions = wcs_get_subscriptions_for_order( $order_id );
91
-		} elseif ( function_exists( 'wcs_order_contains_renewal' ) && wcs_order_contains_renewal( $order_id ) ) {
92
-			$subscriptions = wcs_get_subscriptions_for_renewal_order( $order_id );
89
+		if (function_exists('wcs_order_contains_subscription') && wcs_order_contains_subscription($order_id)) {
90
+			$subscriptions = wcs_get_subscriptions_for_order($order_id);
91
+		} elseif (function_exists('wcs_order_contains_renewal') && wcs_order_contains_renewal($order_id)) {
92
+			$subscriptions = wcs_get_subscriptions_for_renewal_order($order_id);
93 93
 		} else {
94 94
 			$subscriptions = array();
95 95
 		}
96 96
 
97
-		foreach ( $subscriptions as $subscription ) {
97
+		foreach ($subscriptions as $subscription) {
98 98
 			$subscription_id = WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id();
99
-			update_post_meta( $subscription_id, '_stripe_customer_id', $source->customer );
100
-			update_post_meta( $subscription_id, '_stripe_source_id', $source->source );
99
+			update_post_meta($subscription_id, '_stripe_customer_id', $source->customer);
100
+			update_post_meta($subscription_id, '_stripe_source_id', $source->source);
101 101
 		}
102 102
 	}
103 103
 
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
 	 * @param  int $order_id
107 107
 	 * @return array
108 108
 	 */
109
-	public function process_payment( $order_id, $retry = true, $force_save_source = false, $previous_error = false ) {
110
-		if ( $this->has_subscription( $order_id ) ) {
111
-			if ( $this->is_subs_change_payment() ) {
112
-				return $this->change_subs_payment_method( $order_id );
109
+	public function process_payment($order_id, $retry = true, $force_save_source = false, $previous_error = false) {
110
+		if ($this->has_subscription($order_id)) {
111
+			if ($this->is_subs_change_payment()) {
112
+				return $this->change_subs_payment_method($order_id);
113 113
 			}
114 114
 
115 115
 			// Regular payment with force customer enabled
116
-			return parent::process_payment( $order_id, $retry, true, $previous_error );
116
+			return parent::process_payment($order_id, $retry, true, $previous_error);
117 117
 		} else {
118
-			return parent::process_payment( $order_id, $retry, $force_save_source, $previous_error );
118
+			return parent::process_payment($order_id, $retry, $force_save_source, $previous_error);
119 119
 		}
120 120
 	}
121 121
 
@@ -125,25 +125,25 @@  discard block
 block discarded – undo
125 125
 	 * @since 4.0.4
126 126
 	 * @param int $order_id
127 127
 	 */
128
-	public function change_subs_payment_method( $order_id ) {
128
+	public function change_subs_payment_method($order_id) {
129 129
 		try {
130
-			$subscription    = wc_get_order( $order_id );
131
-			$prepared_source = $this->prepare_source( get_current_user_id(), true );
130
+			$subscription    = wc_get_order($order_id);
131
+			$prepared_source = $this->prepare_source(get_current_user_id(), true);
132 132
 
133
-			if ( empty( $prepared_source->source ) ) {
134
-				$localized_message = __( 'Payment processing failed. Please retry.', 'woocommerce-gateway-stripe' );
135
-				throw new WC_Stripe_Exception( print_r( $prepared_source, true ), $localized_message );
133
+			if (empty($prepared_source->source)) {
134
+				$localized_message = __('Payment processing failed. Please retry.', 'woocommerce-gateway-stripe');
135
+				throw new WC_Stripe_Exception(print_r($prepared_source, true), $localized_message);
136 136
 			}
137 137
 
138
-			$this->save_source_to_order( $subscription, $prepared_source );
138
+			$this->save_source_to_order($subscription, $prepared_source);
139 139
 
140 140
 			return array(
141 141
 				'result'   => 'success',
142
-				'redirect' => $this->get_return_url( $subscription ),
142
+				'redirect' => $this->get_return_url($subscription),
143 143
 			);
144
-		} catch ( WC_Stripe_Exception $e ) {
145
-			wc_add_notice( $e->getLocalizedMessage(), 'error' );
146
-			WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() );
144
+		} catch (WC_Stripe_Exception $e) {
145
+			wc_add_notice($e->getLocalizedMessage(), 'error');
146
+			WC_Stripe_Logger::log('Error: ' . $e->getMessage());
147 147
 		}
148 148
 	}
149 149
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 	 * @param $amount_to_charge float The amount to charge.
154 154
 	 * @param $renewal_order WC_Order A WC_Order object created to record the renewal payment.
155 155
 	 */
156
-	public function scheduled_subscription_payment( $amount_to_charge, $renewal_order ) {
157
-		$this->process_subscription_payment( $amount_to_charge, $renewal_order, true, false );
156
+	public function scheduled_subscription_payment($amount_to_charge, $renewal_order) {
157
+		$this->process_subscription_payment($amount_to_charge, $renewal_order, true, false);
158 158
 	}
159 159
 
160 160
 	/**
@@ -168,86 +168,86 @@  discard block
 block discarded – undo
168 168
 	 * @param bool $retry Should we retry the process?
169 169
 	 * @param object $previous_error
170 170
 	 */
171
-	public function process_subscription_payment( $amount = 0.0, $renewal_order, $retry = true, $previous_error ) {
171
+	public function process_subscription_payment($amount = 0.0, $renewal_order, $retry = true, $previous_error) {
172 172
 		try {
173
-			if ( $amount * 100 < WC_Stripe_Helper::get_minimum_amount() ) {
173
+			if ($amount * 100 < WC_Stripe_Helper::get_minimum_amount()) {
174 174
 				/* translators: minimum amount */
175
-				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 ) ) );
175
+				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)));
176 176
 			}
177 177
 
178 178
 			$order_id = WC_Stripe_Helper::is_pre_30() ? $renewal_order->id : $renewal_order->get_id();
179 179
 
180 180
 			// Get source from order
181
-			$prepared_source = $this->prepare_order_source( $renewal_order );
181
+			$prepared_source = $this->prepare_order_source($renewal_order);
182 182
 			$source_object   = $prepared_source->source_object;
183 183
 
184
-			if ( ! $prepared_source->customer ) {
185
-				return new WP_Error( 'stripe_error', __( 'Customer not found', 'woocommerce-gateway-stripe' ) );
184
+			if ( ! $prepared_source->customer) {
185
+				return new WP_Error('stripe_error', __('Customer not found', 'woocommerce-gateway-stripe'));
186 186
 			}
187 187
 
188
-			WC_Stripe_Logger::log( "Info: Begin processing subscription payment for order {$order_id} for the amount of {$amount}" );
188
+			WC_Stripe_Logger::log("Info: Begin processing subscription payment for order {$order_id} for the amount of {$amount}");
189 189
 
190 190
 			/* If we're doing a retry and source is chargeable, we need to pass
191 191
 			 * a different idempotency key and retry for success.
192 192
 			 */
193
-			if ( is_object( $source_object ) && empty( $source_object->error ) && $this->need_update_idempotency_key( $source_object, $previous_error ) ) {
194
-				add_filter( 'wc_stripe_idempotency_key', array( $this, 'change_idempotency_key' ), 10, 2 );
193
+			if (is_object($source_object) && empty($source_object->error) && $this->need_update_idempotency_key($source_object, $previous_error)) {
194
+				add_filter('wc_stripe_idempotency_key', array($this, 'change_idempotency_key'), 10, 2);
195 195
 			}
196 196
 
197
-			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 ) ) {
197
+			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)) {
198 198
 				// Passing empty source will charge customer default.
199 199
 				$prepared_source->source = '';
200 200
 			}
201 201
 
202
-			$request            = $this->generate_payment_request( $renewal_order, $prepared_source );
202
+			$request            = $this->generate_payment_request($renewal_order, $prepared_source);
203 203
 			$request['capture'] = 'true';
204
-			$request['amount']  = WC_Stripe_Helper::get_stripe_amount( $amount, $request['currency'] );
205
-			$response           = WC_Stripe_API::request( $request );
204
+			$request['amount']  = WC_Stripe_Helper::get_stripe_amount($amount, $request['currency']);
205
+			$response           = WC_Stripe_API::request($request);
206 206
 
207
-			if ( ! empty( $response->error ) ) {
207
+			if ( ! empty($response->error)) {
208 208
 				// We want to retry.
209
-				if ( $this->is_retryable_error( $response->error ) ) {
210
-					if ( $retry ) {
209
+				if ($this->is_retryable_error($response->error)) {
210
+					if ($retry) {
211 211
 						// Don't do anymore retries after this.
212
-						if ( 5 <= $this->retry_interval ) {
213
-							return $this->process_subscription_payment( $amount, $renewal_order, false, $response->error );
212
+						if (5 <= $this->retry_interval) {
213
+							return $this->process_subscription_payment($amount, $renewal_order, false, $response->error);
214 214
 						}
215 215
 
216
-						sleep( $this->retry_interval );
216
+						sleep($this->retry_interval);
217 217
 
218 218
 						$this->retry_interval++;
219 219
 
220
-						return $this->process_subscription_payment( $amount, $renewal_order, true, $response->error );
220
+						return $this->process_subscription_payment($amount, $renewal_order, true, $response->error);
221 221
 					} else {
222
-						$localized_message = __( 'Sorry, we are unable to process your payment at this time. Please retry later.', 'woocommerce-gateway-stripe' );
223
-						$renewal_order->add_order_note( $localized_message );
224
-						throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
222
+						$localized_message = __('Sorry, we are unable to process your payment at this time. Please retry later.', 'woocommerce-gateway-stripe');
223
+						$renewal_order->add_order_note($localized_message);
224
+						throw new WC_Stripe_Exception(print_r($response, true), $localized_message);
225 225
 					}
226 226
 				}
227 227
 
228 228
 				$localized_messages = WC_Stripe_Helper::get_localized_messages();
229 229
 
230
-				if ( 'card_error' === $response->error->type ) {
231
-					$localized_message = isset( $localized_messages[ $response->error->code ] ) ? $localized_messages[ $response->error->code ] : $response->error->message;
230
+				if ('card_error' === $response->error->type) {
231
+					$localized_message = isset($localized_messages[$response->error->code]) ? $localized_messages[$response->error->code] : $response->error->message;
232 232
 				} else {
233
-					$localized_message = isset( $localized_messages[ $response->error->type ] ) ? $localized_messages[ $response->error->type ] : $response->error->message;
233
+					$localized_message = isset($localized_messages[$response->error->type]) ? $localized_messages[$response->error->type] : $response->error->message;
234 234
 				}
235 235
 
236
-				$renewal_order->add_order_note( $localized_message );
236
+				$renewal_order->add_order_note($localized_message);
237 237
 
238
-				throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
238
+				throw new WC_Stripe_Exception(print_r($response, true), $localized_message);
239 239
 			}
240 240
 
241
-			do_action( 'wc_gateway_stripe_process_payment', $response, $renewal_order );
241
+			do_action('wc_gateway_stripe_process_payment', $response, $renewal_order);
242 242
 
243
-			$this->process_response( $response, $renewal_order );
244
-		} catch ( WC_Stripe_Exception $e ) {
245
-			WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() );
243
+			$this->process_response($response, $renewal_order);
244
+		} catch (WC_Stripe_Exception $e) {
245
+			WC_Stripe_Logger::log('Error: ' . $e->getMessage());
246 246
 
247
-			do_action( 'wc_gateway_stripe_process_payment_error', $e, $renewal_order );
247
+			do_action('wc_gateway_stripe_process_payment_error', $e, $renewal_order);
248 248
 
249 249
 			/* translators: error message */
250
-			$renewal_order->update_status( 'failed' );
250
+			$renewal_order->update_status('failed');
251 251
 		}
252 252
 	}
253 253
 
@@ -255,21 +255,21 @@  discard block
 block discarded – undo
255 255
 	 * Don't transfer Stripe customer/token meta to resubscribe orders.
256 256
 	 * @param int $resubscribe_order The order created for the customer to resubscribe to the old expired/cancelled subscription
257 257
 	 */
258
-	public function delete_resubscribe_meta( $resubscribe_order ) {
259
-		delete_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $resubscribe_order->id : $resubscribe_order->get_id() ), '_stripe_customer_id' );
260
-		delete_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $resubscribe_order->id : $resubscribe_order->get_id() ), '_stripe_source_id' );
258
+	public function delete_resubscribe_meta($resubscribe_order) {
259
+		delete_post_meta((WC_Stripe_Helper::is_pre_30() ? $resubscribe_order->id : $resubscribe_order->get_id()), '_stripe_customer_id');
260
+		delete_post_meta((WC_Stripe_Helper::is_pre_30() ? $resubscribe_order->id : $resubscribe_order->get_id()), '_stripe_source_id');
261 261
 		// For BW compat will remove in future
262
-		delete_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $resubscribe_order->id : $resubscribe_order->get_id() ), '_stripe_card_id' );
263
-		$this->delete_renewal_meta( $resubscribe_order );
262
+		delete_post_meta((WC_Stripe_Helper::is_pre_30() ? $resubscribe_order->id : $resubscribe_order->get_id()), '_stripe_card_id');
263
+		$this->delete_renewal_meta($resubscribe_order);
264 264
 	}
265 265
 
266 266
 	/**
267 267
 	 * Don't transfer Stripe fee/ID meta to renewal orders.
268 268
 	 * @param int $resubscribe_order The order created for the customer to resubscribe to the old expired/cancelled subscription
269 269
 	 */
270
-	public function delete_renewal_meta( $renewal_order ) {
271
-		WC_Stripe_Helper::delete_stripe_fee( $renewal_order );
272
-		WC_Stripe_Helper::delete_stripe_net( $renewal_order );
270
+	public function delete_renewal_meta($renewal_order) {
271
+		WC_Stripe_Helper::delete_stripe_fee($renewal_order);
272
+		WC_Stripe_Helper::delete_stripe_net($renewal_order);
273 273
 
274 274
 		return $renewal_order;
275 275
 	}
@@ -283,14 +283,14 @@  discard block
 block discarded – undo
283 283
 	 * @param WC_Order $renewal_order The order which recorded the successful payment (to make up for the failed automatic payment).
284 284
 	 * @return void
285 285
 	 */
286
-	public function update_failing_payment_method( $subscription, $renewal_order ) {
287
-		if ( WC_Stripe_Helper::is_pre_30() ) {
288
-			update_post_meta( $subscription->id, '_stripe_customer_id', $renewal_order->stripe_customer_id );
289
-			update_post_meta( $subscription->id, '_stripe_source_id', $renewal_order->stripe_source_id );
286
+	public function update_failing_payment_method($subscription, $renewal_order) {
287
+		if (WC_Stripe_Helper::is_pre_30()) {
288
+			update_post_meta($subscription->id, '_stripe_customer_id', $renewal_order->stripe_customer_id);
289
+			update_post_meta($subscription->id, '_stripe_source_id', $renewal_order->stripe_source_id);
290 290
 
291 291
 		} else {
292
-			update_post_meta( $subscription->get_id(), '_stripe_customer_id', $renewal_order->get_meta( '_stripe_customer_id', true ) );
293
-			update_post_meta( $subscription->get_id(), '_stripe_source_id', $renewal_order->get_meta( '_stripe_source_id', true ) );
292
+			update_post_meta($subscription->get_id(), '_stripe_customer_id', $renewal_order->get_meta('_stripe_customer_id', true));
293
+			update_post_meta($subscription->get_id(), '_stripe_source_id', $renewal_order->get_meta('_stripe_source_id', true));
294 294
 		}
295 295
 	}
296 296
 
@@ -303,21 +303,21 @@  discard block
 block discarded – undo
303 303
 	 * @param WC_Subscription $subscription An instance of a subscription object
304 304
 	 * @return array
305 305
 	 */
306
-	public function add_subscription_payment_meta( $payment_meta, $subscription ) {
307
-		$source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_source_id', true );
306
+	public function add_subscription_payment_meta($payment_meta, $subscription) {
307
+		$source_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id()), '_stripe_source_id', true);
308 308
 
309 309
 		// For BW compat will remove in future.
310
-		if ( empty( $source_id ) ) {
311
-			$source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_card_id', true );
310
+		if (empty($source_id)) {
311
+			$source_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id()), '_stripe_card_id', true);
312 312
 
313 313
 			// Take this opportunity to update the key name.
314
-			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 );
314
+			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);
315 315
 		}
316 316
 
317
-		$payment_meta[ $this->id ] = array(
317
+		$payment_meta[$this->id] = array(
318 318
 			'post_meta' => array(
319 319
 				'_stripe_customer_id' => array(
320
-					'value' => get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_customer_id', true ),
320
+					'value' => get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id()), '_stripe_customer_id', true),
321 321
 					'label' => 'Stripe Customer ID',
322 322
 				),
323 323
 				'_stripe_source_id' => array(
@@ -338,22 +338,22 @@  discard block
 block discarded – undo
338 338
 	 * @param array $payment_meta associative array of meta data required for automatic payments
339 339
 	 * @return array
340 340
 	 */
341
-	public function validate_subscription_payment_meta( $payment_method_id, $payment_meta ) {
342
-		if ( $this->id === $payment_method_id ) {
341
+	public function validate_subscription_payment_meta($payment_method_id, $payment_meta) {
342
+		if ($this->id === $payment_method_id) {
343 343
 
344
-			if ( ! isset( $payment_meta['post_meta']['_stripe_customer_id']['value'] ) || empty( $payment_meta['post_meta']['_stripe_customer_id']['value'] ) ) {
345
-				throw new Exception( __( 'A "Stripe Customer ID" value is required.', 'woocommerce-gateway-stripe' ) );
346
-			} elseif ( 0 !== strpos( $payment_meta['post_meta']['_stripe_customer_id']['value'], 'cus_' ) ) {
347
-				throw new Exception( __( 'Invalid customer ID. A valid "Stripe Customer ID" must begin with "cus_".', 'woocommerce-gateway-stripe' ) );
344
+			if ( ! isset($payment_meta['post_meta']['_stripe_customer_id']['value']) || empty($payment_meta['post_meta']['_stripe_customer_id']['value'])) {
345
+				throw new Exception(__('A "Stripe Customer ID" value is required.', 'woocommerce-gateway-stripe'));
346
+			} elseif (0 !== strpos($payment_meta['post_meta']['_stripe_customer_id']['value'], 'cus_')) {
347
+				throw new Exception(__('Invalid customer ID. A valid "Stripe Customer ID" must begin with "cus_".', 'woocommerce-gateway-stripe'));
348 348
 			}
349 349
 
350 350
 			if (
351
-				( ! empty( $payment_meta['post_meta']['_stripe_source_id']['value'] )
352
-				&& 0 !== strpos( $payment_meta['post_meta']['_stripe_source_id']['value'], 'card_' ) )
353
-				&& ( ! empty( $payment_meta['post_meta']['_stripe_source_id']['value'] )
354
-				&& 0 !== strpos( $payment_meta['post_meta']['_stripe_source_id']['value'], 'src_' ) ) ) {
351
+				( ! empty($payment_meta['post_meta']['_stripe_source_id']['value'])
352
+				&& 0 !== strpos($payment_meta['post_meta']['_stripe_source_id']['value'], 'card_'))
353
+				&& ( ! empty($payment_meta['post_meta']['_stripe_source_id']['value'])
354
+				&& 0 !== strpos($payment_meta['post_meta']['_stripe_source_id']['value'], 'src_')) ) {
355 355
 
356
-				throw new Exception( __( 'Invalid source ID. A valid source "Stripe Source ID" must begin with "src_" or "card_".', 'woocommerce-gateway-stripe' ) );
356
+				throw new Exception(__('Invalid source ID. A valid source "Stripe Source ID" must begin with "src_" or "card_".', 'woocommerce-gateway-stripe'));
357 357
 			}
358 358
 		}
359 359
 	}
@@ -366,67 +366,67 @@  discard block
 block discarded – undo
366 366
 	 * @param WC_Subscription $subscription the subscription details
367 367
 	 * @return string the subscription payment method
368 368
 	 */
369
-	public function maybe_render_subscription_payment_method( $payment_method_to_display, $subscription ) {
369
+	public function maybe_render_subscription_payment_method($payment_method_to_display, $subscription) {
370 370
 		$customer_user = WC_Stripe_Helper::is_pre_30() ? $subscription->customer_user : $subscription->get_customer_id();
371 371
 
372 372
 		// bail for other payment methods
373
-		if ( ( WC_Stripe_Helper::is_pre_30() ? $subscription->payment_method : $subscription->get_payment_method() ) !== $this->id || ! $customer_user ) {
373
+		if ((WC_Stripe_Helper::is_pre_30() ? $subscription->payment_method : $subscription->get_payment_method()) !== $this->id || ! $customer_user) {
374 374
 			return $payment_method_to_display;
375 375
 		}
376 376
 
377
-		$stripe_source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_source_id', true );
377
+		$stripe_source_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id()), '_stripe_source_id', true);
378 378
 
379 379
 		// For BW compat will remove in future.
380
-		if ( empty( $stripe_source_id ) ) {
381
-			$stripe_source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_card_id', true );
380
+		if (empty($stripe_source_id)) {
381
+			$stripe_source_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id()), '_stripe_card_id', true);
382 382
 
383 383
 			// Take this opportunity to update the key name.
384
-			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 );
384
+			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);
385 385
 		}
386 386
 
387 387
 		$stripe_customer    = new WC_Stripe_Customer();
388
-		$stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_customer_id', true );
388
+		$stripe_customer_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id()), '_stripe_customer_id', true);
389 389
 
390 390
 		// If we couldn't find a Stripe customer linked to the subscription, fallback to the user meta data.
391
-		if ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) {
391
+		if ( ! $stripe_customer_id || ! is_string($stripe_customer_id)) {
392 392
 			$user_id            = $customer_user;
393
-			$stripe_customer_id = get_user_meta( $user_id, '_stripe_customer_id', true );
394
-			$stripe_source_id   = get_user_meta( $user_id, '_stripe_source_id', true );
393
+			$stripe_customer_id = get_user_meta($user_id, '_stripe_customer_id', true);
394
+			$stripe_source_id   = get_user_meta($user_id, '_stripe_source_id', true);
395 395
 
396 396
 			// For BW compat will remove in future.
397
-			if ( empty( $stripe_source_id ) ) {
398
-				$stripe_source_id = get_user_meta( $user_id, '_stripe_card_id', true );
397
+			if (empty($stripe_source_id)) {
398
+				$stripe_source_id = get_user_meta($user_id, '_stripe_card_id', true);
399 399
 
400 400
 				// Take this opportunity to update the key name.
401
-				update_user_meta( $user_id, '_stripe_source_id', $stripe_source_id );
401
+				update_user_meta($user_id, '_stripe_source_id', $stripe_source_id);
402 402
 			}
403 403
 		}
404 404
 
405 405
 		// If we couldn't find a Stripe customer linked to the account, fallback to the order meta data.
406
-		if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) {
407
-			$stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_customer_id', true );
408
-			$stripe_source_id   = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_source_id', true );
406
+		if (( ! $stripe_customer_id || ! is_string($stripe_customer_id)) && false !== $subscription->order) {
407
+			$stripe_customer_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id()), '_stripe_customer_id', true);
408
+			$stripe_source_id   = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id()), '_stripe_source_id', true);
409 409
 
410 410
 			// For BW compat will remove in future.
411
-			if ( empty( $stripe_source_id ) ) {
412
-				$stripe_source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_card_id', true );
411
+			if (empty($stripe_source_id)) {
412
+				$stripe_source_id = get_post_meta((WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id()), '_stripe_card_id', true);
413 413
 
414 414
 				// Take this opportunity to update the key name.
415
-				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 );
415
+				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);
416 416
 			}
417 417
 		}
418 418
 
419
-		$stripe_customer->set_id( $stripe_customer_id );
419
+		$stripe_customer->set_id($stripe_customer_id);
420 420
 		$sources = $stripe_customer->get_sources();
421 421
 
422
-		if ( $sources ) {
423
-			foreach ( $sources as $source ) {
424
-				if ( $source->id === $stripe_source_id ) {
425
-					if ( $source->sepa_debit ) {
422
+		if ($sources) {
423
+			foreach ($sources as $source) {
424
+				if ($source->id === $stripe_source_id) {
425
+					if ($source->sepa_debit) {
426 426
 						/* translators: 1) last 4 digits of SEPA Direct Debit */
427
-						$payment_method_to_display = sprintf( __( 'Via SEPA Direct Debit ending in %1$s', 'woocommerce-gateway-stripe' ), $source->sepa_debit->last4 );
427
+						$payment_method_to_display = sprintf(__('Via SEPA Direct Debit ending in %1$s', 'woocommerce-gateway-stripe'), $source->sepa_debit->last4);
428 428
 					} else {
429
-						$payment_method_to_display = __( 'N/A', 'woocommerce-gateway-stripe' );
429
+						$payment_method_to_display = __('N/A', 'woocommerce-gateway-stripe');
430 430
 					}
431 431
 					break;
432 432
 				}
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit; // Exit if accessed directly
4 4
 }
5 5
 
6 6
 // if uninstall not called from WordPress exit
7
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
7
+if ( ! defined('WP_UNINSTALL_PLUGIN')) {
8 8
 	exit;
9 9
 }
10 10
 
@@ -13,30 +13,30 @@  discard block
 block discarded – undo
13 13
  * wp-config.php. This is to prevent data loss when deleting the plugin from the backend
14 14
  * and to ensure only the site owner can perform this action.
15 15
  */
16
-if ( defined( 'WC_REMOVE_ALL_DATA' ) && true === WC_REMOVE_ALL_DATA ) {
16
+if (defined('WC_REMOVE_ALL_DATA') && true === WC_REMOVE_ALL_DATA) {
17 17
 	// Delete options.
18
-	delete_option( 'woocommerce_stripe_settings' );
19
-	delete_option( 'wc_stripe_show_request_api_notice' );
20
-	delete_option( 'wc_stripe_show_apple_pay_notice' );
21
-	delete_option( 'wc_stripe_show_ssl_notice' );
22
-	delete_option( 'wc_stripe_show_keys_notice' );
23
-	delete_option( 'wc_stripe_show_alipay_notice' );
24
-	delete_option( 'wc_stripe_show_bancontact_notice' );
25
-	delete_option( 'wc_stripe_show_bitcoin_notice' );
26
-	delete_option( 'wc_stripe_show_eps_notice' );
27
-	delete_option( 'wc_stripe_show_giropay_notice' );
28
-	delete_option( 'wc_stripe_show_ideal_notice' );
29
-	delete_option( 'wc_stripe_show_multibanco_notice' );
30
-	delete_option( 'wc_stripe_show_p24_notice' );
31
-	delete_option( 'wc_stripe_show_sepa_notice' );
32
-	delete_option( 'wc_stripe_show_sofort_notice' );
33
-	delete_option( 'wc_stripe_version' );
34
-	delete_option( 'woocommerce_stripe_bancontact_settings' );
35
-	delete_option( 'woocommerce_stripe_alipay_settings' );
36
-	delete_option( 'woocommerce_stripe_bitcoin_settings' );
37
-	delete_option( 'woocommerce_stripe_ideal_settings' );
38
-	delete_option( 'woocommerce_stripe_p24_settings' );
39
-	delete_option( 'woocommerce_stripe_giropay_settings' );
40
-	delete_option( 'woocommerce_stripe_sepa_settings' );
41
-	delete_option( 'woocommerce_stripe_sofort_settings' );
18
+	delete_option('woocommerce_stripe_settings');
19
+	delete_option('wc_stripe_show_request_api_notice');
20
+	delete_option('wc_stripe_show_apple_pay_notice');
21
+	delete_option('wc_stripe_show_ssl_notice');
22
+	delete_option('wc_stripe_show_keys_notice');
23
+	delete_option('wc_stripe_show_alipay_notice');
24
+	delete_option('wc_stripe_show_bancontact_notice');
25
+	delete_option('wc_stripe_show_bitcoin_notice');
26
+	delete_option('wc_stripe_show_eps_notice');
27
+	delete_option('wc_stripe_show_giropay_notice');
28
+	delete_option('wc_stripe_show_ideal_notice');
29
+	delete_option('wc_stripe_show_multibanco_notice');
30
+	delete_option('wc_stripe_show_p24_notice');
31
+	delete_option('wc_stripe_show_sepa_notice');
32
+	delete_option('wc_stripe_show_sofort_notice');
33
+	delete_option('wc_stripe_version');
34
+	delete_option('woocommerce_stripe_bancontact_settings');
35
+	delete_option('woocommerce_stripe_alipay_settings');
36
+	delete_option('woocommerce_stripe_bitcoin_settings');
37
+	delete_option('woocommerce_stripe_ideal_settings');
38
+	delete_option('woocommerce_stripe_p24_settings');
39
+	delete_option('woocommerce_stripe_giropay_settings');
40
+	delete_option('woocommerce_stripe_sepa_settings');
41
+	delete_option('woocommerce_stripe_sofort_settings');
42 42
 }
Please login to merge, or discard this patch.
includes/deprecated/class-wc-stripe-apple-pay.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
6 6
 /**
7 7
  * DEPRECATED DO NOT USE!!
8 8
  */
9
-if ( ! class_exists( 'WC_Stripe_Apple_Pay' ) ) {
9
+if ( ! class_exists('WC_Stripe_Apple_Pay')) {
10 10
 	class WC_Stripe_Apple_Pay {
11 11
 		/**
12 12
 		 * This Instance.
@@ -20,15 +20,15 @@  discard block
 block discarded – undo
20 20
 		}
21 21
 
22 22
 		public static function instance() {
23
-			WC_Stripe_Logger::log( 'DEPRECATED! WC_Stripe_Apple_Pay class has been hard deprecated. Please remove any code that references this class or instance. This class will be removed by version 4.2' );
23
+			WC_Stripe_Logger::log('DEPRECATED! WC_Stripe_Apple_Pay class has been hard deprecated. Please remove any code that references this class or instance. This class will be removed by version 4.2');
24 24
 			return self::$_this;
25 25
 		}
26 26
 
27
-		public function __get( $var ) {
27
+		public function __get($var) {
28 28
 			return null;
29 29
 		}
30 30
 
31
-		public function __call( $name, $arguments ) {
31
+		public function __call($name, $arguments) {
32 32
 			return null;
33 33
 		}
34 34
 	}
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-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.