@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -7,36 +7,36 @@ discard block |
||
7 | 7 | 'wc_stripe_multibanco_settings', |
8 | 8 | array( |
9 | 9 | 'geo_target' => array( |
10 | - 'description' => __( 'Relevant Payer Geography: Portugal', 'woocommerce-gateway-stripe' ), |
|
10 | + 'description' => __('Relevant Payer 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(), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -7,40 +7,40 @@ discard block |
||
7 | 7 | 'wc_stripe_ideal_settings', |
8 | 8 | array( |
9 | 9 | 'geo_target' => array( |
10 | - 'description' => __( 'Relevant Payer Geography: The Netherlands', 'woocommerce-gateway-stripe' ), |
|
10 | + 'description' => __('Relevant Payer 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(), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -7,40 +7,40 @@ discard block |
||
7 | 7 | 'wc_stripe_sepa_settings', |
8 | 8 | array( |
9 | 9 | 'geo_target' => array( |
10 | - 'description' => __( 'Relevant Payer Geography: France, Germany, Spain, Belgium, Netherlands, Luxembourg, Italy, Portugal, Austria, Ireland', 'woocommerce-gateway-stripe' ), |
|
10 | + 'description' => __('Relevant Payer 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(), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -7,40 +7,40 @@ discard block |
||
7 | 7 | 'wc_stripe_sofort_settings', |
8 | 8 | array( |
9 | 9 | 'geo_target' => array( |
10 | - 'description' => __( 'Relevant Payer Geography: Germany, Austria', 'woocommerce-gateway-stripe' ), |
|
10 | + 'description' => __('Relevant Payer 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(), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -7,36 +7,36 @@ discard block |
||
7 | 7 | 'wc_stripe_p24_settings', |
8 | 8 | array( |
9 | 9 | 'geo_target' => array( |
10 | - 'description' => __( 'Relevant Payer Geography: Poland', 'woocommerce-gateway-stripe' ), |
|
10 | + 'description' => __('Relevant Payer 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(), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -7,36 +7,36 @@ discard block |
||
7 | 7 | 'wc_stripe_eps_settings', |
8 | 8 | array( |
9 | 9 | 'geo_target' => array( |
10 | - 'description' => __( 'Relevant Payer Geography: Austria', 'woocommerce-gateway-stripe' ), |
|
10 | + 'description' => __('Relevant Payer 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 Enpoints', 'woocommerce-gateway-stripe' ), |
|
39 | + 'title' => __('Webhook Enpoints', 'woocommerce-gateway-stripe'), |
|
40 | 40 | 'type' => 'title', |
41 | 41 | /* translators: webhook URL */ |
42 | 42 | 'description' => $this->display_admin_settings_webhook_description(), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -7,40 +7,40 @@ discard block |
||
7 | 7 | 'wc_stripe_alipay_settings', |
8 | 8 | array( |
9 | 9 | 'geo_target' => array( |
10 | - 'description' => __( 'Relevant Payer Geography: China', 'woocommerce-gateway-stripe' ), |
|
10 | + 'description' => __('Relevant Payer Geography: China', 'woocommerce-gateway-stripe'), |
|
11 | 11 | 'type' => 'title', |
12 | 12 | ), |
13 | 13 | 'guide' => array( |
14 | - 'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#alipay" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ), |
|
14 | + 'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#alipay" 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 Alipay', 'woocommerce-gateway-stripe' ), |
|
22 | + 'title' => __('Enable/Disable', 'woocommerce-gateway-stripe'), |
|
23 | + 'label' => __('Enable Stripe Alipay', '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' => __( 'Alipay', 'woocommerce-gateway-stripe' ), |
|
31 | + 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
32 | + 'default' => __('Alipay', '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 Alipay.', '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 Alipay.', '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(), |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @since 4.0.6 |
6 | 6 | */ |
7 | 7 | |
8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
8 | +if ( ! defined('ABSPATH')) { |
|
9 | 9 | exit; |
10 | 10 | } |
11 | 11 | |
@@ -60,21 +60,21 @@ discard block |
||
60 | 60 | public $apple_pay_verify_notice; |
61 | 61 | |
62 | 62 | public function __construct() { |
63 | - $this->stripe_settings = get_option( 'woocommerce_stripe_settings', array() ); |
|
64 | - $this->stripe_enabled = $this->get_option( 'enabled' ); |
|
65 | - $this->payment_request = 'yes' === $this->get_option( 'payment_request', 'yes' ); |
|
66 | - $this->apple_pay_domain_set = 'yes' === $this->get_option( 'apple_pay_domain_set', 'no' ); |
|
63 | + $this->stripe_settings = get_option('woocommerce_stripe_settings', array()); |
|
64 | + $this->stripe_enabled = $this->get_option('enabled'); |
|
65 | + $this->payment_request = 'yes' === $this->get_option('payment_request', 'yes'); |
|
66 | + $this->apple_pay_domain_set = 'yes' === $this->get_option('apple_pay_domain_set', 'no'); |
|
67 | 67 | $this->apple_pay_verify_notice = ''; |
68 | - $this->testmode = 'yes' === $this->get_option( 'testmode', 'no' ); |
|
69 | - $this->secret_key = $this->testmode ? $this->get_option( 'test_secret_key' ) : $this->get_option( 'secret_key' ); |
|
68 | + $this->testmode = 'yes' === $this->get_option('testmode', 'no'); |
|
69 | + $this->secret_key = $this->testmode ? $this->get_option('test_secret_key') : $this->get_option('secret_key'); |
|
70 | 70 | |
71 | - if ( empty( $this->stripe_settings ) ) { |
|
71 | + if (empty($this->stripe_settings)) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
75 | 75 | $this->init_apple_pay(); |
76 | 76 | |
77 | - add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
|
77 | + add_action('admin_notices', array($this, 'admin_notices')); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | * @param string default |
86 | 86 | * @return string $setting_value |
87 | 87 | */ |
88 | - public function get_option( $setting = '', $default = '' ) { |
|
89 | - if ( empty( $this->stripe_settings ) ) { |
|
88 | + public function get_option($setting = '', $default = '') { |
|
89 | + if (empty($this->stripe_settings)) { |
|
90 | 90 | return $default; |
91 | 91 | } |
92 | 92 | |
93 | - if ( ! empty( $this->stripe_settings[ $setting ] ) ) { |
|
94 | - return $this->stripe_settings[ $setting ]; |
|
93 | + if ( ! empty($this->stripe_settings[$setting])) { |
|
94 | + return $this->stripe_settings[$setting]; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | return $default; |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | public function init_apple_pay() { |
107 | 107 | if ( |
108 | 108 | is_admin() && |
109 | - isset( $_GET['page'] ) && 'wc-settings' === $_GET['page'] && |
|
110 | - isset( $_GET['tab'] ) && 'checkout' === $_GET['tab'] && |
|
111 | - isset( $_GET['section'] ) && 'stripe' === $_GET['section'] && |
|
109 | + isset($_GET['page']) && 'wc-settings' === $_GET['page'] && |
|
110 | + isset($_GET['tab']) && 'checkout' === $_GET['tab'] && |
|
111 | + isset($_GET['section']) && 'stripe' === $_GET['section'] && |
|
112 | 112 | $this->payment_request |
113 | 113 | ) { |
114 | 114 | $this->process_apple_pay_verification(); |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | * @version 3.1.0 |
123 | 123 | * @param string $secret_key |
124 | 124 | */ |
125 | - private function register_apple_pay_domain( $secret_key = '' ) { |
|
126 | - if ( empty( $secret_key ) ) { |
|
127 | - throw new Exception( __( 'Unable to verify domain - missing secret key.', 'woocommerce-gateway-stripe' ) ); |
|
125 | + private function register_apple_pay_domain($secret_key = '') { |
|
126 | + if (empty($secret_key)) { |
|
127 | + throw new Exception(__('Unable to verify domain - missing secret key.', 'woocommerce-gateway-stripe')); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | $endpoint = 'https://api.stripe.com/v1/apple_pay/domains'; |
@@ -142,22 +142,22 @@ discard block |
||
142 | 142 | $endpoint, |
143 | 143 | array( |
144 | 144 | 'headers' => $headers, |
145 | - 'body' => http_build_query( $data ), |
|
145 | + 'body' => http_build_query($data), |
|
146 | 146 | ) |
147 | 147 | ); |
148 | 148 | |
149 | - if ( is_wp_error( $response ) ) { |
|
149 | + if (is_wp_error($response)) { |
|
150 | 150 | /* translators: error message */ |
151 | - throw new Exception( sprintf( __( 'Unable to verify domain - %s', 'woocommerce-gateway-stripe' ), $response->get_error_message() ) ); |
|
151 | + throw new Exception(sprintf(__('Unable to verify domain - %s', 'woocommerce-gateway-stripe'), $response->get_error_message())); |
|
152 | 152 | } |
153 | 153 | |
154 | - if ( 200 !== $response['response']['code'] ) { |
|
155 | - $parsed_response = json_decode( $response['body'] ); |
|
154 | + if (200 !== $response['response']['code']) { |
|
155 | + $parsed_response = json_decode($response['body']); |
|
156 | 156 | |
157 | 157 | $this->apple_pay_verify_notice = $parsed_response->error->message; |
158 | 158 | |
159 | 159 | /* translators: error message */ |
160 | - throw new Exception( sprintf( __( 'Unable to verify domain - %s', 'woocommerce-gateway-stripe' ), $parsed_response->error->message ) ); |
|
160 | + throw new Exception(sprintf(__('Unable to verify domain - %s', 'woocommerce-gateway-stripe'), $parsed_response->error->message)); |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
@@ -169,45 +169,45 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function process_apple_pay_verification() { |
171 | 171 | try { |
172 | - $path = untrailingslashit( $_SERVER['DOCUMENT_ROOT'] ); |
|
172 | + $path = untrailingslashit($_SERVER['DOCUMENT_ROOT']); |
|
173 | 173 | $dir = '.well-known'; |
174 | 174 | $file = 'apple-developer-merchantid-domain-association'; |
175 | 175 | $fullpath = $path . '/' . $dir . '/' . $file; |
176 | 176 | |
177 | - if ( $this->apple_pay_domain_set && file_exists( $fullpath ) ) { |
|
177 | + if ($this->apple_pay_domain_set && file_exists($fullpath)) { |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
181 | - if ( ! file_exists( $path . '/' . $dir ) ) { |
|
182 | - if ( ! @mkdir( $path . '/' . $dir, 0755 ) ) { // @codingStandardsIgnoreLine |
|
183 | - throw new Exception( __( 'Unable to create domain association folder to domain root.', 'woocommerce-gateway-stripe' ) ); |
|
181 | + if ( ! file_exists($path . '/' . $dir)) { |
|
182 | + if ( ! @mkdir($path . '/' . $dir, 0755)) { // @codingStandardsIgnoreLine |
|
183 | + throw new Exception(__('Unable to create domain association folder to domain root.', 'woocommerce-gateway-stripe')); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | - if ( ! file_exists( $fullpath ) ) { |
|
188 | - if ( ! @copy( WC_STRIPE_PLUGIN_PATH . '/' . $file, $fullpath ) ) { // @codingStandardsIgnoreLine |
|
189 | - throw new Exception( __( 'Unable to copy domain association file to domain root.', 'woocommerce-gateway-stripe' ) ); |
|
187 | + if ( ! file_exists($fullpath)) { |
|
188 | + if ( ! @copy(WC_STRIPE_PLUGIN_PATH . '/' . $file, $fullpath)) { // @codingStandardsIgnoreLine |
|
189 | + throw new Exception(__('Unable to copy domain association file to domain root.', 'woocommerce-gateway-stripe')); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
193 | 193 | // At this point then the domain association folder and file should be available. |
194 | 194 | // Proceed to verify/and or verify again. |
195 | - $this->register_apple_pay_domain( $this->secret_key ); |
|
195 | + $this->register_apple_pay_domain($this->secret_key); |
|
196 | 196 | |
197 | 197 | // No errors to this point, verification success! |
198 | 198 | $this->stripe_settings['apple_pay_domain_set'] = 'yes'; |
199 | 199 | $this->apple_pay_domain_set = true; |
200 | 200 | |
201 | - update_option( 'woocommerce_stripe_settings', $this->stripe_settings ); |
|
201 | + update_option('woocommerce_stripe_settings', $this->stripe_settings); |
|
202 | 202 | |
203 | - WC_Stripe_Logger::log( 'Your domain has been verified with Apple Pay!' ); |
|
203 | + WC_Stripe_Logger::log('Your domain has been verified with Apple Pay!'); |
|
204 | 204 | |
205 | - } catch ( Exception $e ) { |
|
205 | + } catch (Exception $e) { |
|
206 | 206 | $this->stripe_settings['apple_pay_domain_set'] = 'no'; |
207 | 207 | |
208 | - update_option( 'woocommerce_stripe_settings', $this->stripe_settings ); |
|
208 | + update_option('woocommerce_stripe_settings', $this->stripe_settings); |
|
209 | 209 | |
210 | - WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() ); |
|
210 | + WC_Stripe_Logger::log('Error: ' . $e->getMessage()); |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | * @since 4.0.6 |
218 | 218 | */ |
219 | 219 | public function admin_notices() { |
220 | - if ( ! $this->stripe_enabled ) { |
|
220 | + if ( ! $this->stripe_enabled) { |
|
221 | 221 | return; |
222 | 222 | } |
223 | 223 | |
224 | - if ( ! current_user_can( 'manage_woocommerce' ) ) { |
|
224 | + if ( ! current_user_can('manage_woocommerce')) { |
|
225 | 225 | return; |
226 | 226 | } |
227 | 227 | |
228 | - if ( $this->payment_request && ! empty( $this->apple_pay_verify_notice ) ) { |
|
228 | + if ($this->payment_request && ! empty($this->apple_pay_verify_notice)) { |
|
229 | 229 | $allowed_html = array( |
230 | 230 | 'a' => array( |
231 | 231 | 'href' => array(), |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | ), |
234 | 234 | ); |
235 | 235 | |
236 | - echo '<div class="error stripe-apple-pay-message"><p>' . wp_kses( make_clickable( $this->apple_pay_verify_notice ), $allowed_html ) . '</p></div>'; |
|
236 | + echo '<div class="error stripe-apple-pay-message"><p>' . wp_kses(make_clickable($this->apple_pay_verify_notice), $allowed_html) . '</p></div>'; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | * when setting screen is displayed. So if domain verification is not set, |
242 | 242 | * something went wrong so lets notify user. |
243 | 243 | */ |
244 | - if ( ! empty( $this->secret_key ) && $this->payment_request && ! $this->apple_pay_domain_set ) { |
|
244 | + if ( ! empty($this->secret_key) && $this->payment_request && ! $this->apple_pay_domain_set) { |
|
245 | 245 | /* translators: 1) HTML anchor open tag 2) HTML anchor closing tag */ |
246 | - echo '<div class="error stripe-apple-pay-message"><p>' . sprintf( __( 'Apple Pay domain verification failed. Please check the %1$slog%2$s to see the issue. (Logging must be enabled to see recorded logs)', 'woocommerce-gateway-stripe' ), '<a href="' . admin_url( 'admin.php?page=wc-status&tab=logs' ) . '">', '</a>' ) . '</p></div>'; |
|
246 | + echo '<div class="error stripe-apple-pay-message"><p>' . sprintf(__('Apple Pay domain verification failed. Please check the %1$slog%2$s to see the issue. (Logging must be enabled to see recorded logs)', 'woocommerce-gateway-stripe'), '<a href="' . admin_url('admin.php?page=wc-status&tab=logs') . '">', '</a>') . '</p></div>'; |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | * Constructor |
33 | 33 | * @param int $user_id The WP user ID |
34 | 34 | */ |
35 | - public function __construct( $user_id = 0 ) { |
|
36 | - if ( $user_id ) { |
|
37 | - $this->set_user_id( $user_id ); |
|
38 | - $this->set_id( get_user_meta( $user_id, '_stripe_customer_id', true ) ); |
|
35 | + public function __construct($user_id = 0) { |
|
36 | + if ($user_id) { |
|
37 | + $this->set_user_id($user_id); |
|
38 | + $this->set_id(get_user_meta($user_id, '_stripe_customer_id', true)); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | * Set Stripe customer ID. |
52 | 52 | * @param [type] $id [description] |
53 | 53 | */ |
54 | - public function set_id( $id ) { |
|
54 | + public function set_id($id) { |
|
55 | 55 | // Backwards compat for customer ID stored in array format. (Pre 3.0) |
56 | - if ( is_array( $id ) && isset( $id['customer_id'] ) ) { |
|
56 | + if (is_array($id) && isset($id['customer_id'])) { |
|
57 | 57 | $id = $id['customer_id']; |
58 | 58 | |
59 | - update_user_meta( $this->get_user_id(), '_stripe_customer_id', $id ); |
|
59 | + update_user_meta($this->get_user_id(), '_stripe_customer_id', $id); |
|
60 | 60 | } |
61 | 61 | |
62 | - $this->id = wc_clean( $id ); |
|
62 | + $this->id = wc_clean($id); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -67,15 +67,15 @@ discard block |
||
67 | 67 | * @return int |
68 | 68 | */ |
69 | 69 | public function get_user_id() { |
70 | - return absint( $this->user_id ); |
|
70 | + return absint($this->user_id); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Set User ID used by WordPress. |
75 | 75 | * @param int $user_id |
76 | 76 | */ |
77 | - public function set_user_id( $user_id ) { |
|
78 | - $this->user_id = absint( $user_id ); |
|
77 | + public function set_user_id($user_id) { |
|
78 | + $this->user_id = absint($user_id); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | * @return WP_User |
84 | 84 | */ |
85 | 85 | protected function get_user() { |
86 | - return $this->get_user_id() ? get_user_by( 'id', $this->get_user_id() ) : false; |
|
86 | + return $this->get_user_id() ? get_user_by('id', $this->get_user_id()) : false; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Store data from the Stripe API about this customer |
91 | 91 | */ |
92 | - public function set_customer_data( $data ) { |
|
92 | + public function set_customer_data($data) { |
|
93 | 93 | $this->customer_data = $data; |
94 | 94 | } |
95 | 95 | |
@@ -98,25 +98,25 @@ discard block |
||
98 | 98 | * @param array $args |
99 | 99 | * @return WP_Error|int |
100 | 100 | */ |
101 | - public function create_customer( $args = array() ) { |
|
102 | - $billing_email = isset( $_POST['billing_email'] ) ? filter_var( $_POST['billing_email'], FILTER_SANITIZE_EMAIL ) : ''; |
|
101 | + public function create_customer($args = array()) { |
|
102 | + $billing_email = isset($_POST['billing_email']) ? filter_var($_POST['billing_email'], FILTER_SANITIZE_EMAIL) : ''; |
|
103 | 103 | $user = $this->get_user(); |
104 | 104 | |
105 | - if ( $user ) { |
|
106 | - $billing_first_name = get_user_meta( $user->ID, 'billing_first_name', true ); |
|
107 | - $billing_last_name = get_user_meta( $user->ID, 'billing_last_name', true ); |
|
105 | + if ($user) { |
|
106 | + $billing_first_name = get_user_meta($user->ID, 'billing_first_name', true); |
|
107 | + $billing_last_name = get_user_meta($user->ID, 'billing_last_name', true); |
|
108 | 108 | |
109 | 109 | // If billing first name does not exists try the user first name. |
110 | - if ( empty( $billing_first_name ) ) { |
|
111 | - $billing_first_name = get_user_meta( $user->ID, 'first_name', true ); |
|
110 | + if (empty($billing_first_name)) { |
|
111 | + $billing_first_name = get_user_meta($user->ID, 'first_name', true); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | // If billing last name does not exists try the user last name. |
115 | - if ( empty( $billing_last_name ) ) { |
|
116 | - $billing_last_name = get_user_meta( $user->ID, 'last_name', true ); |
|
115 | + if (empty($billing_last_name)) { |
|
116 | + $billing_last_name = get_user_meta($user->ID, 'last_name', true); |
|
117 | 117 | } |
118 | 118 | |
119 | - $description = __( 'Name', 'woocommerce-gateway-stripe' ) . ': ' . $billing_first_name . ' ' . $billing_last_name . ' ' . __( 'Username', 'woocommerce-gateway-stripe' ) . ': ' . $user->user_login; |
|
119 | + $description = __('Name', 'woocommerce-gateway-stripe') . ': ' . $billing_first_name . ' ' . $billing_last_name . ' ' . __('Username', 'woocommerce-gateway-stripe') . ': ' . $user->user_login; |
|
120 | 120 | |
121 | 121 | $defaults = array( |
122 | 122 | 'email' => $user->user_email, |
@@ -131,24 +131,24 @@ discard block |
||
131 | 131 | |
132 | 132 | $metadata = array(); |
133 | 133 | |
134 | - $defaults['metadata'] = apply_filters( 'wc_stripe_customer_metadata', $metadata, $user ); |
|
134 | + $defaults['metadata'] = apply_filters('wc_stripe_customer_metadata', $metadata, $user); |
|
135 | 135 | |
136 | - $args = wp_parse_args( $args, $defaults ); |
|
137 | - $response = WC_Stripe_API::request( apply_filters( 'wc_stripe_create_customer_args', $args ), 'customers' ); |
|
136 | + $args = wp_parse_args($args, $defaults); |
|
137 | + $response = WC_Stripe_API::request(apply_filters('wc_stripe_create_customer_args', $args), 'customers'); |
|
138 | 138 | |
139 | - if ( ! empty( $response->error ) ) { |
|
140 | - throw new WC_Stripe_Exception( print_r( $response, true ), $response->error->message ); |
|
139 | + if ( ! empty($response->error)) { |
|
140 | + throw new WC_Stripe_Exception(print_r($response, true), $response->error->message); |
|
141 | 141 | } |
142 | 142 | |
143 | - $this->set_id( $response->id ); |
|
143 | + $this->set_id($response->id); |
|
144 | 144 | $this->clear_cache(); |
145 | - $this->set_customer_data( $response ); |
|
145 | + $this->set_customer_data($response); |
|
146 | 146 | |
147 | - if ( $this->get_user_id() ) { |
|
148 | - update_user_meta( $this->get_user_id(), '_stripe_customer_id', $response->id ); |
|
147 | + if ($this->get_user_id()) { |
|
148 | + update_user_meta($this->get_user_id(), '_stripe_customer_id', $response->id); |
|
149 | 149 | } |
150 | 150 | |
151 | - do_action( 'woocommerce_stripe_add_customer', $args, $response ); |
|
151 | + do_action('woocommerce_stripe_add_customer', $args, $response); |
|
152 | 152 | |
153 | 153 | return $response->id; |
154 | 154 | } |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | * @since 4.1.2 |
161 | 161 | * @param array $error |
162 | 162 | */ |
163 | - public function is_no_such_customer_error( $error ) { |
|
163 | + public function is_no_such_customer_error($error) { |
|
164 | 164 | return ( |
165 | 165 | $error && |
166 | 166 | 'invalid_request_error' === $error->type && |
167 | - preg_match( '/No such customer/i', $error->message ) |
|
167 | + preg_match('/No such customer/i', $error->message) |
|
168 | 168 | ); |
169 | 169 | } |
170 | 170 | |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | * @param bool $retry |
175 | 175 | * @return WP_Error|int |
176 | 176 | */ |
177 | - public function add_source( $source_id, $retry = true ) { |
|
178 | - if ( ! $this->get_id() ) { |
|
179 | - $this->set_id( $this->create_customer() ); |
|
177 | + public function add_source($source_id, $retry = true) { |
|
178 | + if ( ! $this->get_id()) { |
|
179 | + $this->set_id($this->create_customer()); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | $response = WC_Stripe_API::request( |
@@ -188,63 +188,63 @@ discard block |
||
188 | 188 | |
189 | 189 | $wc_token = false; |
190 | 190 | |
191 | - if ( ! empty( $response->error ) ) { |
|
191 | + if ( ! empty($response->error)) { |
|
192 | 192 | // It is possible the WC user once was linked to a customer on Stripe |
193 | 193 | // but no longer exists. Instead of failing, lets try to create a |
194 | 194 | // new customer. |
195 | - if ( $this->is_no_such_customer_error( $response->error ) ) { |
|
196 | - delete_user_meta( $this->get_user_id(), '_stripe_customer_id' ); |
|
195 | + if ($this->is_no_such_customer_error($response->error)) { |
|
196 | + delete_user_meta($this->get_user_id(), '_stripe_customer_id'); |
|
197 | 197 | $this->create_customer(); |
198 | - return $this->add_source( $source_id, false ); |
|
198 | + return $this->add_source($source_id, false); |
|
199 | 199 | } else { |
200 | 200 | return $response; |
201 | 201 | } |
202 | - } elseif ( empty( $response->id ) ) { |
|
203 | - return new WP_Error( 'error', __( 'Unable to add payment source.', 'woocommerce-gateway-stripe' ) ); |
|
202 | + } elseif (empty($response->id)) { |
|
203 | + return new WP_Error('error', __('Unable to add payment source.', 'woocommerce-gateway-stripe')); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | // Add token to WooCommerce. |
207 | - if ( $this->get_user_id() && class_exists( 'WC_Payment_Token_CC' ) ) { |
|
208 | - if ( ! empty( $response->type ) ) { |
|
209 | - switch ( $response->type ) { |
|
207 | + if ($this->get_user_id() && class_exists('WC_Payment_Token_CC')) { |
|
208 | + if ( ! empty($response->type)) { |
|
209 | + switch ($response->type) { |
|
210 | 210 | case 'alipay': |
211 | 211 | break; |
212 | 212 | case 'sepa_debit': |
213 | 213 | $wc_token = new WC_Payment_Token_SEPA(); |
214 | - $wc_token->set_token( $response->id ); |
|
215 | - $wc_token->set_gateway_id( 'stripe_sepa' ); |
|
216 | - $wc_token->set_last4( $response->sepa_debit->last4 ); |
|
214 | + $wc_token->set_token($response->id); |
|
215 | + $wc_token->set_gateway_id('stripe_sepa'); |
|
216 | + $wc_token->set_last4($response->sepa_debit->last4); |
|
217 | 217 | break; |
218 | 218 | default: |
219 | - if ( 'source' === $response->object && 'card' === $response->type ) { |
|
219 | + if ('source' === $response->object && 'card' === $response->type) { |
|
220 | 220 | $wc_token = new WC_Payment_Token_CC(); |
221 | - $wc_token->set_token( $response->id ); |
|
222 | - $wc_token->set_gateway_id( 'stripe' ); |
|
223 | - $wc_token->set_card_type( strtolower( $response->card->brand ) ); |
|
224 | - $wc_token->set_last4( $response->card->last4 ); |
|
225 | - $wc_token->set_expiry_month( $response->card->exp_month ); |
|
226 | - $wc_token->set_expiry_year( $response->card->exp_year ); |
|
221 | + $wc_token->set_token($response->id); |
|
222 | + $wc_token->set_gateway_id('stripe'); |
|
223 | + $wc_token->set_card_type(strtolower($response->card->brand)); |
|
224 | + $wc_token->set_last4($response->card->last4); |
|
225 | + $wc_token->set_expiry_month($response->card->exp_month); |
|
226 | + $wc_token->set_expiry_year($response->card->exp_year); |
|
227 | 227 | } |
228 | 228 | break; |
229 | 229 | } |
230 | 230 | } else { |
231 | 231 | // Legacy. |
232 | 232 | $wc_token = new WC_Payment_Token_CC(); |
233 | - $wc_token->set_token( $response->id ); |
|
234 | - $wc_token->set_gateway_id( 'stripe' ); |
|
235 | - $wc_token->set_card_type( strtolower( $response->brand ) ); |
|
236 | - $wc_token->set_last4( $response->last4 ); |
|
237 | - $wc_token->set_expiry_month( $response->exp_month ); |
|
238 | - $wc_token->set_expiry_year( $response->exp_year ); |
|
233 | + $wc_token->set_token($response->id); |
|
234 | + $wc_token->set_gateway_id('stripe'); |
|
235 | + $wc_token->set_card_type(strtolower($response->brand)); |
|
236 | + $wc_token->set_last4($response->last4); |
|
237 | + $wc_token->set_expiry_month($response->exp_month); |
|
238 | + $wc_token->set_expiry_year($response->exp_year); |
|
239 | 239 | } |
240 | 240 | |
241 | - $wc_token->set_user_id( $this->get_user_id() ); |
|
241 | + $wc_token->set_user_id($this->get_user_id()); |
|
242 | 242 | $wc_token->save(); |
243 | 243 | } |
244 | 244 | |
245 | 245 | $this->clear_cache(); |
246 | 246 | |
247 | - do_action( 'woocommerce_stripe_add_source', $this->get_id(), $wc_token, $response, $source_id ); |
|
247 | + do_action('woocommerce_stripe_add_source', $this->get_id(), $wc_token, $response, $source_id); |
|
248 | 248 | |
249 | 249 | return $response->id; |
250 | 250 | } |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | * @return array |
257 | 257 | */ |
258 | 258 | public function get_sources() { |
259 | - if ( ! $this->get_id() ) { |
|
259 | + if ( ! $this->get_id()) { |
|
260 | 260 | return array(); |
261 | 261 | } |
262 | 262 | |
263 | - $sources = get_transient( 'stripe_sources_' . $this->get_id() ); |
|
263 | + $sources = get_transient('stripe_sources_' . $this->get_id()); |
|
264 | 264 | |
265 | 265 | $response = WC_Stripe_API::request( |
266 | 266 | array( |
@@ -270,32 +270,32 @@ discard block |
||
270 | 270 | 'GET' |
271 | 271 | ); |
272 | 272 | |
273 | - if ( ! empty( $response->error ) ) { |
|
273 | + if ( ! empty($response->error)) { |
|
274 | 274 | return array(); |
275 | 275 | } |
276 | 276 | |
277 | - if ( is_array( $response->data ) ) { |
|
277 | + if (is_array($response->data)) { |
|
278 | 278 | $sources = $response->data; |
279 | 279 | } |
280 | 280 | |
281 | - return empty( $sources ) ? array() : $sources; |
|
281 | + return empty($sources) ? array() : $sources; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
285 | 285 | * Delete a source from stripe. |
286 | 286 | * @param string $source_id |
287 | 287 | */ |
288 | - public function delete_source( $source_id ) { |
|
289 | - if ( ! $this->get_id() ) { |
|
288 | + public function delete_source($source_id) { |
|
289 | + if ( ! $this->get_id()) { |
|
290 | 290 | return false; |
291 | 291 | } |
292 | 292 | |
293 | - $response = WC_Stripe_API::request( array(), 'customers/' . $this->get_id() . '/sources/' . sanitize_text_field( $source_id ), 'DELETE' ); |
|
293 | + $response = WC_Stripe_API::request(array(), 'customers/' . $this->get_id() . '/sources/' . sanitize_text_field($source_id), 'DELETE'); |
|
294 | 294 | |
295 | 295 | $this->clear_cache(); |
296 | 296 | |
297 | - if ( empty( $response->error ) ) { |
|
298 | - do_action( 'wc_stripe_delete_source', $this->get_id(), $response ); |
|
297 | + if (empty($response->error)) { |
|
298 | + do_action('wc_stripe_delete_source', $this->get_id(), $response); |
|
299 | 299 | |
300 | 300 | return true; |
301 | 301 | } |
@@ -307,10 +307,10 @@ discard block |
||
307 | 307 | * Set default source in Stripe |
308 | 308 | * @param string $source_id |
309 | 309 | */ |
310 | - public function set_default_source( $source_id ) { |
|
310 | + public function set_default_source($source_id) { |
|
311 | 311 | $response = WC_Stripe_API::request( |
312 | 312 | array( |
313 | - 'default_source' => sanitize_text_field( $source_id ), |
|
313 | + 'default_source' => sanitize_text_field($source_id), |
|
314 | 314 | ), |
315 | 315 | 'customers/' . $this->get_id(), |
316 | 316 | 'POST' |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | |
319 | 319 | $this->clear_cache(); |
320 | 320 | |
321 | - if ( empty( $response->error ) ) { |
|
322 | - do_action( 'wc_stripe_set_default_source', $this->get_id(), $response ); |
|
321 | + if (empty($response->error)) { |
|
322 | + do_action('wc_stripe_set_default_source', $this->get_id(), $response); |
|
323 | 323 | |
324 | 324 | return true; |
325 | 325 | } |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | * Deletes caches for this users cards. |
332 | 332 | */ |
333 | 333 | public function clear_cache() { |
334 | - delete_transient( 'stripe_sources_' . $this->get_id() ); |
|
335 | - delete_transient( 'stripe_customer_' . $this->get_id() ); |
|
334 | + delete_transient('stripe_sources_' . $this->get_id()); |
|
335 | + delete_transient('stripe_customer_' . $this->get_id()); |
|
336 | 336 | $this->customer_data = array(); |
337 | 337 | } |
338 | 338 | } |