Completed
Push — master ( 7e98cf...023f04 )
by Roy
02:08
created
includes/admin/stripe-p24-settings.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,46 +1,46 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
6 6
 $webhook_url = WC_Stripe_Helper::get_webhook_url();
7 7
 
8
-return apply_filters( 'wc_stripe_p24_settings',
8
+return apply_filters('wc_stripe_p24_settings',
9 9
 	array(
10 10
 		'geo_target' => array(
11
-			'description' => __( 'Relevant Payer Geography: Poland', 'woocommerce-gateway-stripe' ),
11
+			'description' => __('Relevant Payer Geography: Poland', 'woocommerce-gateway-stripe'),
12 12
 			'type'        => 'title',
13 13
 		),
14 14
 		'activation' => array(
15
-			'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' ),
15
+			'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'),
16 16
 			'type'   => 'title',
17 17
 		),
18 18
 		'enabled' => array(
19
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
20
-			'label'       => __( 'Enable Stripe P24', 'woocommerce-gateway-stripe' ),
19
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
20
+			'label'       => __('Enable Stripe P24', 'woocommerce-gateway-stripe'),
21 21
 			'type'        => 'checkbox',
22 22
 			'description' => '',
23 23
 			'default'     => 'no',
24 24
 		),
25 25
 		'title' => array(
26
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
26
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
27 27
 			'type'        => 'text',
28
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
29
-			'default'     => __( 'Przelewy24 (P24)', 'woocommerce-gateway-stripe' ),
28
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
29
+			'default'     => __('Przelewy24 (P24)', 'woocommerce-gateway-stripe'),
30 30
 			'desc_tip'    => true,
31 31
 		),
32 32
 		'description' => array(
33
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
33
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
34 34
 			'type'        => 'text',
35
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
36
-			'default'     => __( 'You will be redirected to P24.', 'woocommerce-gateway-stripe' ),
35
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
36
+			'default'     => __('You will be redirected to P24.', 'woocommerce-gateway-stripe'),
37 37
 			'desc_tip'    => true,
38 38
 		),
39 39
 		'webhook' => array(
40
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
40
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
41 41
 			'type'        => 'title',
42 42
 			/* translators: webhook URL */
43
-			'description' => sprintf( __( 'You must add the webhook endpoint <strong style="background-color:#ddd;">&nbsp;&nbsp;%s&nbsp;&nbsp;</strong> to your Stripe Account Settings <a href="https://dashboard.stripe.com/account/webhooks" target="_blank">Here</a> so you can receive notifications on the charge statuses.', 'woocommerce-gateway-stripe' ), $webhook_url ),
43
+			'description' => sprintf(__('You must add the webhook endpoint <strong style="background-color:#ddd;">&nbsp;&nbsp;%s&nbsp;&nbsp;</strong> to your Stripe Account Settings <a href="https://dashboard.stripe.com/account/webhooks" target="_blank">Here</a> so you can receive notifications on the charge statuses.', 'woocommerce-gateway-stripe'), $webhook_url),
44 44
 		),
45 45
 	)
46 46
 );
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +17 added lines, -17 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,20 +13,20 @@  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_version' );
24
-	delete_option( 'woocommerce_stripe_bancontact_settings' );
25
-	delete_option( 'woocommerce_stripe_alipay_settings' );
26
-	delete_option( 'woocommerce_stripe_bitcoin_settings' );
27
-	delete_option( 'woocommerce_stripe_ideal_settings' );
28
-	delete_option( 'woocommerce_stripe_p24_settings' );
29
-	delete_option( 'woocommerce_stripe_giropay_settings' );
30
-	delete_option( 'woocommerce_stripe_sepa_settings' );
31
-	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_version');
24
+	delete_option('woocommerce_stripe_bancontact_settings');
25
+	delete_option('woocommerce_stripe_alipay_settings');
26
+	delete_option('woocommerce_stripe_bitcoin_settings');
27
+	delete_option('woocommerce_stripe_ideal_settings');
28
+	delete_option('woocommerce_stripe_p24_settings');
29
+	delete_option('woocommerce_stripe_giropay_settings');
30
+	delete_option('woocommerce_stripe_sepa_settings');
31
+	delete_option('woocommerce_stripe_sofort_settings');
32 32
 }
