@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @since 4.0.2 |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if ( ! defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | * @param string $error_message Full response |
24 | 24 | * @param string $localized_message user-friendly translated error message |
25 | 25 | */ |
26 | - public function __construct( $error_message = '', $localized_message = '' ) { |
|
26 | + public function __construct($error_message = '', $localized_message = '') { |
|
27 | 27 | $this->localized_message = $localized_message; |
28 | - parent::__construct( $error_message ); |
|
28 | + parent::__construct($error_message); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -2,12 +2,12 @@ discard block |
||
2 | 2 | |
3 | 3 | class WC_Stripe_Test extends WP_UnitTestCase { |
4 | 4 | public function test_constants_defined() { |
5 | - $this->assertTrue( defined( 'WC_STRIPE_VERSION' ) ); |
|
6 | - $this->assertTrue( defined( 'WC_STRIPE_MIN_PHP_VER' ) ); |
|
7 | - $this->assertTrue( defined( 'WC_STRIPE_MIN_WC_VER' ) ); |
|
8 | - $this->assertTrue( defined( 'WC_STRIPE_MAIN_FILE' ) ); |
|
9 | - $this->assertTrue( defined( 'WC_STRIPE_PLUGIN_URL' ) ); |
|
10 | - $this->assertTrue( defined( 'WC_STRIPE_PLUGIN_PATH' ) ); |
|
5 | + $this->assertTrue(defined('WC_STRIPE_VERSION')); |
|
6 | + $this->assertTrue(defined('WC_STRIPE_MIN_PHP_VER')); |
|
7 | + $this->assertTrue(defined('WC_STRIPE_MIN_WC_VER')); |
|
8 | + $this->assertTrue(defined('WC_STRIPE_MAIN_FILE')); |
|
9 | + $this->assertTrue(defined('WC_STRIPE_PLUGIN_URL')); |
|
10 | + $this->assertTrue(defined('WC_STRIPE_PLUGIN_PATH')); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | * This test will see if we're indeed converting the price correctly. |
16 | 16 | */ |
17 | 17 | public function test_price_conversion_before_send_to_stripe() { |
18 | - $this->assertEquals( 10050, WC_Stripe_Helper::get_stripe_amount( 100.50, 'USD' ) ); |
|
19 | - $this->assertEquals( 10050, WC_Stripe_Helper::get_stripe_amount( 10050, 'JPY' ) ); |
|
20 | - $this->assertEquals( 100, WC_Stripe_Helper::get_stripe_amount( 100.50, 'JPY' ) ); |
|
21 | - $this->assertEquals( 10050, WC_Stripe_Helper::get_stripe_amount( 100.50 ) ); |
|
22 | - $this->assertInternalType( 'int', WC_Stripe_Helper::get_stripe_amount( 100.50, 'USD' ) ); |
|
18 | + $this->assertEquals(10050, WC_Stripe_Helper::get_stripe_amount(100.50, 'USD')); |
|
19 | + $this->assertEquals(10050, WC_Stripe_Helper::get_stripe_amount(10050, 'JPY')); |
|
20 | + $this->assertEquals(100, WC_Stripe_Helper::get_stripe_amount(100.50, 'JPY')); |
|
21 | + $this->assertEquals(10050, WC_Stripe_Helper::get_stripe_amount(100.50)); |
|
22 | + $this->assertInternalType('int', WC_Stripe_Helper::get_stripe_amount(100.50, 'USD')); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -33,37 +33,37 @@ discard block |
||
33 | 33 | $balance_fee1->net = 10000; |
34 | 34 | $balance_fee1->currency = 'USD'; |
35 | 35 | |
36 | - $this->assertEquals( 105.00, WC_Stripe_Helper::format_balance_fee( $balance_fee1, 'fee' ) ); |
|
36 | + $this->assertEquals(105.00, WC_Stripe_Helper::format_balance_fee($balance_fee1, 'fee')); |
|
37 | 37 | |
38 | 38 | $balance_fee2 = new stdClass(); |
39 | 39 | $balance_fee2->fee = 10500; |
40 | 40 | $balance_fee2->net = 10000; |
41 | 41 | $balance_fee2->currency = 'JPY'; |
42 | 42 | |
43 | - $this->assertEquals( 10500, WC_Stripe_Helper::format_balance_fee( $balance_fee2, 'fee' ) ); |
|
43 | + $this->assertEquals(10500, WC_Stripe_Helper::format_balance_fee($balance_fee2, 'fee')); |
|
44 | 44 | |
45 | 45 | $balance_fee3 = new stdClass(); |
46 | 46 | $balance_fee3->fee = 10500; |
47 | 47 | $balance_fee3->net = 10000; |
48 | 48 | $balance_fee3->currency = 'USD'; |
49 | 49 | |
50 | - $this->assertEquals( 100.00, WC_Stripe_Helper::format_balance_fee( $balance_fee3, 'net' ) ); |
|
50 | + $this->assertEquals(100.00, WC_Stripe_Helper::format_balance_fee($balance_fee3, 'net')); |
|
51 | 51 | |
52 | 52 | $balance_fee4 = new stdClass(); |
53 | 53 | $balance_fee4->fee = 10500; |
54 | 54 | $balance_fee4->net = 10000; |
55 | 55 | $balance_fee4->currency = 'JPY'; |
56 | 56 | |
57 | - $this->assertEquals( 10000, WC_Stripe_Helper::format_balance_fee( $balance_fee4, 'net' ) ); |
|
57 | + $this->assertEquals(10000, WC_Stripe_Helper::format_balance_fee($balance_fee4, 'net')); |
|
58 | 58 | |
59 | 59 | $balance_fee5 = new stdClass(); |
60 | 60 | $balance_fee5->fee = 10500; |
61 | 61 | $balance_fee5->net = 10000; |
62 | 62 | $balance_fee5->currency = 'USD'; |
63 | 63 | |
64 | - $this->assertEquals( 105.00, WC_Stripe_Helper::format_balance_fee( $balance_fee5 ) ); |
|
64 | + $this->assertEquals(105.00, WC_Stripe_Helper::format_balance_fee($balance_fee5)); |
|
65 | 65 | |
66 | - $this->assertInternalType( 'string', WC_Stripe_Helper::format_balance_fee( $balance_fee5 ) ); |
|
66 | + $this->assertInternalType('string', WC_Stripe_Helper::format_balance_fee($balance_fee5)); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -76,28 +76,28 @@ discard block |
||
76 | 76 | 'expected' => 'Tests Store', |
77 | 77 | ); |
78 | 78 | |
79 | - $this->assertEquals( $statement_descriptor1['expected'], WC_Stripe_Helper::clean_statement_descriptor( $statement_descriptor1['actual'] ) ); |
|
79 | + $this->assertEquals($statement_descriptor1['expected'], WC_Stripe_Helper::clean_statement_descriptor($statement_descriptor1['actual'])); |
|
80 | 80 | |
81 | 81 | $statement_descriptor2 = array( |
82 | 82 | 'actual' => 'Test\'s Store > Driving Course Range', |
83 | 83 | 'expected' => 'Tests Store Driving C', |
84 | 84 | ); |
85 | 85 | |
86 | - $this->assertEquals( $statement_descriptor2['expected'], WC_Stripe_Helper::clean_statement_descriptor( $statement_descriptor2['actual'] ) ); |
|
86 | + $this->assertEquals($statement_descriptor2['expected'], WC_Stripe_Helper::clean_statement_descriptor($statement_descriptor2['actual'])); |
|
87 | 87 | |
88 | 88 | $statement_descriptor3 = array( |
89 | 89 | 'actual' => 'Test\'s Store < Driving Course Range', |
90 | 90 | 'expected' => 'Tests Store Driving C', |
91 | 91 | ); |
92 | 92 | |
93 | - $this->assertEquals( $statement_descriptor3['expected'], WC_Stripe_Helper::clean_statement_descriptor( $statement_descriptor3['actual'] ) ); |
|
93 | + $this->assertEquals($statement_descriptor3['expected'], WC_Stripe_Helper::clean_statement_descriptor($statement_descriptor3['actual'])); |
|
94 | 94 | |
95 | 95 | $statement_descriptor4 = array( |
96 | 96 | 'actual' => 'Test\'s Store " Driving Course Range', |
97 | 97 | 'expected' => 'Tests Store Driving C', |
98 | 98 | ); |
99 | 99 | |
100 | - $this->assertEquals( $statement_descriptor4['expected'], WC_Stripe_Helper::clean_statement_descriptor( $statement_descriptor4['actual'] ) ); |
|
100 | + $this->assertEquals($statement_descriptor4['expected'], WC_Stripe_Helper::clean_statement_descriptor($statement_descriptor4['actual'])); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | $source = new stdClass(); |
110 | 110 | $source->type = 'three_d_secure'; |
111 | 111 | |
112 | - $this->assertEquals( true, $stripe->is_3ds_card( $source ) ); |
|
112 | + $this->assertEquals(true, $stripe->is_3ds_card($source)); |
|
113 | 113 | |
114 | 114 | $source = new stdClass(); |
115 | 115 | $source->type = 'card'; |
116 | 116 | |
117 | - $this->assertEquals( false, $stripe->is_3ds_card( $source ) ); |
|
117 | + $this->assertEquals(false, $stripe->is_3ds_card($source)); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -128,20 +128,20 @@ discard block |
||
128 | 128 | $source->card = new stdClass(); |
129 | 129 | $source->card->three_d_secure = 'required'; |
130 | 130 | |
131 | - $this->assertEquals( true, $stripe->is_3ds_required( $source ) ); |
|
131 | + $this->assertEquals(true, $stripe->is_3ds_required($source)); |
|
132 | 132 | |
133 | 133 | $source = new stdClass(); |
134 | 134 | $source->type = 'card'; |
135 | 135 | $source->card = new stdClass(); |
136 | 136 | $source->card->three_d_secure = 'optional'; |
137 | 137 | |
138 | - $this->assertEquals( false, $stripe->is_3ds_required( $source ) ); |
|
138 | + $this->assertEquals(false, $stripe->is_3ds_required($source)); |
|
139 | 139 | |
140 | 140 | $source = new stdClass(); |
141 | 141 | $source->type = 'card'; |
142 | 142 | $source->card = new stdClass(); |
143 | 143 | $source->card->three_d_secure = 'not_supported'; |
144 | 144 | |
145 | - $this->assertEquals( false, $stripe->is_3ds_required( $source ) ); |
|
145 | + $this->assertEquals(false, $stripe->is_3ds_required($source)); |
|
146 | 146 | } |
147 | 147 | } |
@@ -1,10 +1,10 @@ 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 | // if uninstall not called from WordPress exit |
7 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
7 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
8 | 8 | exit; |
9 | 9 | } |
10 | 10 | |
@@ -13,30 +13,30 @@ discard block |
||
13 | 13 | * wp-config.php. This is to prevent data loss when deleting the plugin from the backend |
14 | 14 | * and to ensure only the site owner can perform this action. |
15 | 15 | */ |
16 | -if ( defined( 'WC_REMOVE_ALL_DATA' ) && true === WC_REMOVE_ALL_DATA ) { |
|
16 | +if (defined('WC_REMOVE_ALL_DATA') && true === WC_REMOVE_ALL_DATA) { |
|
17 | 17 | // Delete options. |
18 | - delete_option( 'woocommerce_stripe_settings' ); |
|
19 | - delete_option( 'wc_stripe_show_request_api_notice' ); |
|
20 | - delete_option( 'wc_stripe_show_apple_pay_notice' ); |
|
21 | - delete_option( 'wc_stripe_show_ssl_notice' ); |
|
22 | - delete_option( 'wc_stripe_show_keys_notice' ); |
|
23 | - delete_option( 'wc_stripe_show_alipay_notice' ); |
|
24 | - delete_option( 'wc_stripe_show_bancontact_notice' ); |
|
25 | - delete_option( 'wc_stripe_show_bitcoin_notice' ); |
|
26 | - delete_option( 'wc_stripe_show_eps_notice' ); |
|
27 | - delete_option( 'wc_stripe_show_giropay_notice' ); |
|
28 | - delete_option( 'wc_stripe_show_ideal_notice' ); |
|
29 | - delete_option( 'wc_stripe_show_multibanco_notice' ); |
|
30 | - delete_option( 'wc_stripe_show_p24_notice' ); |
|
31 | - delete_option( 'wc_stripe_show_sepa_notice' ); |
|
32 | - delete_option( 'wc_stripe_show_sofort_notice' ); |
|
33 | - delete_option( 'wc_stripe_version' ); |
|
34 | - delete_option( 'woocommerce_stripe_bancontact_settings' ); |
|
35 | - delete_option( 'woocommerce_stripe_alipay_settings' ); |
|
36 | - delete_option( 'woocommerce_stripe_bitcoin_settings' ); |
|
37 | - delete_option( 'woocommerce_stripe_ideal_settings' ); |
|
38 | - delete_option( 'woocommerce_stripe_p24_settings' ); |
|
39 | - delete_option( 'woocommerce_stripe_giropay_settings' ); |
|
40 | - delete_option( 'woocommerce_stripe_sepa_settings' ); |
|
41 | - delete_option( 'woocommerce_stripe_sofort_settings' ); |
|
18 | + delete_option('woocommerce_stripe_settings'); |
|
19 | + delete_option('wc_stripe_show_request_api_notice'); |
|
20 | + delete_option('wc_stripe_show_apple_pay_notice'); |
|
21 | + delete_option('wc_stripe_show_ssl_notice'); |
|
22 | + delete_option('wc_stripe_show_keys_notice'); |
|
23 | + delete_option('wc_stripe_show_alipay_notice'); |
|
24 | + delete_option('wc_stripe_show_bancontact_notice'); |
|
25 | + delete_option('wc_stripe_show_bitcoin_notice'); |
|
26 | + delete_option('wc_stripe_show_eps_notice'); |
|
27 | + delete_option('wc_stripe_show_giropay_notice'); |
|
28 | + delete_option('wc_stripe_show_ideal_notice'); |
|
29 | + delete_option('wc_stripe_show_multibanco_notice'); |
|
30 | + delete_option('wc_stripe_show_p24_notice'); |
|
31 | + delete_option('wc_stripe_show_sepa_notice'); |
|
32 | + delete_option('wc_stripe_show_sofort_notice'); |
|
33 | + delete_option('wc_stripe_version'); |
|
34 | + delete_option('woocommerce_stripe_bancontact_settings'); |
|
35 | + delete_option('woocommerce_stripe_alipay_settings'); |
|
36 | + delete_option('woocommerce_stripe_bitcoin_settings'); |
|
37 | + delete_option('woocommerce_stripe_ideal_settings'); |
|
38 | + delete_option('woocommerce_stripe_p24_settings'); |
|
39 | + delete_option('woocommerce_stripe_giropay_settings'); |
|
40 | + delete_option('woocommerce_stripe_sepa_settings'); |
|
41 | + delete_option('woocommerce_stripe_sofort_settings'); |
|
42 | 42 | } |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
7 | 7 | * DEPRECATED DO NOT USE!! |
8 | 8 | */ |
9 | -if ( ! class_exists( 'WC_Stripe_Apple_Pay' ) ) { |
|
9 | +if ( ! class_exists('WC_Stripe_Apple_Pay')) { |
|
10 | 10 | class WC_Stripe_Apple_Pay { |
11 | 11 | /** |
12 | 12 | * This Instance. |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | public static function instance() { |
23 | - WC_Stripe_Logger::log( 'DEPRECATED! WC_Stripe_Apple_Pay class has been hard deprecated. Please remove any code that references this class or instance. This class will be removed by version 4.2' ); |
|
23 | + WC_Stripe_Logger::log('DEPRECATED! WC_Stripe_Apple_Pay class has been hard deprecated. Please remove any code that references this class or instance. This class will be removed by version 4.2'); |
|
24 | 24 | return self::$_this; |
25 | 25 | } |
26 | 26 | |
27 | - public function __get( $var ) { |
|
27 | + public function __get($var) { |
|
28 | 28 | return null; |
29 | 29 | } |
30 | 30 | |
31 | - public function __call( $name, $arguments ) { |
|
31 | + public function __call($name, $arguments) { |
|
32 | 32 | return null; |
33 | 33 | } |
34 | 34 | } |
@@ -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,68 +19,68 @@ 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 ) { |
|
30 | + public function remove_order_source_before_retry($order) { |
|
31 | 31 | $order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id(); |
32 | - delete_post_meta( $order_id, '_stripe_source_id' ); |
|
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 | } |
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Remove order meta |
39 | 39 | * @param object $order |
40 | 40 | */ |
41 | - public function remove_order_customer_before_retry( $order ) { |
|
41 | + public function remove_order_customer_before_retry($order) { |
|
42 | 42 | $order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id(); |
43 | - delete_post_meta( $order_id, '_stripe_customer_id' ); |
|
43 | + delete_post_meta($order_id, '_stripe_customer_id'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Process the pre-order when pay upon release is used. |
48 | 48 | * @param int $order_id |
49 | 49 | */ |
50 | - public function process_pre_order( $order_id ) { |
|
50 | + public function process_pre_order($order_id) { |
|
51 | 51 | try { |
52 | - $order = wc_get_order( $order_id ); |
|
52 | + $order = wc_get_order($order_id); |
|
53 | 53 | |
54 | 54 | // This will throw exception if not valid. |
55 | - $this->validate_minimum_order_amount( $order ); |
|
55 | + $this->validate_minimum_order_amount($order); |
|
56 | 56 | |
57 | - $prepared_source = $this->prepare_source( get_current_user_id(), true ); |
|
57 | + $prepared_source = $this->prepare_source(get_current_user_id(), true); |
|
58 | 58 | |
59 | 59 | // We need a source on file to continue. |
60 | - if ( empty( $prepared_source->customer ) || empty( $prepared_source->source ) ) { |
|
61 | - throw new WC_Stripe_Exception( __( 'Unable to store payment details. Please try again.', 'woocommerce-gateway-stripe' ) ); |
|
60 | + if (empty($prepared_source->customer) || empty($prepared_source->source)) { |
|
61 | + throw new WC_Stripe_Exception(__('Unable to store payment details. Please try again.', 'woocommerce-gateway-stripe')); |
|
62 | 62 | } |
63 | 63 | |
64 | - $this->save_source_to_order( $order, $prepared_source ); |
|
64 | + $this->save_source_to_order($order, $prepared_source); |
|
65 | 65 | |
66 | 66 | // Remove cart |
67 | 67 | WC()->cart->empty_cart(); |
68 | 68 | |
69 | 69 | // Is pre ordered! |
70 | - WC_Pre_Orders_Order::mark_order_as_pre_ordered( $order ); |
|
70 | + WC_Pre_Orders_Order::mark_order_as_pre_ordered($order); |
|
71 | 71 | |
72 | 72 | // Return thank you page redirect |
73 | 73 | return array( |
74 | 74 | 'result' => 'success', |
75 | - 'redirect' => $this->get_return_url( $order ), |
|
75 | + 'redirect' => $this->get_return_url($order), |
|
76 | 76 | ); |
77 | - } catch ( WC_Stripe_Exception $e ) { |
|
78 | - wc_add_notice( $e->getLocalizedMessage(), 'error' ); |
|
79 | - WC_Stripe_Logger::log( 'Pre Orders Error: ' . $e->getMessage() ); |
|
77 | + } catch (WC_Stripe_Exception $e) { |
|
78 | + wc_add_notice($e->getLocalizedMessage(), 'error'); |
|
79 | + WC_Stripe_Logger::log('Pre Orders Error: ' . $e->getMessage()); |
|
80 | 80 | |
81 | 81 | return array( |
82 | 82 | 'result' => 'success', |
83 | - 'redirect' => $order->get_checkout_payment_url( true ), |
|
83 | + 'redirect' => $order->get_checkout_payment_url(true), |
|
84 | 84 | ); |
85 | 85 | } |
86 | 86 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param WC_Order $order |
91 | 91 | * @return void |
92 | 92 | */ |
93 | - public function process_pre_order_release_payment( $order ) { |
|
93 | + public function process_pre_order_release_payment($order) { |
|
94 | 94 | try { |
95 | 95 | // Define some callbacks if the first attempt fails. |
96 | 96 | $retry_callbacks = array( |
@@ -98,33 +98,33 @@ discard block |
||
98 | 98 | 'remove_order_customer_before_retry', |
99 | 99 | ); |
100 | 100 | |
101 | - while ( 1 ) { |
|
102 | - $source = $this->prepare_order_source( $order ); |
|
103 | - $response = WC_Stripe_API::request( $this->generate_payment_request( $order, $source ) ); |
|
101 | + while (1) { |
|
102 | + $source = $this->prepare_order_source($order); |
|
103 | + $response = WC_Stripe_API::request($this->generate_payment_request($order, $source)); |
|
104 | 104 | |
105 | - if ( ! empty( $response->error ) ) { |
|
106 | - if ( 0 === sizeof( $retry_callbacks ) ) { |
|
107 | - throw new Exception( $response->error->message ); |
|
105 | + if ( ! empty($response->error)) { |
|
106 | + if (0 === sizeof($retry_callbacks)) { |
|
107 | + throw new Exception($response->error->message); |
|
108 | 108 | } else { |
109 | - $retry_callback = array_shift( $retry_callbacks ); |
|
110 | - call_user_func( array( $this, $retry_callback ), $order ); |
|
109 | + $retry_callback = array_shift($retry_callbacks); |
|
110 | + call_user_func(array($this, $retry_callback), $order); |
|
111 | 111 | } |
112 | 112 | } else { |
113 | 113 | // Successful |
114 | - $this->process_response( $response, $order ); |
|
114 | + $this->process_response($response, $order); |
|
115 | 115 | break; |
116 | 116 | } |
117 | 117 | } |
118 | - } catch ( Exception $e ) { |
|
118 | + } catch (Exception $e) { |
|
119 | 119 | /* translators: error message */ |
120 | - $order_note = sprintf( __( 'Stripe Transaction Failed (%s)', 'woocommerce-gateway-stripe' ), $e->getMessage() ); |
|
120 | + $order_note = sprintf(__('Stripe Transaction Failed (%s)', 'woocommerce-gateway-stripe'), $e->getMessage()); |
|
121 | 121 | |
122 | 122 | // Mark order as failed if not already set, |
123 | 123 | // otherwise, make sure we add the order note so we can detect when someone fails to check out multiple times |
124 | - if ( ! $order->has_status( 'failed' ) ) { |
|
125 | - $order->update_status( 'failed', $order_note ); |
|
124 | + if ( ! $order->has_status('failed')) { |
|
125 | + $order->update_status('failed', $order_note); |
|
126 | 126 | } else { |
127 | - $order->add_order_note( $order_note ); |
|
127 | + $order->add_order_note($order_note); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | } |
@@ -1,41 +1,41 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
6 | -return apply_filters( 'wc_stripe_eps_settings', |
|
6 | +return apply_filters('wc_stripe_eps_settings', |
|
7 | 7 | array( |
8 | 8 | 'geo_target' => array( |
9 | - 'description' => __( 'Relevant Payer Geography: Austria', 'woocommerce-gateway-stripe' ), |
|
9 | + 'description' => __('Relevant Payer Geography: Austria', 'woocommerce-gateway-stripe'), |
|
10 | 10 | 'type' => 'title', |
11 | 11 | ), |
12 | 12 | 'activation' => array( |
13 | - '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' ), |
|
13 | + '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 | 14 | 'type' => 'title', |
15 | 15 | ), |
16 | 16 | 'enabled' => array( |
17 | - 'title' => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ), |
|
18 | - 'label' => __( 'Enable Stripe EPS', 'woocommerce-gateway-stripe' ), |
|
17 | + 'title' => __('Enable/Disable', 'woocommerce-gateway-stripe'), |
|
18 | + 'label' => __('Enable Stripe EPS', 'woocommerce-gateway-stripe'), |
|
19 | 19 | 'type' => 'checkbox', |
20 | 20 | 'description' => '', |
21 | 21 | 'default' => 'no', |
22 | 22 | ), |
23 | 23 | 'title' => array( |
24 | - 'title' => __( 'Title', 'woocommerce-gateway-stripe' ), |
|
24 | + 'title' => __('Title', 'woocommerce-gateway-stripe'), |
|
25 | 25 | 'type' => 'text', |
26 | - 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
27 | - 'default' => __( 'EPS', 'woocommerce-gateway-stripe' ), |
|
26 | + 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
27 | + 'default' => __('EPS', 'woocommerce-gateway-stripe'), |
|
28 | 28 | 'desc_tip' => true, |
29 | 29 | ), |
30 | 30 | 'description' => array( |
31 | - 'title' => __( 'Description', 'woocommerce-gateway-stripe' ), |
|
31 | + 'title' => __('Description', 'woocommerce-gateway-stripe'), |
|
32 | 32 | 'type' => 'text', |
33 | - 'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
34 | - 'default' => __( 'You will be redirected to EPS.', 'woocommerce-gateway-stripe' ), |
|
33 | + 'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
34 | + 'default' => __('You will be redirected to EPS.', 'woocommerce-gateway-stripe'), |
|
35 | 35 | 'desc_tip' => true, |
36 | 36 | ), |
37 | 37 | 'webhook' => array( |
38 | - 'title' => __( 'Webhook Enpoints', 'woocommerce-gateway-stripe' ), |
|
38 | + 'title' => __('Webhook Enpoints', 'woocommerce-gateway-stripe'), |
|
39 | 39 | 'type' => 'title', |
40 | 40 | /* translators: webhook URL */ |
41 | 41 | 'description' => $this->display_admin_settings_webhook_description(), |
@@ -1,45 +1,45 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
6 | -return apply_filters( 'wc_stripe_ideal_settings', |
|
6 | +return apply_filters('wc_stripe_ideal_settings', |
|
7 | 7 | array( |
8 | 8 | 'geo_target' => array( |
9 | - 'description' => __( 'Relevant Payer Geography: The Netherlands', 'woocommerce-gateway-stripe' ), |
|
9 | + 'description' => __('Relevant Payer Geography: The Netherlands', 'woocommerce-gateway-stripe'), |
|
10 | 10 | 'type' => 'title', |
11 | 11 | ), |
12 | 12 | 'guide' => array( |
13 | - 'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#ideal" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ), |
|
13 | + 'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#ideal" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'), |
|
14 | 14 | 'type' => 'title', |
15 | 15 | ), |
16 | 16 | 'activation' => array( |
17 | - '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' ), |
|
17 | + '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 | 18 | 'type' => 'title', |
19 | 19 | ), |
20 | 20 | 'enabled' => array( |
21 | - 'title' => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ), |
|
22 | - 'label' => __( 'Enable Stripe iDeal', 'woocommerce-gateway-stripe' ), |
|
21 | + 'title' => __('Enable/Disable', 'woocommerce-gateway-stripe'), |
|
22 | + 'label' => __('Enable Stripe iDeal', 'woocommerce-gateway-stripe'), |
|
23 | 23 | 'type' => 'checkbox', |
24 | 24 | 'description' => '', |
25 | 25 | 'default' => 'no', |
26 | 26 | ), |
27 | 27 | 'title' => array( |
28 | - 'title' => __( 'Title', 'woocommerce-gateway-stripe' ), |
|
28 | + 'title' => __('Title', 'woocommerce-gateway-stripe'), |
|
29 | 29 | 'type' => 'text', |
30 | - 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
31 | - 'default' => __( 'iDeal', 'woocommerce-gateway-stripe' ), |
|
30 | + 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
31 | + 'default' => __('iDeal', 'woocommerce-gateway-stripe'), |
|
32 | 32 | 'desc_tip' => true, |
33 | 33 | ), |
34 | 34 | 'description' => array( |
35 | - 'title' => __( 'Description', 'woocommerce-gateway-stripe' ), |
|
35 | + 'title' => __('Description', 'woocommerce-gateway-stripe'), |
|
36 | 36 | 'type' => 'text', |
37 | - 'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
38 | - 'default' => __( 'You will be redirected to iDeal.', 'woocommerce-gateway-stripe' ), |
|
37 | + 'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
38 | + 'default' => __('You will be redirected to iDeal.', 'woocommerce-gateway-stripe'), |
|
39 | 39 | 'desc_tip' => true, |
40 | 40 | ), |
41 | 41 | 'webhook' => array( |
42 | - 'title' => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ), |
|
42 | + 'title' => __('Webhook Endpoints', 'woocommerce-gateway-stripe'), |
|
43 | 43 | 'type' => 'title', |
44 | 44 | /* translators: webhook URL */ |
45 | 45 | 'description' => $this->display_admin_settings_webhook_description(), |
@@ -1,45 +1,45 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
6 | -return apply_filters( 'wc_stripe_alipay_settings', |
|
6 | +return apply_filters('wc_stripe_alipay_settings', |
|
7 | 7 | array( |
8 | 8 | 'geo_target' => array( |
9 | - 'description' => __( 'Relevant Payer Geography: China', 'woocommerce-gateway-stripe' ), |
|
9 | + 'description' => __('Relevant Payer Geography: China', 'woocommerce-gateway-stripe'), |
|
10 | 10 | 'type' => 'title', |
11 | 11 | ), |
12 | 12 | 'guide' => array( |
13 | - 'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#alipay" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ), |
|
13 | + 'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#alipay" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'), |
|
14 | 14 | 'type' => 'title', |
15 | 15 | ), |
16 | 16 | 'activation' => array( |
17 | - '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' ), |
|
17 | + '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 | 18 | 'type' => 'title', |
19 | 19 | ), |
20 | 20 | 'enabled' => array( |
21 | - 'title' => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ), |
|
22 | - 'label' => __( 'Enable Stripe Alipay', 'woocommerce-gateway-stripe' ), |
|
21 | + 'title' => __('Enable/Disable', 'woocommerce-gateway-stripe'), |
|
22 | + 'label' => __('Enable Stripe Alipay', 'woocommerce-gateway-stripe'), |
|
23 | 23 | 'type' => 'checkbox', |
24 | 24 | 'description' => '', |
25 | 25 | 'default' => 'no', |
26 | 26 | ), |
27 | 27 | 'title' => array( |
28 | - 'title' => __( 'Title', 'woocommerce-gateway-stripe' ), |
|
28 | + 'title' => __('Title', 'woocommerce-gateway-stripe'), |
|
29 | 29 | 'type' => 'text', |
30 | - 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
31 | - 'default' => __( 'Alipay', 'woocommerce-gateway-stripe' ), |
|
30 | + 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
31 | + 'default' => __('Alipay', 'woocommerce-gateway-stripe'), |
|
32 | 32 | 'desc_tip' => true, |
33 | 33 | ), |
34 | 34 | 'description' => array( |
35 | - 'title' => __( 'Description', 'woocommerce-gateway-stripe' ), |
|
35 | + 'title' => __('Description', 'woocommerce-gateway-stripe'), |
|
36 | 36 | 'type' => 'text', |
37 | - 'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
38 | - 'default' => __( 'You will be redirected to Alipay.', 'woocommerce-gateway-stripe' ), |
|
37 | + 'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
38 | + 'default' => __('You will be redirected to Alipay.', 'woocommerce-gateway-stripe'), |
|
39 | 39 | 'desc_tip' => true, |
40 | 40 | ), |
41 | 41 | 'webhook' => array( |
42 | - 'title' => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ), |
|
42 | + 'title' => __('Webhook Endpoints', 'woocommerce-gateway-stripe'), |
|
43 | 43 | 'type' => 'title', |
44 | 44 | /* translators: webhook URL */ |
45 | 45 | 'description' => $this->display_admin_settings_webhook_description(), |
@@ -1,45 +1,45 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
6 | -return apply_filters( 'wc_stripe_bancontact_settings', |
|
6 | +return apply_filters('wc_stripe_bancontact_settings', |
|
7 | 7 | array( |
8 | 8 | 'geo_target' => array( |
9 | - 'description' => __( 'Relevant Payer Geography: Belgium', 'woocommerce-gateway-stripe' ), |
|
9 | + 'description' => __('Relevant Payer Geography: Belgium', 'woocommerce-gateway-stripe'), |
|
10 | 10 | 'type' => 'title', |
11 | 11 | ), |
12 | 12 | 'guide' => array( |
13 | - 'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#bancontact" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ), |
|
13 | + 'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#bancontact" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'), |
|
14 | 14 | 'type' => 'title', |
15 | 15 | ), |
16 | 16 | 'activation' => array( |
17 | - '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' ), |
|
17 | + '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 | 18 | 'type' => 'title', |
19 | 19 | ), |
20 | 20 | 'enabled' => array( |
21 | - 'title' => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ), |
|
22 | - 'label' => __( 'Enable Stripe Bancontact', 'woocommerce-gateway-stripe' ), |
|
21 | + 'title' => __('Enable/Disable', 'woocommerce-gateway-stripe'), |
|
22 | + 'label' => __('Enable Stripe Bancontact', 'woocommerce-gateway-stripe'), |
|
23 | 23 | 'type' => 'checkbox', |
24 | 24 | 'description' => '', |
25 | 25 | 'default' => 'no', |
26 | 26 | ), |
27 | 27 | 'title' => array( |
28 | - 'title' => __( 'Title', 'woocommerce-gateway-stripe' ), |
|
28 | + 'title' => __('Title', 'woocommerce-gateway-stripe'), |
|
29 | 29 | 'type' => 'text', |
30 | - 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
31 | - 'default' => __( 'Bancontact', 'woocommerce-gateway-stripe' ), |
|
30 | + 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
31 | + 'default' => __('Bancontact', 'woocommerce-gateway-stripe'), |
|
32 | 32 | 'desc_tip' => true, |
33 | 33 | ), |
34 | 34 | 'description' => array( |
35 | - 'title' => __( 'Description', 'woocommerce-gateway-stripe' ), |
|
35 | + 'title' => __('Description', 'woocommerce-gateway-stripe'), |
|
36 | 36 | 'type' => 'text', |
37 | - 'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
38 | - 'default' => __( 'You will be redirected to Bancontact.', 'woocommerce-gateway-stripe' ), |
|
37 | + 'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
38 | + 'default' => __('You will be redirected to Bancontact.', 'woocommerce-gateway-stripe'), |
|
39 | 39 | 'desc_tip' => true, |
40 | 40 | ), |
41 | 41 | 'webhook' => array( |
42 | - 'title' => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ), |
|
42 | + 'title' => __('Webhook Endpoints', 'woocommerce-gateway-stripe'), |
|
43 | 43 | 'type' => 'title', |
44 | 44 | /* translators: webhook URL */ |
45 | 45 | 'description' => $this->display_admin_settings_webhook_description(), |