Completed
Pull Request — master (#848)
by Roy
03:00
created
includes/class-wc-stripe-helper.php 1 patch
Spacing   +96 added lines, -96 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
 
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
 	 * @param object $order
23 23
 	 * @return string $currency
24 24
 	 */
25
-	public static function get_stripe_currency( $order = null ) {
26
-		if ( is_null( $order ) ) {
25
+	public static function get_stripe_currency($order = null) {
26
+		if (is_null($order)) {
27 27
 			return false;
28 28
 		}
29 29
 
30
-		$order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id();
30
+		$order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id();
31 31
 
32
-		return WC_Stripe_Helper::is_wc_lt( '3.0' ) ? get_post_meta( $order_id, self::META_NAME_STRIPE_CURRENCY, true ) : $order->get_meta( self::META_NAME_STRIPE_CURRENCY, true );
32
+		return WC_Stripe_Helper::is_wc_lt('3.0') ? get_post_meta($order_id, self::META_NAME_STRIPE_CURRENCY, true) : $order->get_meta(self::META_NAME_STRIPE_CURRENCY, true);
33 33
 	}
34 34
 
35 35
 	/**
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 	 * @param object $order
40 40
 	 * @param string $currency
41 41
 	 */
42
-	public static function update_stripe_currency( $order = null, $currency ) {
43
-		if ( is_null( $order ) ) {
42
+	public static function update_stripe_currency($order = null, $currency) {
43
+		if (is_null($order)) {
44 44
 			return false;
45 45
 		}
46 46
 
47
-		$order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id();
47
+		$order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id();
48 48
 
49
-		WC_Stripe_Helper::is_wc_lt( '3.0' ) ? update_post_meta( $order_id, self::META_NAME_STRIPE_CURRENCY, $currency ) : $order->update_meta_data( self::META_NAME_STRIPE_CURRENCY, $currency );
49
+		WC_Stripe_Helper::is_wc_lt('3.0') ? update_post_meta($order_id, self::META_NAME_STRIPE_CURRENCY, $currency) : $order->update_meta_data(self::META_NAME_STRIPE_CURRENCY, $currency);
50 50
 	}
51 51
 
52 52
 	/**
@@ -56,22 +56,22 @@  discard block
 block discarded – undo
56 56
 	 * @param object $order
57 57
 	 * @return string $amount
58 58
 	 */
59
-	public static function get_stripe_fee( $order = null ) {
60
-		if ( is_null( $order ) ) {
59
+	public static function get_stripe_fee($order = null) {
60
+		if (is_null($order)) {
61 61
 			return false;
62 62
 		}
63 63
 
64
-		$order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id();
64
+		$order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id();
65 65
 
66
-		$amount = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? get_post_meta( $order_id, self::META_NAME_FEE, true ) : $order->get_meta( self::META_NAME_FEE, true );
66
+		$amount = WC_Stripe_Helper::is_wc_lt('3.0') ? get_post_meta($order_id, self::META_NAME_FEE, true) : $order->get_meta(self::META_NAME_FEE, true);
67 67
 
68 68
 		// If not found let's check for legacy name.
69
-		if ( empty( $amount ) ) {
70
-			$amount = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? get_post_meta( $order_id, self::LEGACY_META_NAME_FEE, true ) : $order->get_meta( self::LEGACY_META_NAME_FEE, true );
69
+		if (empty($amount)) {
70
+			$amount = WC_Stripe_Helper::is_wc_lt('3.0') ? get_post_meta($order_id, self::LEGACY_META_NAME_FEE, true) : $order->get_meta(self::LEGACY_META_NAME_FEE, true);
71 71
 
72 72
 			// If found update to new name.
73
-			if ( $amount ) {
74
-				self::update_stripe_fee( $order, $amount );
73
+			if ($amount) {
74
+				self::update_stripe_fee($order, $amount);
75 75
 			}
76 76
 		}
77 77
 
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
 	 * @param object $order
86 86
 	 * @param float $amount
87 87
 	 */
88
-	public static function update_stripe_fee( $order = null, $amount = 0.0 ) {
89
-		if ( is_null( $order ) ) {
88
+	public static function update_stripe_fee($order = null, $amount = 0.0) {
89
+		if (is_null($order)) {
90 90
 			return false;
91 91
 		}
92 92
 
93
-		$order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id();
93
+		$order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id();
94 94
 
95
-		WC_Stripe_Helper::is_wc_lt( '3.0' ) ? update_post_meta( $order_id, self::META_NAME_FEE, $amount ) : $order->update_meta_data( self::META_NAME_FEE, $amount );
95
+		WC_Stripe_Helper::is_wc_lt('3.0') ? update_post_meta($order_id, self::META_NAME_FEE, $amount) : $order->update_meta_data(self::META_NAME_FEE, $amount);
96 96
 	}
97 97
 
98 98
 	/**
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 	 * @since 4.1.0
102 102
 	 * @param object $order
103 103
 	 */
104
-	public static function delete_stripe_fee( $order = null ) {
105
-		if ( is_null( $order ) ) {
104
+	public static function delete_stripe_fee($order = null) {
105
+		if (is_null($order)) {
106 106
 			return false;
107 107
 		}
108 108
 
109
-		$order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id();
109
+		$order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id();
110 110
 
111
-		delete_post_meta( $order_id, self::META_NAME_FEE );
112
-		delete_post_meta( $order_id, self::LEGACY_META_NAME_FEE );
111
+		delete_post_meta($order_id, self::META_NAME_FEE);
112
+		delete_post_meta($order_id, self::LEGACY_META_NAME_FEE);
113 113
 	}
114 114
 
115 115
 	/**
@@ -119,22 +119,22 @@  discard block
 block discarded – undo
119 119
 	 * @param object $order
120 120
 	 * @return string $amount
121 121
 	 */
122
-	public static function get_stripe_net( $order = null ) {
123
-		if ( is_null( $order ) ) {
122
+	public static function get_stripe_net($order = null) {
123
+		if (is_null($order)) {
124 124
 			return false;
125 125
 		}
126 126
 
127
-		$order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id();
127
+		$order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id();
128 128
 
129
-		$amount = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? get_post_meta( $order_id, self::META_NAME_NET, true ) : $order->get_meta( self::META_NAME_NET, true );
129
+		$amount = WC_Stripe_Helper::is_wc_lt('3.0') ? get_post_meta($order_id, self::META_NAME_NET, true) : $order->get_meta(self::META_NAME_NET, true);
130 130
 
131 131
 		// If not found let's check for legacy name.
132
-		if ( empty( $amount ) ) {
133
-			$amount = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? get_post_meta( $order_id, self::LEGACY_META_NAME_NET, true ) : $order->get_meta( self::LEGACY_META_NAME_NET, true );
132
+		if (empty($amount)) {
133
+			$amount = WC_Stripe_Helper::is_wc_lt('3.0') ? get_post_meta($order_id, self::LEGACY_META_NAME_NET, true) : $order->get_meta(self::LEGACY_META_NAME_NET, true);
134 134
 
135 135
 			// If found update to new name.
136
-			if ( $amount ) {
137
-				self::update_stripe_net( $order, $amount );
136
+			if ($amount) {
137
+				self::update_stripe_net($order, $amount);
138 138
 			}
139 139
 		}
140 140
 
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 	 * @param object $order
149 149
 	 * @param float $amount
150 150
 	 */
151
-	public static function update_stripe_net( $order = null, $amount = 0.0 ) {
152
-		if ( is_null( $order ) ) {
151
+	public static function update_stripe_net($order = null, $amount = 0.0) {
152
+		if (is_null($order)) {
153 153
 			return false;
154 154
 		}
155 155
 
156
-		$order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id();
156
+		$order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id();
157 157
 
158
-		WC_Stripe_Helper::is_wc_lt( '3.0' ) ? update_post_meta( $order_id, self::META_NAME_NET, $amount ) : $order->update_meta_data( self::META_NAME_NET, $amount );
158
+		WC_Stripe_Helper::is_wc_lt('3.0') ? update_post_meta($order_id, self::META_NAME_NET, $amount) : $order->update_meta_data(self::META_NAME_NET, $amount);
159 159
 	}
160 160
 
161 161
 	/**
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
 	 * @since 4.1.0
165 165
 	 * @param object $order
166 166
 	 */
167
-	public static function delete_stripe_net( $order = null ) {
168
-		if ( is_null( $order ) ) {
167
+	public static function delete_stripe_net($order = null) {
168
+		if (is_null($order)) {
169 169
 			return false;
170 170
 		}
171 171
 
172
-		$order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id();
172
+		$order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id();
173 173
 
174
-		delete_post_meta( $order_id, self::META_NAME_NET );
175
-		delete_post_meta( $order_id, self::LEGACY_META_NAME_NET );
174
+		delete_post_meta($order_id, self::META_NAME_NET);
175
+		delete_post_meta($order_id, self::LEGACY_META_NAME_NET);
176 176
 	}
177 177
 
178 178
 	/**
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
 	 *
184 184
 	 * @return float|int
185 185
 	 */
186
-	public static function get_stripe_amount( $total, $currency = '' ) {
187
-		if ( ! $currency ) {
186
+	public static function get_stripe_amount($total, $currency = '') {
187
+		if ( ! $currency) {
188 188
 			$currency = get_woocommerce_currency();
189 189
 		}
190 190
 
191
-		if ( in_array( strtolower( $currency ), self::no_decimal_currencies() ) ) {
192
-			return absint( $total );
191
+		if (in_array(strtolower($currency), self::no_decimal_currencies())) {
192
+			return absint($total);
193 193
 		} else {
194
-			return absint( wc_format_decimal( ( (float) $total * 100 ), wc_get_price_decimals() ) ); // In cents.
194
+			return absint(wc_format_decimal(((float) $total * 100), wc_get_price_decimals())); // In cents.
195 195
 		}
196 196
 	}
197 197
 
@@ -206,23 +206,23 @@  discard block
 block discarded – undo
206 206
 		return apply_filters(
207 207
 			'wc_stripe_localized_messages',
208 208
 			array(
209
-				'invalid_number'           => __( 'The card number is not a valid credit card number.', 'woocommerce-gateway-stripe' ),
210
-				'invalid_expiry_month'     => __( 'The card\'s expiration month is invalid.', 'woocommerce-gateway-stripe' ),
211
-				'invalid_expiry_year'      => __( 'The card\'s expiration year is invalid.', 'woocommerce-gateway-stripe' ),
212
-				'invalid_cvc'              => __( 'The card\'s security code is invalid.', 'woocommerce-gateway-stripe' ),
213
-				'incorrect_number'         => __( 'The card number is incorrect.', 'woocommerce-gateway-stripe' ),
214
-				'incomplete_number'        => __( 'The card number is incomplete.', 'woocommerce-gateway-stripe' ),
215
-				'incomplete_cvc'           => __( 'The card\'s security code is incomplete.', 'woocommerce-gateway-stripe' ),
216
-				'incomplete_expiry'        => __( 'The card\'s expiration date is incomplete.', 'woocommerce-gateway-stripe' ),
217
-				'expired_card'             => __( 'The card has expired.', 'woocommerce-gateway-stripe' ),
218
-				'incorrect_cvc'            => __( 'The card\'s security code is incorrect.', 'woocommerce-gateway-stripe' ),
219
-				'incorrect_zip'            => __( 'The card\'s zip code failed validation.', 'woocommerce-gateway-stripe' ),
220
-				'invalid_expiry_year_past' => __( 'The card\'s expiration year is in the past', 'woocommerce-gateway-stripe' ),
221
-				'card_declined'            => __( 'The card was declined.', 'woocommerce-gateway-stripe' ),
222
-				'missing'                  => __( 'There is no card on a customer that is being charged.', 'woocommerce-gateway-stripe' ),
223
-				'processing_error'         => __( 'An error occurred while processing the card.', 'woocommerce-gateway-stripe' ),
224
-				'invalid_request_error'    => __( 'Unable to process this payment, please try again or use alternative method.', 'woocommerce-gateway-stripe' ),
225
-				'invalid_sofort_country'   => __( 'The billing country is not accepted by SOFORT. Please try another country.', 'woocommerce-gateway-stripe' ),
209
+				'invalid_number'           => __('The card number is not a valid credit card number.', 'woocommerce-gateway-stripe'),
210
+				'invalid_expiry_month'     => __('The card\'s expiration month is invalid.', 'woocommerce-gateway-stripe'),
211
+				'invalid_expiry_year'      => __('The card\'s expiration year is invalid.', 'woocommerce-gateway-stripe'),
212
+				'invalid_cvc'              => __('The card\'s security code is invalid.', 'woocommerce-gateway-stripe'),
213
+				'incorrect_number'         => __('The card number is incorrect.', 'woocommerce-gateway-stripe'),
214
+				'incomplete_number'        => __('The card number is incomplete.', 'woocommerce-gateway-stripe'),
215
+				'incomplete_cvc'           => __('The card\'s security code is incomplete.', 'woocommerce-gateway-stripe'),
216
+				'incomplete_expiry'        => __('The card\'s expiration date is incomplete.', 'woocommerce-gateway-stripe'),
217
+				'expired_card'             => __('The card has expired.', 'woocommerce-gateway-stripe'),
218
+				'incorrect_cvc'            => __('The card\'s security code is incorrect.', 'woocommerce-gateway-stripe'),
219
+				'incorrect_zip'            => __('The card\'s zip code failed validation.', 'woocommerce-gateway-stripe'),
220
+				'invalid_expiry_year_past' => __('The card\'s expiration year is in the past', 'woocommerce-gateway-stripe'),
221
+				'card_declined'            => __('The card was declined.', 'woocommerce-gateway-stripe'),
222
+				'missing'                  => __('There is no card on a customer that is being charged.', 'woocommerce-gateway-stripe'),
223
+				'processing_error'         => __('An error occurred while processing the card.', 'woocommerce-gateway-stripe'),
224
+				'invalid_request_error'    => __('Unable to process this payment, please try again or use alternative method.', 'woocommerce-gateway-stripe'),
225
+				'invalid_sofort_country'   => __('The billing country is not accepted by SOFORT. Please try another country.', 'woocommerce-gateway-stripe'),
226 226
 			)
227 227
 		);
228 228
 	}
@@ -261,24 +261,24 @@  discard block
 block discarded – undo
261 261
 	 * @param string $type Type of number to format
262 262
 	 * @return string
263 263
 	 */
264
-	public static function format_balance_fee( $balance_transaction, $type = 'fee' ) {
265
-		if ( ! is_object( $balance_transaction ) ) {
264
+	public static function format_balance_fee($balance_transaction, $type = 'fee') {
265
+		if ( ! is_object($balance_transaction)) {
266 266
 			return;
267 267
 		}
268 268
 
269
-		if ( in_array( strtolower( $balance_transaction->currency ), self::no_decimal_currencies() ) ) {
270
-			if ( 'fee' === $type ) {
269
+		if (in_array(strtolower($balance_transaction->currency), self::no_decimal_currencies())) {
270
+			if ('fee' === $type) {
271 271
 				return $balance_transaction->fee;
272 272
 			}
273 273
 
274 274
 			return $balance_transaction->net;
275 275
 		}
276 276
 
277
-		if ( 'fee' === $type ) {
278
-			return number_format( $balance_transaction->fee / 100, 2, '.', '' );
277
+		if ('fee' === $type) {
278
+			return number_format($balance_transaction->fee / 100, 2, '.', '');
279 279
 		}
280 280
 
281
-		return number_format( $balance_transaction->net / 100, 2, '.', '' );
281
+		return number_format($balance_transaction->net / 100, 2, '.', '');
282 282
 	}
283 283
 
284 284
 	/**
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	public static function get_minimum_amount() {
288 288
 		// Check order amount
289
-		switch ( get_woocommerce_currency() ) {
289
+		switch (get_woocommerce_currency()) {
290 290
 			case 'USD':
291 291
 			case 'CAD':
292 292
 			case 'EUR':
@@ -331,14 +331,14 @@  discard block
 block discarded – undo
331 331
 	 * @param string $method The payment method to get the settings from.
332 332
 	 * @param string $setting The name of the setting to get.
333 333
 	 */
334
-	public static function get_settings( $method = null, $setting = null ) {
335
-		$all_settings = null === $method ? get_option( 'woocommerce_stripe_settings', array() ) : get_option( 'woocommerce_stripe_' . $method . '_settings', array() );
334
+	public static function get_settings($method = null, $setting = null) {
335
+		$all_settings = null === $method ? get_option('woocommerce_stripe_settings', array()) : get_option('woocommerce_stripe_' . $method . '_settings', array());
336 336
 
337
-		if ( null === $setting ) {
337
+		if (null === $setting) {
338 338
 			return $all_settings;
339 339
 		}
340 340
 
341
-		return isset( $all_settings[ $setting ] ) ? $all_settings[ $setting ] : '';
341
+		return isset($all_settings[$setting]) ? $all_settings[$setting] : '';
342 342
 	}
343 343
 
344 344
 	/**
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	 * @return bool
349 349
 	 */
350 350
 	public static function is_pre_orders_exists() {
351
-		return class_exists( 'WC_Pre_Orders_Order' );
351
+		return class_exists('WC_Pre_Orders_Order');
352 352
 	}
353 353
 
354 354
 	/**
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 	 * @return bool
361 361
 	 */
362 362
 	public static function is_pre_30() {
363
-		error_log( 'is_pre_30() function has been deprecated since 4.1.11. Please use is_wc_lt( $version ) instead.' );
363
+		error_log('is_pre_30() function has been deprecated since 4.1.11. Please use is_wc_lt( $version ) instead.');
364 364
 
365
-		return self::is_wc_lt( '3.0' );
365
+		return self::is_wc_lt('3.0');
366 366
 	}
367 367
 
368 368
 	/**
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
 	 * @param string $version Version to check against.
373 373
 	 * @return bool
374 374
 	 */
375
-	public static function is_wc_lt( $version ) {
376
-		return version_compare( WC_VERSION, $version, '<' );
375
+	public static function is_wc_lt($version) {
376
+		return version_compare(WC_VERSION, $version, '<');
377 377
 	}
378 378
 
379 379
 	/**
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 	 * @return string
387 387
 	 */
388 388
 	public static function get_webhook_url() {
389
-		return add_query_arg( 'wc-api', 'wc_stripe', trailingslashit( get_home_url() ) );
389
+		return add_query_arg('wc-api', 'wc_stripe', trailingslashit(get_home_url()));
390 390
 	}
391 391
 
392 392
 	/**
@@ -396,13 +396,13 @@  discard block
 block discarded – undo
396 396
 	 * @version 4.0.0
397 397
 	 * @param string $source_id
398 398
 	 */
399
-	public static function get_order_by_source_id( $source_id ) {
399
+	public static function get_order_by_source_id($source_id) {
400 400
 		global $wpdb;
401 401
 
402
-		$order_id = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT ID FROM $wpdb->posts as posts LEFT JOIN $wpdb->postmeta as meta ON posts.ID = meta.post_id WHERE meta.meta_value = %s AND meta.meta_key = %s", $source_id, '_stripe_source_id' ) );
402
+		$order_id = $wpdb->get_var($wpdb->prepare("SELECT DISTINCT ID FROM $wpdb->posts as posts LEFT JOIN $wpdb->postmeta as meta ON posts.ID = meta.post_id WHERE meta.meta_value = %s AND meta.meta_key = %s", $source_id, '_stripe_source_id'));
403 403
 
404
-		if ( ! empty( $order_id ) ) {
405
-			return wc_get_order( $order_id );
404
+		if ( ! empty($order_id)) {
405
+			return wc_get_order($order_id);
406 406
 		}
407 407
 
408 408
 		return false;
@@ -415,17 +415,17 @@  discard block
 block discarded – undo
415 415
 	 * @since 4.1.16 Return false if charge_id is empty.
416 416
 	 * @param string $charge_id
417 417
 	 */
418
-	public static function get_order_by_charge_id( $charge_id ) {
418
+	public static function get_order_by_charge_id($charge_id) {
419 419
 		global $wpdb;
420 420
 
421
-		if ( empty( $charge_id ) ) {
421
+		if (empty($charge_id)) {
422 422
 			return false;
423 423
 		}
424 424
 
425
-		$order_id = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT ID FROM $wpdb->posts as posts LEFT JOIN $wpdb->postmeta as meta ON posts.ID = meta.post_id WHERE meta.meta_value = %s AND meta.meta_key = %s", $charge_id, '_transaction_id' ) );
425
+		$order_id = $wpdb->get_var($wpdb->prepare("SELECT DISTINCT ID FROM $wpdb->posts as posts LEFT JOIN $wpdb->postmeta as meta ON posts.ID = meta.post_id WHERE meta.meta_value = %s AND meta.meta_key = %s", $charge_id, '_transaction_id'));
426 426
 
427
-		if ( ! empty( $order_id ) ) {
428
-			return wc_get_order( $order_id );
427
+		if ( ! empty($order_id)) {
428
+			return wc_get_order($order_id);
429 429
 		}
430 430
 
431 431
 		return false;
@@ -441,13 +441,13 @@  discard block
 block discarded – undo
441 441
 	 * @param string $statement_descriptor
442 442
 	 * @return string $statement_descriptor Sanitized statement descriptor
443 443
 	 */
444
-	public static function clean_statement_descriptor( $statement_descriptor = '' ) {
445
-		$disallowed_characters = array( '<', '>', '"', "'" );
444
+	public static function clean_statement_descriptor($statement_descriptor = '') {
445
+		$disallowed_characters = array('<', '>', '"', "'");
446 446
 
447 447
 		// Remove special characters.
448
-		$statement_descriptor = str_replace( $disallowed_characters, '', $statement_descriptor );
448
+		$statement_descriptor = str_replace($disallowed_characters, '', $statement_descriptor);
449 449
 
450
-		$statement_descriptor = substr( trim( $statement_descriptor ), 0, 22 );
450
+		$statement_descriptor = substr(trim($statement_descriptor), 0, 22);
451 451
 
452 452
 		return $statement_descriptor;
453 453
 	}
Please login to merge, or discard this patch.