Please login to merge, or discard this patch.
includes/class-wc-stripe-exception.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @since 4.0.2
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if ( ! defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	 * @param string $error_message Full response
24 24
 	 * @param string $localized_message user-friendly translated error message
25 25
 	 */
26
-	public function __construct( $error_message = '', $localized_message = '' ) {
26
+	public function __construct($error_message = '', $localized_message = '') {
27 27
 		$this->localized_message = $localized_message;
28
-		parent::__construct( $error_message );
28
+		parent::__construct($error_message);
29 29
 	}
30 30
 
31 31
 	/**
Please login to merge, or discard this patch.
includes/class-wc-stripe-helper.php 1 patch
Spacing   +51 added lines, -51 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
 
@@ -17,15 +17,15 @@  discard block
 block discarded – undo
17 17
 	 *
18 18
 	 * @return float|int
19 19
 	 */
20
-	public static function get_stripe_amount( $total, $currency = '' ) {
21
-		if ( ! $currency ) {
20
+	public static function get_stripe_amount($total, $currency = '') {
21
+		if ( ! $currency) {
22 22
 			$currency = get_woocommerce_currency();
23 23
 		}
24 24
 
25
-		if ( in_array( strtolower( $currency ), self::no_decimal_currencies() ) ) {
26
-			return absint( $total );
25
+		if (in_array(strtolower($currency), self::no_decimal_currencies())) {
26
+			return absint($total);
27 27
 		} else {
28
-			return absint( wc_format_decimal( ( (float) $total * 100 ), wc_get_price_decimals() ) ); // In cents.
28
+			return absint(wc_format_decimal(((float) $total * 100), wc_get_price_decimals())); // In cents.
29 29
 		}
30 30
 	}
31 31
 
@@ -37,25 +37,25 @@  discard block
 block discarded – undo
37 37
 	 * @return array
38 38
 	 */
39 39
 	public static function get_localized_messages() {
40
-		return apply_filters( 'wc_stripe_localized_messages', array(
41
-			'invalid_number'           => __( 'The card number is not a valid credit card number.', 'woocommerce-gateway-stripe' ),
42
-			'invalid_expiry_month'     => __( 'The card\'s expiration month is invalid.', 'woocommerce-gateway-stripe' ),
43
-			'invalid_expiry_year'      => __( 'The card\'s expiration year is invalid.', 'woocommerce-gateway-stripe' ),
44
-			'invalid_cvc'              => __( 'The card\'s security code is invalid.', 'woocommerce-gateway-stripe' ),
45
-			'incorrect_number'         => __( 'The card number is incorrect.', 'woocommerce-gateway-stripe' ),
46
-			'incomplete_number'        => __( 'The card number is incomplete.', 'woocommerce-gateway-stripe' ),
47
-			'incomplete_cvc'           => __( 'The card\'s security code is incomplete.', 'woocommerce-gateway-stripe' ),
48
-			'incomplete_expiry'        => __( 'The card\'s expiration date is incomplete.', 'woocommerce-gateway-stripe' ),
49
-			'expired_card'             => __( 'The card has expired.', 'woocommerce-gateway-stripe' ),
50
-			'incorrect_cvc'            => __( 'The card\'s security code is incorrect.', 'woocommerce-gateway-stripe' ),
51
-			'incorrect_zip'            => __( 'The card\'s zip code failed validation.', 'woocommerce-gateway-stripe' ),
52
-			'invalid_expiry_year_past' => __( 'The card\'s expiration year is in the past', 'woocommerce-gateway-stripe' ),
53
-			'card_declined'            => __( 'The card was declined.', 'woocommerce-gateway-stripe' ),
54
-			'missing'                  => __( 'There is no card on a customer that is being charged.', 'woocommerce-gateway-stripe' ),
55
-			'processing_error'         => __( 'An error occurred while processing the card.', 'woocommerce-gateway-stripe' ),
56
-			'invalid_request_error'    => __( 'Unable to process this payment, please try again or use alternative method.', 'woocommerce-gateway-stripe' ),
57
-			'invalid_sofort_country'   => __( 'The billing country is not accepted by SOFORT. Please try another country.', 'woocommerce-gateway-stripe' ),
58
-		) );
40
+		return apply_filters('wc_stripe_localized_messages', array(
41
+			'invalid_number'           => __('The card number is not a valid credit card number.', 'woocommerce-gateway-stripe'),
42
+			'invalid_expiry_month'     => __('The card\'s expiration month is invalid.', 'woocommerce-gateway-stripe'),
43
+			'invalid_expiry_year'      => __('The card\'s expiration year is invalid.', 'woocommerce-gateway-stripe'),
44
+			'invalid_cvc'              => __('The card\'s security code is invalid.', 'woocommerce-gateway-stripe'),
45
+			'incorrect_number'         => __('The card number is incorrect.', 'woocommerce-gateway-stripe'),
46
+			'incomplete_number'        => __('The card number is incomplete.', 'woocommerce-gateway-stripe'),
47
+			'incomplete_cvc'           => __('The card\'s security code is incomplete.', 'woocommerce-gateway-stripe'),
48
+			'incomplete_expiry'        => __('The card\'s expiration date is incomplete.', 'woocommerce-gateway-stripe'),
49
+			'expired_card'             => __('The card has expired.', 'woocommerce-gateway-stripe'),
50
+			'incorrect_cvc'            => __('The card\'s security code is incorrect.', 'woocommerce-gateway-stripe'),
51
+			'incorrect_zip'            => __('The card\'s zip code failed validation.', 'woocommerce-gateway-stripe'),
52
+			'invalid_expiry_year_past' => __('The card\'s expiration year is in the past', 'woocommerce-gateway-stripe'),
53
+			'card_declined'            => __('The card was declined.', 'woocommerce-gateway-stripe'),
54
+			'missing'                  => __('There is no card on a customer that is being charged.', 'woocommerce-gateway-stripe'),
55
+			'processing_error'         => __('An error occurred while processing the card.', 'woocommerce-gateway-stripe'),
56
+			'invalid_request_error'    => __('Unable to process this payment, please try again or use alternative method.', 'woocommerce-gateway-stripe'),
57
+			'invalid_sofort_country'   => __('The billing country is not accepted by SOFORT. Please try another country.', 'woocommerce-gateway-stripe'),
58
+		));
59 59
 	}
60 60
 
61 61
 	/**
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
 	 * @param string $type Type of number to format
93 93
 	 * @return string
94 94
 	 */
95
-	public static function format_balance_fee( $balance_transaction, $type = 'fee' ) {
96
-		if ( ! is_object( $balance_transaction ) ) {
95
+	public static function format_balance_fee($balance_transaction, $type = 'fee') {
96
+		if ( ! is_object($balance_transaction)) {
97 97
 			return;
98 98
 		}
99 99
 
100
-		if ( in_array( strtolower( $balance_transaction->currency ), self::no_decimal_currencies() ) ) {
101
-			if ( 'fee' === $type ) {
100
+		if (in_array(strtolower($balance_transaction->currency), self::no_decimal_currencies())) {
101
+			if ('fee' === $type) {
102 102
 				return $balance_transaction->fee;
103 103
 			}
104 104
 
105 105
 			return $balance_transaction->net;
106 106
 		}
107 107
 
108
-		if ( 'fee' === $type ) {
109
-			return number_format( $balance_transaction->fee / 100, 2, '.', '' );
108
+		if ('fee' === $type) {
109
+			return number_format($balance_transaction->fee / 100, 2, '.', '');
110 110
 		}
111 111
 
112
-		return number_format( $balance_transaction->net / 100, 2, '.', '' );
112
+		return number_format($balance_transaction->net / 100, 2, '.', '');
113 113
 	}
114 114
 
115 115
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public static function get_minimum_amount() {
119 119
 		// Check order amount
120
-		switch ( get_woocommerce_currency() ) {
120
+		switch (get_woocommerce_currency()) {
121 121
 			case 'USD':
122 122
 			case 'CAD':
123 123
 			case 'EUR':
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 	 * @param string $method The payment method to get the settings from.
163 163
 	 * @param string $setting The name of the setting to get.
164 164
 	 */
165
-	public static function get_settings( $method = null, $setting = null ) {
166
-		$all_settings = null === $method ? get_option( 'woocommerce_stripe_settings', array() ) : get_option( 'woocommerce_stripe_' . $method . '_settings', array() );
165
+	public static function get_settings($method = null, $setting = null) {
166
+		$all_settings = null === $method ? get_option('woocommerce_stripe_settings', array()) : get_option('woocommerce_stripe_' . $method . '_settings', array());
167 167
 
168
-		if ( null === $setting ) {
168
+		if (null === $setting) {
169 169
 			return $all_settings;
170 170
 		}
171 171
 
172
-		return isset( $all_settings[ $setting ] ) ? $all_settings[ $setting ] : '';
172
+		return isset($all_settings[$setting]) ? $all_settings[$setting] : '';
173 173
 	}
174 174
 
175 175
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 * @return bool
181 181
 	 */
182 182
 	public static function is_pre_30() {
183
-		return version_compare( WC_VERSION, '3.0.0', '<' );
183
+		return version_compare(WC_VERSION, '3.0.0', '<');
184 184
 	}
185 185
 
186 186
 	/**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 * @return string
194 194
 	 */
195 195
 	public static function get_webhook_url() {
196
-		return add_query_arg( 'wc-api', 'wc_stripe', trailingslashit( get_home_url() ) );
196
+		return add_query_arg('wc-api', 'wc_stripe', trailingslashit(get_home_url()));
197 197
 	}
198 198
 
199 199
 	/**
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
 	 * @version 4.0.0
204 204
 	 * @param string $source_id
205 205
 	 */
206
-	public static function get_order_by_source_id( $source_id ) {
206
+	public static function get_order_by_source_id($source_id) {
207 207
 		global $wpdb;
208 208
 
209
-		$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", $source_id ) );
209
+		$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", $source_id));
210 210
 
211
-		if ( ! empty( $order_id ) ) {
212
-			return wc_get_order( $order_id );
211
+		if ( ! empty($order_id)) {
212
+			return wc_get_order($order_id);
213 213
 		}
214 214
 
215 215
 		return false;
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
 	 * @version 4.0.0
223 223
 	 * @param string $charge_id
224 224
 	 */
225
-	public static function get_order_by_charge_id( $charge_id ) {
225
+	public static function get_order_by_charge_id($charge_id) {
226 226
 		global $wpdb;
227 227
 
228
-		$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", $charge_id ) );
228
+		$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", $charge_id));
229 229
 
230
-		if ( ! empty( $order_id ) ) {
231
-			return wc_get_order( $order_id );
230
+		if ( ! empty($order_id)) {
231
+			return wc_get_order($order_id);
232 232
 		}
233 233
 
234 234
 		return false;
@@ -244,13 +244,13 @@  discard block
 block discarded – undo
244 244
 	 * @param string $statement_descriptor
245 245
 	 * @return string $statement_descriptor Sanitized statement descriptor
246 246
 	 */
247
-	public static function clean_statement_descriptor( $statement_descriptor = '' ) {
248
-		$disallowed_characters = array( '<', '>', '"', "'" );
247
+	public static function clean_statement_descriptor($statement_descriptor = '') {
248
+		$disallowed_characters = array('<', '>', '"', "'");
249 249
 
250 250
 		// Remove special characters.
251
-		$statement_descriptor = str_replace( $disallowed_characters, '', $statement_descriptor );
251
+		$statement_descriptor = str_replace($disallowed_characters, '', $statement_descriptor);
252 252
 
253
-		$statement_descriptor = substr( trim( $statement_descriptor ), 0, 22 );
253
+		$statement_descriptor = substr(trim($statement_descriptor), 0, 22);
254 254
 
255 255
 		return $statement_descriptor;
256 256
 	}
Please login to merge, or discard this patch.
includes/payment-methods/class-wc-gateway-stripe-p24.php 1 patch
Spacing   +74 added lines, -74 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
 
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function __construct() {
59 59
 		$this->id                   = 'stripe_p24';
60
-		$this->method_title         = __( 'Stripe P24', 'woocommerce-gateway-stripe' );
60
+		$this->method_title         = __('Stripe P24', 'woocommerce-gateway-stripe');
61 61
 		/* translators: link */
62
-		$this->method_description   = sprintf( __( 'All other general Stripe settings can be adjusted <a href="%s">here</a>.', 'woocommerce-gateway-stripe' ), admin_url( 'admin.php?page=wc-settings&tab=checkout&section=stripe' ) );
62
+		$this->method_description   = sprintf(__('All other general Stripe settings can be adjusted <a href="%s">here</a>.', 'woocommerce-gateway-stripe'), admin_url('admin.php?page=wc-settings&tab=checkout&section=stripe'));
63 63
 		$this->supports             = array(
64 64
 			'products',
65 65
 			'refunds',
@@ -71,25 +71,25 @@  discard block
 block discarded – undo
71 71
 		// Load the settings.
72 72
 		$this->init_settings();
73 73
 
74
-		$main_settings              = get_option( 'woocommerce_stripe_settings' );
75
-		$this->title                = $this->get_option( 'title' );
76
-		$this->description          = $this->get_option( 'description' );
77
-		$this->enabled              = $this->get_option( 'enabled' );
78
-		$this->testmode             = ( ! empty( $main_settings['testmode'] ) && 'yes' === $main_settings['testmode'] ) ? true : false;
79
-		$this->saved_cards          = ( ! empty( $main_settings['saved_cards'] ) && 'yes' === $main_settings['saved_cards'] ) ? true : false;
80
-		$this->publishable_key      = ! empty( $main_settings['publishable_key'] ) ? $main_settings['publishable_key'] : '';
81
-		$this->secret_key           = ! empty( $main_settings['secret_key'] ) ? $main_settings['secret_key'] : '';
82
-		$this->statement_descriptor = ! empty( $main_settings['statement_descriptor'] ) ? $main_settings['statement_descriptor'] : '';
83
-
84
-		if ( $this->testmode ) {
85
-			$this->publishable_key = ! empty( $main_settings['test_publishable_key'] ) ? $main_settings['test_publishable_key'] : '';
86
-			$this->secret_key      = ! empty( $main_settings['test_secret_key'] ) ? $main_settings['test_secret_key'] : '';
74
+		$main_settings              = get_option('woocommerce_stripe_settings');
75
+		$this->title                = $this->get_option('title');
76
+		$this->description          = $this->get_option('description');
77
+		$this->enabled              = $this->get_option('enabled');
78
+		$this->testmode             = ( ! empty($main_settings['testmode']) && 'yes' === $main_settings['testmode']) ? true : false;
79
+		$this->saved_cards          = ( ! empty($main_settings['saved_cards']) && 'yes' === $main_settings['saved_cards']) ? true : false;
80
+		$this->publishable_key      = ! empty($main_settings['publishable_key']) ? $main_settings['publishable_key'] : '';
81
+		$this->secret_key           = ! empty($main_settings['secret_key']) ? $main_settings['secret_key'] : '';
82
+		$this->statement_descriptor = ! empty($main_settings['statement_descriptor']) ? $main_settings['statement_descriptor'] : '';
83
+
84
+		if ($this->testmode) {
85
+			$this->publishable_key = ! empty($main_settings['test_publishable_key']) ? $main_settings['test_publishable_key'] : '';
86
+			$this->secret_key      = ! empty($main_settings['test_secret_key']) ? $main_settings['test_secret_key'] : '';
87 87
 		}
88 88
 
89
-		add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
90
-		add_action( 'admin_notices', array( $this, 'check_environment' ) );
91
-		add_action( 'admin_head', array( $this, 'remove_admin_notice' ) );
92
-		add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) );
89
+		add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
90
+		add_action('admin_notices', array($this, 'check_environment'));
91
+		add_action('admin_head', array($this, 'remove_admin_notice'));
92
+		add_action('wp_enqueue_scripts', array($this, 'payment_scripts'));
93 93
 	}
94 94
 
95 95
 	/**
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
 	 * @version 4.0.0
100 100
 	 */
101 101
 	public function check_environment() {
102
-		if ( ! current_user_can( 'manage_woocommerce' ) ) {
102
+		if ( ! current_user_can('manage_woocommerce')) {
103 103
 			return;
104 104
 		}
105 105
 
106 106
 		$environment_warning = $this->get_environment_warning();
107 107
 
108
-		if ( $environment_warning ) {
109
-			$this->add_admin_notice( 'bad_environment', 'error', $environment_warning );
108
+		if ($environment_warning) {
109
+			$this->add_admin_notice('bad_environment', 'error', $environment_warning);
110 110
 		}
111 111
 
112
-		foreach ( (array) $this->notices as $notice_key => $notice ) {
113
-			echo "<div class='" . esc_attr( $notice['class'] ) . "'><p>";
114
-			echo wp_kses( $notice['message'], array( 'a' => array( 'href' => array() ) ) );
112
+		foreach ((array) $this->notices as $notice_key => $notice) {
113
+			echo "<div class='" . esc_attr($notice['class']) . "'><p>";
114
+			echo wp_kses($notice['message'], array('a' => array('href' => array())));
115 115
 			echo '</p></div>';
116 116
 		}
117 117
 	}
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 	 * @version 4.0.0
125 125
 	 */
126 126
 	public function get_environment_warning() {
127
-		if ( 'yes' === $this->enabled && ! in_array( get_woocommerce_currency(), $this->get_supported_currency() ) ) {
128
-			$message = __( 'P24 is enabled - it requires store currency to be set to Euros or Polish Zloty.', 'woocommerce-gateway-stripe' );
127
+		if ('yes' === $this->enabled && ! in_array(get_woocommerce_currency(), $this->get_supported_currency())) {
128
+			$message = __('P24 is enabled - it requires store currency to be set to Euros or Polish Zloty.', 'woocommerce-gateway-stripe');
129 129
 
130 130
 			return $message;
131 131
 		}
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 	 * @return array
142 142
 	 */
143 143
 	public function get_supported_currency() {
144
-		return apply_filters( 'wc_stripe_p24_supported_currencies', array(
144
+		return apply_filters('wc_stripe_p24_supported_currencies', array(
145 145
 			'EUR',
146 146
 			'PLN',
147
-		) );
147
+		));
148 148
 	}
149 149
 
150 150
 	/**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @return bool
156 156
 	 */
157 157
 	public function is_available() {
158
-		if ( ! in_array( get_woocommerce_currency(), $this->get_supported_currency() ) ) {
158
+		if ( ! in_array(get_woocommerce_currency(), $this->get_supported_currency())) {
159 159
 			return false;
160 160
 		}
161 161
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
 		$icons_str .= $icons['p24'];
178 178
 
179
-		return apply_filters( 'woocommerce_gateway_icon', $icons_str, $this->id );
179
+		return apply_filters('woocommerce_gateway_icon', $icons_str, $this->id);
180 180
 	}
181 181
 
182 182
 	/**
@@ -187,19 +187,19 @@  discard block
 block discarded – undo
187 187
 	 * @access public
188 188
 	 */
189 189
 	public function payment_scripts() {
190
-		if ( ! is_cart() && ! is_checkout() && ! isset( $_GET['pay_for_order'] ) && ! is_add_payment_method_page() ) {
190
+		if ( ! is_cart() && ! is_checkout() && ! isset($_GET['pay_for_order']) && ! is_add_payment_method_page()) {
191 191
 			return;
192 192
 		}
193 193
 
194
-		wp_enqueue_style( 'stripe_paymentfonts' );
195
-		wp_enqueue_script( 'woocommerce_stripe' );
194
+		wp_enqueue_style('stripe_paymentfonts');
195
+		wp_enqueue_script('woocommerce_stripe');
196 196
 	}
197 197
 
198 198
 	/**
199 199
 	 * Initialize Gateway Settings Form Fields.
200 200
 	 */
201 201
 	public function init_form_fields() {
202
-		$this->form_fields = require( WC_STRIPE_PLUGIN_PATH . '/includes/admin/stripe-p24-settings.php' );
202
+		$this->form_fields = require(WC_STRIPE_PLUGIN_PATH . '/includes/admin/stripe-p24-settings.php');
203 203
 	}
204 204
 
205 205
 	/**
@@ -210,25 +210,25 @@  discard block
 block discarded – undo
210 210
 		$total                = WC()->cart->total;
211 211
 
212 212
 		// If paying from order, we need to get total from order not cart.
213
-		if ( isset( $_GET['pay_for_order'] ) && ! empty( $_GET['key'] ) ) {
214
-			$order = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
213
+		if (isset($_GET['pay_for_order']) && ! empty($_GET['key'])) {
214
+			$order = wc_get_order(wc_get_order_id_by_order_key(wc_clean($_GET['key'])));
215 215
 			$total = $order->get_total();
216 216
 		}
217 217
 
218
-		if ( is_add_payment_method_page() ) {
219
-			$pay_button_text = __( 'Add Payment', 'woocommerce-gateway-stripe' );
220
-			$total        = '';
218
+		if (is_add_payment_method_page()) {
219
+			$pay_button_text = __('Add Payment', 'woocommerce-gateway-stripe');
220
+			$total = '';
221 221
 		} else {
222 222
 			$pay_button_text = '';
223 223
 		}
224 224
 
225 225
 		echo '<div
226 226
 			id="stripe-p24-payment-data"
227
-			data-amount="' . esc_attr( WC_Stripe_Helper::get_stripe_amount( $total ) ) . '"
228
-			data-currency="' . esc_attr( strtolower( get_woocommerce_currency() ) ) . '">';
227
+			data-amount="' . esc_attr(WC_Stripe_Helper::get_stripe_amount($total)) . '"
228
+			data-currency="' . esc_attr(strtolower(get_woocommerce_currency())) . '">';
229 229
 
230
-		if ( $this->description ) {
231
-			echo apply_filters( 'wc_stripe_description', wpautop( wp_kses_post( $this->description ) ) );
230
+		if ($this->description) {
231
+			echo apply_filters('wc_stripe_description', wpautop(wp_kses_post($this->description)));
232 232
 		}
233 233
 
234 234
 		echo '</div>';
@@ -242,20 +242,20 @@  discard block
 block discarded – undo
242 242
 	 * @param object $order
243 243
 	 * @return mixed
244 244
 	 */
245
-	public function create_source( $order ) {
245
+	public function create_source($order) {
246 246
 		$currency              = WC_Stripe_Helper::is_pre_30() ? $order->get_order_currency() : $order->get_currency();
247 247
 		$order_id              = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
248
-		$return_url            = $this->get_stripe_return_url( $order );
248
+		$return_url            = $this->get_stripe_return_url($order);
249 249
 		$post_data             = array();
250
-		$post_data['amount']   = WC_Stripe_Helper::get_stripe_amount( $order->get_total(), $currency );
251
-		$post_data['currency'] = strtolower( $currency );
250
+		$post_data['amount']   = WC_Stripe_Helper::get_stripe_amount($order->get_total(), $currency);
251
+		$post_data['currency'] = strtolower($currency);
252 252
 		$post_data['type']     = 'p24';
253
-		$post_data['owner']    = $this->get_owner_details( $order );
254
-		$post_data['redirect'] = array( 'return_url' => $return_url );
253
+		$post_data['owner']    = $this->get_owner_details($order);
254
+		$post_data['redirect'] = array('return_url' => $return_url);
255 255
 
256
-		WC_Stripe_Logger::log( 'Info: Begin creating P24 source' );
256
+		WC_Stripe_Logger::log('Info: Begin creating P24 source');
257 257
 
258
-		return WC_Stripe_API::request( apply_filters( 'wc_stripe_p24_source', $post_data, $order ), 'sources' );
258
+		return WC_Stripe_API::request(apply_filters('wc_stripe_p24_source', $post_data, $order), 'sources');
259 259
 	}
260 260
 
261 261
 	/**
@@ -269,51 +269,51 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @return array|void
271 271
 	 */
272
-	public function process_payment( $order_id, $retry = true, $force_save_source = false ) {
272
+	public function process_payment($order_id, $retry = true, $force_save_source = false) {
273 273
 		try {
274
-			$order = wc_get_order( $order_id );
274
+			$order = wc_get_order($order_id);
275 275
 
276 276
 			// This will throw exception if not valid.
277
-			$this->validate_minimum_order_amount( $order );
277
+			$this->validate_minimum_order_amount($order);
278 278
 
279 279
 			// This comes from the create account checkbox in the checkout page.
280
-			$create_account = ! empty( $_POST['createaccount'] ) ? true : false;
280
+			$create_account = ! empty($_POST['createaccount']) ? true : false;
281 281
 
282
-			if ( $create_account ) {
282
+			if ($create_account) {
283 283
 				$new_customer_id     = WC_Stripe_Helper::is_pre_30() ? $order->customer_user : $order->get_customer_id();
284
-				$new_stripe_customer = new WC_Stripe_Customer( $new_customer_id );
284
+				$new_stripe_customer = new WC_Stripe_Customer($new_customer_id);
285 285
 				$new_stripe_customer->create_customer();
286 286
 			}
287 287
 
288
-			$response = $this->create_source( $order );
288
+			$response = $this->create_source($order);
289 289
 
290
-			if ( ! empty( $response->error ) ) {
291
-				$order->add_order_note( $response->error->message );
290
+			if ( ! empty($response->error)) {
291
+				$order->add_order_note($response->error->message);
292 292
 
293
-				throw new WC_Stripe_Exception( print_r( $response, true ), $response->error->message );
293
+				throw new WC_Stripe_Exception(print_r($response, true), $response->error->message);
294 294
 			}
295 295
 
296
-			if ( WC_Stripe_Helper::is_pre_30() ) {
297
-				update_post_meta( $order_id, '_stripe_source_id', $response->id );
296
+			if (WC_Stripe_Helper::is_pre_30()) {
297
+				update_post_meta($order_id, '_stripe_source_id', $response->id);
298 298
 			} else {
299
-				$order->update_meta_data( '_stripe_source_id', $response->id );
299
+				$order->update_meta_data('_stripe_source_id', $response->id);
300 300
 				$order->save();
301 301
 			}
302 302
 
303
-			WC_Stripe_Logger::log( 'Info: Redirecting to P24...' );
303
+			WC_Stripe_Logger::log('Info: Redirecting to P24...');
304 304
 
305 305
 			return array(
306 306
 				'result'   => 'success',
307
-				'redirect' => esc_url_raw( $response->redirect->url ),
307
+				'redirect' => esc_url_raw($response->redirect->url),
308 308
 			);
309
-		} catch ( WC_Stripe_Exception $e ) {
310
-			wc_add_notice( $e->getLocalizedMessage(), 'error' );
311
-			WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() );
309
+		} catch (WC_Stripe_Exception $e) {
310
+			wc_add_notice($e->getLocalizedMessage(), 'error');
311
+			WC_Stripe_Logger::log('Error: ' . $e->getMessage());
312 312
 
313
-			do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
313
+			do_action('wc_gateway_stripe_process_payment_error', $e, $order);
314 314
 
315
-			if ( $order->has_status( array( 'pending', 'failed' ) ) ) {
316
-				$this->send_failed_order_email( $order_id );
315
+			if ($order->has_status(array('pending', 'failed'))) {
316
+				$this->send_failed_order_email($order_id);
317 317
 			}
318 318
 
319 319
 			return array(
Please login to merge, or discard this patch.
includes/payment-methods/class-wc-gateway-stripe-alipay.php 1 patch
Spacing   +77 added lines, -77 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
 
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function __construct() {
59 59
 		$this->id                   = 'stripe_alipay';
60
-		$this->method_title         = __( 'Stripe Alipay', 'woocommerce-gateway-stripe' );
60
+		$this->method_title         = __('Stripe Alipay', 'woocommerce-gateway-stripe');
61 61
 		/* translators: link */
62
-		$this->method_description   = sprintf( __( 'All other general Stripe settings can be adjusted <a href="%s">here</a>.', 'woocommerce-gateway-stripe' ), admin_url( 'admin.php?page=wc-settings&tab=checkout&section=stripe' ) );
62
+		$this->method_description   = sprintf(__('All other general Stripe settings can be adjusted <a href="%s">here</a>.', 'woocommerce-gateway-stripe'), admin_url('admin.php?page=wc-settings&tab=checkout&section=stripe'));
63 63
 		$this->supports             = array(
64 64
 			'products',
65 65
 			'refunds',
@@ -71,25 +71,25 @@  discard block
 block discarded – undo
71 71
 		// Load the settings.
72 72
 		$this->init_settings();
73 73
 
74
-		$main_settings              = get_option( 'woocommerce_stripe_settings' );
75
-		$this->title                = $this->get_option( 'title' );
76
-		$this->description          = $this->get_option( 'description' );
77
-		$this->enabled              = $this->get_option( 'enabled' );
78
-		$this->testmode             = ( ! empty( $main_settings['testmode'] ) && 'yes' === $main_settings['testmode'] ) ? true : false;
79
-		$this->saved_cards          = ( ! empty( $main_settings['saved_cards'] ) && 'yes' === $main_settings['saved_cards'] ) ? true : false;
80
-		$this->publishable_key      = ! empty( $main_settings['publishable_key'] ) ? $main_settings['publishable_key'] : '';
81
-		$this->secret_key           = ! empty( $main_settings['secret_key'] ) ? $main_settings['secret_key'] : '';
82
-		$this->statement_descriptor = ! empty( $main_settings['statement_descriptor'] ) ? $main_settings['statement_descriptor'] : '';
83
-
84
-		if ( $this->testmode ) {
85
-			$this->publishable_key = ! empty( $main_settings['test_publishable_key'] ) ? $main_settings['test_publishable_key'] : '';
86
-			$this->secret_key      = ! empty( $main_settings['test_secret_key'] ) ? $main_settings['test_secret_key'] : '';
74
+		$main_settings              = get_option('woocommerce_stripe_settings');
75
+		$this->title                = $this->get_option('title');
76
+		$this->description          = $this->get_option('description');
77
+		$this->enabled              = $this->get_option('enabled');
78
+		$this->testmode             = ( ! empty($main_settings['testmode']) && 'yes' === $main_settings['testmode']) ? true : false;
79
+		$this->saved_cards          = ( ! empty($main_settings['saved_cards']) && 'yes' === $main_settings['saved_cards']) ? true : false;
80
+		$this->publishable_key      = ! empty($main_settings['publishable_key']) ? $main_settings['publishable_key'] : '';
81
+		$this->secret_key           = ! empty($main_settings['secret_key']) ? $main_settings['secret_key'] : '';
82
+		$this->statement_descriptor = ! empty($main_settings['statement_descriptor']) ? $main_settings['statement_descriptor'] : '';
83
+
84
+		if ($this->testmode) {
85
+			$this->publishable_key = ! empty($main_settings['test_publishable_key']) ? $main_settings['test_publishable_key'] : '';
86
+			$this->secret_key      = ! empty($main_settings['test_secret_key']) ? $main_settings['test_secret_key'] : '';
87 87
 		}
88 88
 
89
-		add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
90
-		add_action( 'admin_notices', array( $this, 'check_environment' ) );
91
-		add_action( 'admin_head', array( $this, 'remove_admin_notice' ) );
92
-		add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) );
89
+		add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
90
+		add_action('admin_notices', array($this, 'check_environment'));
91
+		add_action('admin_head', array($this, 'remove_admin_notice'));
92
+		add_action('wp_enqueue_scripts', array($this, 'payment_scripts'));
93 93
 	}
94 94
 
95 95
 	/**
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
 	 * @version 4.0.0
100 100
 	 */
101 101
 	public function check_environment() {
102
-		if ( ! current_user_can( 'manage_woocommerce' ) ) {
102
+		if ( ! current_user_can('manage_woocommerce')) {
103 103
 			return;
104 104
 		}
105 105
 
106 106
 		$environment_warning = $this->get_environment_warning();
107 107
 
108
-		if ( $environment_warning ) {
109
-			$this->add_admin_notice( 'bad_environment', 'error', $environment_warning );
108
+		if ($environment_warning) {
109
+			$this->add_admin_notice('bad_environment', 'error', $environment_warning);
110 110
 		}
111 111
 
112
-		foreach ( (array) $this->notices as $notice_key => $notice ) {
113
-			echo "<div class='" . esc_attr( $notice['class'] ) . "'><p>";
114
-			echo wp_kses( $notice['message'], array( 'a' => array( 'href' => array() ) ) );
112
+		foreach ((array) $this->notices as $notice_key => $notice) {
113
+			echo "<div class='" . esc_attr($notice['class']) . "'><p>";
114
+			echo wp_kses($notice['message'], array('a' => array('href' => array())));
115 115
 			echo '</p></div>';
116 116
 		}
117 117
 	}
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function get_environment_warning() {
127 127
 		if (
128
-			'yes' === $this->enabled && ! in_array( get_woocommerce_currency(), $this->get_supported_currency() )
128
+			'yes' === $this->enabled && ! in_array(get_woocommerce_currency(), $this->get_supported_currency())
129 129
 		) {
130 130
 			/* translators: supported currency list */
131
-			$message = sprintf( __( 'Alipay is enabled - it requires store currency to be set to %s', 'woocommerce-gateway-stripe' ), implode( ', ', $this->get_supported_currency() ) );
131
+			$message = sprintf(__('Alipay is enabled - it requires store currency to be set to %s', 'woocommerce-gateway-stripe'), implode(', ', $this->get_supported_currency()));
132 132
 
133 133
 			return $message;
134 134
 		}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @return array
145 145
 	 */
146 146
 	public function get_supported_currency() {
147
-		return apply_filters( 'wc_stripe_alipay_supported_currencies', array(
147
+		return apply_filters('wc_stripe_alipay_supported_currencies', array(
148 148
 			'EUR',
149 149
 			'AUD',
150 150
 			'CAD',
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 			'NZD',
155 155
 			'SGD',
156 156
 			'USD',
157
-		) );
157
+		));
158 158
 	}
159 159
 
160 160
 	/**
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @return bool
166 166
 	 */
167 167
 	public function is_available() {
168
-		if ( ! in_array( get_woocommerce_currency(), $this->get_supported_currency() ) ) {
168
+		if ( ! in_array(get_woocommerce_currency(), $this->get_supported_currency())) {
169 169
 			return false;
170 170
 		}
171 171
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
 		$icons_str .= $icons['alipay'];
188 188
 
189
-		return apply_filters( 'woocommerce_gateway_icon', $icons_str, $this->id );
189
+		return apply_filters('woocommerce_gateway_icon', $icons_str, $this->id);
190 190
 	}
191 191
 
192 192
 	/**
@@ -196,19 +196,19 @@  discard block
 block discarded – undo
196 196
 	 * @version 4.0.0
197 197
 	 */
198 198
 	public function payment_scripts() {
199
-		if ( ! is_cart() && ! is_checkout() && ! isset( $_GET['pay_for_order'] ) && ! is_add_payment_method_page() ) {
199
+		if ( ! is_cart() && ! is_checkout() && ! isset($_GET['pay_for_order']) && ! is_add_payment_method_page()) {
200 200
 			return;
201 201
 		}
202 202
 
203
-		wp_enqueue_style( 'stripe_paymentfonts' );
204
-		wp_enqueue_script( 'woocommerce_stripe' );
203
+		wp_enqueue_style('stripe_paymentfonts');
204
+		wp_enqueue_script('woocommerce_stripe');
205 205
 	}
206 206
 
207 207
 	/**
208 208
 	 * Initialize Gateway Settings Form Fields.
209 209
 	 */
210 210
 	public function init_form_fields() {
211
-		$this->form_fields = require( WC_STRIPE_PLUGIN_PATH . '/includes/admin/stripe-alipay-settings.php' );
211
+		$this->form_fields = require(WC_STRIPE_PLUGIN_PATH . '/includes/admin/stripe-alipay-settings.php');
212 212
 	}
213 213
 
214 214
 	/**
@@ -219,25 +219,25 @@  discard block
 block discarded – undo
219 219
 		$total                = WC()->cart->total;
220 220
 
221 221
 		// If paying from order, we need to get total from order not cart.
222
-		if ( isset( $_GET['pay_for_order'] ) && ! empty( $_GET['key'] ) ) {
223
-			$order = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
222
+		if (isset($_GET['pay_for_order']) && ! empty($_GET['key'])) {
223
+			$order = wc_get_order(wc_get_order_id_by_order_key(wc_clean($_GET['key'])));
224 224
 			$total = $order->get_total();
225 225
 		}
226 226
 
227
-		if ( is_add_payment_method_page() ) {
228
-			$pay_button_text = __( 'Add Payment', 'woocommerce-gateway-stripe' );
229
-			$total        = '';
227
+		if (is_add_payment_method_page()) {
228
+			$pay_button_text = __('Add Payment', 'woocommerce-gateway-stripe');
229
+			$total = '';
230 230
 		} else {
231 231
 			$pay_button_text = '';
232 232
 		}
233 233
 
234 234
 		echo '<div
235 235
 			id="stripe-alipay-payment-data"
236
-			data-amount="' . esc_attr( WC_Stripe_Helper::get_stripe_amount( $total ) ) . '"
237
-			data-currency="' . esc_attr( strtolower( get_woocommerce_currency() ) ) . '">';
236
+			data-amount="' . esc_attr(WC_Stripe_Helper::get_stripe_amount($total)) . '"
237
+			data-currency="' . esc_attr(strtolower(get_woocommerce_currency())) . '">';
238 238
 
239
-		if ( $this->description ) {
240
-			echo apply_filters( 'wc_stripe_description', wpautop( wp_kses_post( $this->description ) ) );
239
+		if ($this->description) {
240
+			echo apply_filters('wc_stripe_description', wpautop(wp_kses_post($this->description)));
241 241
 		}
242 242
 
243 243
 		echo '</div>';
@@ -251,24 +251,24 @@  discard block
 block discarded – undo
251 251
 	 * @param object $order
252 252
 	 * @return mixed
253 253
 	 */
254
-	public function create_source( $order ) {
254
+	public function create_source($order) {
255 255
 		$currency                          = WC_Stripe_Helper::is_pre_30() ? $order->get_order_currency() : $order->get_currency();
256 256
 		$order_id                          = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
257
-		$return_url                        = $this->get_stripe_return_url( $order );
257
+		$return_url                        = $this->get_stripe_return_url($order);
258 258
 		$post_data                         = array();
259
-		$post_data['amount']               = WC_Stripe_Helper::get_stripe_amount( $order->get_total(), $currency );
260
-		$post_data['currency']             = strtolower( $currency );
259
+		$post_data['amount']               = WC_Stripe_Helper::get_stripe_amount($order->get_total(), $currency);
260
+		$post_data['currency']             = strtolower($currency);
261 261
 		$post_data['type']                 = 'alipay';
262
-		$post_data['owner']                = $this->get_owner_details( $order );
263
-		$post_data['redirect']             = array( 'return_url' => $return_url );
262
+		$post_data['owner']                = $this->get_owner_details($order);
263
+		$post_data['redirect']             = array('return_url' => $return_url);
264 264
 
265
-		if ( ! empty( $this->statement_descriptor ) ) {
266
-			$post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor( $this->statement_descriptor );
265
+		if ( ! empty($this->statement_descriptor)) {
266
+			$post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor($this->statement_descriptor);
267 267
 		}
268 268
 
269
-		WC_Stripe_Logger::log( 'Info: Begin creating Alipay source' );
269
+		WC_Stripe_Logger::log('Info: Begin creating Alipay source');
270 270
 
271
-		return WC_Stripe_API::request( apply_filters( 'wc_stripe_alipay_source', $post_data, $order ), 'sources' );
271
+		return WC_Stripe_API::request(apply_filters('wc_stripe_alipay_source', $post_data, $order), 'sources');
272 272
 	}
273 273
 
274 274
 	/**
@@ -282,53 +282,53 @@  discard block
 block discarded – undo
282 282
 	 *
283 283
 	 * @return array|void
284 284
 	 */
285
-	public function process_payment( $order_id, $retry = true, $force_save_save = false ) {
285
+	public function process_payment($order_id, $retry = true, $force_save_save = false) {
286 286
 		try {
287
-			$order = wc_get_order( $order_id );
287
+			$order = wc_get_order($order_id);
288 288
 
289 289
 			// This will throw exception if not valid.
290
-			$this->validate_minimum_order_amount( $order );
290
+			$this->validate_minimum_order_amount($order);
291 291
 
292 292
 			// This comes from the create account checkbox in the checkout page.
293
-			$create_account = ! empty( $_POST['createaccount'] ) ? true : false;
293
+			$create_account = ! empty($_POST['createaccount']) ? true : false;
294 294
 
295
-			if ( $create_account ) {
295
+			if ($create_account) {
296 296
 				$new_customer_id     = WC_Stripe_Helper::is_pre_30() ? $order->customer_user : $order->get_customer_id();
297
-				$new_stripe_customer = new WC_Stripe_Customer( $new_customer_id );
297
+				$new_stripe_customer = new WC_Stripe_Customer($new_customer_id);
298 298
 				$new_stripe_customer->create_customer();
299 299
 			}
300 300
 
301
-			$response = $this->create_source( $order );
301
+			$response = $this->create_source($order);
302 302
 
303
-			if ( ! empty( $response->error ) ) {
304
-				$order->add_order_note( $response->error->message );
303
+			if ( ! empty($response->error)) {
304
+				$order->add_order_note($response->error->message);
305 305
 
306
-				throw new WC_Stripe_Exception( print_r( $response, true ), $response->error->message );
306
+				throw new WC_Stripe_Exception(print_r($response, true), $response->error->message);
307 307
 			}
308 308
 
309
-			if ( WC_Stripe_Helper::is_pre_30() ) {
310
-				update_post_meta( $order_id, '_stripe_source_id', $response->id );
309
+			if (WC_Stripe_Helper::is_pre_30()) {
310
+				update_post_meta($order_id, '_stripe_source_id', $response->id);
311 311
 			} else {
312
-				$order->update_meta_data( '_stripe_source_id', $response->id );
312
+				$order->update_meta_data('_stripe_source_id', $response->id);
313 313
 				$order->save();
314 314
 			}
315 315
 
316
-			WC_Stripe_Logger::log( 'Info: Redirecting to Alipay...' );
316
+			WC_Stripe_Logger::log('Info: Redirecting to Alipay...');
317 317
 
318 318
 			return array(
319 319
 				'result'   => 'success',
320
-				'redirect' => esc_url_raw( $response->redirect->url ),
320
+				'redirect' => esc_url_raw($response->redirect->url),
321 321
 			);
322
-		} catch ( WC_Stripe_Exception $e ) {
323
-			wc_add_notice( $e->getLocalizedMessage(), 'error' );
324
-			WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() );
322
+		} catch (WC_Stripe_Exception $e) {
323
+			wc_add_notice($e->getLocalizedMessage(), 'error');
324
+			WC_Stripe_Logger::log('Error: ' . $e->getMessage());
325 325
 
326
-			do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
326
+			do_action('wc_gateway_stripe_process_payment_error', $e, $order);
327 327
 
328
-			$statuses = array( 'pending', 'failed' );
328
+			$statuses = array('pending', 'failed');
329 329
 
330
-			if ( $order->has_status( $statuses ) ) {
331
-				$this->send_failed_order_email( $order_id );
330
+			if ($order->has_status($statuses)) {
331
+				$this->send_failed_order_email($order_id);
332 332
 			}
333 333
 
334 334
 			return array(
Please login to merge, or discard this patch.
includes/payment-methods/class-wc-gateway-stripe-giropay.php 1 patch
Spacing   +76 added lines, -76 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
 
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function __construct() {
59 59
 		$this->id                   = 'stripe_giropay';
60
-		$this->method_title         = __( 'Stripe Giropay', 'woocommerce-gateway-stripe' );
60
+		$this->method_title         = __('Stripe Giropay', 'woocommerce-gateway-stripe');
61 61
 		/* translators: link */
62
-		$this->method_description   = sprintf( __( 'All other general Stripe settings can be adjusted <a href="%s">here</a>.', 'woocommerce-gateway-stripe' ), admin_url( 'admin.php?page=wc-settings&tab=checkout&section=stripe' ) );
62
+		$this->method_description   = sprintf(__('All other general Stripe settings can be adjusted <a href="%s">here</a>.', 'woocommerce-gateway-stripe'), admin_url('admin.php?page=wc-settings&tab=checkout&section=stripe'));
63 63
 		$this->supports             = array(
64 64
 			'products',
65 65
 			'refunds',
@@ -71,25 +71,25 @@  discard block
 block discarded – undo
71 71
 		// Load the settings.
72 72
 		$this->init_settings();
73 73
 
74
-		$main_settings              = get_option( 'woocommerce_stripe_settings' );
75
-		$this->title                = $this->get_option( 'title' );
76
-		$this->description          = $this->get_option( 'description' );
77
-		$this->enabled              = $this->get_option( 'enabled' );
78
-		$this->testmode             = ( ! empty( $main_settings['testmode'] ) && 'yes' === $main_settings['testmode'] ) ? true : false;
79
-		$this->saved_cards          = ( ! empty( $main_settings['saved_cards'] ) && 'yes' === $main_settings['saved_cards'] ) ? true : false;
80
-		$this->publishable_key      = ! empty( $main_settings['publishable_key'] ) ? $main_settings['publishable_key'] : '';
81
-		$this->secret_key           = ! empty( $main_settings['secret_key'] ) ? $main_settings['secret_key'] : '';
82
-		$this->statement_descriptor = ! empty( $main_settings['statement_descriptor'] ) ? $main_settings['statement_descriptor'] : '';
83
-
84
-		if ( $this->testmode ) {
85
-			$this->publishable_key = ! empty( $main_settings['test_publishable_key'] ) ? $main_settings['test_publishable_key'] : '';
86
-			$this->secret_key      = ! empty( $main_settings['test_secret_key'] ) ? $main_settings['test_secret_key'] : '';
74
+		$main_settings              = get_option('woocommerce_stripe_settings');
75
+		$this->title                = $this->get_option('title');
76
+		$this->description          = $this->get_option('description');
77
+		$this->enabled              = $this->get_option('enabled');
78
+		$this->testmode             = ( ! empty($main_settings['testmode']) && 'yes' === $main_settings['testmode']) ? true : false;
79
+		$this->saved_cards          = ( ! empty($main_settings['saved_cards']) && 'yes' === $main_settings['saved_cards']) ? true : false;
80
+		$this->publishable_key      = ! empty($main_settings['publishable_key']) ? $main_settings['publishable_key'] : '';
81
+		$this->secret_key           = ! empty($main_settings['secret_key']) ? $main_settings['secret_key'] : '';
82
+		$this->statement_descriptor = ! empty($main_settings['statement_descriptor']) ? $main_settings['statement_descriptor'] : '';
83
+
84
+		if ($this->testmode) {
85
+			$this->publishable_key = ! empty($main_settings['test_publishable_key']) ? $main_settings['test_publishable_key'] : '';
86
+			$this->secret_key      = ! empty($main_settings['test_secret_key']) ? $main_settings['test_secret_key'] : '';
87 87
 		}
88 88
 
89
-		add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
90
-		add_action( 'admin_notices', array( $this, 'check_environment' ) );
91
-		add_action( 'admin_head', array( $this, 'remove_admin_notice' ) );
92
-		add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) );
89
+		add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
90
+		add_action('admin_notices', array($this, 'check_environment'));
91
+		add_action('admin_head', array($this, 'remove_admin_notice'));
92
+		add_action('wp_enqueue_scripts', array($this, 'payment_scripts'));
93 93
 	}
94 94
 
95 95
 	/**
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
 	 * @version 4.0.0
100 100
 	 */
101 101
 	public function check_environment() {
102
-		if ( ! current_user_can( 'manage_woocommerce' ) ) {
102
+		if ( ! current_user_can('manage_woocommerce')) {
103 103
 			return;
104 104
 		}
105 105
 
106 106
 		$environment_warning = $this->get_environment_warning();
107 107
 
108
-		if ( $environment_warning ) {
109
-			$this->add_admin_notice( 'bad_environment', 'error', $environment_warning );
108
+		if ($environment_warning) {
109
+			$this->add_admin_notice('bad_environment', 'error', $environment_warning);
110 110
 		}
111 111
 
112
-		foreach ( (array) $this->notices as $notice_key => $notice ) {
113
-			echo "<div class='" . esc_attr( $notice['class'] ) . "'><p>";
114
-			echo wp_kses( $notice['message'], array( 'a' => array( 'href' => array() ) ) );
112
+		foreach ((array) $this->notices as $notice_key => $notice) {
113
+			echo "<div class='" . esc_attr($notice['class']) . "'><p>";
114
+			echo wp_kses($notice['message'], array('a' => array('href' => array())));
115 115
 			echo '</p></div>';
116 116
 		}
117 117
 	}
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 	 * @version 4.0.0
125 125
 	 */
126 126
 	public function get_environment_warning() {
127
-		if ( 'yes' === $this->enabled && ! in_array( get_woocommerce_currency(), $this->get_supported_currency() ) ) {
128
-			$message = __( 'Giropay is enabled - it requires store currency to be set to Euros.', 'woocommerce-gateway-stripe' );
127
+		if ('yes' === $this->enabled && ! in_array(get_woocommerce_currency(), $this->get_supported_currency())) {
128
+			$message = __('Giropay is enabled - it requires store currency to be set to Euros.', 'woocommerce-gateway-stripe');
129 129
 
130 130
 			return $message;
131 131
 		}
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 	 * @return array
142 142
 	 */
143 143
 	public function get_supported_currency() {
144
-		return apply_filters( 'wc_stripe_giropay_supported_currencies', array(
144
+		return apply_filters('wc_stripe_giropay_supported_currencies', array(
145 145
 			'EUR',
146
-		) );
146
+		));
147 147
 	}
148 148
 
149 149
 	/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @return bool
155 155
 	 */
156 156
 	public function is_available() {
157
-		if ( ! in_array( get_woocommerce_currency(), $this->get_supported_currency() ) ) {
157
+		if ( ! in_array(get_woocommerce_currency(), $this->get_supported_currency())) {
158 158
 			return false;
159 159
 		}
160 160
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
 		$icons_str .= $icons['giropay'];
177 177
 
178
-		return apply_filters( 'woocommerce_gateway_icon', $icons_str, $this->id );
178
+		return apply_filters('woocommerce_gateway_icon', $icons_str, $this->id);
179 179
 	}
180 180
 
181 181
 	/**
@@ -186,19 +186,19 @@  discard block
 block discarded – undo
186 186
 	 * @access public
187 187
 	 */
188 188
 	public function payment_scripts() {
189
-		if ( ! is_cart() && ! is_checkout() && ! isset( $_GET['pay_for_order'] ) && ! is_add_payment_method_page() ) {
189
+		if ( ! is_cart() && ! is_checkout() && ! isset($_GET['pay_for_order']) && ! is_add_payment_method_page()) {
190 190
 			return;
191 191
 		}
192 192
 
193
-		wp_enqueue_style( 'stripe_paymentfonts' );
194
-		wp_enqueue_script( 'woocommerce_stripe' );
193
+		wp_enqueue_style('stripe_paymentfonts');
194
+		wp_enqueue_script('woocommerce_stripe');
195 195
 	}
196 196
 
197 197
 	/**
198 198
 	 * Initialize Gateway Settings Form Fields.
199 199
 	 */
200 200
 	public function init_form_fields() {
201
-		$this->form_fields = require( WC_STRIPE_PLUGIN_PATH . '/includes/admin/stripe-giropay-settings.php' );
201
+		$this->form_fields = require(WC_STRIPE_PLUGIN_PATH . '/includes/admin/stripe-giropay-settings.php');
202 202
 	}
203 203
 
204 204
 	/**
@@ -209,25 +209,25 @@  discard block
 block discarded – undo
209 209
 		$total                = WC()->cart->total;
210 210
 
211 211
 		// If paying from order, we need to get total from order not cart.
212
-		if ( isset( $_GET['pay_for_order'] ) && ! empty( $_GET['key'] ) ) {
213
-			$order = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
212
+		if (isset($_GET['pay_for_order']) && ! empty($_GET['key'])) {
213
+			$order = wc_get_order(wc_get_order_id_by_order_key(wc_clean($_GET['key'])));
214 214
 			$total = $order->get_total();
215 215
 		}
216 216
 
217
-		if ( is_add_payment_method_page() ) {
218
-			$pay_button_text = __( 'Add Payment', 'woocommerce-gateway-stripe' );
219
-			$total        = '';
217
+		if (is_add_payment_method_page()) {
218
+			$pay_button_text = __('Add Payment', 'woocommerce-gateway-stripe');
219
+			$total = '';
220 220
 		} else {
221 221
 			$pay_button_text = '';
222 222
 		}
223 223
 
224 224
 		echo '<div
225 225
 			id="stripe-giropay-payment-data"
226
-			data-amount="' . esc_attr( WC_Stripe_Helper::get_stripe_amount( $total ) ) . '"
227
-			data-currency="' . esc_attr( strtolower( get_woocommerce_currency() ) ) . '">';
226
+			data-amount="' . esc_attr(WC_Stripe_Helper::get_stripe_amount($total)) . '"
227
+			data-currency="' . esc_attr(strtolower(get_woocommerce_currency())) . '">';
228 228
 
229
-		if ( $this->description ) {
230
-			echo apply_filters( 'wc_stripe_description', wpautop( wp_kses_post( $this->description ) ) );
229
+		if ($this->description) {
230
+			echo apply_filters('wc_stripe_description', wpautop(wp_kses_post($this->description)));
231 231
 		}
232 232
 
233 233
 		echo '</div>';
@@ -241,24 +241,24 @@  discard block
 block discarded – undo
241 241
 	 * @param object $order
242 242
 	 * @return mixed
243 243
 	 */
244
-	public function create_source( $order ) {
244
+	public function create_source($order) {
245 245
 		$currency                          = WC_Stripe_Helper::is_pre_30() ? $order->get_order_currency() : $order->get_currency();
246 246
 		$order_id                          = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
247
-		$return_url                        = $this->get_stripe_return_url( $order );
247
+		$return_url                        = $this->get_stripe_return_url($order);
248 248
 		$post_data                         = array();
249
-		$post_data['amount']               = WC_Stripe_Helper::get_stripe_amount( $order->get_total(), $currency );
250
-		$post_data['currency']             = strtolower( $currency );
249
+		$post_data['amount']               = WC_Stripe_Helper::get_stripe_amount($order->get_total(), $currency);
250
+		$post_data['currency']             = strtolower($currency);
251 251
 		$post_data['type']                 = 'giropay';
252
-		$post_data['owner']                = $this->get_owner_details( $order );
253
-		$post_data['redirect']             = array( 'return_url' => $return_url );
252
+		$post_data['owner']                = $this->get_owner_details($order);
253
+		$post_data['redirect']             = array('return_url' => $return_url);
254 254
 
255
-		if ( ! empty( $this->statement_descriptor ) ) {
256
-			$post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor( $this->statement_descriptor );
255
+		if ( ! empty($this->statement_descriptor)) {
256
+			$post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor($this->statement_descriptor);
257 257
 		}
258 258
 
259
-		WC_Stripe_Logger::log( 'Info: Begin creating Giropay source' );
259
+		WC_Stripe_Logger::log('Info: Begin creating Giropay source');
260 260
 
261
-		return WC_Stripe_API::request( apply_filters( 'wc_stripe_giropay_source', $post_data, $order ), 'sources' );
261
+		return WC_Stripe_API::request(apply_filters('wc_stripe_giropay_source', $post_data, $order), 'sources');
262 262
 	}
263 263
 
264 264
 	/**
@@ -272,51 +272,51 @@  discard block
 block discarded – undo
272 272
 	 *
273 273
 	 * @return array|void
274 274
 	 */
275
-	public function process_payment( $order_id, $retry = true, $force_save_source = false ) {
275
+	public function process_payment($order_id, $retry = true, $force_save_source = false) {
276 276
 		try {
277
-			$order = wc_get_order( $order_id );
277
+			$order = wc_get_order($order_id);
278 278
 
279 279
 			// This will throw exception if not valid.
280
-			$this->validate_minimum_order_amount( $order );
280
+			$this->validate_minimum_order_amount($order);
281 281
 
282 282
 			// This comes from the create account checkbox in the checkout page.
283
-			$create_account = ! empty( $_POST['createaccount'] ) ? true : false;
283
+			$create_account = ! empty($_POST['createaccount']) ? true : false;
284 284
 
285
-			if ( $create_account ) {
285
+			if ($create_account) {
286 286
 				$new_customer_id     = WC_Stripe_Helper::is_pre_30() ? $order->customer_user : $order->get_customer_id();
287
-				$new_stripe_customer = new WC_Stripe_Customer( $new_customer_id );
287
+				$new_stripe_customer = new WC_Stripe_Customer($new_customer_id);
288 288
 				$new_stripe_customer->create_customer();
289 289
 			}
290 290
 
291
-			$response = $this->create_source( $order );
291
+			$response = $this->create_source($order);
292 292
 
293
-			if ( ! empty( $response->error ) ) {
294
-				$order->add_order_note( $response->error->message );
293
+			if ( ! empty($response->error)) {
294
+				$order->add_order_note($response->error->message);
295 295
 
296
-				throw new WC_Stripe_Exception( print_r( $response, true ), $response->error->message );
296
+				throw new WC_Stripe_Exception(print_r($response, true), $response->error->message);
297 297
 			}
298 298
 
299
-			if ( WC_Stripe_Helper::is_pre_30() ) {
300
-				update_post_meta( $order_id, '_stripe_source_id', $response->id );
299
+			if (WC_Stripe_Helper::is_pre_30()) {
300
+				update_post_meta($order_id, '_stripe_source_id', $response->id);
301 301
 			} else {
302
-				$order->update_meta_data( '_stripe_source_id', $response->id );
302
+				$order->update_meta_data('_stripe_source_id', $response->id);
303 303
 				$order->save();
304 304
 			}
305 305
 
306
-			WC_Stripe_Logger::log( 'Info: Redirecting to Giropay...' );
306
+			WC_Stripe_Logger::log('Info: Redirecting to Giropay...');
307 307
 
308 308
 			return array(
309 309
 				'result'   => 'success',
310
-				'redirect' => esc_url_raw( $response->redirect->url ),
310
+				'redirect' => esc_url_raw($response->redirect->url),
311 311
 			);
312
-		} catch ( WC_Stripe_Exception $e ) {
313
-			wc_add_notice( $e->getLocalizedMessage(), 'error' );
314
-			WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() );
312
+		} catch (WC_Stripe_Exception $e) {
313
+			wc_add_notice($e->getLocalizedMessage(), 'error');
314
+			WC_Stripe_Logger::log('Error: ' . $e->getMessage());
315 315
 
316
-			do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
316
+			do_action('wc_gateway_stripe_process_payment_error', $e, $order);
317 317
 
318
-			if ( $order->has_status( array( 'pending', 'failed' ) ) ) {
319
-				$this->send_failed_order_email( $order_id );
318
+			if ($order->has_status(array('pending', 'failed'))) {
319
+				$this->send_failed_order_email($order_id);
320 320
 			}
321 321
 
322 322
 			return array(
Please login to merge, or discard this patch.
includes/payment-methods/class-wc-gateway-stripe-ideal.php 1 patch
Spacing   +76 added lines, -76 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
 
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function __construct() {
59 59
 		$this->id                   = 'stripe_ideal';
60
-		$this->method_title         = __( 'Stripe iDeal', 'woocommerce-gateway-stripe' );
60
+		$this->method_title         = __('Stripe iDeal', 'woocommerce-gateway-stripe');
61 61
 		/* translators: link */
62
-		$this->method_description   = sprintf( __( 'All other general Stripe settings can be adjusted <a href="%s">here</a>.', 'woocommerce-gateway-stripe' ), admin_url( 'admin.php?page=wc-settings&tab=checkout&section=stripe' ) );
62
+		$this->method_description   = sprintf(__('All other general Stripe settings can be adjusted <a href="%s">here</a>.', 'woocommerce-gateway-stripe'), admin_url('admin.php?page=wc-settings&tab=checkout&section=stripe'));
63 63
 		$this->supports             = array(
64 64
 			'products',
65 65
 			'refunds',
@@ -71,25 +71,25 @@  discard block
 block discarded – undo
71 71
 		// Load the settings.
72 72
 		$this->init_settings();
73 73
 
74
-		$main_settings              = get_option( 'woocommerce_stripe_settings' );
75
-		$this->title                = $this->get_option( 'title' );
76
-		$this->description          = $this->get_option( 'description' );
77
-		$this->enabled              = $this->get_option( 'enabled' );
78
-		$this->testmode             = ( ! empty( $main_settings['testmode'] ) && 'yes' === $main_settings['testmode'] ) ? true : false;
79
-		$this->saved_cards          = ( ! empty( $main_settings['saved_cards'] ) && 'yes' === $main_settings['saved_cards'] ) ? true : false;
80
-		$this->publishable_key      = ! empty( $main_settings['publishable_key'] ) ? $main_settings['publishable_key'] : '';
81
-		$this->secret_key           = ! empty( $main_settings['secret_key'] ) ? $main_settings['secret_key'] : '';
82
-		$this->statement_descriptor = ! empty( $main_settings['statement_descriptor'] ) ? $main_settings['statement_descriptor'] : '';
83
-
84
-		if ( $this->testmode ) {
85
-			$this->publishable_key = ! empty( $main_settings['test_publishable_key'] ) ? $main_settings['test_publishable_key'] : '';
86
-			$this->secret_key      = ! empty( $main_settings['test_secret_key'] ) ? $main_settings['test_secret_key'] : '';
74
+		$main_settings              = get_option('woocommerce_stripe_settings');
75
+		$this->title                = $this->get_option('title');
76
+		$this->description          = $this->get_option('description');
77
+		$this->enabled              = $this->get_option('enabled');
78
+		$this->testmode             = ( ! empty($main_settings['testmode']) && 'yes' === $main_settings['testmode']) ? true : false;
79
+		$this->saved_cards          = ( ! empty($main_settings['saved_cards']) && 'yes' === $main_settings['saved_cards']) ? true : false;
80
+		$this->publishable_key      = ! empty($main_settings['publishable_key']) ? $main_settings['publishable_key'] : '';
81
+		$this->secret_key           = ! empty($main_settings['secret_key']) ? $main_settings['secret_key'] : '';
82
+		$this->statement_descriptor = ! empty($main_settings['statement_descriptor']) ? $main_settings['statement_descriptor'] : '';
83
+
84
+		if ($this->testmode) {
85
+			$this->publishable_key = ! empty($main_settings['test_publishable_key']) ? $main_settings['test_publishable_key'] : '';
86
+			$this->secret_key      = ! empty($main_settings['test_secret_key']) ? $main_settings['test_secret_key'] : '';
87 87
 		}
88 88
 
89
-		add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
90
-		add_action( 'admin_notices', array( $this, 'check_environment' ) );
91
-		add_action( 'admin_head', array( $this, 'remove_admin_notice' ) );
92
-		add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) );
89
+		add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
90
+		add_action('admin_notices', array($this, 'check_environment'));
91
+		add_action('admin_head', array($this, 'remove_admin_notice'));
92
+		add_action('wp_enqueue_scripts', array($this, 'payment_scripts'));
93 93
 	}
94 94
 
95 95
 	/**
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
 	 * @version 4.0.0
100 100
 	 */
101 101
 	public function check_environment() {
102
-		if ( ! current_user_can( 'manage_woocommerce' ) ) {
102
+		if ( ! current_user_can('manage_woocommerce')) {
103 103
 			return;
104 104
 		}
105 105
 
106 106
 		$environment_warning = $this->get_environment_warning();
107 107
 
108
-		if ( $environment_warning ) {
109
-			$this->add_admin_notice( 'bad_environment', 'error', $environment_warning );
108
+		if ($environment_warning) {
109
+			$this->add_admin_notice('bad_environment', 'error', $environment_warning);
110 110
 		}
111 111
 
112
-		foreach ( (array) $this->notices as $notice_key => $notice ) {
113
-			echo "<div class='" . esc_attr( $notice['class'] ) . "'><p>";
114
-			echo wp_kses( $notice['message'], array( 'a' => array( 'href' => array() ) ) );
112
+		foreach ((array) $this->notices as $notice_key => $notice) {
113
+			echo "<div class='" . esc_attr($notice['class']) . "'><p>";
114
+			echo wp_kses($notice['message'], array('a' => array('href' => array())));
115 115
 			echo '</p></div>';
116 116
 		}
117 117
 	}
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 	 * @version 4.0.0
125 125
 	 */
126 126
 	public function get_environment_warning() {
127
-		if ( 'yes' === $this->enabled && ! in_array( get_woocommerce_currency(), $this->get_supported_currency() ) ) {
128
-			$message = __( 'iDeal is enabled - it requires store currency to be set to Euros.', 'woocommerce-gateway-stripe' );
127
+		if ('yes' === $this->enabled && ! in_array(get_woocommerce_currency(), $this->get_supported_currency())) {
128
+			$message = __('iDeal is enabled - it requires store currency to be set to Euros.', 'woocommerce-gateway-stripe');
129 129
 
130 130
 			return $message;
131 131
 		}
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 	 * @return array
142 142
 	 */
143 143
 	public function get_supported_currency() {
144
-		return apply_filters( 'wc_stripe_ideal_supported_currencies', array(
144
+		return apply_filters('wc_stripe_ideal_supported_currencies', array(
145 145
 			'EUR',
146
-		) );
146
+		));
147 147
 	}
148 148
 
149 149
 	/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @return bool
155 155
 	 */
156 156
 	public function is_available() {
157
-		if ( ! in_array( get_woocommerce_currency(), $this->get_supported_currency() ) ) {
157
+		if ( ! in_array(get_woocommerce_currency(), $this->get_supported_currency())) {
158 158
 			return false;
159 159
 		}
160 160
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
 		$icons_str .= $icons['ideal'];
177 177
 
178
-		return apply_filters( 'woocommerce_gateway_icon', $icons_str, $this->id );
178
+		return apply_filters('woocommerce_gateway_icon', $icons_str, $this->id);
179 179
 	}
180 180
 
181 181
 	/**
@@ -186,19 +186,19 @@  discard block
 block discarded – undo
186 186
 	 * @access public
187 187
 	 */
188 188
 	public function payment_scripts() {
189
-		if ( ! is_cart() && ! is_checkout() && ! isset( $_GET['pay_for_order'] ) && ! is_add_payment_method_page() ) {
189
+		if ( ! is_cart() && ! is_checkout() && ! isset($_GET['pay_for_order']) && ! is_add_payment_method_page()) {
190 190
 			return;
191 191
 		}
192 192
 
193
-		wp_enqueue_style( 'stripe_paymentfonts' );
194
-		wp_enqueue_script( 'woocommerce_stripe' );
193
+		wp_enqueue_style('stripe_paymentfonts');
194
+		wp_enqueue_script('woocommerce_stripe');
195 195
 	}
196 196
 
197 197
 	/**
198 198
 	 * Initialize Gateway Settings Form Fields.
199 199
 	 */
200 200
 	public function init_form_fields() {
201
-		$this->form_fields = require( WC_STRIPE_PLUGIN_PATH . '/includes/admin/stripe-ideal-settings.php' );
201
+		$this->form_fields = require(WC_STRIPE_PLUGIN_PATH . '/includes/admin/stripe-ideal-settings.php');
202 202
 	}
203 203
 
204 204
 	/**
@@ -209,25 +209,25 @@  discard block
 block discarded – undo
209 209
 		$total                = WC()->cart->total;
210 210
 
211 211
 		// If paying from order, we need to get total from order not cart.
212
-		if ( isset( $_GET['pay_for_order'] ) && ! empty( $_GET['key'] ) ) {
213
-			$order = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
212
+		if (isset($_GET['pay_for_order']) && ! empty($_GET['key'])) {
213
+			$order = wc_get_order(wc_get_order_id_by_order_key(wc_clean($_GET['key'])));
214 214
 			$total = $order->get_total();
215 215
 		}
216 216
 
217
-		if ( is_add_payment_method_page() ) {
218
-			$pay_button_text = __( 'Add Payment', 'woocommerce-gateway-stripe' );
219
-			$total        = '';
217
+		if (is_add_payment_method_page()) {
218
+			$pay_button_text = __('Add Payment', 'woocommerce-gateway-stripe');
219
+			$total = '';
220 220
 		} else {
221 221
 			$pay_button_text = '';
222 222
 		}
223 223
 
224 224
 		echo '<div
225 225
 			id="stripe-ideal-payment-data"
226
-			data-amount="' . esc_attr( WC_Stripe_Helper::get_stripe_amount( $total ) ) . '"
227
-			data-currency="' . esc_attr( strtolower( get_woocommerce_currency() ) ) . '">';
226
+			data-amount="' . esc_attr(WC_Stripe_Helper::get_stripe_amount($total)) . '"
227
+			data-currency="' . esc_attr(strtolower(get_woocommerce_currency())) . '">';
228 228
 
229
-		if ( $this->description ) {
230
-			echo apply_filters( 'wc_stripe_description', wpautop( wp_kses_post( $this->description ) ) );
229
+		if ($this->description) {
230
+			echo apply_filters('wc_stripe_description', wpautop(wp_kses_post($this->description)));
231 231
 		}
232 232
 
233 233
 		echo '</div>';
@@ -241,24 +241,24 @@  discard block
 block discarded – undo
241 241
 	 * @param object $order
242 242
 	 * @return mixed
243 243
 	 */
244
-	public function create_source( $order ) {
244
+	public function create_source($order) {
245 245
 		$currency                          = WC_Stripe_Helper::is_pre_30() ? $order->get_order_currency() : $order->get_currency();
246 246
 		$order_id                          = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
247
-		$return_url                        = $this->get_stripe_return_url( $order );
247
+		$return_url                        = $this->get_stripe_return_url($order);
248 248
 		$post_data                         = array();
249
-		$post_data['amount']               = WC_Stripe_Helper::get_stripe_amount( $order->get_total(), $currency );
250
-		$post_data['currency']             = strtolower( $currency );
249
+		$post_data['amount']               = WC_Stripe_Helper::get_stripe_amount($order->get_total(), $currency);
250
+		$post_data['currency']             = strtolower($currency);
251 251
 		$post_data['type']                 = 'ideal';
252
-		$post_data['owner']                = $this->get_owner_details( $order );
253
-		$post_data['redirect']             = array( 'return_url' => $return_url );
252
+		$post_data['owner']                = $this->get_owner_details($order);
253
+		$post_data['redirect']             = array('return_url' => $return_url);
254 254
 
255
-		if ( ! empty( $this->statement_descriptor ) ) {
256
-			$post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor( $this->statement_descriptor );
255
+		if ( ! empty($this->statement_descriptor)) {
256
+			$post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor($this->statement_descriptor);
257 257
 		}
258 258
 
259
-		WC_Stripe_Logger::log( 'Info: Begin creating iDeal source' );
259
+		WC_Stripe_Logger::log('Info: Begin creating iDeal source');
260 260
 
261
-		return WC_Stripe_API::request( apply_filters( 'wc_stripe_ideal_source', $post_data, $order ), 'sources' );
261
+		return WC_Stripe_API::request(apply_filters('wc_stripe_ideal_source', $post_data, $order), 'sources');
262 262
 	}
263 263
 
264 264
 	/**
@@ -272,51 +272,51 @@  discard block
 block discarded – undo
272 272
 	 *
273 273
 	 * @return array|void
274 274
 	 */
275
-	public function process_payment( $order_id, $retry = true, $force_save_source = false ) {
275
+	public function process_payment($order_id, $retry = true, $force_save_source = false) {
276 276
 		try {
277
-			$order = wc_get_order( $order_id );
277
+			$order = wc_get_order($order_id);
278 278
 
279 279
 			// This will throw exception if not valid.
280
-			$this->validate_minimum_order_amount( $order );
280
+			$this->validate_minimum_order_amount($order);
281 281
 
282 282
 			// This comes from the create account checkbox in the checkout page.
283
-			$create_account = ! empty( $_POST['createaccount'] ) ? true : false;
283
+			$create_account = ! empty($_POST['createaccount']) ? true : false;
284 284
 
285
-			if ( $create_account ) {
285
+			if ($create_account) {
286 286
 				$new_customer_id     = WC_Stripe_Helper::is_pre_30() ? $order->customer_user : $order->get_customer_id();
287
-				$new_stripe_customer = new WC_Stripe_Customer( $new_customer_id );
287
+				$new_stripe_customer = new WC_Stripe_Customer($new_customer_id);
288 288
 				$new_stripe_customer->create_customer();
289 289
 			}
290 290
 
291
-			$response = $this->create_source( $order );
291
+			$response = $this->create_source($order);
292 292
 
293
-			if ( ! empty( $response->error ) ) {
294
-				$order->add_order_note( $response->error->message );
293
+			if ( ! empty($response->error)) {
294
+				$order->add_order_note($response->error->message);
295 295
 
296
-				throw new WC_Stripe_Exception( print_r( $response, true ), $response->error->message );
296
+				throw new WC_Stripe_Exception(print_r($response, true), $response->error->message);
297 297
 			}
298 298
 
299
-			if ( WC_Stripe_Helper::is_pre_30() ) {
300
-				update_post_meta( $order_id, '_stripe_source_id', $response->id );
299
+			if (WC_Stripe_Helper::is_pre_30()) {
300
+				update_post_meta($order_id, '_stripe_source_id', $response->id);
301 301
 			} else {
302
-				$order->update_meta_data( '_stripe_source_id', $response->id );
302
+				$order->update_meta_data('_stripe_source_id', $response->id);
303 303
 				$order->save();
304 304
 			}
305 305
 
306
-			WC_Stripe_Logger::log( 'Info: Redirecting to iDeal...' );
306
+			WC_Stripe_Logger::log('Info: Redirecting to iDeal...');
307 307
 
308 308
 			return array(
309 309
 				'result'   => 'success',
310
-				'redirect' => esc_url_raw( $response->redirect->url ),
310
+				'redirect' => esc_url_raw($response->redirect->url),
311 311
 			);
312
-		} catch ( WC_Stripe_Exception $e ) {
313
-			wc_add_notice( $e->getLocalizedMessage(), 'error' );
314
-			WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() );
312
+		} catch (WC_Stripe_Exception $e) {
313
+			wc_add_notice($e->getLocalizedMessage(), 'error');
314
+			WC_Stripe_Logger::log('Error: ' . $e->getMessage());
315 315
 
316
-			do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
316
+			do_action('wc_gateway_stripe_process_payment_error', $e, $order);
317 317
 
318
-			if ( $order->has_status( array( 'pending', 'failed' ) ) ) {
319
-				$this->send_failed_order_email( $order_id );
318
+			if ($order->has_status(array('pending', 'failed'))) {
319
+				$this->send_failed_order_email($order_id);
320 320
 			}
321 321
 
322 322
 			return array(
Please login to merge, or discard this patch.
includes/admin/stripe-settings.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,184 +1,184 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
6 6
 $webhook_url = WC_Stripe_Helper::get_webhook_url();
7 7
 
8
-return apply_filters( 'wc_stripe_settings',
8
+return apply_filters('wc_stripe_settings',
9 9
 	array(
10 10
 		'enabled' => array(
11
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
12
-			'label'       => __( 'Enable Stripe', 'woocommerce-gateway-stripe' ),
11
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
12
+			'label'       => __('Enable Stripe', 'woocommerce-gateway-stripe'),
13 13
 			'type'        => 'checkbox',
14 14
 			'description' => '',
15 15
 			'default'     => 'no',
16 16
 		),
17 17
 		'title' => array(
18
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
18
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
19 19
 			'type'        => 'text',
20
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
21
-			'default'     => __( 'Credit Card (Stripe)', 'woocommerce-gateway-stripe' ),
20
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
21
+			'default'     => __('Credit Card (Stripe)', 'woocommerce-gateway-stripe'),
22 22
 			'desc_tip'    => true,
23 23
 		),
24 24
 		'description' => array(
25
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
25
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
26 26
 			'type'        => 'text',
27
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
28
-			'default'     => __( 'Pay with your credit card via Stripe.', 'woocommerce-gateway-stripe' ),
27
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
28
+			'default'     => __('Pay with your credit card via Stripe.', 'woocommerce-gateway-stripe'),
29 29
 			'desc_tip'    => true,
30 30
 		),
31 31
 		'webhook' => array(
32
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
32
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
33 33
 			'type'        => 'title',
34 34
 			/* translators: webhook URL */
35
-			'description' => sprintf( __( 'You must add the webhook endpoint <strong style="background-color:#ddd;">&nbsp;&nbsp;%s&nbsp;&nbsp;</strong> to your Stripe Account Settings <a href="https://dashboard.stripe.com/account/webhooks" target="_blank">Here</a> so you can receive notifications on the charge statuses.', 'woocommerce-gateway-stripe' ), $webhook_url ),
35
+			'description' => sprintf(__('You must add the webhook endpoint <strong style="background-color:#ddd;">&nbsp;&nbsp;%s&nbsp;&nbsp;</strong> to your Stripe Account Settings <a href="https://dashboard.stripe.com/account/webhooks" target="_blank">Here</a> so you can receive notifications on the charge statuses.', 'woocommerce-gateway-stripe'), $webhook_url),
36 36
 		),
37 37
 		'testmode' => array(
38
-			'title'       => __( 'Test mode', 'woocommerce-gateway-stripe' ),
39
-			'label'       => __( 'Enable Test Mode', 'woocommerce-gateway-stripe' ),
38
+			'title'       => __('Test mode', 'woocommerce-gateway-stripe'),
39
+			'label'       => __('Enable Test Mode', 'woocommerce-gateway-stripe'),
40 40
 			'type'        => 'checkbox',
41
-			'description' => __( 'Place the payment gateway in test mode using test API keys.', 'woocommerce-gateway-stripe' ),
41
+			'description' => __('Place the payment gateway in test mode using test API keys.', 'woocommerce-gateway-stripe'),
42 42
 			'default'     => 'yes',
43 43
 			'desc_tip'    => true,
44 44
 		),
45 45
 		'test_publishable_key' => array(
46
-			'title'       => __( 'Test Publishable Key', 'woocommerce-gateway-stripe' ),
46
+			'title'       => __('Test Publishable Key', 'woocommerce-gateway-stripe'),
47 47
 			'type'        => 'password',
48
-			'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
48
+			'description' => __('Get your API keys from your stripe account.', 'woocommerce-gateway-stripe'),
49 49
 			'default'     => '',
50 50
 			'desc_tip'    => true,
51 51
 		),
52 52
 		'test_secret_key' => array(
53
-			'title'       => __( 'Test Secret Key', 'woocommerce-gateway-stripe' ),
53
+			'title'       => __('Test Secret Key', 'woocommerce-gateway-stripe'),
54 54
 			'type'        => 'password',
55
-			'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
55
+			'description' => __('Get your API keys from your stripe account.', 'woocommerce-gateway-stripe'),
56 56
 			'default'     => '',
57 57
 			'desc_tip'    => true,
58 58
 		),
59 59
 		'publishable_key' => array(
60
-			'title'       => __( 'Live Publishable Key', 'woocommerce-gateway-stripe' ),
60
+			'title'       => __('Live Publishable Key', 'woocommerce-gateway-stripe'),
61 61
 			'type'        => 'password',
62
-			'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
62
+			'description' => __('Get your API keys from your stripe account.', 'woocommerce-gateway-stripe'),
63 63
 			'default'     => '',
64 64
 			'desc_tip'    => true,
65 65
 		),
66 66
 		'secret_key' => array(
67
-			'title'       => __( 'Live Secret Key', 'woocommerce-gateway-stripe' ),
67
+			'title'       => __('Live Secret Key', 'woocommerce-gateway-stripe'),
68 68
 			'type'        => 'password',
69
-			'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
69
+			'description' => __('Get your API keys from your stripe account.', 'woocommerce-gateway-stripe'),
70 70
 			'default'     => '',
71 71
 			'desc_tip'    => true,
72 72
 		),
73 73
 		'inline_cc_form' => array(
74
-			'title'       => __( 'Inline Credit Card Form', 'woocommerce-gateway-stripe' ),
74
+			'title'       => __('Inline Credit Card Form', 'woocommerce-gateway-stripe'),
75 75
 			'type'        => 'checkbox',
76
-			'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' ),
76
+			'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'),
77 77
 			'default'     => 'no',
78 78
 			'desc_tip'    => true,
79 79
 		),
80 80
 		'statement_descriptor' => array(
81
-			'title'       => __( 'Statement Descriptor', 'woocommerce-gateway-stripe' ),
81
+			'title'       => __('Statement Descriptor', 'woocommerce-gateway-stripe'),
82 82
 			'type'        => 'text',
83
-			'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' ),
83
+			'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'),
84 84
 			'default'     => '',
85 85
 			'desc_tip'    => true,
86 86
 		),
87 87
 		'capture' => array(
88
-			'title'       => __( 'Capture', 'woocommerce-gateway-stripe' ),
89
-			'label'       => __( 'Capture charge immediately', 'woocommerce-gateway-stripe' ),
88
+			'title'       => __('Capture', 'woocommerce-gateway-stripe'),
89
+			'label'       => __('Capture charge immediately', 'woocommerce-gateway-stripe'),
90 90
 			'type'        => 'checkbox',
91
-			'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' ),
91
+			'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'),
92 92
 			'default'     => 'yes',
93 93
 			'desc_tip'    => true,
94 94
 		),
95 95
 		'three_d_secure' => array(
96
-			'title'       => __( '3D Secure', 'woocommerce-gateway-stripe' ),
97
-			'label'       => __( 'Require 3D Secure when applicable', 'woocommerce-gateway-stripe' ),
96
+			'title'       => __('3D Secure', 'woocommerce-gateway-stripe'),
97
+			'label'       => __('Require 3D Secure when applicable', 'woocommerce-gateway-stripe'),
98 98
 			'type'        => 'checkbox',
99
-			'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 optional. Enabling would require customers to use 3D Secure when optional.', 'woocommerce-gateway-stripe' ),
99
+			'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 optional. Enabling would require customers to use 3D Secure when optional.', 'woocommerce-gateway-stripe'),
100 100
 			'default'     => 'no',
101 101
 			'desc_tip'    => true,
102 102
 		),
103 103
 		'stripe_checkout' => array(
104
-			'title'       => __( 'Stripe Checkout', 'woocommerce-gateway-stripe' ),
105
-			'label'       => __( 'Enable Stripe Checkout', 'woocommerce-gateway-stripe' ),
104
+			'title'       => __('Stripe Checkout', 'woocommerce-gateway-stripe'),
105
+			'label'       => __('Enable Stripe Checkout', 'woocommerce-gateway-stripe'),
106 106
 			'type'        => 'checkbox',
107
-			'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' ),
107
+			'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'),
108 108
 			'default'     => 'no',
109 109
 			'desc_tip'    => true,
110 110
 		),
111 111
 		'stripe_bitcoin' => array(
112
-			'title'       => __( 'Bitcoin Currency', 'woocommerce-gateway-stripe' ),
113
-			'label'       => __( 'Enable Bitcoin Currency', 'woocommerce-gateway-stripe' ),
112
+			'title'       => __('Bitcoin Currency', 'woocommerce-gateway-stripe'),
113
+			'label'       => __('Enable Bitcoin Currency', 'woocommerce-gateway-stripe'),
114 114
 			'type'        => 'checkbox',
115
-			'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' ),
115
+			'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'),
116 116
 			'default'     => 'no',
117 117
 			'desc_tip'    => true,
118 118
 		),
119 119
 		'stripe_checkout_image' => array(
120
-			'title'       => __( 'Stripe Checkout Image', 'woocommerce-gateway-stripe' ),
121
-			'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
+			'title'       => __('Stripe Checkout Image', 'woocommerce-gateway-stripe'),
121
+			'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'),
122 122
 			'type'        => 'text',
123 123
 			'default'     => '',
124 124
 			'desc_tip'    => true,
125 125
 		),
126 126
 		'payment_request' => array(
127
-			'title'       => __( 'Payment Request Buttons', 'woocommerce-gateway-stripe' ),
127
+			'title'       => __('Payment Request Buttons', 'woocommerce-gateway-stripe'),
128 128
 			/* translators: 1) br tag 2) opening anchor tag 3) closing anchor tag */
129
-			'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>' ),
129
+			'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>'),
130 130
 			'type'        => 'checkbox',
131
-			'description' => __( 'If enabled, users will be able to pay using Apple Pay or Chrome Payment Request if supported by the browser.', 'woocommerce-gateway-stripe' ),
131
+			'description' => __('If enabled, users will be able to pay using Apple Pay or Chrome Payment Request if supported by the browser.', 'woocommerce-gateway-stripe'),
132 132
 			'default'     => 'yes',
133 133
 			'desc_tip'    => true,
134 134
 		),
135 135
 		'payment_request_button_type' => array(
136
-			'title'       => __( 'Payment Request Button Type', 'woocommerce-gateway-stripe' ),
137
-			'label'       => __( 'Button Type', 'woocommerce-gateway-stripe' ),
136
+			'title'       => __('Payment Request Button Type', 'woocommerce-gateway-stripe'),
137
+			'label'       => __('Button Type', 'woocommerce-gateway-stripe'),
138 138
 			'type'        => 'select',
139
-			'description' => __( 'Select the button type you would like to show.', 'woocommerce-gateway-stripe' ),
139
+			'description' => __('Select the button type you would like to show.', 'woocommerce-gateway-stripe'),
140 140
 			'default'     => 'buy',
141 141
 			'desc_tip'    => true,
142 142
 			'options'     => array(
143
-				'default' => __( 'Default', 'woocommerce-gateway-stripe' ),
144
-				'buy'     => __( 'Buy', 'woocommerce-gateway-stripe' ),
145
-				'donate'  => __( 'Donate', 'woocommerce-gateway-stripe' ),
143
+				'default' => __('Default', 'woocommerce-gateway-stripe'),
144
+				'buy'     => __('Buy', 'woocommerce-gateway-stripe'),
145
+				'donate'  => __('Donate', 'woocommerce-gateway-stripe'),
146 146
 			),
147 147
 		),
148 148
 		'payment_request_button_theme' => array(
149
-			'title'       => __( 'Payment Request Button Theme', 'woocommerce-gateway-stripe' ),
150
-			'label'       => __( 'Button Theme', 'woocommerce-gateway-stripe' ),
149
+			'title'       => __('Payment Request Button Theme', 'woocommerce-gateway-stripe'),
150
+			'label'       => __('Button Theme', 'woocommerce-gateway-stripe'),
151 151
 			'type'        => 'select',
152
-			'description' => __( 'Select the button theme you would like to show.', 'woocommerce-gateway-stripe' ),
152
+			'description' => __('Select the button theme you would like to show.', 'woocommerce-gateway-stripe'),
153 153
 			'default'     => 'dark',
154 154
 			'desc_tip'    => true,
155 155
 			'options'     => array(
156
-				'dark'          => __( 'Dark', 'woocommerce-gateway-stripe' ),
157
-				'light'         => __( 'Light', 'woocommerce-gateway-stripe' ),
158
-				'light-outline' => __( 'Light-Outline', 'woocommerce-gateway-stripe' ),
156
+				'dark'          => __('Dark', 'woocommerce-gateway-stripe'),
157
+				'light'         => __('Light', 'woocommerce-gateway-stripe'),
158
+				'light-outline' => __('Light-Outline', 'woocommerce-gateway-stripe'),
159 159
 			),
160 160
 		),
161 161
 		'payment_request_button_height' => array(
162
-			'title'       => __( 'Payment Request Button Height', 'woocommerce-gateway-stripe' ),
163
-			'label'       => __( 'Button Height', 'woocommerce-gateway-stripe' ),
162
+			'title'       => __('Payment Request Button Height', 'woocommerce-gateway-stripe'),
163
+			'label'       => __('Button Height', 'woocommerce-gateway-stripe'),
164 164
 			'type'        => 'text',
165
-			'description' => __( 'Enter the height you would like the button to be in pixels. Width will always be 100%.', 'woocommerce-gateway-stripe' ),
165
+			'description' => __('Enter the height you would like the button to be in pixels. Width will always be 100%.', 'woocommerce-gateway-stripe'),
166 166
 			'default'     => '44',
167 167
 			'desc_tip'    => true,
168 168
 		),
169 169
 		'saved_cards' => array(
170
-			'title'       => __( 'Saved Cards', 'woocommerce-gateway-stripe' ),
171
-			'label'       => __( 'Enable Payment via Saved Cards', 'woocommerce-gateway-stripe' ),
170
+			'title'       => __('Saved Cards', 'woocommerce-gateway-stripe'),
171
+			'label'       => __('Enable Payment via Saved Cards', 'woocommerce-gateway-stripe'),
172 172
 			'type'        => 'checkbox',
173
-			'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' ),
173
+			'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'),
174 174
 			'default'     => 'no',
175 175
 			'desc_tip'    => true,
176 176
 		),
177 177
 		'logging' => array(
178
-			'title'       => __( 'Logging', 'woocommerce-gateway-stripe' ),
179
-			'label'       => __( 'Log debug messages', 'woocommerce-gateway-stripe' ),
178
+			'title'       => __('Logging', 'woocommerce-gateway-stripe'),
179
+			'label'       => __('Log debug messages', 'woocommerce-gateway-stripe'),
180 180
 			'type'        => 'checkbox',
181
-			'description' => __( 'Save debug messages to the WooCommerce System Status log.', 'woocommerce-gateway-stripe' ),
181
+			'description' => __('Save debug messages to the WooCommerce System Status log.', 'woocommerce-gateway-stripe'),
182 182
 			'default'     => 'no',
183 183
 			'desc_tip'    => true,
184 184
 		),
Please login to merge, or discard this patch.