Completed
Pull Request — master (#1383)
by
unknown
02:09
created
includes/admin/stripe-sepa-settings.php 1 patch
Spacing   +13 added lines, -13 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
 
@@ -7,40 +7,40 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_sepa_settings',
8 8
 	array(
9 9
 		'geo_target'  => array(
10
-			'description' => __( 'Customer Geography: France, Germany, Spain, Belgium, Netherlands, Luxembourg, Italy, Portugal, Austria, Ireland', 'woocommerce-gateway-stripe' ),
10
+			'description' => __('Customer Geography: France, Germany, Spain, Belgium, Netherlands, Luxembourg, Italy, Portugal, Austria, Ireland', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'title',
12 12
 		),
13 13
 		'guide'       => array(
14
-			'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#sepa-direct-debit" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ),
14
+			'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#sepa-direct-debit" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'),
15 15
 			'type'        => 'title',
16 16
 		),
17 17
 		'activation'  => array(
18
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
18
+			'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'),
19 19
 			'type'        => 'title',
20 20
 		),
21 21
 		'enabled'     => array(
22
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
23
-			'label'       => __( 'Enable Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe' ),
22
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
23
+			'label'       => __('Enable Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe'),
24 24
 			'type'        => 'checkbox',
25 25
 			'description' => '',
26 26
 			'default'     => 'no',
27 27
 		),
28 28
 		'title'       => array(
29
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
29
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
30 30
 			'type'        => 'text',
31
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
32
-			'default'     => __( 'SEPA Direct Debit', 'woocommerce-gateway-stripe' ),
31
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
32
+			'default'     => __('SEPA Direct Debit', 'woocommerce-gateway-stripe'),
33 33
 			'desc_tip'    => true,
34 34
 		),
35 35
 		'description' => array(
36
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
36
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
37 37
 			'type'        => 'text',
38
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
39
-			'default'     => __( 'Mandate Information.', 'woocommerce-gateway-stripe' ),
38
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
39
+			'default'     => __('Mandate Information.', 'woocommerce-gateway-stripe'),
40 40
 			'desc_tip'    => true,
41 41
 		),
42 42
 		'webhook'     => array(
43
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
43
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
44 44
 			'type'        => 'title',
45 45
 			/* translators: webhook URL */
46 46
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/stripe-multibanco-settings.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -7,36 +7,36 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_multibanco_settings',
8 8
 	array(
9 9
 		'geo_target'  => array(
10
-			'description' => __( 'Customer Geography: Portugal', 'woocommerce-gateway-stripe' ),
10
+			'description' => __('Customer Geography: Portugal', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'title',
12 12
 		),
13 13
 		'activation'  => array(
14
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
14
+			'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 15
 			'type'        => 'title',
16 16
 		),
17 17
 		'enabled'     => array(
18
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
19
-			'label'       => __( 'Enable Stripe Multibanco', 'woocommerce-gateway-stripe' ),
18
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
19
+			'label'       => __('Enable Stripe Multibanco', 'woocommerce-gateway-stripe'),
20 20
 			'type'        => 'checkbox',
21 21
 			'description' => '',
22 22
 			'default'     => 'no',
23 23
 		),
24 24
 		'title'       => array(
25
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
25
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
26 26
 			'type'        => 'text',
27
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
28
-			'default'     => __( 'Multibanco', 'woocommerce-gateway-stripe' ),
27
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
28
+			'default'     => __('Multibanco', 'woocommerce-gateway-stripe'),
29 29
 			'desc_tip'    => true,
30 30
 		),
31 31
 		'description' => array(
32
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
32
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
33 33
 			'type'        => 'text',
34
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
35
-			'default'     => __( 'You will be redirected to Multibanco.', 'woocommerce-gateway-stripe' ),
34
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
35
+			'default'     => __('You will be redirected to Multibanco.', 'woocommerce-gateway-stripe'),
36 36
 			'desc_tip'    => true,
37 37
 		),
38 38
 		'webhook'     => array(
39
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
39
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
40 40
 			'type'        => 'title',
41 41
 			/* translators: webhook URL */
42 42
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/stripe-p24-settings.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -7,36 +7,36 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_p24_settings',
8 8
 	array(
9 9
 		'geo_target'  => array(
10
-			'description' => __( 'Customer Geography: Poland', 'woocommerce-gateway-stripe' ),
10
+			'description' => __('Customer Geography: Poland', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'title',
12 12
 		),
13 13
 		'activation'  => array(
14
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
14
+			'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 15
 			'type'        => 'title',
16 16
 		),
17 17
 		'enabled'     => array(
18
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
19
-			'label'       => __( 'Enable Stripe P24', 'woocommerce-gateway-stripe' ),
18
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
19
+			'label'       => __('Enable Stripe P24', 'woocommerce-gateway-stripe'),
20 20
 			'type'        => 'checkbox',
21 21
 			'description' => '',
22 22
 			'default'     => 'no',
23 23
 		),
24 24
 		'title'       => array(
25
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
25
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
26 26
 			'type'        => 'text',
27
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
28
-			'default'     => __( 'Przelewy24 (P24)', 'woocommerce-gateway-stripe' ),
27
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
28
+			'default'     => __('Przelewy24 (P24)', 'woocommerce-gateway-stripe'),
29 29
 			'desc_tip'    => true,
30 30
 		),
31 31
 		'description' => array(
32
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
32
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
33 33
 			'type'        => 'text',
34
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
35
-			'default'     => __( 'You will be redirected to P24.', 'woocommerce-gateway-stripe' ),
34
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
35
+			'default'     => __('You will be redirected to P24.', 'woocommerce-gateway-stripe'),
36 36
 			'desc_tip'    => true,
37 37
 		),
38 38
 		'webhook'     => array(
39
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
39
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
40 40
 			'type'        => 'title',
41 41
 			/* translators: webhook URL */
42 42
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/stripe-sofort-settings.php 1 patch
Spacing   +13 added lines, -13 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
 
@@ -7,40 +7,40 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_sofort_settings',
8 8
 	array(
9 9
 		'geo_target'  => array(
10
-			'description' => __( 'Customer Geography: Germany, Austria', 'woocommerce-gateway-stripe' ),
10
+			'description' => __('Customer Geography: Germany, Austria', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'title',
12 12
 		),
13 13
 		'guide'       => array(
14
-			'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#sofort" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ),
14
+			'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#sofort" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'),
15 15
 			'type'        => 'title',
16 16
 		),
17 17
 		'activation'  => array(
18
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
18
+			'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'),
19 19
 			'type'        => 'title',
20 20
 		),
21 21
 		'enabled'     => array(
22
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
23
-			'label'       => __( 'Enable Stripe SOFORT', 'woocommerce-gateway-stripe' ),
22
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
23
+			'label'       => __('Enable Stripe SOFORT', 'woocommerce-gateway-stripe'),
24 24
 			'type'        => 'checkbox',
25 25
 			'description' => '',
26 26
 			'default'     => 'no',
27 27
 		),
28 28
 		'title'       => array(
29
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
29
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
30 30
 			'type'        => 'text',
31
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
32
-			'default'     => __( 'SOFORT', 'woocommerce-gateway-stripe' ),
31
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
32
+			'default'     => __('SOFORT', 'woocommerce-gateway-stripe'),
33 33
 			'desc_tip'    => true,
34 34
 		),
35 35
 		'description' => array(
36
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
36
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
37 37
 			'type'        => 'text',
38
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
39
-			'default'     => __( 'You will be redirected to SOFORT.', 'woocommerce-gateway-stripe' ),
38
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
39
+			'default'     => __('You will be redirected to SOFORT.', 'woocommerce-gateway-stripe'),
40 40
 			'desc_tip'    => true,
41 41
 		),
42 42
 		'webhook'     => array(
43
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
43
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
44 44
 			'type'        => 'title',
45 45
 			/* translators: webhook URL */
46 46
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/stripe-bancontact-settings.php 1 patch
Spacing   +13 added lines, -13 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
 
@@ -7,40 +7,40 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_bancontact_settings',
8 8
 	array(
9 9
 		'geo_target'  => array(
10
-			'description' => __( 'Customer Geography: Belgium', 'woocommerce-gateway-stripe' ),
10
+			'description' => __('Customer Geography: Belgium', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'title',
12 12
 		),
13 13
 		'guide'       => array(
14
-			'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#bancontact" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ),
14
+			'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#bancontact" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'),
15 15
 			'type'        => 'title',
16 16
 		),
17 17
 		'activation'  => array(
18
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
18
+			'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'),
19 19
 			'type'        => 'title',
20 20
 		),
21 21
 		'enabled'     => array(
22
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
23
-			'label'       => __( 'Enable Stripe Bancontact', 'woocommerce-gateway-stripe' ),
22
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
23
+			'label'       => __('Enable Stripe Bancontact', 'woocommerce-gateway-stripe'),
24 24
 			'type'        => 'checkbox',
25 25
 			'description' => '',
26 26
 			'default'     => 'no',
27 27
 		),
28 28
 		'title'       => array(
29
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
29
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
30 30
 			'type'        => 'text',
31
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
32
-			'default'     => __( 'Bancontact', 'woocommerce-gateway-stripe' ),
31
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
32
+			'default'     => __('Bancontact', 'woocommerce-gateway-stripe'),
33 33
 			'desc_tip'    => true,
34 34
 		),
35 35
 		'description' => array(
36
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
36
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
37 37
 			'type'        => 'text',
38
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
39
-			'default'     => __( 'You will be redirected to Bancontact.', 'woocommerce-gateway-stripe' ),
38
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
39
+			'default'     => __('You will be redirected to Bancontact.', 'woocommerce-gateway-stripe'),
40 40
 			'desc_tip'    => true,
41 41
 		),
42 42
 		'webhook'     => array(
43
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
43
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
44 44
 			'type'        => 'title',
45 45
 			/* translators: webhook URL */
46 46
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/stripe-ideal-settings.php 1 patch
Spacing   +13 added lines, -13 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
 
@@ -7,40 +7,40 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_ideal_settings',
8 8
 	array(
9 9
 		'geo_target'  => array(
10
-			'description' => __( 'Customer Geography: The Netherlands', 'woocommerce-gateway-stripe' ),
10
+			'description' => __('Customer Geography: The Netherlands', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'title',
12 12
 		),
13 13
 		'guide'       => array(
14
-			'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#ideal" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ),
14
+			'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#ideal" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'),
15 15
 			'type'        => 'title',
16 16
 		),
17 17
 		'activation'  => array(
18
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
18
+			'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'),
19 19
 			'type'        => 'title',
20 20
 		),
21 21
 		'enabled'     => array(
22
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
23
-			'label'       => __( 'Enable Stripe iDeal', 'woocommerce-gateway-stripe' ),
22
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
23
+			'label'       => __('Enable Stripe iDeal', 'woocommerce-gateway-stripe'),
24 24
 			'type'        => 'checkbox',
25 25
 			'description' => '',
26 26
 			'default'     => 'no',
27 27
 		),
28 28
 		'title'       => array(
29
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
29
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
30 30
 			'type'        => 'text',
31
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
32
-			'default'     => __( 'iDeal', 'woocommerce-gateway-stripe' ),
31
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
32
+			'default'     => __('iDeal', 'woocommerce-gateway-stripe'),
33 33
 			'desc_tip'    => true,
34 34
 		),
35 35
 		'description' => array(
36
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
36
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
37 37
 			'type'        => 'text',
38
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
39
-			'default'     => __( 'You will be redirected to iDeal.', 'woocommerce-gateway-stripe' ),
38
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
39
+			'default'     => __('You will be redirected to iDeal.', 'woocommerce-gateway-stripe'),
40 40
 			'desc_tip'    => true,
41 41
 		),
42 42
 		'webhook'     => array(
43
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
43
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
44 44
 			'type'        => 'title',
45 45
 			/* translators: webhook URL */
46 46
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/stripe-eps-settings.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -7,36 +7,36 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_eps_settings',
8 8
 	array(
9 9
 		'geo_target'  => array(
10
-			'description' => __( 'Customer Geography: Austria', 'woocommerce-gateway-stripe' ),
10
+			'description' => __('Customer Geography: Austria', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'title',
12 12
 		),
13 13
 		'activation'  => array(
14
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
14
+			'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 15
 			'type'        => 'title',
16 16
 		),
17 17
 		'enabled'     => array(
18
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
19
-			'label'       => __( 'Enable Stripe EPS', 'woocommerce-gateway-stripe' ),
18
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
19
+			'label'       => __('Enable Stripe EPS', 'woocommerce-gateway-stripe'),
20 20
 			'type'        => 'checkbox',
21 21
 			'description' => '',
22 22
 			'default'     => 'no',
23 23
 		),
24 24
 		'title'       => array(
25
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
25
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
26 26
 			'type'        => 'text',
27
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
28
-			'default'     => __( 'EPS', 'woocommerce-gateway-stripe' ),
27
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
28
+			'default'     => __('EPS', 'woocommerce-gateway-stripe'),
29 29
 			'desc_tip'    => true,
30 30
 		),
31 31
 		'description' => array(
32
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
32
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
33 33
 			'type'        => 'text',
34
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
35
-			'default'     => __( 'You will be redirected to EPS.', 'woocommerce-gateway-stripe' ),
34
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
35
+			'default'     => __('You will be redirected to EPS.', 'woocommerce-gateway-stripe'),
36 36
 			'desc_tip'    => true,
37 37
 		),
38 38
 		'webhook'     => array(
39
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
39
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
40 40
 			'type'        => 'title',
41 41
 			/* translators: webhook URL */
42 42
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/compat/class-wc-stripe-sepa-subs-compat.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -321,7 +321,7 @@
 block discarded – undo
321 321
 
322 322
 	/**
323 323
 	 * Don't transfer Stripe fee/ID meta to renewal orders.
324
-	 * @param int $resubscribe_order The order created for the customer to resubscribe to the old expired/cancelled subscription
324
+	 * @param integer $renewal_order
325 325
 	 */
326 326
 	public function delete_renewal_meta( $renewal_order ) {
327 327
 		WC_Stripe_Helper::delete_stripe_fee( $renewal_order );
Please login to merge, or discard this patch.
Spacing   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
@@ -15,21 +15,21 @@  discard block
 block discarded – undo
15 15
 	public function __construct() {
16 16
 		parent::__construct();
17 17
 
18
-		if ( class_exists( 'WC_Subscriptions_Order' ) ) {
19
-			add_action( 'woocommerce_scheduled_subscription_payment_' . $this->id, array( $this, 'scheduled_subscription_payment' ), 10, 2 );
20
-			add_action( 'wcs_resubscribe_order_created', array( $this, 'delete_resubscribe_meta' ), 10 );
21
-			add_action( 'wcs_renewal_order_created', array( $this, 'delete_renewal_meta' ), 10 );
22
-			add_action( 'woocommerce_subscription_failing_payment_method_updated_stripe', array( $this, 'update_failing_payment_method' ), 10, 2 );
23
-			add_action( 'wc_stripe_sepa_payment_fields', array( $this, 'display_update_subs_payment_checkout' ) );
24
-			add_action( 'wc_stripe_add_payment_method_' . $this->id . '_success', array( $this, 'handle_add_payment_method_success' ), 10, 2 );
18
+		if (class_exists('WC_Subscriptions_Order')) {
19
+			add_action('woocommerce_scheduled_subscription_payment_' . $this->id, array($this, 'scheduled_subscription_payment'), 10, 2);
20
+			add_action('wcs_resubscribe_order_created', array($this, 'delete_resubscribe_meta'), 10);
21
+			add_action('wcs_renewal_order_created', array($this, 'delete_renewal_meta'), 10);
22
+			add_action('woocommerce_subscription_failing_payment_method_updated_stripe', array($this, 'update_failing_payment_method'), 10, 2);
23
+			add_action('wc_stripe_sepa_payment_fields', array($this, 'display_update_subs_payment_checkout'));
24
+			add_action('wc_stripe_add_payment_method_' . $this->id . '_success', array($this, 'handle_add_payment_method_success'), 10, 2);
25 25
 
26 26
 			// Display the credit card used for a subscription in the "My Subscriptions" table.
27
-			add_filter( 'woocommerce_my_subscriptions_payment_method', array( $this, 'maybe_render_subscription_payment_method' ), 10, 2 );
27
+			add_filter('woocommerce_my_subscriptions_payment_method', array($this, 'maybe_render_subscription_payment_method'), 10, 2);
28 28
 
29 29
 			// Allow store managers to manually set Stripe as the payment method on a subscription.
30
-			add_filter( 'woocommerce_subscription_payment_meta', array( $this, 'add_subscription_payment_meta' ), 10, 2 );
31
-			add_filter( 'woocommerce_subscription_validate_payment_meta', array( $this, 'validate_subscription_payment_meta' ), 10, 2 );
32
-			add_filter( 'wc_stripe_display_save_payment_method_checkbox', array( $this, 'maybe_hide_save_checkbox' ) );
30
+			add_filter('woocommerce_subscription_payment_meta', array($this, 'add_subscription_payment_meta'), 10, 2);
31
+			add_filter('woocommerce_subscription_validate_payment_meta', array($this, 'validate_subscription_payment_meta'), 10, 2);
32
+			add_filter('wc_stripe_display_save_payment_method_checkbox', array($this, 'maybe_hide_save_checkbox'));
33 33
 		}
34 34
 	}
35 35
 
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	 * @since 4.0.0
41 41
 	 * @version 4.0.0
42 42
 	 */
43
-	public function maybe_hide_save_checkbox( $display_tokenization ) {
44
-		if ( WC_Subscriptions_Cart::cart_contains_subscription() ) {
43
+	public function maybe_hide_save_checkbox($display_tokenization) {
44
+		if (WC_Subscriptions_Cart::cart_contains_subscription()) {
45 45
 			return false;
46 46
 		}
47 47
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	 * @param  int  $order_id
54 54
 	 * @return boolean
55 55
 	 */
56
-	public function has_subscription( $order_id ) {
57
-		return ( function_exists( 'wcs_order_contains_subscription' ) && ( wcs_order_contains_subscription( $order_id ) || wcs_is_subscription( $order_id ) || wcs_order_contains_renewal( $order_id ) ) );
56
+	public function has_subscription($order_id) {
57
+		return (function_exists('wcs_order_contains_subscription') && (wcs_order_contains_subscription($order_id) || wcs_is_subscription($order_id) || wcs_order_contains_renewal($order_id)));
58 58
 	}
59 59
 
60 60
 	/**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @return bool
65 65
 	 */
66 66
 	public function is_subs_change_payment() {
67
-		return ( isset( $_GET['pay_for_order'] ) && isset( $_GET['change_payment_method'] ) );
67
+		return (isset($_GET['pay_for_order']) && isset($_GET['change_payment_method']));
68 68
 	}
69 69
 
70 70
 	/**
@@ -74,20 +74,20 @@  discard block
 block discarded – undo
74 74
 	 * @since 4.1.11
75 75
 	 */
76 76
 	public function display_update_subs_payment_checkout() {
77
-		$subs_statuses = apply_filters( 'wc_stripe_update_subs_payment_method_card_statuses', array( 'active' ) );
77
+		$subs_statuses = apply_filters('wc_stripe_update_subs_payment_method_card_statuses', array('active'));
78 78
 		if (
79
-			apply_filters( 'wc_stripe_display_update_subs_payment_method_card_checkbox', true ) &&
80
-			wcs_user_has_subscription( get_current_user_id(), '', $subs_statuses ) &&
79
+			apply_filters('wc_stripe_display_update_subs_payment_method_card_checkbox', true) &&
80
+			wcs_user_has_subscription(get_current_user_id(), '', $subs_statuses) &&
81 81
 			is_add_payment_method_page()
82 82
 		) {
83
-			$label = esc_html( apply_filters( 'wc_stripe_save_to_subs_text', __( 'Update the Payment Method used for all of my active subscriptions.', 'woocommerce-gateway-stripe' ) ) );
84
-			$id    = sprintf( 'wc-%1$s-update-subs-payment-method-card', $this->id );
83
+			$label = esc_html(apply_filters('wc_stripe_save_to_subs_text', __('Update the Payment Method used for all of my active subscriptions.', 'woocommerce-gateway-stripe')));
84
+			$id    = sprintf('wc-%1$s-update-subs-payment-method-card', $this->id);
85 85
 			woocommerce_form_field(
86 86
 				$id,
87 87
 				array(
88 88
 					'type'    => 'checkbox',
89 89
 					'label'   => $label,
90
-					'default' => apply_filters( 'wc_stripe_save_to_subs_checked', false ),
90
+					'default' => apply_filters('wc_stripe_save_to_subs_checked', false),
91 91
 				)
92 92
 			);
93 93
 		}
@@ -100,19 +100,19 @@  discard block
 block discarded – undo
100 100
 	 * @param string $source_id
101 101
 	 * @param object $source_object
102 102
 	 */
103
-	public function handle_add_payment_method_success( $source_id, $source_object ) {
104
-		if ( isset( $_POST[ 'wc-' . $this->id . '-update-subs-payment-method-card' ] ) ) {
103
+	public function handle_add_payment_method_success($source_id, $source_object) {
104
+		if (isset($_POST['wc-' . $this->id . '-update-subs-payment-method-card'])) {
105 105
 			$all_subs        = wcs_get_users_subscriptions();
106
-			$subs_statuses   = apply_filters( 'wc_stripe_update_subs_payment_method_card_statuses', array( 'active' ) );
107
-			$stripe_customer = new WC_Stripe_Customer( get_current_user_id() );
108
-
109
-			if ( ! empty( $all_subs ) ) {
110
-				foreach ( $all_subs as $sub ) {
111
-					if ( $sub->has_status( $subs_statuses ) ) {
112
-						update_post_meta( $sub->get_id(), '_stripe_source_id', $source_id );
113
-						update_post_meta( $sub->get_id(), '_stripe_customer_id', $stripe_customer->get_id() );
114
-						update_post_meta( $sub->get_id(), '_payment_method', $this->id );
115
-						update_post_meta( $sub->get_id(), '_payment_method_title', $this->method_title );
106
+			$subs_statuses   = apply_filters('wc_stripe_update_subs_payment_method_card_statuses', array('active'));
107
+			$stripe_customer = new WC_Stripe_Customer(get_current_user_id());
108
+
109
+			if ( ! empty($all_subs)) {
110
+				foreach ($all_subs as $sub) {
111
+					if ($sub->has_status($subs_statuses)) {
112
+						update_post_meta($sub->get_id(), '_stripe_source_id', $source_id);
113
+						update_post_meta($sub->get_id(), '_stripe_customer_id', $stripe_customer->get_id());
114
+						update_post_meta($sub->get_id(), '_payment_method', $this->id);
115
+						update_post_meta($sub->get_id(), '_payment_method_title', $this->method_title);
116 116
 					}
117 117
 				}
118 118
 			}
@@ -125,24 +125,24 @@  discard block
 block discarded – undo
125 125
 	 * @since 3.1.0
126 126
 	 * @version 4.0.0
127 127
 	 */
128
-	public function save_source_to_order( $order, $source ) {
129
-		parent::save_source_to_order( $order, $source );
128
+	public function save_source_to_order($order, $source) {
129
+		parent::save_source_to_order($order, $source);
130 130
 
131 131
 		$order_id = $order->get_id();
132 132
 
133 133
 		// Also store it on the subscriptions being purchased or paid for in the order.
134
-		if ( function_exists( 'wcs_order_contains_subscription' ) && wcs_order_contains_subscription( $order_id ) ) {
135
-			$subscriptions = wcs_get_subscriptions_for_order( $order_id );
136
-		} elseif ( function_exists( 'wcs_order_contains_renewal' ) && wcs_order_contains_renewal( $order_id ) ) {
137
-			$subscriptions = wcs_get_subscriptions_for_renewal_order( $order_id );
134
+		if (function_exists('wcs_order_contains_subscription') && wcs_order_contains_subscription($order_id)) {
135
+			$subscriptions = wcs_get_subscriptions_for_order($order_id);
136
+		} elseif (function_exists('wcs_order_contains_renewal') && wcs_order_contains_renewal($order_id)) {
137
+			$subscriptions = wcs_get_subscriptions_for_renewal_order($order_id);
138 138
 		} else {
139 139
 			$subscriptions = array();
140 140
 		}
141 141
 
142
-		foreach ( $subscriptions as $subscription ) {
142
+		foreach ($subscriptions as $subscription) {
143 143
 			$subscription_id = $subscription->get_id();
144
-			update_post_meta( $subscription_id, '_stripe_customer_id', $source->customer );
145
-			update_post_meta( $subscription_id, '_stripe_source_id', $source->source );
144
+			update_post_meta($subscription_id, '_stripe_customer_id', $source->customer);
145
+			update_post_meta($subscription_id, '_stripe_source_id', $source->source);
146 146
 		}
147 147
 	}
148 148
 
@@ -151,16 +151,16 @@  discard block
 block discarded – undo
151 151
 	 * @param  int $order_id
152 152
 	 * @return array
153 153
 	 */
154
-	public function process_payment( $order_id, $retry = true, $force_save_source = false, $previous_error = false ) {
155
-		if ( $this->has_subscription( $order_id ) ) {
156
-			if ( $this->is_subs_change_payment() ) {
157
-				return $this->change_subs_payment_method( $order_id );
154
+	public function process_payment($order_id, $retry = true, $force_save_source = false, $previous_error = false) {
155
+		if ($this->has_subscription($order_id)) {
156
+			if ($this->is_subs_change_payment()) {
157
+				return $this->change_subs_payment_method($order_id);
158 158
 			}
159 159
 
160 160
 			// Regular payment with force customer enabled
161
-			return parent::process_payment( $order_id, $retry, true, $previous_error );
161
+			return parent::process_payment($order_id, $retry, true, $previous_error);
162 162
 		} else {
163
-			return parent::process_payment( $order_id, $retry, $force_save_source, $previous_error );
163
+			return parent::process_payment($order_id, $retry, $force_save_source, $previous_error);
164 164
 		}
165 165
 	}
166 166
 
@@ -170,27 +170,27 @@  discard block
 block discarded – undo
170 170
 	 * @since 4.0.4
171 171
 	 * @param int $order_id
172 172
 	 */
173
-	public function change_subs_payment_method( $order_id ) {
173
+	public function change_subs_payment_method($order_id) {
174 174
 		try {
175
-			$subscription    = wc_get_order( $order_id );
176
-			$prepared_source = $this->prepare_source( get_current_user_id(), true );
175
+			$subscription    = wc_get_order($order_id);
176
+			$prepared_source = $this->prepare_source(get_current_user_id(), true);
177 177
 
178
-			if ( empty( $prepared_source->source ) ) {
179
-				$localized_message = __( 'Payment processing failed. Please retry.', 'woocommerce-gateway-stripe' );
180
-				throw new WC_Stripe_Exception( print_r( $prepared_source, true ), $localized_message );
178
+			if (empty($prepared_source->source)) {
179
+				$localized_message = __('Payment processing failed. Please retry.', 'woocommerce-gateway-stripe');
180
+				throw new WC_Stripe_Exception(print_r($prepared_source, true), $localized_message);
181 181
 			}
182 182
 
183
-			$this->save_source_to_order( $subscription, $prepared_source );
183
+			$this->save_source_to_order($subscription, $prepared_source);
184 184
 
185
-			do_action( 'wc_stripe_change_subs_payment_method_success', $prepared_source->source, $prepared_source );
185
+			do_action('wc_stripe_change_subs_payment_method_success', $prepared_source->source, $prepared_source);
186 186
 
187 187
 			return array(
188 188
 				'result'   => 'success',
189
-				'redirect' => $this->get_return_url( $subscription ),
189
+				'redirect' => $this->get_return_url($subscription),
190 190
 			);
191
-		} catch ( WC_Stripe_Exception $e ) {
192
-			wc_add_notice( $e->getLocalizedMessage(), 'error' );
193
-			WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() );
191
+		} catch (WC_Stripe_Exception $e) {
192
+			wc_add_notice($e->getLocalizedMessage(), 'error');
193
+			WC_Stripe_Logger::log('Error: ' . $e->getMessage());
194 194
 		}
195 195
 	}
196 196
 
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 	 * @param $amount_to_charge float The amount to charge.
201 201
 	 * @param $renewal_order WC_Order A WC_Order object created to record the renewal payment.
202 202
 	 */
203
-	public function scheduled_subscription_payment( $amount_to_charge, $renewal_order ) {
204
-		$this->process_subscription_payment( $amount_to_charge, $renewal_order, true, false );
203
+	public function scheduled_subscription_payment($amount_to_charge, $renewal_order) {
204
+		$this->process_subscription_payment($amount_to_charge, $renewal_order, true, false);
205 205
 	}
206 206
 
207 207
 	/**
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
 	 * @param bool $retry Should we retry the process?
216 216
 	 * @param object $previous_error
217 217
 	 */
218
-	public function process_subscription_payment( $amount, $renewal_order, $retry = true, $previous_error = false ) {
218
+	public function process_subscription_payment($amount, $renewal_order, $retry = true, $previous_error = false) {
219 219
 		try {
220
-			if ( $amount * 100 < WC_Stripe_Helper::get_minimum_amount() ) {
220
+			if ($amount * 100 < WC_Stripe_Helper::get_minimum_amount()) {
221 221
 				/* translators: minimum amount */
222
-				$message = sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe_Helper::get_minimum_amount() / 100 ) );
222
+				$message = sprintf(__('Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe'), wc_price(WC_Stripe_Helper::get_minimum_amount() / 100));
223 223
 				throw new WC_Stripe_Exception(
224 224
 					'Error while processing renewal order ' . $renewal_order->get_id() . ' : ' . $message,
225 225
 					$message
@@ -228,82 +228,82 @@  discard block
 block discarded – undo
228 228
 
229 229
 			$order_id = $renewal_order->get_id();
230 230
 
231
-			$this->ensure_subscription_has_customer_id( $order_id );
231
+			$this->ensure_subscription_has_customer_id($order_id);
232 232
 
233 233
 			// Get source from order
234
-			$prepared_source = $this->prepare_order_source( $renewal_order );
234
+			$prepared_source = $this->prepare_order_source($renewal_order);
235 235
 			$source_object   = $prepared_source->source_object;
236 236
 
237
-			if ( ! $prepared_source->customer ) {
237
+			if ( ! $prepared_source->customer) {
238 238
 				throw new WC_Stripe_Exception(
239 239
 					'Failed to process renewal for order ' . $renewal_order->get_id() . '. Stripe customer id is missing in the order',
240
-					__( 'Customer not found', 'woocommerce-gateway-stripe' )
240
+					__('Customer not found', 'woocommerce-gateway-stripe')
241 241
 				);
242 242
 			}
243 243
 
244
-			WC_Stripe_Logger::log( "Info: Begin processing subscription payment for order {$order_id} for the amount of {$amount}" );
244
+			WC_Stripe_Logger::log("Info: Begin processing subscription payment for order {$order_id} for the amount of {$amount}");
245 245
 
246 246
 			/* If we're doing a retry and source is chargeable, we need to pass
247 247
 			 * a different idempotency key and retry for success.
248 248
 			 */
249
-			if ( is_object( $source_object ) && empty( $source_object->error ) && $this->need_update_idempotency_key( $source_object, $previous_error ) ) {
250
-				add_filter( 'wc_stripe_idempotency_key', array( $this, 'change_idempotency_key' ), 10, 2 );
249
+			if (is_object($source_object) && empty($source_object->error) && $this->need_update_idempotency_key($source_object, $previous_error)) {
250
+				add_filter('wc_stripe_idempotency_key', array($this, 'change_idempotency_key'), 10, 2);
251 251
 			}
252 252
 
253
-			if ( ( $this->is_no_such_source_error( $previous_error ) || $this->is_no_linked_source_error( $previous_error ) ) && apply_filters( 'wc_stripe_use_default_customer_source', true ) ) {
253
+			if (($this->is_no_such_source_error($previous_error) || $this->is_no_linked_source_error($previous_error)) && apply_filters('wc_stripe_use_default_customer_source', true)) {
254 254
 				// Passing empty source will charge customer default.
255 255
 				$prepared_source->source = '';
256 256
 			}
257 257
 
258
-			$request            = $this->generate_payment_request( $renewal_order, $prepared_source );
258
+			$request            = $this->generate_payment_request($renewal_order, $prepared_source);
259 259
 			$request['capture'] = 'true';
260
-			$request['amount']  = WC_Stripe_Helper::get_stripe_amount( $amount, $request['currency'] );
261
-			$response           = WC_Stripe_API::request( $request );
260
+			$request['amount']  = WC_Stripe_Helper::get_stripe_amount($amount, $request['currency']);
261
+			$response           = WC_Stripe_API::request($request);
262 262
 
263
-			if ( ! empty( $response->error ) ) {
263
+			if ( ! empty($response->error)) {
264 264
 				// We want to retry.
265
-				if ( $this->is_retryable_error( $response->error ) ) {
266
-					if ( $retry ) {
265
+				if ($this->is_retryable_error($response->error)) {
266
+					if ($retry) {
267 267
 						// Don't do anymore retries after this.
268
-						if ( 5 <= $this->retry_interval ) {
269
-							return $this->process_subscription_payment( $amount, $renewal_order, false, $response->error );
268
+						if (5 <= $this->retry_interval) {
269
+							return $this->process_subscription_payment($amount, $renewal_order, false, $response->error);
270 270
 						}
271 271
 
272
-						sleep( $this->retry_interval );
272
+						sleep($this->retry_interval);
273 273
 
274 274
 						$this->retry_interval++;
275 275
 
276
-						return $this->process_subscription_payment( $amount, $renewal_order, true, $response->error );
276
+						return $this->process_subscription_payment($amount, $renewal_order, true, $response->error);
277 277
 					} else {
278
-						$localized_message = __( 'Sorry, we are unable to process your payment at this time. Please retry later.', 'woocommerce-gateway-stripe' );
279
-						$renewal_order->add_order_note( $localized_message );
280
-						throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
278
+						$localized_message = __('Sorry, we are unable to process your payment at this time. Please retry later.', 'woocommerce-gateway-stripe');
279
+						$renewal_order->add_order_note($localized_message);
280
+						throw new WC_Stripe_Exception(print_r($response, true), $localized_message);
281 281
 					}
282 282
 				}
283 283
 
284 284
 				$localized_messages = WC_Stripe_Helper::get_localized_messages();
285 285
 
286
-				if ( 'card_error' === $response->error->type ) {
287
-					$localized_message = isset( $localized_messages[ $response->error->code ] ) ? $localized_messages[ $response->error->code ] : $response->error->message;
286
+				if ('card_error' === $response->error->type) {
287
+					$localized_message = isset($localized_messages[$response->error->code]) ? $localized_messages[$response->error->code] : $response->error->message;
288 288
 				} else {
289
-					$localized_message = isset( $localized_messages[ $response->error->type ] ) ? $localized_messages[ $response->error->type ] : $response->error->message;
289
+					$localized_message = isset($localized_messages[$response->error->type]) ? $localized_messages[$response->error->type] : $response->error->message;
290 290
 				}
291 291
 
292
-				$renewal_order->add_order_note( $localized_message );
292
+				$renewal_order->add_order_note($localized_message);
293 293
 
294
-				throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
294
+				throw new WC_Stripe_Exception(print_r($response, true), $localized_message);
295 295
 			}
296 296
 
297
-			do_action( 'wc_gateway_stripe_process_payment', $response, $renewal_order );
297
+			do_action('wc_gateway_stripe_process_payment', $response, $renewal_order);
298 298
 
299
-			$this->process_response( $response, $renewal_order );
300
-		} catch ( WC_Stripe_Exception $e ) {
301
-			WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() );
299
+			$this->process_response($response, $renewal_order);
300
+		} catch (WC_Stripe_Exception $e) {
301
+			WC_Stripe_Logger::log('Error: ' . $e->getMessage());
302 302
 
303
-			do_action( 'wc_gateway_stripe_process_payment_error', $e, $renewal_order );
303
+			do_action('wc_gateway_stripe_process_payment_error', $e, $renewal_order);
304 304
 
305 305
 			/* translators: error message */
306
-			$renewal_order->update_status( 'failed' );
306
+			$renewal_order->update_status('failed');
307 307
 		}
308 308
 	}
309 309
 
@@ -311,21 +311,21 @@  discard block
 block discarded – undo
311 311
 	 * Don't transfer Stripe customer/token meta to resubscribe orders.
312 312
 	 * @param int $resubscribe_order The order created for the customer to resubscribe to the old expired/cancelled subscription
313 313
 	 */
314
-	public function delete_resubscribe_meta( $resubscribe_order ) {
315
-		delete_post_meta( $resubscribe_order->get_id(), '_stripe_customer_id' );
316
-		delete_post_meta( $resubscribe_order->get_id(), '_stripe_source_id' );
314
+	public function delete_resubscribe_meta($resubscribe_order) {
315
+		delete_post_meta($resubscribe_order->get_id(), '_stripe_customer_id');
316
+		delete_post_meta($resubscribe_order->get_id(), '_stripe_source_id');
317 317
 		// For BW compat will remove in future
318
-		delete_post_meta( $resubscribe_order->get_id(), '_stripe_card_id' );
319
-		$this->delete_renewal_meta( $resubscribe_order );
318
+		delete_post_meta($resubscribe_order->get_id(), '_stripe_card_id');
319
+		$this->delete_renewal_meta($resubscribe_order);
320 320
 	}
321 321
 
322 322
 	/**
323 323
 	 * Don't transfer Stripe fee/ID meta to renewal orders.
324 324
 	 * @param int $resubscribe_order The order created for the customer to resubscribe to the old expired/cancelled subscription
325 325
 	 */
326
-	public function delete_renewal_meta( $renewal_order ) {
327
-		WC_Stripe_Helper::delete_stripe_fee( $renewal_order );
328
-		WC_Stripe_Helper::delete_stripe_net( $renewal_order );
326
+	public function delete_renewal_meta($renewal_order) {
327
+		WC_Stripe_Helper::delete_stripe_fee($renewal_order);
328
+		WC_Stripe_Helper::delete_stripe_net($renewal_order);
329 329
 
330 330
 		return $renewal_order;
331 331
 	}
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
 	 * @param WC_Order $renewal_order The order which recorded the successful payment (to make up for the failed automatic payment).
340 340
 	 * @return void
341 341
 	 */
342
-	public function update_failing_payment_method( $subscription, $renewal_order ) {
343
-		update_post_meta( $subscription->get_id(), '_stripe_customer_id', $renewal_order->get_meta( '_stripe_customer_id', true ) );
344
-		update_post_meta( $subscription->get_id(), '_stripe_source_id', $renewal_order->get_meta( '_stripe_source_id', true ) );
342
+	public function update_failing_payment_method($subscription, $renewal_order) {
343
+		update_post_meta($subscription->get_id(), '_stripe_customer_id', $renewal_order->get_meta('_stripe_customer_id', true));
344
+		update_post_meta($subscription->get_id(), '_stripe_source_id', $renewal_order->get_meta('_stripe_source_id', true));
345 345
 	}
346 346
 
347 347
 	/**
@@ -353,21 +353,21 @@  discard block
 block discarded – undo
353 353
 	 * @param WC_Subscription $subscription An instance of a subscription object
354 354
 	 * @return array
355 355
 	 */
356
-	public function add_subscription_payment_meta( $payment_meta, $subscription ) {
357
-		$source_id = get_post_meta( $subscription->get_id(), '_stripe_source_id', true );
356
+	public function add_subscription_payment_meta($payment_meta, $subscription) {
357
+		$source_id = get_post_meta($subscription->get_id(), '_stripe_source_id', true);
358 358
 
359 359
 		// For BW compat will remove in future.
360
-		if ( empty( $source_id ) ) {
361
-			$source_id = get_post_meta( $subscription->get_id(), '_stripe_card_id', true );
360
+		if (empty($source_id)) {
361
+			$source_id = get_post_meta($subscription->get_id(), '_stripe_card_id', true);
362 362
 
363 363
 			// Take this opportunity to update the key name.
364
-			update_post_meta( $subscription->get_id(), '_stripe_source_id', $source_id );
364
+			update_post_meta($subscription->get_id(), '_stripe_source_id', $source_id);
365 365
 		}
366 366
 
367
-		$payment_meta[ $this->id ] = array(
367
+		$payment_meta[$this->id] = array(
368 368
 			'post_meta' => array(
369 369
 				'_stripe_customer_id' => array(
370
-					'value' => get_post_meta( $subscription->get_id(), '_stripe_customer_id', true ),
370
+					'value' => get_post_meta($subscription->get_id(), '_stripe_customer_id', true),
371 371
 					'label' => 'Stripe Customer ID',
372 372
 				),
373 373
 				'_stripe_source_id'   => array(
@@ -388,26 +388,26 @@  discard block
 block discarded – undo
388 388
 	 * @param array $payment_meta associative array of meta data required for automatic payments
389 389
 	 * @return array
390 390
 	 */
391
-	public function validate_subscription_payment_meta( $payment_method_id, $payment_meta ) {
392
-		if ( $this->id === $payment_method_id ) {
391
+	public function validate_subscription_payment_meta($payment_method_id, $payment_meta) {
392
+		if ($this->id === $payment_method_id) {
393 393
 
394
-			if ( ! isset( $payment_meta['post_meta']['_stripe_customer_id']['value'] ) || empty( $payment_meta['post_meta']['_stripe_customer_id']['value'] ) ) {
394
+			if ( ! isset($payment_meta['post_meta']['_stripe_customer_id']['value']) || empty($payment_meta['post_meta']['_stripe_customer_id']['value'])) {
395 395
 
396 396
 				// Allow empty stripe customer id during subscription renewal. It will be added when processing payment if required.
397
-				if ( ! isset( $_POST['wc_order_action'] ) || 'wcs_process_renewal' !== $_POST['wc_order_action'] ) {
398
-					throw new Exception( __( 'A "Stripe Customer ID" value is required.', 'woocommerce-gateway-stripe' ) );
397
+				if ( ! isset($_POST['wc_order_action']) || 'wcs_process_renewal' !== $_POST['wc_order_action']) {
398
+					throw new Exception(__('A "Stripe Customer ID" value is required.', 'woocommerce-gateway-stripe'));
399 399
 				}
400
-			} elseif ( 0 !== strpos( $payment_meta['post_meta']['_stripe_customer_id']['value'], 'cus_' ) ) {
401
-				throw new Exception( __( 'Invalid customer ID. A valid "Stripe Customer ID" must begin with "cus_".', 'woocommerce-gateway-stripe' ) );
400
+			} elseif (0 !== strpos($payment_meta['post_meta']['_stripe_customer_id']['value'], 'cus_')) {
401
+				throw new Exception(__('Invalid customer ID. A valid "Stripe Customer ID" must begin with "cus_".', 'woocommerce-gateway-stripe'));
402 402
 			}
403 403
 
404 404
 			if (
405
-				( ! empty( $payment_meta['post_meta']['_stripe_source_id']['value'] )
406
-				&& 0 !== strpos( $payment_meta['post_meta']['_stripe_source_id']['value'], 'card_' ) )
407
-				&& ( ! empty( $payment_meta['post_meta']['_stripe_source_id']['value'] )
408
-				&& 0 !== strpos( $payment_meta['post_meta']['_stripe_source_id']['value'], 'src_' ) ) ) {
405
+				( ! empty($payment_meta['post_meta']['_stripe_source_id']['value'])
406
+				&& 0 !== strpos($payment_meta['post_meta']['_stripe_source_id']['value'], 'card_'))
407
+				&& ( ! empty($payment_meta['post_meta']['_stripe_source_id']['value'])
408
+				&& 0 !== strpos($payment_meta['post_meta']['_stripe_source_id']['value'], 'src_')) ) {
409 409
 
410
-				throw new Exception( __( 'Invalid source ID. A valid source "Stripe Source ID" must begin with "src_" or "card_".', 'woocommerce-gateway-stripe' ) );
410
+				throw new Exception(__('Invalid source ID. A valid source "Stripe Source ID" must begin with "src_" or "card_".', 'woocommerce-gateway-stripe'));
411 411
 			}
412 412
 		}
413 413
 	}
@@ -420,67 +420,67 @@  discard block
 block discarded – undo
420 420
 	 * @param WC_Subscription $subscription the subscription details
421 421
 	 * @return string the subscription payment method
422 422
 	 */
423
-	public function maybe_render_subscription_payment_method( $payment_method_to_display, $subscription ) {
423
+	public function maybe_render_subscription_payment_method($payment_method_to_display, $subscription) {
424 424
 		$customer_user = $subscription->get_customer_id();
425 425
 
426 426
 		// bail for other payment methods
427
-		if ( $subscription->get_payment_method() !== $this->id || ! $customer_user ) {
427
+		if ($subscription->get_payment_method() !== $this->id || ! $customer_user) {
428 428
 			return $payment_method_to_display;
429 429
 		}
430 430
 
431
-		$stripe_source_id = get_post_meta( $subscription->get_id(), '_stripe_source_id', true );
431
+		$stripe_source_id = get_post_meta($subscription->get_id(), '_stripe_source_id', true);
432 432
 
433 433
 		// For BW compat will remove in future.
434
-		if ( empty( $stripe_source_id ) ) {
435
-			$stripe_source_id = get_post_meta( $subscription->get_id(), '_stripe_card_id', true );
434
+		if (empty($stripe_source_id)) {
435
+			$stripe_source_id = get_post_meta($subscription->get_id(), '_stripe_card_id', true);
436 436
 
437 437
 			// Take this opportunity to update the key name.
438
-			update_post_meta( $subscription->get_id(), '_stripe_source_id', $stripe_source_id );
438
+			update_post_meta($subscription->get_id(), '_stripe_source_id', $stripe_source_id);
439 439
 		}
440 440
 
441 441
 		$stripe_customer    = new WC_Stripe_Customer();
442
-		$stripe_customer_id = get_post_meta( $subscription->get_id(), '_stripe_customer_id', true );
442
+		$stripe_customer_id = get_post_meta($subscription->get_id(), '_stripe_customer_id', true);
443 443
 
444 444
 		// If we couldn't find a Stripe customer linked to the subscription, fallback to the user meta data.
445
-		if ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) {
445
+		if ( ! $stripe_customer_id || ! is_string($stripe_customer_id)) {
446 446
 			$user_id            = $customer_user;
447
-			$stripe_customer_id = get_user_option( '_stripe_customer_id', $user_id );
448
-			$stripe_source_id   = get_user_option( '_stripe_source_id', $user_id );
447
+			$stripe_customer_id = get_user_option('_stripe_customer_id', $user_id);
448
+			$stripe_source_id   = get_user_option('_stripe_source_id', $user_id);
449 449
 
450 450
 			// For BW compat will remove in future.
451
-			if ( empty( $stripe_source_id ) ) {
452
-				$stripe_source_id = get_user_option( '_stripe_card_id', $user_id );
451
+			if (empty($stripe_source_id)) {
452
+				$stripe_source_id = get_user_option('_stripe_card_id', $user_id);
453 453
 
454 454
 				// Take this opportunity to update the key name.
455
-				update_user_option( $user_id, '_stripe_source_id', $stripe_source_id, false );
455
+				update_user_option($user_id, '_stripe_source_id', $stripe_source_id, false);
456 456
 			}
457 457
 		}
458 458
 
459 459
 		// If we couldn't find a Stripe customer linked to the account, fallback to the order meta data.
460
-		if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) {
461
-			$stripe_customer_id = get_post_meta( $subscription->get_parent_id(), '_stripe_customer_id', true );
462
-			$stripe_source_id   = get_post_meta( $subscription->get_parent_id(), '_stripe_source_id', true );
460
+		if (( ! $stripe_customer_id || ! is_string($stripe_customer_id)) && false !== $subscription->order) {
461
+			$stripe_customer_id = get_post_meta($subscription->get_parent_id(), '_stripe_customer_id', true);
462
+			$stripe_source_id   = get_post_meta($subscription->get_parent_id(), '_stripe_source_id', true);
463 463
 
464 464
 			// For BW compat will remove in future.
465
-			if ( empty( $stripe_source_id ) ) {
466
-				$stripe_source_id = get_post_meta( $subscription->get_parent_id(), '_stripe_card_id', true );
465
+			if (empty($stripe_source_id)) {
466
+				$stripe_source_id = get_post_meta($subscription->get_parent_id(), '_stripe_card_id', true);
467 467
 
468 468
 				// Take this opportunity to update the key name.
469
-				update_post_meta( $subscription->get_parent_id(), '_stripe_source_id', $stripe_source_id );
469
+				update_post_meta($subscription->get_parent_id(), '_stripe_source_id', $stripe_source_id);
470 470
 			}
471 471
 		}
472 472
 
473
-		$stripe_customer->set_id( $stripe_customer_id );
473
+		$stripe_customer->set_id($stripe_customer_id);
474 474
 
475 475
 		$sources                   = $stripe_customer->get_sources();
476
-		$payment_method_to_display = __( 'N/A', 'woocommerce-gateway-stripe' );
476
+		$payment_method_to_display = __('N/A', 'woocommerce-gateway-stripe');
477 477
 
478
-		if ( $sources ) {
479
-			foreach ( $sources as $source ) {
480
-				if ( $source->id === $stripe_source_id ) {
481
-					if ( $source->sepa_debit ) {
478
+		if ($sources) {
479
+			foreach ($sources as $source) {
480
+				if ($source->id === $stripe_source_id) {
481
+					if ($source->sepa_debit) {
482 482
 						/* translators: 1) last 4 digits of SEPA Direct Debit */
483
-						$payment_method_to_display = sprintf( __( 'Via SEPA Direct Debit ending in %1$s', 'woocommerce-gateway-stripe' ), $source->sepa_debit->last4 );
483
+						$payment_method_to_display = sprintf(__('Via SEPA Direct Debit ending in %1$s', 'woocommerce-gateway-stripe'), $source->sepa_debit->last4);
484 484
 					}
485 485
 
486 486
 					break;
Please login to merge, or discard this patch.
includes/class-wc-stripe-payment-tokens.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 	public function __construct() {
22 22
 		self::$_this = $this;
23 23
 
24
-		add_filter( 'woocommerce_get_customer_payment_tokens', array( $this, 'woocommerce_get_customer_payment_tokens' ), 10, 3 );
25
-		add_filter( 'woocommerce_payment_methods_list_item', array( $this, 'get_account_saved_payment_methods_list_item_sepa' ), 10, 2 );
26
-		add_filter( 'woocommerce_get_credit_card_type_label', array( $this, 'normalize_sepa_label' ) );
27
-		add_action( 'woocommerce_payment_token_deleted', array( $this, 'woocommerce_payment_token_deleted' ), 10, 2 );
28
-		add_action( 'woocommerce_payment_token_set_default', array( $this, 'woocommerce_payment_token_set_default' ) );
24
+		add_filter('woocommerce_get_customer_payment_tokens', array($this, 'woocommerce_get_customer_payment_tokens'), 10, 3);
25
+		add_filter('woocommerce_payment_methods_list_item', array($this, 'get_account_saved_payment_methods_list_item_sepa'), 10, 2);
26
+		add_filter('woocommerce_get_credit_card_type_label', array($this, 'normalize_sepa_label'));
27
+		add_action('woocommerce_payment_token_deleted', array($this, 'woocommerce_payment_token_deleted'), 10, 2);
28
+		add_action('woocommerce_payment_token_set_default', array($this, 'woocommerce_payment_token_set_default'));
29 29
 	}
30 30
 
31 31
 	/**
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	 * @param string $label
47 47
 	 * @return string $label
48 48
 	 */
49
-	public function normalize_sepa_label( $label ) {
50
-		if ( 'sepa iban' === strtolower( $label ) ) {
49
+	public function normalize_sepa_label($label) {
50
+		if ('sepa iban' === strtolower($label)) {
51 51
 			return 'SEPA IBAN';
52 52
 		}
53 53
 
@@ -61,19 +61,19 @@  discard block
 block discarded – undo
61 61
 	 * @param int $customer_id
62 62
 	 * @return bool
63 63
 	 */
64
-	public static function customer_has_saved_methods( $customer_id ) {
65
-		$gateways = array( 'stripe', 'stripe_sepa' );
64
+	public static function customer_has_saved_methods($customer_id) {
65
+		$gateways = array('stripe', 'stripe_sepa');
66 66
 
67
-		if ( empty( $customer_id ) ) {
67
+		if (empty($customer_id)) {
68 68
 			return false;
69 69
 		}
70 70
 
71 71
 		$has_token = false;
72 72
 
73
-		foreach ( $gateways as $gateway ) {
74
-			$tokens = WC_Payment_Tokens::get_customer_tokens( $customer_id, $gateway );
73
+		foreach ($gateways as $gateway) {
74
+			$tokens = WC_Payment_Tokens::get_customer_tokens($customer_id, $gateway);
75 75
 
76
-			if ( ! empty( $tokens ) ) {
76
+			if ( ! empty($tokens)) {
77 77
 				$has_token = true;
78 78
 				break;
79 79
 			}
@@ -90,67 +90,67 @@  discard block
 block discarded – undo
90 90
 	 * @param array $tokens
91 91
 	 * @return array
92 92
 	 */
93
-	public function woocommerce_get_customer_payment_tokens( $tokens, $customer_id, $gateway_id ) {
94
-		if ( is_user_logged_in() && class_exists( 'WC_Payment_Token_CC' ) ) {
93
+	public function woocommerce_get_customer_payment_tokens($tokens, $customer_id, $gateway_id) {
94
+		if (is_user_logged_in() && class_exists('WC_Payment_Token_CC')) {
95 95
 			$stored_tokens = array();
96 96
 
97
-			foreach ( $tokens as $token ) {
97
+			foreach ($tokens as $token) {
98 98
 				$stored_tokens[] = $token->get_token();
99 99
 			}
100 100
 
101
-			if ( 'stripe' === $gateway_id ) {
102
-				$stripe_customer = new WC_Stripe_Customer( $customer_id );
101
+			if ('stripe' === $gateway_id) {
102
+				$stripe_customer = new WC_Stripe_Customer($customer_id);
103 103
 				$stripe_sources  = $stripe_customer->get_sources();
104 104
 
105
-				foreach ( $stripe_sources as $source ) {
106
-					if ( isset( $source->type ) && 'card' === $source->type ) {
107
-						if ( ! in_array( $source->id, $stored_tokens ) ) {
105
+				foreach ($stripe_sources as $source) {
106
+					if (isset($source->type) && 'card' === $source->type) {
107
+						if ( ! in_array($source->id, $stored_tokens)) {
108 108
 							$token = new WC_Payment_Token_CC();
109
-							$token->set_token( $source->id );
110
-							$token->set_gateway_id( 'stripe' );
111
-
112
-							if ( 'source' === $source->object && 'card' === $source->type ) {
113
-								$token->set_card_type( strtolower( $source->card->brand ) );
114
-								$token->set_last4( $source->card->last4 );
115
-								$token->set_expiry_month( $source->card->exp_month );
116
-								$token->set_expiry_year( $source->card->exp_year );
109
+							$token->set_token($source->id);
110
+							$token->set_gateway_id('stripe');
111
+
112
+							if ('source' === $source->object && 'card' === $source->type) {
113
+								$token->set_card_type(strtolower($source->card->brand));
114
+								$token->set_last4($source->card->last4);
115
+								$token->set_expiry_month($source->card->exp_month);
116
+								$token->set_expiry_year($source->card->exp_year);
117 117
 							}
118 118
 
119
-							$token->set_user_id( $customer_id );
119
+							$token->set_user_id($customer_id);
120 120
 							$token->save();
121
-							$tokens[ $token->get_id() ] = $token;
121
+							$tokens[$token->get_id()] = $token;
122 122
 						}
123 123
 					} else {
124
-						if ( ! in_array( $source->id, $stored_tokens ) && 'card' === $source->object ) {
124
+						if ( ! in_array($source->id, $stored_tokens) && 'card' === $source->object) {
125 125
 							$token = new WC_Payment_Token_CC();
126
-							$token->set_token( $source->id );
127
-							$token->set_gateway_id( 'stripe' );
128
-							$token->set_card_type( strtolower( $source->brand ) );
129
-							$token->set_last4( $source->last4 );
130
-							$token->set_expiry_month( $source->exp_month );
131
-							$token->set_expiry_year( $source->exp_year );
132
-							$token->set_user_id( $customer_id );
126
+							$token->set_token($source->id);
127
+							$token->set_gateway_id('stripe');
128
+							$token->set_card_type(strtolower($source->brand));
129
+							$token->set_last4($source->last4);
130
+							$token->set_expiry_month($source->exp_month);
131
+							$token->set_expiry_year($source->exp_year);
132
+							$token->set_user_id($customer_id);
133 133
 							$token->save();
134
-							$tokens[ $token->get_id() ] = $token;
134
+							$tokens[$token->get_id()] = $token;
135 135
 						}
136 136
 					}
137 137
 				}
138 138
 			}
139 139
 
140
-			if ( 'stripe_sepa' === $gateway_id ) {
141
-				$stripe_customer = new WC_Stripe_Customer( $customer_id );
140
+			if ('stripe_sepa' === $gateway_id) {
141
+				$stripe_customer = new WC_Stripe_Customer($customer_id);
142 142
 				$stripe_sources  = $stripe_customer->get_sources();
143 143
 
144
-				foreach ( $stripe_sources as $source ) {
145
-					if ( isset( $source->type ) && 'sepa_debit' === $source->type ) {
146
-						if ( ! in_array( $source->id, $stored_tokens ) ) {
144
+				foreach ($stripe_sources as $source) {
145
+					if (isset($source->type) && 'sepa_debit' === $source->type) {
146
+						if ( ! in_array($source->id, $stored_tokens)) {
147 147
 							$token = new WC_Payment_Token_SEPA();
148
-							$token->set_token( $source->id );
149
-							$token->set_gateway_id( 'stripe_sepa' );
150
-							$token->set_last4( $source->sepa_debit->last4 );
151
-							$token->set_user_id( $customer_id );
148
+							$token->set_token($source->id);
149
+							$token->set_gateway_id('stripe_sepa');
150
+							$token->set_last4($source->sepa_debit->last4);
151
+							$token->set_user_id($customer_id);
152 152
 							$token->save();
153
-							$tokens[ $token->get_id() ] = $token;
153
+							$tokens[$token->get_id()] = $token;
154 154
 						}
155 155
 					}
156 156
 				}
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 	 * @param  WC_Payment_Token $payment_token The payment token associated with this method entry
170 170
 	 * @return array                           Filtered item
171 171
 	 */
172
-	public function get_account_saved_payment_methods_list_item_sepa( $item, $payment_token ) {
173
-		if ( 'sepa' === strtolower( $payment_token->get_type() ) ) {
172
+	public function get_account_saved_payment_methods_list_item_sepa($item, $payment_token) {
173
+		if ('sepa' === strtolower($payment_token->get_type())) {
174 174
 			$item['method']['last4'] = $payment_token->get_last4();
175
-			$item['method']['brand'] = esc_html__( 'SEPA IBAN', 'woocommerce-gateway-stripe' );
175
+			$item['method']['brand'] = esc_html__('SEPA IBAN', 'woocommerce-gateway-stripe');
176 176
 		}
177 177
 
178 178
 		return $item;
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 	 * @since 3.1.0
185 185
 	 * @version 4.0.0
186 186
 	 */
187
-	public function woocommerce_payment_token_deleted( $token_id, $token ) {
188
-		if ( 'stripe' === $token->get_gateway_id() || 'stripe_sepa' === $token->get_gateway_id() ) {
189
-			$stripe_customer = new WC_Stripe_Customer( get_current_user_id() );
190
-			$stripe_customer->delete_source( $token->get_token() );
187
+	public function woocommerce_payment_token_deleted($token_id, $token) {
188
+		if ('stripe' === $token->get_gateway_id() || 'stripe_sepa' === $token->get_gateway_id()) {
189
+			$stripe_customer = new WC_Stripe_Customer(get_current_user_id());
190
+			$stripe_customer->delete_source($token->get_token());
191 191
 		}
192 192
 	}
193 193
 
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 	 * @since 3.1.0
198 198
 	 * @version 4.0.0
199 199
 	 */
200
-	public function woocommerce_payment_token_set_default( $token_id ) {
201
-		$token = WC_Payment_Tokens::get( $token_id );
200
+	public function woocommerce_payment_token_set_default($token_id) {
201
+		$token = WC_Payment_Tokens::get($token_id);
202 202
 
203
-		if ( 'stripe' === $token->get_gateway_id() || 'stripe_sepa' === $token->get_gateway_id() ) {
204
-			$stripe_customer = new WC_Stripe_Customer( get_current_user_id() );
205
-			$stripe_customer->set_default_source( $token->get_token() );
203
+		if ('stripe' === $token->get_gateway_id() || 'stripe_sepa' === $token->get_gateway_id()) {
204
+			$stripe_customer = new WC_Stripe_Customer(get_current_user_id());
205
+			$stripe_customer->set_default_source($token->get_token());
206 206
 		}
207 207
 	}
208 208
 }
Please login to merge, or discard this patch.