@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; // Exit if accessed directly |
4 | 4 | } |
5 | 5 | ?> |
6 | 6 | |
7 | -<?php do_action( 'woocommerce_email_header', $email_heading, $email ); ?> |
|
7 | +<?php do_action('woocommerce_email_header', $email_heading, $email); ?> |
|
8 | 8 | |
9 | 9 | <?php |
10 | -$pre_wc_30 = version_compare( WC_VERSION, '3.0', '<' ); |
|
10 | +$pre_wc_30 = version_compare(WC_VERSION, '3.0', '<'); |
|
11 | 11 | $billing_email = $pre_wc_30 ? $order->billing_email : $order->get_billing_email(); |
12 | 12 | $billing_phone = $pre_wc_30 ? $order->billing_phone : $order->get_billing_phone(); |
13 | 13 | |
@@ -16,19 +16,19 @@ discard block |
||
16 | 16 | echo wp_kses( |
17 | 17 | sprintf( |
18 | 18 | // translators: %s is a link to the payment re-authentication URL. |
19 | - _x( 'Your pre-order is now available, but payment cannot be completed automatically. %s', 'In failed SCA authentication for a pre-order.', 'woocommerce-gateway-stripe' ), |
|
20 | - '<a href="' . esc_url( $authorization_url ) . '">' . esc_html__( 'Authorize the payment now »', 'woocommerce-gateway-stripe' ) . '</a>' |
|
19 | + _x('Your pre-order is now available, but payment cannot be completed automatically. %s', 'In failed SCA authentication for a pre-order.', 'woocommerce-gateway-stripe'), |
|
20 | + '<a href="' . esc_url($authorization_url) . '">' . esc_html__('Authorize the payment now »', 'woocommerce-gateway-stripe') . '</a>' |
|
21 | 21 | ), |
22 | - array( 'a' => array( 'href' => true ) ) |
|
22 | + array('a' => array('href' => true)) |
|
23 | 23 | ); |
24 | 24 | ?></p> |
25 | 25 | |
26 | -<?php if ( $email->get_custom_message() ) : ?> |
|
27 | - <blockquote><?php echo wpautop( wptexturize( $email->get_custom_message() ) ); ?></blockquote> |
|
26 | +<?php if ($email->get_custom_message()) : ?> |
|
27 | + <blockquote><?php echo wpautop(wptexturize($email->get_custom_message())); ?></blockquote> |
|
28 | 28 | <?php endif; ?> |
29 | 29 | |
30 | 30 | <?php |
31 | -do_action( 'woocommerce_email_before_order_table', $order, false, $plain_text, $email ); |
|
31 | +do_action('woocommerce_email_before_order_table', $order, false, $plain_text, $email); |
|
32 | 32 | |
33 | 33 | /* |
34 | 34 | * @hooked WC_Emails::order_details() Shows the order details table. |
@@ -36,28 +36,28 @@ discard block |
||
36 | 36 | * @hooked WC_Structured_Data::output_structured_data() Outputs structured data. |
37 | 37 | * @since 2.5.0 |
38 | 38 | */ |
39 | -do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email ); |
|
39 | +do_action('woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email); |
|
40 | 40 | |
41 | 41 | /* |
42 | 42 | * @hooked WC_Emails::order_meta() Shows order meta data. |
43 | 43 | */ |
44 | -do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email ); |
|
44 | +do_action('woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email); |
|
45 | 45 | |
46 | -do_action( 'woocommerce_email_after_order_table', $order, false, $plain_text, $email ); |
|
46 | +do_action('woocommerce_email_after_order_table', $order, false, $plain_text, $email); |
|
47 | 47 | |
48 | 48 | /* |
49 | 49 | * @hooked WC_Emails::customer_details() Shows customer details |
50 | 50 | * @hooked WC_Emails::email_address() Shows email address |
51 | 51 | */ |
52 | -do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); |
|
52 | +do_action('woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email); |
|
53 | 53 | |
54 | 54 | ?> |
55 | 55 | <p> |
56 | -<?php esc_html_e( 'Thanks for shopping with us.', 'woocommerce-gateway-stripe' ); ?> |
|
56 | +<?php esc_html_e('Thanks for shopping with us.', 'woocommerce-gateway-stripe'); ?> |
|
57 | 57 | </p> |
58 | 58 | <?php |
59 | 59 | |
60 | 60 | /* |
61 | 61 | * @hooked WC_Emails::email_footer() Output the email footer |
62 | 62 | */ |
63 | -do_action( 'woocommerce_email_footer', $email ); |
|
63 | +do_action('woocommerce_email_footer', $email); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; // Exit if accessed directly |
4 | 4 | } |
5 | 5 | |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | |
8 | 8 | printf( |
9 | 9 | // translators: %s is a link to the payment re-authentication URL. |
10 | - _x( 'Your pre-order is now available, but payment cannot be completed automatically. Please complete the payment now: %s', 'woocommerce-gateway-stripe' ), |
|
10 | + _x('Your pre-order is now available, but payment cannot be completed automatically. Please complete the payment now: %s', 'woocommerce-gateway-stripe'), |
|
11 | 11 | $authorization_url |
12 | 12 | ); |
13 | 13 | |
14 | -if ( $email->get_custom_message() ) : |
|
14 | +if ($email->get_custom_message()) : |
|
15 | 15 | |
16 | 16 | echo "----------\n\n"; |
17 | - echo wptexturize( $email->get_custom_message() ) . "\n\n"; |
|
17 | + echo wptexturize($email->get_custom_message()) . "\n\n"; |
|
18 | 18 | echo "----------\n\n"; |
19 | 19 | |
20 | 20 | endif; |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | |
23 | 23 | echo "\n\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n"; |
24 | 24 | |
25 | -do_action( 'woocommerce_subscriptions_email_order_details', $order, $sent_to_admin, $plain_text, $email ); |
|
25 | +do_action('woocommerce_subscriptions_email_order_details', $order, $sent_to_admin, $plain_text, $email); |
|
26 | 26 | |
27 | 27 | echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; |
28 | 28 | |
29 | -echo apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) ); |
|
29 | +echo apply_filters('woocommerce_email_footer_text', get_option('woocommerce_email_footer_text')); |
@@ -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,37 +98,37 @@ 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 | 119 | // translators: %1$s First name, %2$s Second name, %3$s Username. |
120 | - $description = sprintf( __( 'Name: %1$s %2$s, Username: %s', 'woocommerce-gateway-stripe' ), $billing_first_name, $billing_last_name, $user->user_login ); |
|
120 | + $description = sprintf(__('Name: %1$s %2$s, Username: %s', 'woocommerce-gateway-stripe'), $billing_first_name, $billing_last_name, $user->user_login); |
|
121 | 121 | |
122 | 122 | $defaults = array( |
123 | 123 | 'email' => $user->user_email, |
124 | 124 | 'description' => $description, |
125 | 125 | ); |
126 | 126 | } else { |
127 | - $billing_first_name = isset( $_POST['billing_first_name'] ) ? filter_var( wp_unslash( $_POST['billing_first_name'] ), FILTER_SANITIZE_STRING ) : ''; // phpcs:ignore WordPress.Security.NonceVerification |
|
128 | - $billing_last_name = isset( $_POST['billing_last_name'] ) ? filter_var( wp_unslash( $_POST['billing_last_name'] ), FILTER_SANITIZE_STRING ) : ''; // phpcs:ignore WordPress.Security.NonceVerification |
|
127 | + $billing_first_name = isset($_POST['billing_first_name']) ? filter_var(wp_unslash($_POST['billing_first_name']), FILTER_SANITIZE_STRING) : ''; // phpcs:ignore WordPress.Security.NonceVerification |
|
128 | + $billing_last_name = isset($_POST['billing_last_name']) ? filter_var(wp_unslash($_POST['billing_last_name']), FILTER_SANITIZE_STRING) : ''; // phpcs:ignore WordPress.Security.NonceVerification |
|
129 | 129 | |
130 | 130 | // translators: %1$s First name, %2$s Second name. |
131 | - $description = sprintf( __( 'Name: %1$s %2$s, Guest', 'woocommerce-gateway-stripe' ), $billing_first_name, $billing_last_name ); |
|
131 | + $description = sprintf(__('Name: %1$s %2$s, Guest', 'woocommerce-gateway-stripe'), $billing_first_name, $billing_last_name); |
|
132 | 132 | |
133 | 133 | $defaults = array( |
134 | 134 | 'email' => $billing_email, |
@@ -138,24 +138,24 @@ discard block |
||
138 | 138 | |
139 | 139 | $metadata = array(); |
140 | 140 | |
141 | - $defaults['metadata'] = apply_filters( 'wc_stripe_customer_metadata', $metadata, $user ); |
|
141 | + $defaults['metadata'] = apply_filters('wc_stripe_customer_metadata', $metadata, $user); |
|
142 | 142 | |
143 | - $args = wp_parse_args( $args, $defaults ); |
|
144 | - $response = WC_Stripe_API::request( apply_filters( 'wc_stripe_create_customer_args', $args ), 'customers' ); |
|
143 | + $args = wp_parse_args($args, $defaults); |
|
144 | + $response = WC_Stripe_API::request(apply_filters('wc_stripe_create_customer_args', $args), 'customers'); |
|
145 | 145 | |
146 | - if ( ! empty( $response->error ) ) { |
|
147 | - throw new WC_Stripe_Exception( print_r( $response, true ), $response->error->message ); |
|
146 | + if ( ! empty($response->error)) { |
|
147 | + throw new WC_Stripe_Exception(print_r($response, true), $response->error->message); |
|
148 | 148 | } |
149 | 149 | |
150 | - $this->set_id( $response->id ); |
|
150 | + $this->set_id($response->id); |
|
151 | 151 | $this->clear_cache(); |
152 | - $this->set_customer_data( $response ); |
|
152 | + $this->set_customer_data($response); |
|
153 | 153 | |
154 | - if ( $this->get_user_id() ) { |
|
155 | - update_user_meta( $this->get_user_id(), '_stripe_customer_id', $response->id ); |
|
154 | + if ($this->get_user_id()) { |
|
155 | + update_user_meta($this->get_user_id(), '_stripe_customer_id', $response->id); |
|
156 | 156 | } |
157 | 157 | |
158 | - do_action( 'woocommerce_stripe_add_customer', $args, $response ); |
|
158 | + do_action('woocommerce_stripe_add_customer', $args, $response); |
|
159 | 159 | |
160 | 160 | return $response->id; |
161 | 161 | } |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | * @since 4.1.2 |
168 | 168 | * @param array $error |
169 | 169 | */ |
170 | - public function is_no_such_customer_error( $error ) { |
|
170 | + public function is_no_such_customer_error($error) { |
|
171 | 171 | return ( |
172 | 172 | $error && |
173 | 173 | 'invalid_request_error' === $error->type && |
174 | - preg_match( '/No such customer/i', $error->message ) |
|
174 | + preg_match('/No such customer/i', $error->message) |
|
175 | 175 | ); |
176 | 176 | } |
177 | 177 | |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param string $source_id |
181 | 181 | * @return WP_Error|int |
182 | 182 | */ |
183 | - public function add_source( $source_id ) { |
|
184 | - if ( ! $this->get_id() ) { |
|
185 | - $this->set_id( $this->create_customer() ); |
|
183 | + public function add_source($source_id) { |
|
184 | + if ( ! $this->get_id()) { |
|
185 | + $this->set_id($this->create_customer()); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | $response = WC_Stripe_API::request( |
@@ -194,63 +194,63 @@ discard block |
||
194 | 194 | |
195 | 195 | $wc_token = false; |
196 | 196 | |
197 | - if ( ! empty( $response->error ) ) { |
|
197 | + if ( ! empty($response->error)) { |
|
198 | 198 | // It is possible the WC user once was linked to a customer on Stripe |
199 | 199 | // but no longer exists. Instead of failing, lets try to create a |
200 | 200 | // new customer. |
201 | - if ( $this->is_no_such_customer_error( $response->error ) ) { |
|
202 | - delete_user_meta( $this->get_user_id(), '_stripe_customer_id' ); |
|
201 | + if ($this->is_no_such_customer_error($response->error)) { |
|
202 | + delete_user_meta($this->get_user_id(), '_stripe_customer_id'); |
|
203 | 203 | $this->create_customer(); |
204 | - return $this->add_source( $source_id ); |
|
204 | + return $this->add_source($source_id); |
|
205 | 205 | } else { |
206 | 206 | return $response; |
207 | 207 | } |
208 | - } elseif ( empty( $response->id ) ) { |
|
209 | - return new WP_Error( 'error', __( 'Unable to add payment source.', 'woocommerce-gateway-stripe' ) ); |
|
208 | + } elseif (empty($response->id)) { |
|
209 | + return new WP_Error('error', __('Unable to add payment source.', 'woocommerce-gateway-stripe')); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | // Add token to WooCommerce. |
213 | - if ( $this->get_user_id() && class_exists( 'WC_Payment_Token_CC' ) ) { |
|
214 | - if ( ! empty( $response->type ) ) { |
|
215 | - switch ( $response->type ) { |
|
213 | + if ($this->get_user_id() && class_exists('WC_Payment_Token_CC')) { |
|
214 | + if ( ! empty($response->type)) { |
|
215 | + switch ($response->type) { |
|
216 | 216 | case 'alipay': |
217 | 217 | break; |
218 | 218 | case 'sepa_debit': |
219 | 219 | $wc_token = new WC_Payment_Token_SEPA(); |
220 | - $wc_token->set_token( $response->id ); |
|
221 | - $wc_token->set_gateway_id( 'stripe_sepa' ); |
|
222 | - $wc_token->set_last4( $response->sepa_debit->last4 ); |
|
220 | + $wc_token->set_token($response->id); |
|
221 | + $wc_token->set_gateway_id('stripe_sepa'); |
|
222 | + $wc_token->set_last4($response->sepa_debit->last4); |
|
223 | 223 | break; |
224 | 224 | default: |
225 | - if ( 'source' === $response->object && 'card' === $response->type ) { |
|
225 | + if ('source' === $response->object && 'card' === $response->type) { |
|
226 | 226 | $wc_token = new WC_Payment_Token_CC(); |
227 | - $wc_token->set_token( $response->id ); |
|
228 | - $wc_token->set_gateway_id( 'stripe' ); |
|
229 | - $wc_token->set_card_type( strtolower( $response->card->brand ) ); |
|
230 | - $wc_token->set_last4( $response->card->last4 ); |
|
231 | - $wc_token->set_expiry_month( $response->card->exp_month ); |
|
232 | - $wc_token->set_expiry_year( $response->card->exp_year ); |
|
227 | + $wc_token->set_token($response->id); |
|
228 | + $wc_token->set_gateway_id('stripe'); |
|
229 | + $wc_token->set_card_type(strtolower($response->card->brand)); |
|
230 | + $wc_token->set_last4($response->card->last4); |
|
231 | + $wc_token->set_expiry_month($response->card->exp_month); |
|
232 | + $wc_token->set_expiry_year($response->card->exp_year); |
|
233 | 233 | } |
234 | 234 | break; |
235 | 235 | } |
236 | 236 | } else { |
237 | 237 | // Legacy. |
238 | 238 | $wc_token = new WC_Payment_Token_CC(); |
239 | - $wc_token->set_token( $response->id ); |
|
240 | - $wc_token->set_gateway_id( 'stripe' ); |
|
241 | - $wc_token->set_card_type( strtolower( $response->brand ) ); |
|
242 | - $wc_token->set_last4( $response->last4 ); |
|
243 | - $wc_token->set_expiry_month( $response->exp_month ); |
|
244 | - $wc_token->set_expiry_year( $response->exp_year ); |
|
239 | + $wc_token->set_token($response->id); |
|
240 | + $wc_token->set_gateway_id('stripe'); |
|
241 | + $wc_token->set_card_type(strtolower($response->brand)); |
|
242 | + $wc_token->set_last4($response->last4); |
|
243 | + $wc_token->set_expiry_month($response->exp_month); |
|
244 | + $wc_token->set_expiry_year($response->exp_year); |
|
245 | 245 | } |
246 | 246 | |
247 | - $wc_token->set_user_id( $this->get_user_id() ); |
|
247 | + $wc_token->set_user_id($this->get_user_id()); |
|
248 | 248 | $wc_token->save(); |
249 | 249 | } |
250 | 250 | |
251 | 251 | $this->clear_cache(); |
252 | 252 | |
253 | - do_action( 'woocommerce_stripe_add_source', $this->get_id(), $wc_token, $response, $source_id ); |
|
253 | + do_action('woocommerce_stripe_add_source', $this->get_id(), $wc_token, $response, $source_id); |
|
254 | 254 | |
255 | 255 | return $response->id; |
256 | 256 | } |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | * @return array |
263 | 263 | */ |
264 | 264 | public function get_sources() { |
265 | - if ( ! $this->get_id() ) { |
|
265 | + if ( ! $this->get_id()) { |
|
266 | 266 | return array(); |
267 | 267 | } |
268 | 268 | |
269 | - $sources = get_transient( 'stripe_sources_' . $this->get_id() ); |
|
269 | + $sources = get_transient('stripe_sources_' . $this->get_id()); |
|
270 | 270 | |
271 | 271 | $response = WC_Stripe_API::request( |
272 | 272 | array( |
@@ -276,32 +276,32 @@ discard block |
||
276 | 276 | 'GET' |
277 | 277 | ); |
278 | 278 | |
279 | - if ( ! empty( $response->error ) ) { |
|
279 | + if ( ! empty($response->error)) { |
|
280 | 280 | return array(); |
281 | 281 | } |
282 | 282 | |
283 | - if ( is_array( $response->data ) ) { |
|
283 | + if (is_array($response->data)) { |
|
284 | 284 | $sources = $response->data; |
285 | 285 | } |
286 | 286 | |
287 | - return empty( $sources ) ? array() : $sources; |
|
287 | + return empty($sources) ? array() : $sources; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
291 | 291 | * Delete a source from stripe. |
292 | 292 | * @param string $source_id |
293 | 293 | */ |
294 | - public function delete_source( $source_id ) { |
|
295 | - if ( ! $this->get_id() ) { |
|
294 | + public function delete_source($source_id) { |
|
295 | + if ( ! $this->get_id()) { |
|
296 | 296 | return false; |
297 | 297 | } |
298 | 298 | |
299 | - $response = WC_Stripe_API::request( array(), 'customers/' . $this->get_id() . '/sources/' . sanitize_text_field( $source_id ), 'DELETE' ); |
|
299 | + $response = WC_Stripe_API::request(array(), 'customers/' . $this->get_id() . '/sources/' . sanitize_text_field($source_id), 'DELETE'); |
|
300 | 300 | |
301 | 301 | $this->clear_cache(); |
302 | 302 | |
303 | - if ( empty( $response->error ) ) { |
|
304 | - do_action( 'wc_stripe_delete_source', $this->get_id(), $response ); |
|
303 | + if (empty($response->error)) { |
|
304 | + do_action('wc_stripe_delete_source', $this->get_id(), $response); |
|
305 | 305 | |
306 | 306 | return true; |
307 | 307 | } |
@@ -313,10 +313,10 @@ discard block |
||
313 | 313 | * Set default source in Stripe |
314 | 314 | * @param string $source_id |
315 | 315 | */ |
316 | - public function set_default_source( $source_id ) { |
|
316 | + public function set_default_source($source_id) { |
|
317 | 317 | $response = WC_Stripe_API::request( |
318 | 318 | array( |
319 | - 'default_source' => sanitize_text_field( $source_id ), |
|
319 | + 'default_source' => sanitize_text_field($source_id), |
|
320 | 320 | ), |
321 | 321 | 'customers/' . $this->get_id(), |
322 | 322 | 'POST' |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | |
325 | 325 | $this->clear_cache(); |
326 | 326 | |
327 | - if ( empty( $response->error ) ) { |
|
328 | - do_action( 'wc_stripe_set_default_source', $this->get_id(), $response ); |
|
327 | + if (empty($response->error)) { |
|
328 | + do_action('wc_stripe_set_default_source', $this->get_id(), $response); |
|
329 | 329 | |
330 | 330 | return true; |
331 | 331 | } |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | * Deletes caches for this users cards. |
338 | 338 | */ |
339 | 339 | public function clear_cache() { |
340 | - delete_transient( 'stripe_sources_' . $this->get_id() ); |
|
341 | - delete_transient( 'stripe_customer_' . $this->get_id() ); |
|
340 | + delete_transient('stripe_sources_' . $this->get_id()); |
|
341 | + delete_transient('stripe_customer_' . $this->get_id()); |
|
342 | 342 | $this->customer_data = array(); |
343 | 343 | } |
344 | 344 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | public $saved_cards; |
12 | 12 | |
13 | 13 | public function __construct() { |
14 | - $this->saved_cards = WC_Stripe_Helper::get_settings( 'stripe', 'saved_cards' ); |
|
14 | + $this->saved_cards = WC_Stripe_Helper::get_settings('stripe', 'saved_cards'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
@@ -19,22 +19,22 @@ discard block |
||
19 | 19 | * @param int $order_id |
20 | 20 | * @return boolean |
21 | 21 | */ |
22 | - public function is_pre_order( $order_id ) { |
|
23 | - return WC_Pre_Orders_Order::order_contains_pre_order( $order_id ); |
|
22 | + public function is_pre_order($order_id) { |
|
23 | + return WC_Pre_Orders_Order::order_contains_pre_order($order_id); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Remove order meta |
28 | 28 | * @param object $order |
29 | 29 | */ |
30 | - public function remove_order_source_before_retry( $order ) { |
|
31 | - if ( WC_Stripe_Helper::is_wc_lt( '3.0' ) ) { |
|
32 | - delete_post_meta( $order->id, '_stripe_source_id' ); |
|
30 | + public function remove_order_source_before_retry($order) { |
|
31 | + if (WC_Stripe_Helper::is_wc_lt('3.0')) { |
|
32 | + delete_post_meta($order->id, '_stripe_source_id'); |
|
33 | 33 | // For BW compat will remove in the future. |
34 | - delete_post_meta( $order->id, '_stripe_card_id' ); |
|
34 | + delete_post_meta($order->id, '_stripe_card_id'); |
|
35 | 35 | } else { |
36 | - $order->delete_meta_data( '_stripe_source_id' ); |
|
37 | - $order->delete_meta_data( '_stripe_card_id' ); |
|
36 | + $order->delete_meta_data('_stripe_source_id'); |
|
37 | + $order->delete_meta_data('_stripe_card_id'); |
|
38 | 38 | $order->save(); |
39 | 39 | } |
40 | 40 | } |
@@ -43,31 +43,31 @@ discard block |
||
43 | 43 | * Process the pre-order when pay upon release is used. |
44 | 44 | * @param int $order_id |
45 | 45 | */ |
46 | - public function process_pre_order( $order_id ) { |
|
46 | + public function process_pre_order($order_id) { |
|
47 | 47 | try { |
48 | - $order = wc_get_order( $order_id ); |
|
48 | + $order = wc_get_order($order_id); |
|
49 | 49 | |
50 | 50 | // This will throw exception if not valid. |
51 | - $this->validate_minimum_order_amount( $order ); |
|
51 | + $this->validate_minimum_order_amount($order); |
|
52 | 52 | |
53 | - $prepared_source = $this->prepare_source( get_current_user_id(), true ); |
|
53 | + $prepared_source = $this->prepare_source(get_current_user_id(), true); |
|
54 | 54 | |
55 | 55 | // We need a source on file to continue. |
56 | - if ( empty( $prepared_source->customer ) || empty( $prepared_source->source ) ) { |
|
57 | - throw new WC_Stripe_Exception( __( 'Unable to store payment details. Please try again.', 'woocommerce-gateway-stripe' ) ); |
|
56 | + if (empty($prepared_source->customer) || empty($prepared_source->source)) { |
|
57 | + throw new WC_Stripe_Exception(__('Unable to store payment details. Please try again.', 'woocommerce-gateway-stripe')); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // Setup the response early to allow later modifications. |
61 | 61 | $response = array( |
62 | 62 | 'result' => 'success', |
63 | - 'redirect' => $this->get_return_url( $order ), |
|
63 | + 'redirect' => $this->get_return_url($order), |
|
64 | 64 | ); |
65 | 65 | |
66 | - $this->save_source_to_order( $order, $prepared_source ); |
|
66 | + $this->save_source_to_order($order, $prepared_source); |
|
67 | 67 | |
68 | 68 | // Try setting up a payment intent. |
69 | - $intent_secret = $this->setup_intent( $order, $prepared_source ); |
|
70 | - if ( ! empty( $intent_secret ) ) { |
|
69 | + $intent_secret = $this->setup_intent($order, $prepared_source); |
|
70 | + if ( ! empty($intent_secret)) { |
|
71 | 71 | $response['setup_intent_secret'] = $intent_secret; |
72 | 72 | return $response; |
73 | 73 | } |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | WC()->cart->empty_cart(); |
77 | 77 | |
78 | 78 | // Is pre ordered! |
79 | - WC_Pre_Orders_Order::mark_order_as_pre_ordered( $order ); |
|
79 | + WC_Pre_Orders_Order::mark_order_as_pre_ordered($order); |
|
80 | 80 | |
81 | 81 | // Return thank you page redirect |
82 | 82 | return $response; |
83 | - } catch ( WC_Stripe_Exception $e ) { |
|
84 | - wc_add_notice( $e->getLocalizedMessage(), 'error' ); |
|
85 | - WC_Stripe_Logger::log( 'Pre Orders Error: ' . $e->getMessage() ); |
|
83 | + } catch (WC_Stripe_Exception $e) { |
|
84 | + wc_add_notice($e->getLocalizedMessage(), 'error'); |
|
85 | + WC_Stripe_Logger::log('Pre Orders Error: ' . $e->getMessage()); |
|
86 | 86 | |
87 | 87 | return array( |
88 | 88 | 'result' => 'success', |
89 | - 'redirect' => $order->get_checkout_payment_url( true ), |
|
89 | + 'redirect' => $order->get_checkout_payment_url(true), |
|
90 | 90 | ); |
91 | 91 | } |
92 | 92 | } |
@@ -99,50 +99,50 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @return void |
101 | 101 | */ |
102 | - public function process_pre_order_release_payment( $order, $retry = true ) { |
|
102 | + public function process_pre_order_release_payment($order, $retry = true) { |
|
103 | 103 | try { |
104 | - $source = $this->prepare_order_source( $order ); |
|
105 | - $response = $this->create_and_confirm_intent_for_off_session( $order, $source ); |
|
104 | + $source = $this->prepare_order_source($order); |
|
105 | + $response = $this->create_and_confirm_intent_for_off_session($order, $source); |
|
106 | 106 | |
107 | - $is_authentication_required = $this->is_authentication_required_for_payment( $response ); |
|
107 | + $is_authentication_required = $this->is_authentication_required_for_payment($response); |
|
108 | 108 | |
109 | - if ( ! empty( $response->error ) && ! $is_authentication_required ) { |
|
110 | - if ( ! $retry ) { |
|
111 | - throw new Exception( $response->error->message ); |
|
109 | + if ( ! empty($response->error) && ! $is_authentication_required) { |
|
110 | + if ( ! $retry) { |
|
111 | + throw new Exception($response->error->message); |
|
112 | 112 | } |
113 | - $this->remove_order_source_before_retry( $order ); |
|
114 | - $this->process_pre_order_release_payment( $order, false ); |
|
115 | - } else if ( $is_authentication_required ) { |
|
116 | - $charge = end( $response->error->payment_intent->charges->data ); |
|
113 | + $this->remove_order_source_before_retry($order); |
|
114 | + $this->process_pre_order_release_payment($order, false); |
|
115 | + } else if ($is_authentication_required) { |
|
116 | + $charge = end($response->error->payment_intent->charges->data); |
|
117 | 117 | $id = $charge->id; |
118 | - $order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id(); |
|
118 | + $order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id(); |
|
119 | 119 | |
120 | - WC_Stripe_Helper::is_wc_lt( '3.0' ) ? update_post_meta( $order_id, '_transaction_id', $id ) : $order->set_transaction_id( $id ); |
|
121 | - $order->update_status( 'failed', sprintf( __( 'Stripe charge awaiting authentication by user: %s.', 'woocommerce-gateway-stripe' ), $id ) ); |
|
122 | - if ( is_callable( array( $order, 'save' ) ) ) { |
|
120 | + WC_Stripe_Helper::is_wc_lt('3.0') ? update_post_meta($order_id, '_transaction_id', $id) : $order->set_transaction_id($id); |
|
121 | + $order->update_status('failed', sprintf(__('Stripe charge awaiting authentication by user: %s.', 'woocommerce-gateway-stripe'), $id)); |
|
122 | + if (is_callable(array($order, 'save'))) { |
|
123 | 123 | $order->save(); |
124 | 124 | } |
125 | 125 | |
126 | 126 | WC_Emails::instance(); |
127 | 127 | |
128 | - do_action( 'wc_gateway_stripe_process_payment_authentication_required', $order ); |
|
128 | + do_action('wc_gateway_stripe_process_payment_authentication_required', $order); |
|
129 | 129 | |
130 | - throw new WC_Stripe_Exception( print_r( $response, true ), $response->error->message ); |
|
130 | + throw new WC_Stripe_Exception(print_r($response, true), $response->error->message); |
|
131 | 131 | } else { |
132 | 132 | // Successful |
133 | - $this->process_response( end( $response->charges->data ), $order ); |
|
133 | + $this->process_response(end($response->charges->data), $order); |
|
134 | 134 | } |
135 | - } catch ( Exception $e ) { |
|
136 | - $error_message = is_callable( array( $e, 'getLocalizedMessage' ) ) ? $e->getLocalizedMessage() : $e->getMessage(); |
|
135 | + } catch (Exception $e) { |
|
136 | + $error_message = is_callable(array($e, 'getLocalizedMessage')) ? $e->getLocalizedMessage() : $e->getMessage(); |
|
137 | 137 | /* translators: error message */ |
138 | - $order_note = sprintf( __( 'Stripe Transaction Failed (%s)', 'woocommerce-gateway-stripe' ), $error_message ); |
|
138 | + $order_note = sprintf(__('Stripe Transaction Failed (%s)', 'woocommerce-gateway-stripe'), $error_message); |
|
139 | 139 | |
140 | 140 | // Mark order as failed if not already set, |
141 | 141 | // otherwise, make sure we add the order note so we can detect when someone fails to check out multiple times |
142 | - if ( ! $order->has_status( 'failed' ) ) { |
|
143 | - $order->update_status( 'failed', $order_note ); |
|
142 | + if ( ! $order->has_status('failed')) { |
|
143 | + $order->update_status('failed', $order_note); |
|
144 | 144 | } else { |
145 | - $order->add_order_note( $order_note ); |
|
145 | + $order->add_order_note($order_note); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | } |
@@ -6,14 +6,14 @@ discard block |
||
6 | 6 | * @version 4.3.0 |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Output the email header. |
15 | 15 | */ |
16 | -do_action( 'woocommerce_email_header', $email_heading, $email ); ?> |
|
16 | +do_action('woocommerce_email_header', $email_heading, $email); ?> |
|
17 | 17 | |
18 | 18 | <p> |
19 | 19 | <?php |
@@ -27,31 +27,31 @@ discard block |
||
27 | 27 | ), |
28 | 28 | $order->get_order_number(), |
29 | 29 | $order->get_formatted_billing_full_name(), |
30 | - wcs_get_human_time_diff( $retry->get_time() ) |
|
30 | + wcs_get_human_time_diff($retry->get_time()) |
|
31 | 31 | ) |
32 | 32 | ); |
33 | 33 | ?> |
34 | 34 | </p> |
35 | -<p><?php esc_html_e( 'The renewal order is as follows:', 'woocommerce-gateway-stripe' ); ?></p> |
|
35 | +<p><?php esc_html_e('The renewal order is as follows:', 'woocommerce-gateway-stripe'); ?></p> |
|
36 | 36 | |
37 | 37 | <?php |
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Shows the order details table. |
41 | 41 | */ |
42 | -do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email ); |
|
42 | +do_action('woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email); |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Shows order meta data. |
46 | 46 | */ |
47 | -do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email ); |
|
47 | +do_action('woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Shows customer details, and email address. |
51 | 51 | */ |
52 | -do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); |
|
52 | +do_action('woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email); |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Output the email footer. |
56 | 56 | */ |
57 | -do_action( 'woocommerce_email_footer', $email ); |
|
57 | +do_action('woocommerce_email_footer', $email); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @version 4.3.0 |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -21,29 +21,29 @@ discard block |
||
21 | 21 | ), |
22 | 22 | $order->get_order_number(), |
23 | 23 | $order->get_formatted_billing_full_name(), |
24 | - wcs_get_human_time_diff( $retry->get_time() ) |
|
24 | + wcs_get_human_time_diff($retry->get_time()) |
|
25 | 25 | ) . "\n\n"; |
26 | -printf( __( 'The renewal order is as follows:', 'woocommerce-gateway-stripe' ) ) . "\n\n"; |
|
26 | +printf(__('The renewal order is as follows:', 'woocommerce-gateway-stripe')) . "\n\n"; |
|
27 | 27 | |
28 | 28 | echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; |
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Shows the order details table. |
32 | 32 | */ |
33 | -do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email ); |
|
33 | +do_action('woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email); |
|
34 | 34 | |
35 | 35 | echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; |
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Shows order meta data. |
39 | 39 | */ |
40 | -do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email ); |
|
40 | +do_action('woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email); |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Shows customer details, and email address. |
44 | 44 | */ |
45 | -do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); |
|
45 | +do_action('woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email); |
|
46 | 46 | |
47 | 47 | echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; |
48 | 48 | |
49 | -echo apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) ); |
|
49 | +echo apply_filters('woocommerce_email_footer_text', get_option('woocommerce_email_footer_text')); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @extends WC_Email_Failed_Order |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __construct() { |
28 | 28 | $this->id = 'failed_authentication_requested'; |
29 | - $this->title = __( 'Payment Authentication Requested Email', 'woocommerce-gateway-stripe' ); |
|
30 | - $this->description = __( 'Payment authentication requested emails are sent to chosen recipient(s) when an attempt to automatically process a subscription renewal payment fails because the transaction requires an SCA verification, the customer is requested to authenticate the payment, and a retry rule has been applied to notify the customer again within a certain time period.', 'woocommerce-gateway-stripe' ); |
|
29 | + $this->title = __('Payment Authentication Requested Email', 'woocommerce-gateway-stripe'); |
|
30 | + $this->description = __('Payment authentication requested emails are sent to chosen recipient(s) when an attempt to automatically process a subscription renewal payment fails because the transaction requires an SCA verification, the customer is requested to authenticate the payment, and a retry rule has been applied to notify the customer again within a certain time period.', 'woocommerce-gateway-stripe'); |
|
31 | 31 | |
32 | - $this->heading = __( 'Automatic renewal payment failed due to authentication required', 'woocommerce-gateway-stripe' ); |
|
33 | - $this->subject = __( '[{site_title}] Automatic payment failed for {order_number}. Customer asked to authenticate payment and will be notified again {retry_time}', 'woocommerce-gateway-stripe' ); |
|
32 | + $this->heading = __('Automatic renewal payment failed due to authentication required', 'woocommerce-gateway-stripe'); |
|
33 | + $this->subject = __('[{site_title}] Automatic payment failed for {order_number}. Customer asked to authenticate payment and will be notified again {retry_time}', 'woocommerce-gateway-stripe'); |
|
34 | 34 | |
35 | 35 | $this->template_html = 'emails/failed-renewal-authentication-requested.php'; |
36 | 36 | $this->template_plain = 'emails/plain/failed-renewal-authentication-requested.php'; |
37 | - $this->template_base = plugin_dir_path( WC_STRIPE_MAIN_FILE ) . 'templates/'; |
|
37 | + $this->template_base = plugin_dir_path(WC_STRIPE_MAIN_FILE) . 'templates/'; |
|
38 | 38 | |
39 | - $this->recipient = $this->get_option( 'recipient', get_option( 'admin_email' ) ); |
|
39 | + $this->recipient = $this->get_option('recipient', get_option('admin_email')); |
|
40 | 40 | |
41 | 41 | // We want all the parent's methods, with none of its properties, so call its parent's constructor, rather than my parent constructor. |
42 | 42 | WC_Email::__construct(); |
@@ -66,26 +66,26 @@ discard block |
||
66 | 66 | * @param int $order_id The order ID. |
67 | 67 | * @param WC_Order|null $order Order object. |
68 | 68 | */ |
69 | - public function trigger( $order_id, $order = null ) { |
|
69 | + public function trigger($order_id, $order = null) { |
|
70 | 70 | $this->object = $order; |
71 | 71 | |
72 | 72 | $this->find['retry-time'] = '{retry_time}'; |
73 | - if ( class_exists( 'WCS_Retry_Manager' ) && function_exists( 'wcs_get_human_time_diff' ) ) { |
|
74 | - $this->retry = WCS_Retry_Manager::store()->get_last_retry_for_order( wcs_get_objects_property( $order, 'id' ) ); |
|
75 | - $this->replace['retry-time'] = wcs_get_human_time_diff( $this->retry->get_time() ); |
|
73 | + if (class_exists('WCS_Retry_Manager') && function_exists('wcs_get_human_time_diff')) { |
|
74 | + $this->retry = WCS_Retry_Manager::store()->get_last_retry_for_order(wcs_get_objects_property($order, 'id')); |
|
75 | + $this->replace['retry-time'] = wcs_get_human_time_diff($this->retry->get_time()); |
|
76 | 76 | } else { |
77 | - WC_Stripe_Logger::log( 'WCS_Retry_Manager class or does not exist. Not able to send admnin email about customer notification for authentication required for renewal payment.' ); |
|
77 | + WC_Stripe_Logger::log('WCS_Retry_Manager class or does not exist. Not able to send admnin email about customer notification for authentication required for renewal payment.'); |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
81 | 81 | $this->find['order-number'] = '{order_number}'; |
82 | 82 | $this->replace['order-number'] = $this->object->get_order_number(); |
83 | 83 | |
84 | - if ( ! $this->is_enabled() || ! $this->get_recipient() ) { |
|
84 | + if ( ! $this->is_enabled() || ! $this->get_recipient()) { |
|
85 | 85 | return; |
86 | 86 | } |
87 | 87 | |
88 | - $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); |
|
88 | + $this->send($this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments()); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; // Exit if accessed directly. |
4 | 4 | } |
5 | 5 | |
@@ -14,20 +14,20 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @param WC_Email[] $email_classes All existing instances of WooCommerce emails. |
16 | 16 | */ |
17 | - public function __construct( $email_classes = array() ) { |
|
17 | + public function __construct($email_classes = array()) { |
|
18 | 18 | $this->id = 'failed_renewal_authentication'; |
19 | - $this->title = __( 'Failed Subscription Renewal SCA Authentication', 'woocommerce-gateway-stripe' ); |
|
20 | - $this->description = __( 'Sent to a customer when a renewal fails because the transaction requires an SCA verification. The email contains renewal order information and payment links.', 'woocommerce-gateway-stripe' ); |
|
19 | + $this->title = __('Failed Subscription Renewal SCA Authentication', 'woocommerce-gateway-stripe'); |
|
20 | + $this->description = __('Sent to a customer when a renewal fails because the transaction requires an SCA verification. The email contains renewal order information and payment links.', 'woocommerce-gateway-stripe'); |
|
21 | 21 | $this->customer_email = true; |
22 | 22 | |
23 | 23 | $this->template_html = 'emails/failed-renewal-authentication.php'; |
24 | 24 | $this->template_plain = 'emails/plain/failed-renewal-authentication.php'; |
25 | - $this->template_base = plugin_dir_path( WC_STRIPE_MAIN_FILE ) . 'templates/'; |
|
25 | + $this->template_base = plugin_dir_path(WC_STRIPE_MAIN_FILE) . 'templates/'; |
|
26 | 26 | |
27 | 27 | // Triggers the email at the correct hook. |
28 | - add_action( 'wc_gateway_stripe_process_payment_authentication_required', array( $this, 'trigger' ) ); |
|
28 | + add_action('wc_gateway_stripe_process_payment_authentication_required', array($this, 'trigger')); |
|
29 | 29 | |
30 | - if ( isset( $email_classes['WCS_Email_Customer_Renewal_Invoice'] ) ) { |
|
30 | + if (isset($email_classes['WCS_Email_Customer_Renewal_Invoice'])) { |
|
31 | 31 | $this->original_email = $email_classes['WCS_Email_Customer_Renewal_Invoice']; |
32 | 32 | } |
33 | 33 | |
@@ -40,21 +40,21 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param WC_Order $order The order that is being paid. |
42 | 42 | */ |
43 | - public function trigger( $order ) { |
|
44 | - if ( function_exists( 'wcs_order_contains_subscription' ) && ( wcs_order_contains_subscription( $order->get_id() ) || wcs_is_subscription( $order->get_id() ) || wcs_order_contains_renewal( $order->get_id() ) ) ) { |
|
45 | - parent::trigger( $order ); |
|
43 | + public function trigger($order) { |
|
44 | + if (function_exists('wcs_order_contains_subscription') && (wcs_order_contains_subscription($order->get_id()) || wcs_is_subscription($order->get_id()) || wcs_order_contains_renewal($order->get_id()))) { |
|
45 | + parent::trigger($order); |
|
46 | 46 | |
47 | 47 | // Prevent the renewal email from WooCommerce Subscriptions from being sent. |
48 | - if ( isset( $this->original_email ) ) { |
|
49 | - remove_action( 'woocommerce_generated_manual_renewal_order_renewal_notification', array( $this->original_email, 'trigger' ) ); |
|
50 | - remove_action( 'woocommerce_order_status_failed_renewal_notification', array( $this->original_email, 'trigger' ) ); |
|
48 | + if (isset($this->original_email)) { |
|
49 | + remove_action('woocommerce_generated_manual_renewal_order_renewal_notification', array($this->original_email, 'trigger')); |
|
50 | + remove_action('woocommerce_order_status_failed_renewal_notification', array($this->original_email, 'trigger')); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | // Prevent the retry email from WooCommerce Subscriptions from being sent. |
54 | - add_filter( 'wcs_get_retry_rule_raw', array( $this, 'prevent_retry_notification_email' ), 100, 3 ); |
|
54 | + add_filter('wcs_get_retry_rule_raw', array($this, 'prevent_retry_notification_email'), 100, 3); |
|
55 | 55 | |
56 | 56 | // Send email to store owner indicating communication is happening with the customer to request authentication. |
57 | - add_filter( 'wcs_get_retry_rule_raw', array( $this, 'set_store_owner_custom_email' ), 100, 3 ); |
|
57 | + add_filter('wcs_get_retry_rule_raw', array($this, 'set_store_owner_custom_email'), 100, 3); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return string |
65 | 65 | */ |
66 | 66 | public function get_default_subject() { |
67 | - return __( 'Payment authorization needed for renewal of {site_title} order {order_number}', 'woocommerce-gateway-stripe' ); |
|
67 | + return __('Payment authorization needed for renewal of {site_title} order {order_number}', 'woocommerce-gateway-stripe'); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return string |
74 | 74 | */ |
75 | 75 | public function get_default_heading() { |
76 | - return __( 'Payment authorization needed for renewal of order {order_number}', 'woocommerce-gateway-stripe' ); |
|
76 | + return __('Payment authorization needed for renewal of order {order_number}', 'woocommerce-gateway-stripe'); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | * @param int $order_id The ID of the order that needs payment. |
85 | 85 | * @return array |
86 | 86 | */ |
87 | - public function prevent_retry_notification_email( $rule_array, $retry_number, $order_id ) { |
|
88 | - if ( wcs_get_objects_property( $this->object, 'id' ) === $order_id ) { |
|
87 | + public function prevent_retry_notification_email($rule_array, $retry_number, $order_id) { |
|
88 | + if (wcs_get_objects_property($this->object, 'id') === $order_id) { |
|
89 | 89 | $rule_array['email_template_customer'] = ''; |
90 | 90 | } |
91 | 91 | |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | * @param int $order_id The ID of the order that needs payment. |
101 | 101 | * @return array |
102 | 102 | */ |
103 | - public function set_store_owner_custom_email( $rule_array, $retry_number, $order_id ) { |
|
103 | + public function set_store_owner_custom_email($rule_array, $retry_number, $order_id) { |
|
104 | 104 | if ( |
105 | - wcs_get_objects_property( $this->object, 'id' ) === $order_id && |
|
105 | + wcs_get_objects_property($this->object, 'id') === $order_id && |
|
106 | 106 | '' !== $rule_array['email_template_admin'] // Only send our email if a retry admin email was already going to be sent. |
107 | 107 | ) { |
108 | 108 | $rule_array['email_template_admin'] = 'WC_Stripe_Email_Failed_Authentication_Retry'; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * |
16 | 16 | */ |
17 | 17 | |
18 | -if ( ! defined( 'ABSPATH' ) ) { |
|
18 | +if ( ! defined('ABSPATH')) { |
|
19 | 19 | exit; |
20 | 20 | } |
21 | 21 | |
@@ -29,29 +29,29 @@ discard block |
||
29 | 29 | */ |
30 | 30 | function woocommerce_stripe_missing_wc_notice() { |
31 | 31 | /* translators: 1. URL link. */ |
32 | - echo '<div class="error"><p><strong>' . sprintf( esc_html__( 'Stripe requires WooCommerce to be installed and active. You can download %s here.', 'woocommerce-gateway-stripe' ), '<a href="https://woocommerce.com/" target="_blank">WooCommerce</a>' ) . '</strong></p></div>'; |
|
32 | + echo '<div class="error"><p><strong>' . sprintf(esc_html__('Stripe requires WooCommerce to be installed and active. You can download %s here.', 'woocommerce-gateway-stripe'), '<a href="https://woocommerce.com/" target="_blank">WooCommerce</a>') . '</strong></p></div>'; |
|
33 | 33 | } |
34 | 34 | |
35 | -add_action( 'plugins_loaded', 'woocommerce_gateway_stripe_init' ); |
|
35 | +add_action('plugins_loaded', 'woocommerce_gateway_stripe_init'); |
|
36 | 36 | |
37 | 37 | function woocommerce_gateway_stripe_init() { |
38 | - load_plugin_textdomain( 'woocommerce-gateway-stripe', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' ); |
|
38 | + load_plugin_textdomain('woocommerce-gateway-stripe', false, plugin_basename(dirname(__FILE__)) . '/languages'); |
|
39 | 39 | |
40 | - if ( ! class_exists( 'WooCommerce' ) ) { |
|
41 | - add_action( 'admin_notices', 'woocommerce_stripe_missing_wc_notice' ); |
|
40 | + if ( ! class_exists('WooCommerce')) { |
|
41 | + add_action('admin_notices', 'woocommerce_stripe_missing_wc_notice'); |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
45 | - if ( ! class_exists( 'WC_Stripe' ) ) : |
|
45 | + if ( ! class_exists('WC_Stripe')) : |
|
46 | 46 | /** |
47 | 47 | * Required minimums and constants |
48 | 48 | */ |
49 | - define( 'WC_STRIPE_VERSION', '4.3.0' ); |
|
50 | - define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' ); |
|
51 | - define( 'WC_STRIPE_MIN_WC_VER', '2.6.0' ); |
|
52 | - define( 'WC_STRIPE_MAIN_FILE', __FILE__ ); |
|
53 | - define( 'WC_STRIPE_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) ); |
|
54 | - define( 'WC_STRIPE_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); |
|
49 | + define('WC_STRIPE_VERSION', '4.3.0'); |
|
50 | + define('WC_STRIPE_MIN_PHP_VER', '5.6.0'); |
|
51 | + define('WC_STRIPE_MIN_WC_VER', '2.6.0'); |
|
52 | + define('WC_STRIPE_MAIN_FILE', __FILE__); |
|
53 | + define('WC_STRIPE_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__)))); |
|
54 | + define('WC_STRIPE_PLUGIN_PATH', untrailingslashit(plugin_dir_path(__FILE__))); |
|
55 | 55 | |
56 | 56 | class WC_Stripe { |
57 | 57 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @return Singleton The *Singleton* instance. |
67 | 67 | */ |
68 | 68 | public static function get_instance() { |
69 | - if ( null === self::$instance ) { |
|
69 | + if (null === self::$instance) { |
|
70 | 70 | self::$instance = new self(); |
71 | 71 | } |
72 | 72 | return self::$instance; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * *Singleton* via the `new` operator from outside of this class. |
94 | 94 | */ |
95 | 95 | private function __construct() { |
96 | - add_action( 'admin_init', array( $this, 'install' ) ); |
|
96 | + add_action('admin_init', array($this, 'install')); |
|
97 | 97 | $this->init(); |
98 | 98 | } |
99 | 99 | |
@@ -104,52 +104,52 @@ discard block |
||
104 | 104 | * @version 4.0.0 |
105 | 105 | */ |
106 | 106 | public function init() { |
107 | - if ( is_admin() ) { |
|
108 | - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-privacy.php'; |
|
107 | + if (is_admin()) { |
|
108 | + require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-privacy.php'; |
|
109 | 109 | } |
110 | 110 | |
111 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-exception.php'; |
|
112 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-logger.php'; |
|
113 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-helper.php'; |
|
114 | - include_once dirname( __FILE__ ) . '/includes/class-wc-stripe-api.php'; |
|
115 | - require_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php'; |
|
116 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-webhook-handler.php'; |
|
117 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-sepa-payment-token.php'; |
|
118 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-apple-pay-registration.php'; |
|
119 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-pre-orders-compat.php'; |
|
120 | - require_once dirname( __FILE__ ) . '/includes/class-wc-gateway-stripe.php'; |
|
121 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php'; |
|
122 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php'; |
|
123 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php'; |
|
124 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php'; |
|
125 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php'; |
|
126 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php'; |
|
127 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php'; |
|
128 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php'; |
|
129 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php'; |
|
130 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-payment-request.php'; |
|
131 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-subs-compat.php'; |
|
132 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php'; |
|
133 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-order-handler.php'; |
|
134 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-payment-tokens.php'; |
|
135 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-customer.php'; |
|
136 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-intent-controller.php'; |
|
137 | - |
|
138 | - if ( is_admin() ) { |
|
139 | - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-admin-notices.php'; |
|
111 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-exception.php'; |
|
112 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-logger.php'; |
|
113 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-helper.php'; |
|
114 | + include_once dirname(__FILE__) . '/includes/class-wc-stripe-api.php'; |
|
115 | + require_once dirname(__FILE__) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php'; |
|
116 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-webhook-handler.php'; |
|
117 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-sepa-payment-token.php'; |
|
118 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-apple-pay-registration.php'; |
|
119 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-pre-orders-compat.php'; |
|
120 | + require_once dirname(__FILE__) . '/includes/class-wc-gateway-stripe.php'; |
|
121 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php'; |
|
122 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php'; |
|
123 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php'; |
|
124 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php'; |
|
125 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php'; |
|
126 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php'; |
|
127 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php'; |
|
128 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php'; |
|
129 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php'; |
|
130 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-stripe-payment-request.php'; |
|
131 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-subs-compat.php'; |
|
132 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php'; |
|
133 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-order-handler.php'; |
|
134 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-payment-tokens.php'; |
|
135 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-customer.php'; |
|
136 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-intent-controller.php'; |
|
137 | + |
|
138 | + if (is_admin()) { |
|
139 | + require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-admin-notices.php'; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | // REMOVE IN THE FUTURE. |
143 | - require_once dirname( __FILE__ ) . '/includes/deprecated/class-wc-stripe-apple-pay.php'; |
|
143 | + require_once dirname(__FILE__) . '/includes/deprecated/class-wc-stripe-apple-pay.php'; |
|
144 | 144 | |
145 | - add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) ); |
|
146 | - add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) ); |
|
145 | + add_filter('woocommerce_payment_gateways', array($this, 'add_gateways')); |
|
146 | + add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links')); |
|
147 | 147 | |
148 | 148 | // Modify emails emails. |
149 | - add_filter( 'woocommerce_email_classes', array( $this, 'add_emails' ), 20 ); |
|
149 | + add_filter('woocommerce_email_classes', array($this, 'add_emails'), 20); |
|
150 | 150 | |
151 | - if ( version_compare( WC_VERSION, '3.4', '<' ) ) { |
|
152 | - add_filter( 'woocommerce_get_sections_checkout', array( $this, 'filter_gateway_order_admin' ) ); |
|
151 | + if (version_compare(WC_VERSION, '3.4', '<')) { |
|
152 | + add_filter('woocommerce_get_sections_checkout', array($this, 'filter_gateway_order_admin')); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | * @version 4.0.0 |
161 | 161 | */ |
162 | 162 | public function update_plugin_version() { |
163 | - delete_option( 'wc_stripe_version' ); |
|
164 | - update_option( 'wc_stripe_version', WC_STRIPE_VERSION ); |
|
163 | + delete_option('wc_stripe_version'); |
|
164 | + update_option('wc_stripe_version', WC_STRIPE_VERSION); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -171,15 +171,15 @@ discard block |
||
171 | 171 | * @version 3.1.0 |
172 | 172 | */ |
173 | 173 | public function install() { |
174 | - if ( ! is_plugin_active( plugin_basename( __FILE__ ) ) ) { |
|
174 | + if ( ! is_plugin_active(plugin_basename(__FILE__))) { |
|
175 | 175 | return; |
176 | 176 | } |
177 | 177 | |
178 | - if ( ! defined( 'IFRAME_REQUEST' ) && ( WC_STRIPE_VERSION !== get_option( 'wc_stripe_version' ) ) ) { |
|
179 | - do_action( 'woocommerce_stripe_updated' ); |
|
178 | + if ( ! defined('IFRAME_REQUEST') && (WC_STRIPE_VERSION !== get_option('wc_stripe_version'))) { |
|
179 | + do_action('woocommerce_stripe_updated'); |
|
180 | 180 | |
181 | - if ( ! defined( 'WC_STRIPE_INSTALLING' ) ) { |
|
182 | - define( 'WC_STRIPE_INSTALLING', true ); |
|
181 | + if ( ! defined('WC_STRIPE_INSTALLING')) { |
|
182 | + define('WC_STRIPE_INSTALLING', true); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | $this->update_plugin_version(); |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | * @since 1.0.0 |
193 | 193 | * @version 4.0.0 |
194 | 194 | */ |
195 | - public function plugin_action_links( $links ) { |
|
195 | + public function plugin_action_links($links) { |
|
196 | 196 | $plugin_links = array( |
197 | - '<a href="admin.php?page=wc-settings&tab=checkout§ion=stripe">' . esc_html__( 'Settings', 'woocommerce-gateway-stripe' ) . '</a>', |
|
198 | - '<a href="https://docs.woocommerce.com/document/stripe/">' . esc_html__( 'Docs', 'woocommerce-gateway-stripe' ) . '</a>', |
|
199 | - '<a href="https://woocommerce.com/my-account/create-a-ticket?broken=primary&select=18627">' . esc_html__( 'Support', 'woocommerce-gateway-stripe' ) . '</a>', |
|
197 | + '<a href="admin.php?page=wc-settings&tab=checkout§ion=stripe">' . esc_html__('Settings', 'woocommerce-gateway-stripe') . '</a>', |
|
198 | + '<a href="https://docs.woocommerce.com/document/stripe/">' . esc_html__('Docs', 'woocommerce-gateway-stripe') . '</a>', |
|
199 | + '<a href="https://woocommerce.com/my-account/create-a-ticket?broken=primary&select=18627">' . esc_html__('Support', 'woocommerce-gateway-stripe') . '</a>', |
|
200 | 200 | ); |
201 | - return array_merge( $plugin_links, $links ); |
|
201 | + return array_merge($plugin_links, $links); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | * @since 1.0.0 |
208 | 208 | * @version 4.0.0 |
209 | 209 | */ |
210 | - public function add_gateways( $methods ) { |
|
211 | - if ( class_exists( 'WC_Subscriptions_Order' ) && function_exists( 'wcs_create_renewal_order' ) ) { |
|
210 | + public function add_gateways($methods) { |
|
211 | + if (class_exists('WC_Subscriptions_Order') && function_exists('wcs_create_renewal_order')) { |
|
212 | 212 | $methods[] = 'WC_Stripe_Subs_Compat'; |
213 | 213 | $methods[] = 'WC_Stripe_Sepa_Subs_Compat'; |
214 | 214 | } else { |
@@ -234,28 +234,28 @@ discard block |
||
234 | 234 | * @since 4.0.0 |
235 | 235 | * @version 4.0.0 |
236 | 236 | */ |
237 | - public function filter_gateway_order_admin( $sections ) { |
|
238 | - unset( $sections['stripe'] ); |
|
239 | - unset( $sections['stripe_bancontact'] ); |
|
240 | - unset( $sections['stripe_sofort'] ); |
|
241 | - unset( $sections['stripe_giropay'] ); |
|
242 | - unset( $sections['stripe_eps'] ); |
|
243 | - unset( $sections['stripe_ideal'] ); |
|
244 | - unset( $sections['stripe_p24'] ); |
|
245 | - unset( $sections['stripe_alipay'] ); |
|
246 | - unset( $sections['stripe_sepa'] ); |
|
247 | - unset( $sections['stripe_multibanco'] ); |
|
237 | + public function filter_gateway_order_admin($sections) { |
|
238 | + unset($sections['stripe']); |
|
239 | + unset($sections['stripe_bancontact']); |
|
240 | + unset($sections['stripe_sofort']); |
|
241 | + unset($sections['stripe_giropay']); |
|
242 | + unset($sections['stripe_eps']); |
|
243 | + unset($sections['stripe_ideal']); |
|
244 | + unset($sections['stripe_p24']); |
|
245 | + unset($sections['stripe_alipay']); |
|
246 | + unset($sections['stripe_sepa']); |
|
247 | + unset($sections['stripe_multibanco']); |
|
248 | 248 | |
249 | 249 | $sections['stripe'] = 'Stripe'; |
250 | - $sections['stripe_bancontact'] = __( 'Stripe Bancontact', 'woocommerce-gateway-stripe' ); |
|
251 | - $sections['stripe_sofort'] = __( 'Stripe SOFORT', 'woocommerce-gateway-stripe' ); |
|
252 | - $sections['stripe_giropay'] = __( 'Stripe Giropay', 'woocommerce-gateway-stripe' ); |
|
253 | - $sections['stripe_eps'] = __( 'Stripe EPS', 'woocommerce-gateway-stripe' ); |
|
254 | - $sections['stripe_ideal'] = __( 'Stripe iDeal', 'woocommerce-gateway-stripe' ); |
|
255 | - $sections['stripe_p24'] = __( 'Stripe P24', 'woocommerce-gateway-stripe' ); |
|
256 | - $sections['stripe_alipay'] = __( 'Stripe Alipay', 'woocommerce-gateway-stripe' ); |
|
257 | - $sections['stripe_sepa'] = __( 'Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe' ); |
|
258 | - $sections['stripe_multibanco'] = __( 'Stripe Multibanco', 'woocommerce-gateway-stripe' ); |
|
250 | + $sections['stripe_bancontact'] = __('Stripe Bancontact', 'woocommerce-gateway-stripe'); |
|
251 | + $sections['stripe_sofort'] = __('Stripe SOFORT', 'woocommerce-gateway-stripe'); |
|
252 | + $sections['stripe_giropay'] = __('Stripe Giropay', 'woocommerce-gateway-stripe'); |
|
253 | + $sections['stripe_eps'] = __('Stripe EPS', 'woocommerce-gateway-stripe'); |
|
254 | + $sections['stripe_ideal'] = __('Stripe iDeal', 'woocommerce-gateway-stripe'); |
|
255 | + $sections['stripe_p24'] = __('Stripe P24', 'woocommerce-gateway-stripe'); |
|
256 | + $sections['stripe_alipay'] = __('Stripe Alipay', 'woocommerce-gateway-stripe'); |
|
257 | + $sections['stripe_sepa'] = __('Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe'); |
|
258 | + $sections['stripe_multibanco'] = __('Stripe Multibanco', 'woocommerce-gateway-stripe'); |
|
259 | 259 | |
260 | 260 | return $sections; |
261 | 261 | } |
@@ -266,16 +266,16 @@ discard block |
||
266 | 266 | * @param WC_Email[] $email_classes All existing emails. |
267 | 267 | * @return WC_Email[] |
268 | 268 | */ |
269 | - public function add_emails( $email_classes ) { |
|
269 | + public function add_emails($email_classes) { |
|
270 | 270 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication.php'; |
271 | 271 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-renewal-authentication.php'; |
272 | 272 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-preorder-authentication.php'; |
273 | 273 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication-retry.php'; |
274 | 274 | |
275 | 275 | // Add all emails, generated by the gateway. |
276 | - $email_classes['WC_Stripe_Email_Failed_Renewal_Authentication'] = new WC_Stripe_Email_Failed_Renewal_Authentication( $email_classes ); |
|
277 | - $email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication( $email_classes ); |
|
278 | - $email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry( $email_classes ); |
|
276 | + $email_classes['WC_Stripe_Email_Failed_Renewal_Authentication'] = new WC_Stripe_Email_Failed_Renewal_Authentication($email_classes); |
|
277 | + $email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication($email_classes); |
|
278 | + $email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry($email_classes); |
|
279 | 279 | |
280 | 280 | return $email_classes; |
281 | 281 | } |