@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function display_admin_settings_webhook_description() { |
23 | 23 | /* translators: 1) webhook url */ |
24 | - return sprintf( __( 'You must add the following webhook endpoint <strong style="background-color:#ddd;"> %s </strong> to your <a href="https://dashboard.stripe.com/account/webhooks" target="_blank">Stripe account settings</a>. This will enable you to receive notifications on the charge statuses.', 'woocommerce-gateway-stripe' ), WC_Stripe_Helper::get_webhook_url() ); |
|
24 | + return sprintf(__('You must add the following webhook endpoint <strong style="background-color:#ddd;"> %s </strong> to your <a href="https://dashboard.stripe.com/account/webhooks" target="_blank">Stripe account settings</a>. This will enable you to receive notifications on the charge statuses.', 'woocommerce-gateway-stripe'), WC_Stripe_Helper::get_webhook_url()); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | <input id="wc-%1$s-new-payment-method" name="wc-%1$s-new-payment-method" type="checkbox" value="true" style="width:auto;" /> |
36 | 36 | <label for="wc-%1$s-new-payment-method" style="display:inline;">%2$s</label> |
37 | 37 | </p>', |
38 | - esc_attr( $this->id ), |
|
39 | - esc_html( apply_filters( 'wc_stripe_save_to_account_text', __( 'Save payment information to my account for future purchases.', 'woocommerce-gateway-stripe' ) ) ) |
|
38 | + esc_attr($this->id), |
|
39 | + esc_html(apply_filters('wc_stripe_save_to_account_text', __('Save payment information to my account for future purchases.', 'woocommerce-gateway-stripe'))) |
|
40 | 40 | ); |
41 | 41 | } |
42 | 42 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @since 4.0.5 |
48 | 48 | * @param array $error |
49 | 49 | */ |
50 | - public function is_retryable_error( $error ) { |
|
50 | + public function is_retryable_error($error) { |
|
51 | 51 | return ( |
52 | 52 | 'invalid_request_error' === $error->type || |
53 | 53 | 'idempotency_error' === $error->type || |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * @since 4.1.0 |
65 | 65 | * @param array $error |
66 | 66 | */ |
67 | - public function is_same_idempotency_error( $error ) { |
|
67 | + public function is_same_idempotency_error($error) { |
|
68 | 68 | return ( |
69 | 69 | $error && |
70 | 70 | 'idempotency_error' === $error->type && |
71 | - preg_match( '/Keys for idempotent requests can only be used with the same parameters they were first used with./i', $error->message ) |
|
71 | + preg_match('/Keys for idempotent requests can only be used with the same parameters they were first used with./i', $error->message) |
|
72 | 72 | ); |
73 | 73 | } |
74 | 74 | |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | * @since 4.1.0 |
80 | 80 | * @param array $error |
81 | 81 | */ |
82 | - public function is_source_already_consumed_error( $error ) { |
|
82 | + public function is_source_already_consumed_error($error) { |
|
83 | 83 | return ( |
84 | 84 | $error && |
85 | 85 | 'invalid_request_error' === $error->type && |
86 | - preg_match( '/The reusable source you provided is consumed because it was previously charged without being attached to a customer or was detached from a customer. To charge a reusable source multiple time you must attach it to a customer first./i', $error->message ) |
|
86 | + preg_match('/The reusable source you provided is consumed because it was previously charged without being attached to a customer or was detached from a customer. To charge a reusable source multiple time you must attach it to a customer first./i', $error->message) |
|
87 | 87 | ); |
88 | 88 | } |
89 | 89 | |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | * @since 4.1.0 |
95 | 95 | * @param array $error |
96 | 96 | */ |
97 | - public function is_no_such_customer_error( $error ) { |
|
97 | + public function is_no_such_customer_error($error) { |
|
98 | 98 | return ( |
99 | 99 | $error && |
100 | 100 | 'invalid_request_error' === $error->type && |
101 | - preg_match( '/No such customer/i', $error->message ) |
|
101 | + preg_match('/No such customer/i', $error->message) |
|
102 | 102 | ); |
103 | 103 | } |
104 | 104 | |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | * @since 4.1.0 |
110 | 110 | * @param array $error |
111 | 111 | */ |
112 | - public function is_no_such_token_error( $error ) { |
|
112 | + public function is_no_such_token_error($error) { |
|
113 | 113 | return ( |
114 | 114 | $error && |
115 | 115 | 'invalid_request_error' === $error->type && |
116 | - preg_match( '/No such token/i', $error->message ) |
|
116 | + preg_match('/No such token/i', $error->message) |
|
117 | 117 | ); |
118 | 118 | } |
119 | 119 | |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | * @since 4.1.0 |
125 | 125 | * @param array $error |
126 | 126 | */ |
127 | - public function is_no_such_source_error( $error ) { |
|
127 | + public function is_no_such_source_error($error) { |
|
128 | 128 | return ( |
129 | 129 | $error && |
130 | 130 | 'invalid_request_error' === $error->type && |
131 | - preg_match( '/No such source/i', $error->message ) |
|
131 | + preg_match('/No such source/i', $error->message) |
|
132 | 132 | ); |
133 | 133 | } |
134 | 134 | |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | * @since 4.1.0 |
140 | 140 | * @param array $error |
141 | 141 | */ |
142 | - public function is_no_linked_source_error( $error ) { |
|
142 | + public function is_no_linked_source_error($error) { |
|
143 | 143 | return ( |
144 | 144 | $error && |
145 | 145 | 'invalid_request_error' === $error->type && |
146 | - preg_match( '/does not have a linked source with ID/i', $error->message ) |
|
146 | + preg_match('/does not have a linked source with ID/i', $error->message) |
|
147 | 147 | ); |
148 | 148 | } |
149 | 149 | |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | * @param object $error |
157 | 157 | * @return bool |
158 | 158 | */ |
159 | - public function need_update_idempotency_key( $source_object, $error ) { |
|
159 | + public function need_update_idempotency_key($source_object, $error) { |
|
160 | 160 | return ( |
161 | 161 | $error && |
162 | 162 | 1 < $this->retry_interval && |
163 | - ! empty( $source_object ) && |
|
163 | + ! empty($source_object) && |
|
164 | 164 | 'chargeable' === $source_object->status && |
165 | - self::is_same_idempotency_error( $error ) |
|
165 | + self::is_same_idempotency_error($error) |
|
166 | 166 | ); |
167 | 167 | } |
168 | 168 | |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | * @since 4.1.3 |
173 | 173 | */ |
174 | 174 | public function is_available() { |
175 | - if ( 'yes' === $this->enabled ) { |
|
176 | - if ( ! $this->secret_key || ! $this->publishable_key ) { |
|
175 | + if ('yes' === $this->enabled) { |
|
176 | + if ( ! $this->secret_key || ! $this->publishable_key) { |
|
177 | 177 | return false; |
178 | 178 | } |
179 | 179 | return true; |
@@ -190,12 +190,12 @@ discard block |
||
190 | 190 | * @param int $order_id |
191 | 191 | * @return bool |
192 | 192 | */ |
193 | - public function maybe_process_pre_orders( $order_id ) { |
|
193 | + public function maybe_process_pre_orders($order_id) { |
|
194 | 194 | return ( |
195 | 195 | WC_Stripe_Helper::is_pre_orders_exists() && |
196 | - $this->pre_orders->is_pre_order( $order_id ) && |
|
197 | - WC_Pre_Orders_Order::order_requires_payment_tokenization( $order_id ) && |
|
198 | - ! is_wc_endpoint_url( 'order-pay' ) |
|
196 | + $this->pre_orders->is_pre_order($order_id) && |
|
197 | + WC_Pre_Orders_Order::order_requires_payment_tokenization($order_id) && |
|
198 | + ! is_wc_endpoint_url('order-pay') |
|
199 | 199 | ); |
200 | 200 | } |
201 | 201 | |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | * @since 1.0.0 |
206 | 206 | * @version 4.0.0 |
207 | 207 | */ |
208 | - public function add_admin_notice( $slug, $class, $message, $dismissible = false ) { |
|
209 | - $this->notices[ $slug ] = array( |
|
208 | + public function add_admin_notice($slug, $class, $message, $dismissible = false) { |
|
209 | + $this->notices[$slug] = array( |
|
210 | 210 | 'class' => $class, |
211 | 211 | 'message' => $message, |
212 | 212 | 'dismissible' => $dismissible, |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | * @version 4.0.0 |
254 | 254 | * @param object $order |
255 | 255 | */ |
256 | - public function validate_minimum_order_amount( $order ) { |
|
257 | - if ( $order->get_total() * 100 < WC_Stripe_Helper::get_minimum_amount() ) { |
|
256 | + public function validate_minimum_order_amount($order) { |
|
257 | + if ($order->get_total() * 100 < WC_Stripe_Helper::get_minimum_amount()) { |
|
258 | 258 | /* translators: 1) dollar amount */ |
259 | - throw new WC_Stripe_Exception( 'Did not meet minimum amount', sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe_Helper::get_minimum_amount() / 100 ) ) ); |
|
259 | + throw new WC_Stripe_Exception('Did not meet minimum amount', sprintf(__('Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe'), wc_price(WC_Stripe_Helper::get_minimum_amount() / 100))); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
@@ -266,14 +266,14 @@ discard block |
||
266 | 266 | * @since 4.0.0 |
267 | 267 | * @version 4.0.0 |
268 | 268 | */ |
269 | - public function get_transaction_url( $order ) { |
|
270 | - if ( $this->testmode ) { |
|
269 | + public function get_transaction_url($order) { |
|
270 | + if ($this->testmode) { |
|
271 | 271 | $this->view_transaction_url = 'https://dashboard.stripe.com/test/payments/%s'; |
272 | 272 | } else { |
273 | 273 | $this->view_transaction_url = 'https://dashboard.stripe.com/payments/%s'; |
274 | 274 | } |
275 | 275 | |
276 | - return parent::get_transaction_url( $order ); |
|
276 | + return parent::get_transaction_url($order); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
@@ -282,15 +282,15 @@ discard block |
||
282 | 282 | * @since 4.0.0 |
283 | 283 | * @version 4.0.0 |
284 | 284 | */ |
285 | - public function get_stripe_customer_id( $order ) { |
|
286 | - $customer = get_user_meta( WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->customer_user : $order->get_customer_id(), '_stripe_customer_id', true ); |
|
285 | + public function get_stripe_customer_id($order) { |
|
286 | + $customer = get_user_meta(WC_Stripe_Helper::is_wc_lt('3.0') ? $order->customer_user : $order->get_customer_id(), '_stripe_customer_id', true); |
|
287 | 287 | |
288 | - if ( empty( $customer ) ) { |
|
288 | + if (empty($customer)) { |
|
289 | 289 | // Try to get it via the order. |
290 | - if ( WC_Stripe_Helper::is_wc_lt( '3.0' ) ) { |
|
291 | - return get_post_meta( $order->id, '_stripe_customer_id', true ); |
|
290 | + if (WC_Stripe_Helper::is_wc_lt('3.0')) { |
|
291 | + return get_post_meta($order->id, '_stripe_customer_id', true); |
|
292 | 292 | } else { |
293 | - return $order->get_meta( '_stripe_customer_id', true ); |
|
293 | + return $order->get_meta('_stripe_customer_id', true); |
|
294 | 294 | } |
295 | 295 | } else { |
296 | 296 | return $customer; |
@@ -307,23 +307,23 @@ discard block |
||
307 | 307 | * @param object $order |
308 | 308 | * @param int $id Stripe session id. |
309 | 309 | */ |
310 | - public function get_stripe_return_url( $order = null, $id = null ) { |
|
311 | - if ( is_object( $order ) ) { |
|
312 | - if ( empty( $id ) ) { |
|
310 | + public function get_stripe_return_url($order = null, $id = null) { |
|
311 | + if (is_object($order)) { |
|
312 | + if (empty($id)) { |
|
313 | 313 | $id = uniqid(); |
314 | 314 | } |
315 | 315 | |
316 | - $order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id(); |
|
316 | + $order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id(); |
|
317 | 317 | |
318 | 318 | $args = array( |
319 | 319 | 'utm_nooverride' => '1', |
320 | 320 | 'order_id' => $order_id, |
321 | 321 | ); |
322 | 322 | |
323 | - return esc_url_raw( add_query_arg( $args, $this->get_return_url( $order ) ) ); |
|
323 | + return esc_url_raw(add_query_arg($args, $this->get_return_url($order))); |
|
324 | 324 | } |
325 | 325 | |
326 | - return esc_url_raw( add_query_arg( array( 'utm_nooverride' => '1' ), $this->get_return_url() ) ); |
|
326 | + return esc_url_raw(add_query_arg(array('utm_nooverride' => '1'), $this->get_return_url())); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | * @param int $order_id |
332 | 332 | * @return boolean |
333 | 333 | */ |
334 | - public function has_subscription( $order_id ) { |
|
335 | - return ( function_exists( 'wcs_order_contains_subscription' ) && ( wcs_order_contains_subscription( $order_id ) || wcs_is_subscription( $order_id ) || wcs_order_contains_renewal( $order_id ) ) ); |
|
334 | + public function has_subscription($order_id) { |
|
335 | + return (function_exists('wcs_order_contains_subscription') && (wcs_order_contains_subscription($order_id) || wcs_is_subscription($order_id) || wcs_order_contains_renewal($order_id))); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -344,34 +344,33 @@ discard block |
||
344 | 344 | * @param object $prepared_source |
345 | 345 | * @return array() |
346 | 346 | */ |
347 | - public function generate_payment_request( $order, $prepared_source ) { |
|
348 | - $settings = get_option( 'woocommerce_stripe_settings', array() ); |
|
349 | - $statement_descriptor = ! empty( $settings['statement_descriptor'] ) ? str_replace( "'", '', $settings['statement_descriptor'] ) : ''; |
|
350 | - $capture = ! empty( $settings['capture'] ) && 'yes' === $settings['capture'] ? true : false; |
|
347 | + public function generate_payment_request($order, $prepared_source) { |
|
348 | + $settings = get_option('woocommerce_stripe_settings', array()); |
|
349 | + $statement_descriptor = ! empty($settings['statement_descriptor']) ? str_replace("'", '', $settings['statement_descriptor']) : ''; |
|
350 | + $capture = ! empty($settings['capture']) && 'yes' === $settings['capture'] ? true : false; |
|
351 | 351 | $post_data = array(); |
352 | - $post_data['currency'] = strtolower( WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->get_order_currency() : $order->get_currency() ); |
|
353 | - $post_data['amount'] = WC_Stripe_Helper::get_stripe_amount( $order->get_total(), $post_data['currency'] ); |
|
352 | + $post_data['currency'] = strtolower(WC_Stripe_Helper::is_wc_lt('3.0') ? $order->get_order_currency() : $order->get_currency()); |
|
353 | + $post_data['amount'] = WC_Stripe_Helper::get_stripe_amount($order->get_total(), $post_data['currency']); |
|
354 | 354 | /* translators: 1) blog name 2) order number */ |
355 | - $post_data['description'] = sprintf( __( '%1$s - Order %2$s', 'woocommerce-gateway-stripe' ), wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), $order->get_order_number() ); |
|
356 | - $billing_email = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_email : $order->get_billing_email(); |
|
357 | - $billing_first_name = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_first_name : $order->get_billing_first_name(); |
|
358 | - $billing_last_name = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_last_name : $order->get_billing_last_name(); |
|
355 | + $post_data['description'] = sprintf(__('%1$s - Order %2$s', 'woocommerce-gateway-stripe'), wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES), $order->get_order_number()); |
|
356 | + $billing_email = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->billing_email : $order->get_billing_email(); |
|
357 | + $billing_first_name = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->billing_first_name : $order->get_billing_first_name(); |
|
358 | + $billing_last_name = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->billing_last_name : $order->get_billing_last_name(); |
|
359 | 359 | |
360 | - if ( ! empty( $billing_email ) && apply_filters( 'wc_stripe_send_stripe_receipt', false ) ) { |
|
360 | + if ( ! empty($billing_email) && apply_filters('wc_stripe_send_stripe_receipt', false)) { |
|
361 | 361 | $post_data['receipt_email'] = $billing_email; |
362 | 362 | } |
363 | 363 | |
364 | - switch ( WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->payment_method : $order->get_payment_method() ) { |
|
365 | - case 'stripe': |
|
366 | - if ( ! empty( $statement_descriptor ) ) { |
|
367 | - $post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor( $statement_descriptor ); |
|
364 | + switch (WC_Stripe_Helper::is_wc_lt('3.0') ? $order->payment_method : $order->get_payment_method()) { |
|
365 | + case 'stripe' : if ( ! empty($statement_descriptor)) { |
|
366 | + $post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor($statement_descriptor); |
|
368 | 367 | } |
369 | 368 | |
370 | 369 | $post_data['capture'] = $capture ? 'true' : 'false'; |
371 | 370 | break; |
372 | 371 | case 'stripe_sepa': |
373 | - if ( ! empty( $statement_descriptor ) ) { |
|
374 | - $post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor( $statement_descriptor ); |
|
372 | + if ( ! empty($statement_descriptor)) { |
|
373 | + $post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor($statement_descriptor); |
|
375 | 374 | } |
376 | 375 | break; |
377 | 376 | } |
@@ -379,25 +378,25 @@ discard block |
||
379 | 378 | $post_data['expand[]'] = 'balance_transaction'; |
380 | 379 | |
381 | 380 | $metadata = array( |
382 | - __( 'customer_name', 'woocommerce-gateway-stripe' ) => sanitize_text_field( $billing_first_name ) . ' ' . sanitize_text_field( $billing_last_name ), |
|
383 | - __( 'customer_email', 'woocommerce-gateway-stripe' ) => sanitize_email( $billing_email ), |
|
381 | + __('customer_name', 'woocommerce-gateway-stripe') => sanitize_text_field($billing_first_name) . ' ' . sanitize_text_field($billing_last_name), |
|
382 | + __('customer_email', 'woocommerce-gateway-stripe') => sanitize_email($billing_email), |
|
384 | 383 | 'order_id' => $order->get_order_number(), |
385 | 384 | ); |
386 | 385 | |
387 | - if ( $this->has_subscription( WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id() ) ) { |
|
386 | + if ($this->has_subscription(WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id())) { |
|
388 | 387 | $metadata += array( |
389 | 388 | 'payment_type' => 'recurring', |
390 | - 'site_url' => esc_url( get_site_url() ), |
|
389 | + 'site_url' => esc_url(get_site_url()), |
|
391 | 390 | ); |
392 | 391 | } |
393 | 392 | |
394 | - $post_data['metadata'] = apply_filters( 'wc_stripe_payment_metadata', $metadata, $order, $prepared_source ); |
|
393 | + $post_data['metadata'] = apply_filters('wc_stripe_payment_metadata', $metadata, $order, $prepared_source); |
|
395 | 394 | |
396 | - if ( $prepared_source->customer ) { |
|
395 | + if ($prepared_source->customer) { |
|
397 | 396 | $post_data['customer'] = $prepared_source->customer; |
398 | 397 | } |
399 | 398 | |
400 | - if ( $prepared_source->source ) { |
|
399 | + if ($prepared_source->source) { |
|
401 | 400 | $post_data['source'] = $prepared_source->source; |
402 | 401 | } |
403 | 402 | |
@@ -409,83 +408,83 @@ discard block |
||
409 | 408 | * @param WC_Order $order |
410 | 409 | * @param object $source |
411 | 410 | */ |
412 | - return apply_filters( 'wc_stripe_generate_payment_request', $post_data, $order, $prepared_source ); |
|
411 | + return apply_filters('wc_stripe_generate_payment_request', $post_data, $order, $prepared_source); |
|
413 | 412 | } |
414 | 413 | |
415 | 414 | /** |
416 | 415 | * Store extra meta data for an order from a Stripe Response. |
417 | 416 | */ |
418 | - public function process_response( $response, $order ) { |
|
419 | - WC_Stripe_Logger::log( 'Processing response: ' . print_r( $response, true ) ); |
|
417 | + public function process_response($response, $order) { |
|
418 | + WC_Stripe_Logger::log('Processing response: ' . print_r($response, true)); |
|
420 | 419 | |
421 | - $order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id(); |
|
420 | + $order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id(); |
|
422 | 421 | |
423 | - $captured = ( isset( $response->captured ) && $response->captured ) ? 'yes' : 'no'; |
|
422 | + $captured = (isset($response->captured) && $response->captured) ? 'yes' : 'no'; |
|
424 | 423 | |
425 | 424 | // Store charge data. |
426 | - WC_Stripe_Helper::is_wc_lt( '3.0' ) ? update_post_meta( $order_id, '_stripe_charge_captured', $captured ) : $order->update_meta_data( '_stripe_charge_captured', $captured ); |
|
425 | + WC_Stripe_Helper::is_wc_lt('3.0') ? update_post_meta($order_id, '_stripe_charge_captured', $captured) : $order->update_meta_data('_stripe_charge_captured', $captured); |
|
427 | 426 | |
428 | 427 | // Store other data such as fees. |
429 | - if ( isset( $response->balance_transaction ) && isset( $response->balance_transaction->fee ) ) { |
|
428 | + if (isset($response->balance_transaction) && isset($response->balance_transaction->fee)) { |
|
430 | 429 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
431 | 430 | // values are in the local currency of the Stripe account, not from WC. |
432 | - $fee = ! empty( $response->balance_transaction->fee ) ? WC_Stripe_Helper::format_balance_fee( $response->balance_transaction, 'fee' ) : 0; |
|
433 | - $net = ! empty( $response->balance_transaction->net ) ? WC_Stripe_Helper::format_balance_fee( $response->balance_transaction, 'net' ) : 0; |
|
434 | - WC_Stripe_Helper::update_stripe_fee( $order, $fee ); |
|
435 | - WC_Stripe_Helper::update_stripe_net( $order, $net ); |
|
431 | + $fee = ! empty($response->balance_transaction->fee) ? WC_Stripe_Helper::format_balance_fee($response->balance_transaction, 'fee') : 0; |
|
432 | + $net = ! empty($response->balance_transaction->net) ? WC_Stripe_Helper::format_balance_fee($response->balance_transaction, 'net') : 0; |
|
433 | + WC_Stripe_Helper::update_stripe_fee($order, $fee); |
|
434 | + WC_Stripe_Helper::update_stripe_net($order, $net); |
|
436 | 435 | |
437 | 436 | // Store currency stripe. |
438 | - $currency = ! empty( $response->balance_transaction->currency ) ? strtoupper( $response->balance_transaction->currency ) : null; |
|
439 | - WC_Stripe_Helper::update_stripe_currency( $order, $currency ); |
|
437 | + $currency = ! empty($response->balance_transaction->currency) ? strtoupper($response->balance_transaction->currency) : null; |
|
438 | + WC_Stripe_Helper::update_stripe_currency($order, $currency); |
|
440 | 439 | } |
441 | 440 | |
442 | - if ( 'yes' === $captured ) { |
|
441 | + if ('yes' === $captured) { |
|
443 | 442 | /** |
444 | 443 | * Charge can be captured but in a pending state. Payment methods |
445 | 444 | * that are asynchronous may take couple days to clear. Webhook will |
446 | 445 | * take care of the status changes. |
447 | 446 | */ |
448 | - if ( 'pending' === $response->status ) { |
|
449 | - $order_stock_reduced = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? get_post_meta( $order_id, '_order_stock_reduced', true ) : $order->get_meta( '_order_stock_reduced', true ); |
|
447 | + if ('pending' === $response->status) { |
|
448 | + $order_stock_reduced = WC_Stripe_Helper::is_wc_lt('3.0') ? get_post_meta($order_id, '_order_stock_reduced', true) : $order->get_meta('_order_stock_reduced', true); |
|
450 | 449 | |
451 | - if ( ! $order_stock_reduced ) { |
|
452 | - WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->reduce_order_stock() : wc_reduce_stock_levels( $order_id ); |
|
450 | + if ( ! $order_stock_reduced) { |
|
451 | + WC_Stripe_Helper::is_wc_lt('3.0') ? $order->reduce_order_stock() : wc_reduce_stock_levels($order_id); |
|
453 | 452 | } |
454 | 453 | |
455 | - WC_Stripe_Helper::is_wc_lt( '3.0' ) ? update_post_meta( $order_id, '_transaction_id', $response->id ) : $order->set_transaction_id( $response->id ); |
|
454 | + WC_Stripe_Helper::is_wc_lt('3.0') ? update_post_meta($order_id, '_transaction_id', $response->id) : $order->set_transaction_id($response->id); |
|
456 | 455 | /* translators: transaction id */ |
457 | - $order->update_status( 'on-hold', sprintf( __( 'Stripe charge awaiting payment: %s.', 'woocommerce-gateway-stripe' ), $response->id ) ); |
|
456 | + $order->update_status('on-hold', sprintf(__('Stripe charge awaiting payment: %s.', 'woocommerce-gateway-stripe'), $response->id)); |
|
458 | 457 | } |
459 | 458 | |
460 | - if ( 'succeeded' === $response->status ) { |
|
461 | - $order->payment_complete( $response->id ); |
|
459 | + if ('succeeded' === $response->status) { |
|
460 | + $order->payment_complete($response->id); |
|
462 | 461 | |
463 | 462 | /* translators: transaction id */ |
464 | - $message = sprintf( __( 'Stripe charge complete (Charge ID: %s)', 'woocommerce-gateway-stripe' ), $response->id ); |
|
465 | - $order->add_order_note( $message ); |
|
463 | + $message = sprintf(__('Stripe charge complete (Charge ID: %s)', 'woocommerce-gateway-stripe'), $response->id); |
|
464 | + $order->add_order_note($message); |
|
466 | 465 | } |
467 | 466 | |
468 | - if ( 'failed' === $response->status ) { |
|
469 | - $localized_message = __( 'Payment processing failed. Please retry.', 'woocommerce-gateway-stripe' ); |
|
470 | - $order->add_order_note( $localized_message ); |
|
471 | - throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message ); |
|
467 | + if ('failed' === $response->status) { |
|
468 | + $localized_message = __('Payment processing failed. Please retry.', 'woocommerce-gateway-stripe'); |
|
469 | + $order->add_order_note($localized_message); |
|
470 | + throw new WC_Stripe_Exception(print_r($response, true), $localized_message); |
|
472 | 471 | } |
473 | 472 | } else { |
474 | - WC_Stripe_Helper::is_wc_lt( '3.0' ) ? update_post_meta( $order_id, '_transaction_id', $response->id ) : $order->set_transaction_id( $response->id ); |
|
473 | + WC_Stripe_Helper::is_wc_lt('3.0') ? update_post_meta($order_id, '_transaction_id', $response->id) : $order->set_transaction_id($response->id); |
|
475 | 474 | |
476 | - if ( $order->has_status( array( 'pending', 'failed' ) ) ) { |
|
477 | - WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->reduce_order_stock() : wc_reduce_stock_levels( $order_id ); |
|
475 | + if ($order->has_status(array('pending', 'failed'))) { |
|
476 | + WC_Stripe_Helper::is_wc_lt('3.0') ? $order->reduce_order_stock() : wc_reduce_stock_levels($order_id); |
|
478 | 477 | } |
479 | 478 | |
480 | 479 | /* translators: transaction id */ |
481 | - $order->update_status( 'on-hold', sprintf( __( 'Stripe charge authorized (Charge ID: %s). Process order to take payment, or cancel to remove the pre-authorization.', 'woocommerce-gateway-stripe' ), $response->id ) ); |
|
480 | + $order->update_status('on-hold', sprintf(__('Stripe charge authorized (Charge ID: %s). Process order to take payment, or cancel to remove the pre-authorization.', 'woocommerce-gateway-stripe'), $response->id)); |
|
482 | 481 | } |
483 | 482 | |
484 | - if ( is_callable( array( $order, 'save' ) ) ) { |
|
483 | + if (is_callable(array($order, 'save'))) { |
|
485 | 484 | $order->save(); |
486 | 485 | } |
487 | 486 | |
488 | - do_action( 'wc_gateway_stripe_process_response', $response, $order ); |
|
487 | + do_action('wc_gateway_stripe_process_response', $response, $order); |
|
489 | 488 | |
490 | 489 | return $response; |
491 | 490 | } |
@@ -498,10 +497,10 @@ discard block |
||
498 | 497 | * @param int $order_id |
499 | 498 | * @return null |
500 | 499 | */ |
501 | - public function send_failed_order_email( $order_id ) { |
|
500 | + public function send_failed_order_email($order_id) { |
|
502 | 501 | $emails = WC()->mailer()->get_emails(); |
503 | - if ( ! empty( $emails ) && ! empty( $order_id ) ) { |
|
504 | - $emails['WC_Email_Failed_Order']->trigger( $order_id ); |
|
502 | + if ( ! empty($emails) && ! empty($order_id)) { |
|
503 | + $emails['WC_Email_Failed_Order']->trigger($order_id); |
|
505 | 504 | } |
506 | 505 | } |
507 | 506 | |
@@ -513,36 +512,36 @@ discard block |
||
513 | 512 | * @param object $order |
514 | 513 | * @return object $details |
515 | 514 | */ |
516 | - public function get_owner_details( $order ) { |
|
517 | - $billing_first_name = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_first_name : $order->get_billing_first_name(); |
|
518 | - $billing_last_name = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_last_name : $order->get_billing_last_name(); |
|
515 | + public function get_owner_details($order) { |
|
516 | + $billing_first_name = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->billing_first_name : $order->get_billing_first_name(); |
|
517 | + $billing_last_name = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->billing_last_name : $order->get_billing_last_name(); |
|
519 | 518 | |
520 | 519 | $details = array(); |
521 | 520 | |
522 | 521 | $name = $billing_first_name . ' ' . $billing_last_name; |
523 | - $email = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_email : $order->get_billing_email(); |
|
524 | - $phone = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_phone : $order->get_billing_phone(); |
|
522 | + $email = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->billing_email : $order->get_billing_email(); |
|
523 | + $phone = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->billing_phone : $order->get_billing_phone(); |
|
525 | 524 | |
526 | - if ( ! empty( $phone ) ) { |
|
525 | + if ( ! empty($phone)) { |
|
527 | 526 | $details['phone'] = $phone; |
528 | 527 | } |
529 | 528 | |
530 | - if ( ! empty( $name ) ) { |
|
529 | + if ( ! empty($name)) { |
|
531 | 530 | $details['name'] = $name; |
532 | 531 | } |
533 | 532 | |
534 | - if ( ! empty( $email ) ) { |
|
533 | + if ( ! empty($email)) { |
|
535 | 534 | $details['email'] = $email; |
536 | 535 | } |
537 | 536 | |
538 | - $details['address']['line1'] = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_address_1 : $order->get_billing_address_1(); |
|
539 | - $details['address']['line2'] = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_address_2 : $order->get_billing_address_2(); |
|
540 | - $details['address']['state'] = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_state : $order->get_billing_state(); |
|
541 | - $details['address']['city'] = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_city : $order->get_billing_city(); |
|
542 | - $details['address']['postal_code'] = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_postcode : $order->get_billing_postcode(); |
|
543 | - $details['address']['country'] = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_country : $order->get_billing_country(); |
|
537 | + $details['address']['line1'] = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->billing_address_1 : $order->get_billing_address_1(); |
|
538 | + $details['address']['line2'] = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->billing_address_2 : $order->get_billing_address_2(); |
|
539 | + $details['address']['state'] = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->billing_state : $order->get_billing_state(); |
|
540 | + $details['address']['city'] = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->billing_city : $order->get_billing_city(); |
|
541 | + $details['address']['postal_code'] = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->billing_postcode : $order->get_billing_postcode(); |
|
542 | + $details['address']['country'] = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->billing_country : $order->get_billing_country(); |
|
544 | 543 | |
545 | - return (object) apply_filters( 'wc_stripe_owner_details', $details, $order ); |
|
544 | + return (object) apply_filters('wc_stripe_owner_details', $details, $order); |
|
546 | 545 | } |
547 | 546 | |
548 | 547 | /** |
@@ -551,15 +550,15 @@ discard block |
||
551 | 550 | * @since 4.0.3 |
552 | 551 | * @param string $source_id The source ID to get source object for. |
553 | 552 | */ |
554 | - public function get_source_object( $source_id = '' ) { |
|
555 | - if ( empty( $source_id ) ) { |
|
553 | + public function get_source_object($source_id = '') { |
|
554 | + if (empty($source_id)) { |
|
556 | 555 | return ''; |
557 | 556 | } |
558 | 557 | |
559 | - $source_object = WC_Stripe_API::retrieve( 'sources/' . $source_id ); |
|
558 | + $source_object = WC_Stripe_API::retrieve('sources/' . $source_id); |
|
560 | 559 | |
561 | - if ( ! empty( $source_object->error ) ) { |
|
562 | - throw new WC_Stripe_Exception( print_r( $source_object, true ), $source_object->error->message ); |
|
560 | + if ( ! empty($source_object->error)) { |
|
561 | + throw new WC_Stripe_Exception(print_r($source_object, true), $source_object->error->message); |
|
563 | 562 | } |
564 | 563 | |
565 | 564 | return $source_object; |
@@ -573,13 +572,13 @@ discard block |
||
573 | 572 | * @param object $source_object |
574 | 573 | * @return bool |
575 | 574 | */ |
576 | - public function is_3ds_required( $source_object ) { |
|
575 | + public function is_3ds_required($source_object) { |
|
577 | 576 | return apply_filters( |
578 | 577 | 'wc_stripe_require_3ds', |
579 | 578 | ( |
580 | - $source_object && ! empty( $source_object->card ) ) && |
|
581 | - ( 'card' === $source_object->type && 'required' === $source_object->card->three_d_secure || |
|
582 | - ( $this->three_d_secure && 'recommended' === $source_object->card->three_d_secure ) |
|
579 | + $source_object && ! empty($source_object->card) ) && |
|
580 | + ('card' === $source_object->type && 'required' === $source_object->card->three_d_secure || |
|
581 | + ($this->three_d_secure && 'recommended' === $source_object->card->three_d_secure) |
|
583 | 582 | ), |
584 | 583 | $source_object, |
585 | 584 | $this->three_d_secure |
@@ -593,8 +592,8 @@ discard block |
||
593 | 592 | * @param object $source_object |
594 | 593 | * @return bool |
595 | 594 | */ |
596 | - public function is_3ds_card( $source_object ) { |
|
597 | - return ( $source_object && 'three_d_secure' === $source_object->type ); |
|
595 | + public function is_3ds_card($source_object) { |
|
596 | + return ($source_object && 'three_d_secure' === $source_object->type); |
|
598 | 597 | } |
599 | 598 | |
600 | 599 | /** |
@@ -604,8 +603,8 @@ discard block |
||
604 | 603 | * @param object $source_object |
605 | 604 | * @return bool |
606 | 605 | */ |
607 | - public function is_prepaid_card( $source_object ) { |
|
608 | - return ( $source_object && 'token' === $source_object->object && 'prepaid' === $source_object->card->funding ); |
|
606 | + public function is_prepaid_card($source_object) { |
|
607 | + return ($source_object && 'token' === $source_object->object && 'prepaid' === $source_object->card->funding); |
|
609 | 608 | } |
610 | 609 | |
611 | 610 | /** |
@@ -615,8 +614,8 @@ discard block |
||
615 | 614 | * @param string $source_id |
616 | 615 | * @return bool |
617 | 616 | */ |
618 | - public function is_type_legacy_card( $source_id ) { |
|
619 | - return ( preg_match( '/^card_/', $source_id ) ); |
|
617 | + public function is_type_legacy_card($source_id) { |
|
618 | + return (preg_match('/^card_/', $source_id)); |
|
620 | 619 | } |
621 | 620 | |
622 | 621 | /** |
@@ -626,9 +625,9 @@ discard block |
||
626 | 625 | * @return bool |
627 | 626 | */ |
628 | 627 | public function is_using_saved_payment_method() { |
629 | - $payment_method = isset( $_POST['payment_method'] ) ? wc_clean( $_POST['payment_method'] ) : 'stripe'; |
|
628 | + $payment_method = isset($_POST['payment_method']) ? wc_clean($_POST['payment_method']) : 'stripe'; |
|
630 | 629 | |
631 | - return ( isset( $_POST[ 'wc-' . $payment_method . '-payment-token' ] ) && 'new' !== $_POST[ 'wc-' . $payment_method . '-payment-token' ] ); |
|
630 | + return (isset($_POST['wc-' . $payment_method . '-payment-token']) && 'new' !== $_POST['wc-' . $payment_method . '-payment-token']); |
|
632 | 631 | } |
633 | 632 | |
634 | 633 | /** |
@@ -641,22 +640,22 @@ discard block |
||
641 | 640 | * @param string $return_url |
642 | 641 | * @return mixed |
643 | 642 | */ |
644 | - public function create_3ds_source( $order, $source_object, $return_url = '' ) { |
|
645 | - $currency = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->get_order_currency() : $order->get_currency(); |
|
646 | - $order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id(); |
|
647 | - $return_url = empty( $return_url ) ? $this->get_stripe_return_url( $order ) : $return_url; |
|
643 | + public function create_3ds_source($order, $source_object, $return_url = '') { |
|
644 | + $currency = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->get_order_currency() : $order->get_currency(); |
|
645 | + $order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id(); |
|
646 | + $return_url = empty($return_url) ? $this->get_stripe_return_url($order) : $return_url; |
|
648 | 647 | |
649 | 648 | $post_data = array(); |
650 | - $post_data['amount'] = WC_Stripe_Helper::get_stripe_amount( $order->get_total(), $currency ); |
|
651 | - $post_data['currency'] = strtolower( $currency ); |
|
649 | + $post_data['amount'] = WC_Stripe_Helper::get_stripe_amount($order->get_total(), $currency); |
|
650 | + $post_data['currency'] = strtolower($currency); |
|
652 | 651 | $post_data['type'] = 'three_d_secure'; |
653 | - $post_data['owner'] = $this->get_owner_details( $order ); |
|
654 | - $post_data['three_d_secure'] = array( 'card' => $source_object->id ); |
|
655 | - $post_data['redirect'] = array( 'return_url' => $return_url ); |
|
652 | + $post_data['owner'] = $this->get_owner_details($order); |
|
653 | + $post_data['three_d_secure'] = array('card' => $source_object->id); |
|
654 | + $post_data['redirect'] = array('return_url' => $return_url); |
|
656 | 655 | |
657 | - WC_Stripe_Logger::log( 'Info: Begin creating 3DS source...' ); |
|
656 | + WC_Stripe_Logger::log('Info: Begin creating 3DS source...'); |
|
658 | 657 | |
659 | - return WC_Stripe_API::request( apply_filters( 'wc_stripe_3ds_source', $post_data, $order ), 'sources' ); |
|
658 | + return WC_Stripe_API::request(apply_filters('wc_stripe_3ds_source', $post_data, $order), 'sources'); |
|
660 | 659 | } |
661 | 660 | |
662 | 661 | /** |
@@ -672,61 +671,61 @@ discard block |
||
672 | 671 | * @throws Exception When card was not added or for and invalid card. |
673 | 672 | * @return object |
674 | 673 | */ |
675 | - public function prepare_source( $user_id, $force_save_source = false ) { |
|
676 | - $customer = new WC_Stripe_Customer( $user_id ); |
|
674 | + public function prepare_source($user_id, $force_save_source = false) { |
|
675 | + $customer = new WC_Stripe_Customer($user_id); |
|
677 | 676 | $set_customer = true; |
678 | - $force_save_source = apply_filters( 'wc_stripe_force_save_source', $force_save_source, $customer ); |
|
677 | + $force_save_source = apply_filters('wc_stripe_force_save_source', $force_save_source, $customer); |
|
679 | 678 | $source_object = ''; |
680 | 679 | $source_id = ''; |
681 | 680 | $wc_token_id = false; |
682 | - $payment_method = isset( $_POST['payment_method'] ) ? wc_clean( $_POST['payment_method'] ) : 'stripe'; |
|
681 | + $payment_method = isset($_POST['payment_method']) ? wc_clean($_POST['payment_method']) : 'stripe'; |
|
683 | 682 | $is_token = false; |
684 | 683 | |
685 | 684 | // New CC info was entered and we have a new source to process. |
686 | - if ( ! empty( $_POST['stripe_source'] ) ) { |
|
687 | - $source_object = self::get_source_object( wc_clean( $_POST['stripe_source'] ) ); |
|
685 | + if ( ! empty($_POST['stripe_source'])) { |
|
686 | + $source_object = self::get_source_object(wc_clean($_POST['stripe_source'])); |
|
688 | 687 | $source_id = $source_object->id; |
689 | 688 | |
690 | 689 | // This checks to see if customer opted to save the payment method to file. |
691 | - $maybe_saved_card = isset( $_POST[ 'wc-' . $payment_method . '-new-payment-method' ] ) && ! empty( $_POST[ 'wc-' . $payment_method . '-new-payment-method' ] ); |
|
690 | + $maybe_saved_card = isset($_POST['wc-' . $payment_method . '-new-payment-method']) && ! empty($_POST['wc-' . $payment_method . '-new-payment-method']); |
|
692 | 691 | |
693 | 692 | /** |
694 | 693 | * This is true if the user wants to store the card to their account. |
695 | 694 | * Criteria to save to file is they are logged in, they opted to save or product requirements and the source is |
696 | 695 | * actually reusable. Either that or force_save_source is true. |
697 | 696 | */ |
698 | - if ( ( $user_id && $this->saved_cards && $maybe_saved_card && 'reusable' === $source_object->usage ) || $force_save_source ) { |
|
699 | - $response = $customer->add_source( $source_object->id ); |
|
697 | + if (($user_id && $this->saved_cards && $maybe_saved_card && 'reusable' === $source_object->usage) || $force_save_source) { |
|
698 | + $response = $customer->add_source($source_object->id); |
|
700 | 699 | |
701 | - if ( ! empty( $response->error ) ) { |
|
702 | - throw new WC_Stripe_Exception( print_r( $response, true ), $response->error->message ); |
|
700 | + if ( ! empty($response->error)) { |
|
701 | + throw new WC_Stripe_Exception(print_r($response, true), $response->error->message); |
|
703 | 702 | } |
704 | 703 | } |
705 | - } elseif ( $this->is_using_saved_payment_method() ) { |
|
704 | + } elseif ($this->is_using_saved_payment_method()) { |
|
706 | 705 | // Use an existing token, and then process the payment. |
707 | - $wc_token_id = wc_clean( $_POST[ 'wc-' . $payment_method . '-payment-token' ] ); |
|
708 | - $wc_token = WC_Payment_Tokens::get( $wc_token_id ); |
|
706 | + $wc_token_id = wc_clean($_POST['wc-' . $payment_method . '-payment-token']); |
|
707 | + $wc_token = WC_Payment_Tokens::get($wc_token_id); |
|
709 | 708 | |
710 | - if ( ! $wc_token || $wc_token->get_user_id() !== get_current_user_id() ) { |
|
711 | - WC()->session->set( 'refresh_totals', true ); |
|
712 | - throw new WC_Stripe_Exception( 'Invalid payment method', __( 'Invalid payment method. Please input a new card number.', 'woocommerce-gateway-stripe' ) ); |
|
709 | + if ( ! $wc_token || $wc_token->get_user_id() !== get_current_user_id()) { |
|
710 | + WC()->session->set('refresh_totals', true); |
|
711 | + throw new WC_Stripe_Exception('Invalid payment method', __('Invalid payment method. Please input a new card number.', 'woocommerce-gateway-stripe')); |
|
713 | 712 | } |
714 | 713 | |
715 | 714 | $source_id = $wc_token->get_token(); |
716 | 715 | |
717 | - if ( $this->is_type_legacy_card( $source_id ) ) { |
|
716 | + if ($this->is_type_legacy_card($source_id)) { |
|
718 | 717 | $is_token = true; |
719 | 718 | } |
720 | - } elseif ( isset( $_POST['stripe_token'] ) && 'new' !== $_POST['stripe_token'] ) { |
|
721 | - $stripe_token = wc_clean( $_POST['stripe_token'] ); |
|
722 | - $maybe_saved_card = isset( $_POST[ 'wc-' . $payment_method . '-new-payment-method' ] ) && ! empty( $_POST[ 'wc-' . $payment_method . '-new-payment-method' ] ); |
|
719 | + } elseif (isset($_POST['stripe_token']) && 'new' !== $_POST['stripe_token']) { |
|
720 | + $stripe_token = wc_clean($_POST['stripe_token']); |
|
721 | + $maybe_saved_card = isset($_POST['wc-' . $payment_method . '-new-payment-method']) && ! empty($_POST['wc-' . $payment_method . '-new-payment-method']); |
|
723 | 722 | |
724 | 723 | // This is true if the user wants to store the card to their account. |
725 | - if ( ( $user_id && $this->saved_cards && $maybe_saved_card ) || $force_save_source ) { |
|
726 | - $response = $customer->add_source( $stripe_token ); |
|
724 | + if (($user_id && $this->saved_cards && $maybe_saved_card) || $force_save_source) { |
|
725 | + $response = $customer->add_source($stripe_token); |
|
727 | 726 | |
728 | - if ( ! empty( $response->error ) ) { |
|
729 | - throw new WC_Stripe_Exception( print_r( $response, true ), $response->error->message ); |
|
727 | + if ( ! empty($response->error)) { |
|
728 | + throw new WC_Stripe_Exception(print_r($response, true), $response->error->message); |
|
730 | 729 | } |
731 | 730 | } else { |
732 | 731 | $set_customer = false; |
@@ -735,14 +734,14 @@ discard block |
||
735 | 734 | } |
736 | 735 | } |
737 | 736 | |
738 | - if ( ! $set_customer ) { |
|
737 | + if ( ! $set_customer) { |
|
739 | 738 | $customer_id = false; |
740 | 739 | } else { |
741 | 740 | $customer_id = $customer->get_id() ? $customer->get_id() : false; |
742 | 741 | } |
743 | 742 | |
744 | - if ( empty( $source_object ) && ! $is_token ) { |
|
745 | - $source_object = self::get_source_object( $source_id ); |
|
743 | + if (empty($source_object) && ! $is_token) { |
|
744 | + $source_object = self::get_source_object($source_id); |
|
746 | 745 | } |
747 | 746 | |
748 | 747 | return (object) array( |
@@ -766,39 +765,39 @@ discard block |
||
766 | 765 | * @param object $order |
767 | 766 | * @return object |
768 | 767 | */ |
769 | - public function prepare_order_source( $order = null ) { |
|
768 | + public function prepare_order_source($order = null) { |
|
770 | 769 | $stripe_customer = new WC_Stripe_Customer(); |
771 | 770 | $stripe_source = false; |
772 | 771 | $token_id = false; |
773 | 772 | $source_object = false; |
774 | 773 | |
775 | - if ( $order ) { |
|
776 | - $order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id(); |
|
774 | + if ($order) { |
|
775 | + $order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id(); |
|
777 | 776 | |
778 | - $stripe_customer_id = get_post_meta( $order_id, '_stripe_customer_id', true ); |
|
777 | + $stripe_customer_id = get_post_meta($order_id, '_stripe_customer_id', true); |
|
779 | 778 | |
780 | - if ( $stripe_customer_id ) { |
|
781 | - $stripe_customer->set_id( $stripe_customer_id ); |
|
779 | + if ($stripe_customer_id) { |
|
780 | + $stripe_customer->set_id($stripe_customer_id); |
|
782 | 781 | } |
783 | 782 | |
784 | - $source_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? get_post_meta( $order_id, '_stripe_source_id', true ) : $order->get_meta( '_stripe_source_id', true ); |
|
783 | + $source_id = WC_Stripe_Helper::is_wc_lt('3.0') ? get_post_meta($order_id, '_stripe_source_id', true) : $order->get_meta('_stripe_source_id', true); |
|
785 | 784 | |
786 | 785 | // Since 4.0.0, we changed card to source so we need to account for that. |
787 | - if ( empty( $source_id ) ) { |
|
788 | - $source_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? get_post_meta( $order_id, '_stripe_card_id', true ) : $order->get_meta( '_stripe_card_id', true ); |
|
786 | + if (empty($source_id)) { |
|
787 | + $source_id = WC_Stripe_Helper::is_wc_lt('3.0') ? get_post_meta($order_id, '_stripe_card_id', true) : $order->get_meta('_stripe_card_id', true); |
|
789 | 788 | |
790 | 789 | // Take this opportunity to update the key name. |
791 | - WC_Stripe_Helper::is_wc_lt( '3.0' ) ? update_post_meta( $order_id, '_stripe_source_id', $source_id ) : $order->update_meta_data( '_stripe_source_id', $source_id ); |
|
790 | + WC_Stripe_Helper::is_wc_lt('3.0') ? update_post_meta($order_id, '_stripe_source_id', $source_id) : $order->update_meta_data('_stripe_source_id', $source_id); |
|
792 | 791 | |
793 | - if ( is_callable( array( $order, 'save' ) ) ) { |
|
792 | + if (is_callable(array($order, 'save'))) { |
|
794 | 793 | $order->save(); |
795 | 794 | } |
796 | 795 | } |
797 | 796 | |
798 | - if ( $source_id ) { |
|
797 | + if ($source_id) { |
|
799 | 798 | $stripe_source = $source_id; |
800 | - $source_object = WC_Stripe_API::retrieve( 'sources/' . $source_id ); |
|
801 | - } elseif ( apply_filters( 'wc_stripe_use_default_customer_source', true ) ) { |
|
799 | + $source_object = WC_Stripe_API::retrieve('sources/' . $source_id); |
|
800 | + } elseif (apply_filters('wc_stripe_use_default_customer_source', true)) { |
|
802 | 801 | /* |
803 | 802 | * We can attempt to charge the customer's default source |
804 | 803 | * by sending empty source id. |
@@ -823,27 +822,27 @@ discard block |
||
823 | 822 | * @param WC_Order $order For to which the source applies. |
824 | 823 | * @param stdClass $source Source information. |
825 | 824 | */ |
826 | - public function save_source_to_order( $order, $source ) { |
|
827 | - $order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id(); |
|
825 | + public function save_source_to_order($order, $source) { |
|
826 | + $order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id(); |
|
828 | 827 | |
829 | 828 | // Store source in the order. |
830 | - if ( $source->customer ) { |
|
831 | - if ( WC_Stripe_Helper::is_wc_lt( '3.0' ) ) { |
|
832 | - update_post_meta( $order_id, '_stripe_customer_id', $source->customer ); |
|
829 | + if ($source->customer) { |
|
830 | + if (WC_Stripe_Helper::is_wc_lt('3.0')) { |
|
831 | + update_post_meta($order_id, '_stripe_customer_id', $source->customer); |
|
833 | 832 | } else { |
834 | - $order->update_meta_data( '_stripe_customer_id', $source->customer ); |
|
833 | + $order->update_meta_data('_stripe_customer_id', $source->customer); |
|
835 | 834 | } |
836 | 835 | } |
837 | 836 | |
838 | - if ( $source->source ) { |
|
839 | - if ( WC_Stripe_Helper::is_wc_lt( '3.0' ) ) { |
|
840 | - update_post_meta( $order_id, '_stripe_source_id', $source->source ); |
|
837 | + if ($source->source) { |
|
838 | + if (WC_Stripe_Helper::is_wc_lt('3.0')) { |
|
839 | + update_post_meta($order_id, '_stripe_source_id', $source->source); |
|
841 | 840 | } else { |
842 | - $order->update_meta_data( '_stripe_source_id', $source->source ); |
|
841 | + $order->update_meta_data('_stripe_source_id', $source->source); |
|
843 | 842 | } |
844 | 843 | } |
845 | 844 | |
846 | - if ( is_callable( array( $order, 'save' ) ) ) { |
|
845 | + if (is_callable(array($order, 'save'))) { |
|
847 | 846 | $order->save(); |
848 | 847 | } |
849 | 848 | } |
@@ -857,38 +856,38 @@ discard block |
||
857 | 856 | * @param object $order The order object |
858 | 857 | * @param int $balance_transaction_id |
859 | 858 | */ |
860 | - public function update_fees( $order, $balance_transaction_id ) { |
|
861 | - $order_id = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->id : $order->get_id(); |
|
859 | + public function update_fees($order, $balance_transaction_id) { |
|
860 | + $order_id = WC_Stripe_Helper::is_wc_lt('3.0') ? $order->id : $order->get_id(); |
|
862 | 861 | |
863 | - $balance_transaction = WC_Stripe_API::retrieve( 'balance/history/' . $balance_transaction_id ); |
|
862 | + $balance_transaction = WC_Stripe_API::retrieve('balance/history/' . $balance_transaction_id); |
|
864 | 863 | |
865 | - if ( empty( $balance_transaction->error ) ) { |
|
866 | - if ( isset( $balance_transaction ) && isset( $balance_transaction->fee ) ) { |
|
864 | + if (empty($balance_transaction->error)) { |
|
865 | + if (isset($balance_transaction) && isset($balance_transaction->fee)) { |
|
867 | 866 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
868 | 867 | // values are in the local currency of the Stripe account, not from WC. |
869 | - $fee_refund = ! empty( $balance_transaction->fee ) ? WC_Stripe_Helper::format_balance_fee( $balance_transaction, 'fee' ) : 0; |
|
870 | - $net_refund = ! empty( $balance_transaction->net ) ? WC_Stripe_Helper::format_balance_fee( $balance_transaction, 'net' ) : 0; |
|
868 | + $fee_refund = ! empty($balance_transaction->fee) ? WC_Stripe_Helper::format_balance_fee($balance_transaction, 'fee') : 0; |
|
869 | + $net_refund = ! empty($balance_transaction->net) ? WC_Stripe_Helper::format_balance_fee($balance_transaction, 'net') : 0; |
|
871 | 870 | |
872 | 871 | // Current data fee & net. |
873 | - $fee_current = WC_Stripe_Helper::get_stripe_fee( $order ); |
|
874 | - $net_current = WC_Stripe_Helper::get_stripe_net( $order ); |
|
872 | + $fee_current = WC_Stripe_Helper::get_stripe_fee($order); |
|
873 | + $net_current = WC_Stripe_Helper::get_stripe_net($order); |
|
875 | 874 | |
876 | 875 | // Calculation. |
877 | 876 | $fee = (float) $fee_current + (float) $fee_refund; |
878 | 877 | $net = (float) $net_current + (float) $net_refund; |
879 | 878 | |
880 | - WC_Stripe_Helper::update_stripe_fee( $order, $fee ); |
|
881 | - WC_Stripe_Helper::update_stripe_net( $order, $net ); |
|
879 | + WC_Stripe_Helper::update_stripe_fee($order, $fee); |
|
880 | + WC_Stripe_Helper::update_stripe_net($order, $net); |
|
882 | 881 | |
883 | - $currency = ! empty( $balance_transaction->currency ) ? strtoupper( $balance_transaction->currency ) : null; |
|
884 | - WC_Stripe_Helper::update_stripe_currency( $order, $currency ); |
|
882 | + $currency = ! empty($balance_transaction->currency) ? strtoupper($balance_transaction->currency) : null; |
|
883 | + WC_Stripe_Helper::update_stripe_currency($order, $currency); |
|
885 | 884 | |
886 | - if ( is_callable( array( $order, 'save' ) ) ) { |
|
885 | + if (is_callable(array($order, 'save'))) { |
|
887 | 886 | $order->save(); |
888 | 887 | } |
889 | 888 | } |
890 | 889 | } else { |
891 | - WC_Stripe_Logger::log( "Unable to update fees/net meta for order: {$order_id}" ); |
|
890 | + WC_Stripe_Logger::log("Unable to update fees/net meta for order: {$order_id}"); |
|
892 | 891 | } |
893 | 892 | } |
894 | 893 | |
@@ -901,33 +900,33 @@ discard block |
||
901 | 900 | * @param float $amount |
902 | 901 | * @return bool |
903 | 902 | */ |
904 | - public function process_refund( $order_id, $amount = null, $reason = '' ) { |
|
905 | - $order = wc_get_order( $order_id ); |
|
903 | + public function process_refund($order_id, $amount = null, $reason = '') { |
|
904 | + $order = wc_get_order($order_id); |
|
906 | 905 | |
907 | - if ( ! $order || ! $order->get_transaction_id() ) { |
|
906 | + if ( ! $order || ! $order->get_transaction_id()) { |
|
908 | 907 | return false; |
909 | 908 | } |
910 | 909 | |
911 | 910 | $request = array(); |
912 | 911 | |
913 | - if ( WC_Stripe_Helper::is_wc_lt( '3.0' ) ) { |
|
914 | - $order_currency = get_post_meta( $order_id, '_order_currency', true ); |
|
915 | - $captured = get_post_meta( $order_id, '_stripe_charge_captured', true ); |
|
912 | + if (WC_Stripe_Helper::is_wc_lt('3.0')) { |
|
913 | + $order_currency = get_post_meta($order_id, '_order_currency', true); |
|
914 | + $captured = get_post_meta($order_id, '_stripe_charge_captured', true); |
|
916 | 915 | } else { |
917 | 916 | $order_currency = $order->get_currency(); |
918 | - $captured = $order->get_meta( '_stripe_charge_captured', true ); |
|
917 | + $captured = $order->get_meta('_stripe_charge_captured', true); |
|
919 | 918 | } |
920 | 919 | |
921 | - if ( ! is_null( $amount ) ) { |
|
922 | - $request['amount'] = WC_Stripe_Helper::get_stripe_amount( $amount, $order_currency ); |
|
920 | + if ( ! is_null($amount)) { |
|
921 | + $request['amount'] = WC_Stripe_Helper::get_stripe_amount($amount, $order_currency); |
|
923 | 922 | } |
924 | 923 | |
925 | 924 | // If order is only authorized, don't pass amount. |
926 | - if ( 'yes' !== $captured ) { |
|
927 | - unset( $request['amount'] ); |
|
925 | + if ('yes' !== $captured) { |
|
926 | + unset($request['amount']); |
|
928 | 927 | } |
929 | 928 | |
930 | - if ( $reason ) { |
|
929 | + if ($reason) { |
|
931 | 930 | $request['metadata'] = array( |
932 | 931 | 'reason' => $reason, |
933 | 932 | ); |
@@ -935,35 +934,35 @@ discard block |
||
935 | 934 | |
936 | 935 | $request['charge'] = $order->get_transaction_id(); |
937 | 936 | |
938 | - WC_Stripe_Logger::log( "Info: Beginning refund for order {$order->get_transaction_id()} for the amount of {$amount}" ); |
|
937 | + WC_Stripe_Logger::log("Info: Beginning refund for order {$order->get_transaction_id()} for the amount of {$amount}"); |
|
939 | 938 | |
940 | - $request = apply_filters( 'wc_stripe_refund_request', $request, $order ); |
|
939 | + $request = apply_filters('wc_stripe_refund_request', $request, $order); |
|
941 | 940 | |
942 | - $response = WC_Stripe_API::request( $request, 'refunds' ); |
|
941 | + $response = WC_Stripe_API::request($request, 'refunds'); |
|
943 | 942 | |
944 | - if ( ! empty( $response->error ) ) { |
|
945 | - WC_Stripe_Logger::log( 'Error: ' . $response->error->message ); |
|
943 | + if ( ! empty($response->error)) { |
|
944 | + WC_Stripe_Logger::log('Error: ' . $response->error->message); |
|
946 | 945 | |
947 | 946 | return $response; |
948 | 947 | |
949 | - } elseif ( ! empty( $response->id ) ) { |
|
950 | - WC_Stripe_Helper::is_wc_lt( '3.0' ) ? update_post_meta( $order_id, '_stripe_refund_id', $response->id ) : $order->update_meta_data( '_stripe_refund_id', $response->id ); |
|
948 | + } elseif ( ! empty($response->id)) { |
|
949 | + WC_Stripe_Helper::is_wc_lt('3.0') ? update_post_meta($order_id, '_stripe_refund_id', $response->id) : $order->update_meta_data('_stripe_refund_id', $response->id); |
|
951 | 950 | |
952 | - $amount = wc_price( $response->amount / 100 ); |
|
951 | + $amount = wc_price($response->amount / 100); |
|
953 | 952 | |
954 | - if ( in_array( strtolower( WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->get_order_currency() : $order->get_currency() ), WC_Stripe_Helper::no_decimal_currencies() ) ) { |
|
955 | - $amount = wc_price( $response->amount ); |
|
953 | + if (in_array(strtolower(WC_Stripe_Helper::is_wc_lt('3.0') ? $order->get_order_currency() : $order->get_currency()), WC_Stripe_Helper::no_decimal_currencies())) { |
|
954 | + $amount = wc_price($response->amount); |
|
956 | 955 | } |
957 | 956 | |
958 | - if ( isset( $response->balance_transaction ) ) { |
|
959 | - $this->update_fees( $order, $response->balance_transaction ); |
|
957 | + if (isset($response->balance_transaction)) { |
|
958 | + $this->update_fees($order, $response->balance_transaction); |
|
960 | 959 | } |
961 | 960 | |
962 | 961 | /* translators: 1) dollar amount 2) transaction id 3) refund message */ |
963 | - $refund_message = ( isset( $captured ) && 'yes' === $captured ) ? sprintf( __( 'Refunded %1$s - Refund ID: %2$s - Reason: %3$s', 'woocommerce-gateway-stripe' ), $amount, $response->id, $reason ) : __( 'Pre-Authorization Released', 'woocommerce-gateway-stripe' ); |
|
962 | + $refund_message = (isset($captured) && 'yes' === $captured) ? sprintf(__('Refunded %1$s - Refund ID: %2$s - Reason: %3$s', 'woocommerce-gateway-stripe'), $amount, $response->id, $reason) : __('Pre-Authorization Released', 'woocommerce-gateway-stripe'); |
|
964 | 963 | |
965 | - $order->add_order_note( $refund_message ); |
|
966 | - WC_Stripe_Logger::log( 'Success: ' . html_entity_decode( wp_strip_all_tags( $refund_message ) ) ); |
|
964 | + $order->add_order_note($refund_message); |
|
965 | + WC_Stripe_Logger::log('Success: ' . html_entity_decode(wp_strip_all_tags($refund_message))); |
|
967 | 966 | |
968 | 967 | return true; |
969 | 968 | } |
@@ -978,46 +977,46 @@ discard block |
||
978 | 977 | */ |
979 | 978 | public function add_payment_method() { |
980 | 979 | $error = false; |
981 | - $error_msg = __( 'There was a problem adding the payment method.', 'woocommerce-gateway-stripe' ); |
|
980 | + $error_msg = __('There was a problem adding the payment method.', 'woocommerce-gateway-stripe'); |
|
982 | 981 | $source_id = ''; |
983 | 982 | |
984 | - if ( empty( $_POST['stripe_source'] ) && empty( $_POST['stripe_token'] ) || ! is_user_logged_in() ) { |
|
983 | + if (empty($_POST['stripe_source']) && empty($_POST['stripe_token']) || ! is_user_logged_in()) { |
|
985 | 984 | $error = true; |
986 | 985 | } |
987 | 986 | |
988 | - $stripe_customer = new WC_Stripe_Customer( get_current_user_id() ); |
|
987 | + $stripe_customer = new WC_Stripe_Customer(get_current_user_id()); |
|
989 | 988 | |
990 | - $source = ! empty( $_POST['stripe_source'] ) ? wc_clean( $_POST['stripe_source'] ) : ''; |
|
989 | + $source = ! empty($_POST['stripe_source']) ? wc_clean($_POST['stripe_source']) : ''; |
|
991 | 990 | |
992 | - $source_object = WC_Stripe_API::retrieve( 'sources/' . $source ); |
|
991 | + $source_object = WC_Stripe_API::retrieve('sources/' . $source); |
|
993 | 992 | |
994 | - if ( isset( $source_object ) ) { |
|
995 | - if ( ! empty( $source_object->error ) ) { |
|
993 | + if (isset($source_object)) { |
|
994 | + if ( ! empty($source_object->error)) { |
|
996 | 995 | $error = true; |
997 | 996 | } |
998 | 997 | |
999 | 998 | $source_id = $source_object->id; |
1000 | - } elseif ( isset( $_POST['stripe_token'] ) ) { |
|
1001 | - $source_id = wc_clean( $_POST['stripe_token'] ); |
|
999 | + } elseif (isset($_POST['stripe_token'])) { |
|
1000 | + $source_id = wc_clean($_POST['stripe_token']); |
|
1002 | 1001 | } |
1003 | 1002 | |
1004 | - $response = $stripe_customer->add_source( $source_id ); |
|
1003 | + $response = $stripe_customer->add_source($source_id); |
|
1005 | 1004 | |
1006 | - if ( ! $response || is_wp_error( $response ) || ! empty( $response->error ) ) { |
|
1005 | + if ( ! $response || is_wp_error($response) || ! empty($response->error)) { |
|
1007 | 1006 | $error = true; |
1008 | 1007 | } |
1009 | 1008 | |
1010 | - if ( $error ) { |
|
1011 | - wc_add_notice( $error_msg, 'error' ); |
|
1012 | - WC_Stripe_Logger::log( 'Add payment method Error: ' . $error_msg ); |
|
1009 | + if ($error) { |
|
1010 | + wc_add_notice($error_msg, 'error'); |
|
1011 | + WC_Stripe_Logger::log('Add payment method Error: ' . $error_msg); |
|
1013 | 1012 | return; |
1014 | 1013 | } |
1015 | 1014 | |
1016 | - do_action( 'wc_stripe_add_payment_method_' . $_POST['payment_method'] . '_success', $source_id, $source_object ); |
|
1015 | + do_action('wc_stripe_add_payment_method_' . $_POST['payment_method'] . '_success', $source_id, $source_object); |
|
1017 | 1016 | |
1018 | 1017 | return array( |
1019 | 1018 | 'result' => 'success', |
1020 | - 'redirect' => wc_get_endpoint_url( 'payment-methods' ), |
|
1019 | + 'redirect' => wc_get_endpoint_url('payment-methods'), |
|
1021 | 1020 | ); |
1022 | 1021 | } |
1023 | 1022 | |
@@ -1034,10 +1033,10 @@ discard block |
||
1034 | 1033 | * Stripe expects Norwegian to only be passed NO. |
1035 | 1034 | * But WP has different dialects. |
1036 | 1035 | */ |
1037 | - if ( 'NO' === substr( $locale, 3, 2 ) ) { |
|
1036 | + if ('NO' === substr($locale, 3, 2)) { |
|
1038 | 1037 | $locale = 'no'; |
1039 | 1038 | } else { |
1040 | - $locale = substr( get_locale(), 0, 2 ); |
|
1039 | + $locale = substr(get_locale(), 0, 2); |
|
1041 | 1040 | } |
1042 | 1041 | |
1043 | 1042 | return $locale; |
@@ -1051,9 +1050,9 @@ discard block |
||
1051 | 1050 | * @param string $idempotency_key |
1052 | 1051 | * @param array $request |
1053 | 1052 | */ |
1054 | - public function change_idempotency_key( $idempotency_key, $request ) { |
|
1055 | - $customer = ! empty( $request['customer'] ) ? $request['customer'] : ''; |
|
1056 | - $source = ! empty( $request['source'] ) ? $request['source'] : $customer; |
|
1053 | + public function change_idempotency_key($idempotency_key, $request) { |
|
1054 | + $customer = ! empty($request['customer']) ? $request['customer'] : ''; |
|
1055 | + $source = ! empty($request['source']) ? $request['source'] : $customer; |
|
1057 | 1056 | $count = $this->retry_interval; |
1058 | 1057 | |
1059 | 1058 | return $request['metadata']['order_id'] . '-' . $count . '-' . $source; |
@@ -1067,8 +1066,8 @@ discard block |
||
1067 | 1066 | * @since 4.0.6 |
1068 | 1067 | * @param array $headers |
1069 | 1068 | */ |
1070 | - public function is_original_request( $headers ) { |
|
1071 | - if ( $headers['original-request'] === $headers['request-id'] ) { |
|
1069 | + public function is_original_request($headers) { |
|
1070 | + if ($headers['original-request'] === $headers['request-id']) { |
|
1072 | 1071 | return true; |
1073 | 1072 | } |
1074 | 1073 |
@@ -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_giropay_settings', |
8 | 8 | array( |
9 | 9 | 'geo_target' => array( |
10 | - 'description' => __( 'Relevant Payer Geography: Germany', 'woocommerce-gateway-stripe' ), |
|
10 | + 'description' => __('Relevant Payer Geography: Germany', 'woocommerce-gateway-stripe'), |
|
11 | 11 | 'type' => 'title', |
12 | 12 | ), |
13 | 13 | 'guide' => array( |
14 | - 'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#giropay" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ), |
|
14 | + 'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#giropay" 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 Giropay', 'woocommerce-gateway-stripe' ), |
|
22 | + 'title' => __('Enable/Disable', 'woocommerce-gateway-stripe'), |
|
23 | + 'label' => __('Enable Stripe Giropay', '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' => __( 'Giropay', 'woocommerce-gateway-stripe' ), |
|
31 | + 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
32 | + 'default' => __('Giropay', '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 Giropay.', '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 Giropay.', '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_bancontact_settings', |
8 | 8 | array( |
9 | 9 | 'geo_target' => array( |
10 | - 'description' => __( 'Relevant Payer Geography: Belgium', 'woocommerce-gateway-stripe' ), |
|
10 | + 'description' => __('Relevant Payer Geography: Belgium', 'woocommerce-gateway-stripe'), |
|
11 | 11 | 'type' => 'title', |
12 | 12 | ), |
13 | 13 | 'guide' => array( |
14 | - 'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#bancontact" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ), |
|
14 | + 'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#bancontact" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'), |
|
15 | 15 | 'type' => 'title', |
16 | 16 | ), |
17 | 17 | 'activation' => array( |
18 | - 'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ), |
|
18 | + 'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'), |
|
19 | 19 | 'type' => 'title', |
20 | 20 | ), |
21 | 21 | 'enabled' => array( |
22 | - 'title' => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ), |
|
23 | - 'label' => __( 'Enable Stripe Bancontact', 'woocommerce-gateway-stripe' ), |
|
22 | + 'title' => __('Enable/Disable', 'woocommerce-gateway-stripe'), |
|
23 | + 'label' => __('Enable Stripe Bancontact', 'woocommerce-gateway-stripe'), |
|
24 | 24 | 'type' => 'checkbox', |
25 | 25 | 'description' => '', |
26 | 26 | 'default' => 'no', |
27 | 27 | ), |
28 | 28 | 'title' => array( |
29 | - 'title' => __( 'Title', 'woocommerce-gateway-stripe' ), |
|
29 | + 'title' => __('Title', 'woocommerce-gateway-stripe'), |
|
30 | 30 | 'type' => 'text', |
31 | - 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
32 | - 'default' => __( 'Bancontact', 'woocommerce-gateway-stripe' ), |
|
31 | + 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
32 | + 'default' => __('Bancontact', 'woocommerce-gateway-stripe'), |
|
33 | 33 | 'desc_tip' => true, |
34 | 34 | ), |
35 | 35 | 'description' => array( |
36 | - 'title' => __( 'Description', 'woocommerce-gateway-stripe' ), |
|
36 | + 'title' => __('Description', 'woocommerce-gateway-stripe'), |
|
37 | 37 | 'type' => 'text', |
38 | - 'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
39 | - 'default' => __( 'You will be redirected to Bancontact.', 'woocommerce-gateway-stripe' ), |
|
38 | + 'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
39 | + 'default' => __('You will be redirected to Bancontact.', 'woocommerce-gateway-stripe'), |
|
40 | 40 | 'desc_tip' => true, |
41 | 41 | ), |
42 | 42 | 'webhook' => array( |
43 | - 'title' => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ), |
|
43 | + 'title' => __('Webhook Endpoints', 'woocommerce-gateway-stripe'), |
|
44 | 44 | 'type' => 'title', |
45 | 45 | /* translators: webhook URL */ |
46 | 46 | 'description' => $this->display_admin_settings_webhook_description(), |
@@ -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(), |