WooCommerce Stripe Payment Gateway - Version 3.0.1

Version Description

  • Backwards compatibility update to prevent error finding WC_Payment_Token_CC.
  • Added inline validation of keys.
Download this release

Release Info

Developer mikejolley
Plugin Icon 128x128 WooCommerce Stripe Payment Gateway
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0.0 to 3.0.1

changelog.txt CHANGED
@@ -1,9 +1,6 @@
1
  *** Changelog ***
2
 
3
- = 3.0.0 =
4
- * First public WordPress.org release.
5
- * Refactor for WC 2.6 and above. Legacy support for 2.5.
6
- * Improved saved card handling using tokenization API in WooCommerce.
7
 
8
  = 2.6.12 - 2016.04.13 =
9
  * Fix - When saved cards option is enabled with no cards on file, CC field was hidden.
1
  *** Changelog ***
2
 
3
+ = For newer changelog entries, see readme.txt =
 
 
 
4
 
5
  = 2.6.12 - 2016.04.13 =
6
  * Fix - When saved cards option is enabled with no cards on file, CC field was hidden.
includes/class-wc-gateway-stripe.php CHANGED
@@ -180,6 +180,28 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
180
  $( '#woocommerce_stripe_stripe_checkout_locale, #woocommerce_stripe_stripe_bitcoin, #woocommerce_stripe_stripe_checkout_image' ).closest( 'tr' ).hide();
181
  }
182
  }).change();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  });
184
  " );
185
  }
180
  $( '#woocommerce_stripe_stripe_checkout_locale, #woocommerce_stripe_stripe_bitcoin, #woocommerce_stripe_stripe_checkout_image' ).closest( 'tr' ).hide();
181
  }
182
  }).change();
183
+
184
+ $( '#woocommerce_stripe_secret_key, #woocommerce_stripe_publishable_key' ).change(function(){
185
+ var value = $( this ).val();
186
+
187
+ if ( value.indexOf( '_test_' ) >= 0 ) {
188
+ $( this ).css( 'border-color', 'red' ).after( '<span class=\"description stripe-error-description\" style=\"color:red; display:block;\">" . __( 'This is not a valid live key. Live keys start with "sk_live_" and "pk_live_".', 'woocommerce-gateway-stripe' ) . "</span>' );
189
+ } else {
190
+ $( this ).css( 'border-color', '' );
191
+ $( '.stripe-error-description', $( this ).parent() ).remove();
192
+ }
193
+ }).change();
194
+
195
+ $( '#woocommerce_stripe_test_secret_key, #woocommerce_stripe_test_publishable_key' ).change(function(){
196
+ var value = $( this ).val();
197
+
198
+ if ( value.indexOf( '_live_' ) >= 0 ) {
199
+ $( this ).css( 'border-color', 'red' ).after( '<span class=\"description stripe-error-description\" style=\"color:red; display:block;\">" . __( 'This is not a valid test key. Test keys start with "sk_test_" and "pk_test_".', 'woocommerce-gateway-stripe' ) . "</span>' );
200
+ } else {
201
+ $( this ).css( 'border-color', '' );
202
+ $( '.stripe-error-description', $( this ).parent() ).remove();
203
+ }
204
+ }).change();
205
  });
206
  " );
207
  }
includes/class-wc-stripe-customer.php CHANGED
@@ -185,7 +185,7 @@ class WC_Stripe_Customer {
185
  }
186
 
187
  // Add token to WooCommerce
188
- if ( $this->get_user_id() ) {
189
  $token = new WC_Payment_Token_CC();
190
  $token->set_token( $response->id );
191
  $token->set_gateway_id( 'stripe' );
185
  }
186
 
187
  // Add token to WooCommerce
188
+ if ( $this->get_user_id() && class_exists( 'WC_Payment_Token_CC' ) ) {
189
  $token = new WC_Payment_Token_CC();
190
  $token->set_token( $response->id );
191
  $token->set_gateway_id( 'stripe' );
languages/woocommerce-gateway-stripe.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the WooCommerce Stripe Gateway package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Stripe Gateway 3.0.0\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/woocommerce-gateway-stripe\n"
7
- "POT-Creation-Date: 2016-06-07 10:40:14+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -14,7 +14,7 @@ msgstr ""
14
 
15
  #: includes/class-wc-gateway-stripe-addons.php:104
16
  #: includes/class-wc-gateway-stripe-addons.php:150
17
- #: includes/class-wc-gateway-stripe.php:415
18
  #: includes/legacy/class-wc-gateway-stripe.php:446
19
  msgid ""
20
  "Sorry, the minimum allowed order total is 0.50 to use this payment method."
@@ -71,68 +71,80 @@ msgid ""
71
  "has a valid SSL certificate - Stripe will only work in test mode."
72
  msgstr ""
73
 
74
- #: includes/class-wc-gateway-stripe.php:202
 
 
 
 
 
 
 
 
 
 
 
 
75
  msgid "Add Card"
76
  msgstr ""
77
 
78
- #: includes/class-wc-gateway-stripe.php:213
79
  #: includes/legacy/class-wc-gateway-stripe.php:262
80
  msgid "%s"
81
  msgstr ""
82
 
83
- #: includes/class-wc-gateway-stripe.php:257
84
  #: includes/legacy/class-wc-gateway-stripe.php:296
85
  msgid "Please accept the terms and conditions first"
86
  msgstr ""
87
 
88
- #: includes/class-wc-gateway-stripe.php:258
89
  #: includes/legacy/class-wc-gateway-stripe.php:297
90
  msgid "Please fill in required checkout fields first"
91
  msgstr ""
92
 
93
- #: includes/class-wc-gateway-stripe.php:292
94
  #: includes/legacy/class-wc-gateway-stripe.php:331
95
  msgid "%s - Order %s"
96
  msgstr ""
97
 
98
- #: includes/class-wc-gateway-stripe.php:349
99
  msgid "Invalid payment method. Please input a new card number."
100
  msgstr ""
101
 
102
- #: includes/class-wc-gateway-stripe.php:403
103
  #: includes/legacy/class-wc-gateway-stripe.php:434
104
  msgid "Please enter your card details to make a payment."
105
  msgstr ""
106
 
107
- #: includes/class-wc-gateway-stripe.php:404
108
  #: includes/legacy/class-wc-gateway-stripe.php:435
109
  msgid ""
110
  "Developers: Please make sure that you are including jQuery and there are no "
111
  "JavaScript errors on the page."
112
  msgstr ""
113
 
114
- #: includes/class-wc-gateway-stripe.php:432
115
  msgid "This card is no longer available and has been removed."
116
  msgstr ""
117
 
118
- #: includes/class-wc-gateway-stripe.php:455
119
  #: includes/legacy/class-wc-gateway-stripe.php:481
120
  msgid "Error: %s"
121
  msgstr ""
122
 
123
- #: includes/class-wc-gateway-stripe.php:500
124
  #: includes/legacy/class-wc-gateway-stripe.php:526
125
  msgid ""
126
  "Stripe charge authorized (Charge ID: %s). Process order to take payment, or "
127
  "cancel to remove the pre-authorization."
128
  msgstr ""
129
 
130
- #: includes/class-wc-gateway-stripe.php:514
131
  #: includes/legacy/class-wc-gateway-stripe.php:540
132
  msgid "There was a problem adding the card."
133
  msgstr ""
134
 
135
- #: includes/class-wc-gateway-stripe.php:564
136
  #: includes/legacy/class-wc-gateway-stripe.php:590
137
  msgid "Refunded %s - Refund ID: %s - Reason: %s"
138
  msgstr ""
2
  # This file is distributed under the same license as the WooCommerce Stripe Gateway package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Stripe Gateway 3.0.1\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/woocommerce-gateway-stripe\n"
7
+ "POT-Creation-Date: 2016-06-08 11:48:25+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
14
 
15
  #: includes/class-wc-gateway-stripe-addons.php:104
16
  #: includes/class-wc-gateway-stripe-addons.php:150
17
+ #: includes/class-wc-gateway-stripe.php:437
18
  #: includes/legacy/class-wc-gateway-stripe.php:446
19
  msgid ""
20
  "Sorry, the minimum allowed order total is 0.50 to use this payment method."
71
  "has a valid SSL certificate - Stripe will only work in test mode."
72
  msgstr ""
73
 
74
+ #: includes/class-wc-gateway-stripe.php:188
75
+ msgid ""
76
+ "This is not a valid live key. Live keys start with \"sk_live_\" and "
77
+ "\"pk_live_\"."
78
+ msgstr ""
79
+
80
+ #: includes/class-wc-gateway-stripe.php:199
81
+ msgid ""
82
+ "This is not a valid test key. Test keys start with \"sk_test_\" and "
83
+ "\"pk_test_\"."
84
+ msgstr ""
85
+
86
+ #: includes/class-wc-gateway-stripe.php:224
87
  msgid "Add Card"
88
  msgstr ""
89
 
90
+ #: includes/class-wc-gateway-stripe.php:235
91
  #: includes/legacy/class-wc-gateway-stripe.php:262
92
  msgid "%s"
93
  msgstr ""
94
 
95
+ #: includes/class-wc-gateway-stripe.php:279
96
  #: includes/legacy/class-wc-gateway-stripe.php:296
97
  msgid "Please accept the terms and conditions first"
98
  msgstr ""
99
 
100
+ #: includes/class-wc-gateway-stripe.php:280
101
  #: includes/legacy/class-wc-gateway-stripe.php:297
102
  msgid "Please fill in required checkout fields first"
103
  msgstr ""
104
 
105
+ #: includes/class-wc-gateway-stripe.php:314
106
  #: includes/legacy/class-wc-gateway-stripe.php:331
107
  msgid "%s - Order %s"
108
  msgstr ""
109
 
110
+ #: includes/class-wc-gateway-stripe.php:371
111
  msgid "Invalid payment method. Please input a new card number."
112
  msgstr ""
113
 
114
+ #: includes/class-wc-gateway-stripe.php:425
115
  #: includes/legacy/class-wc-gateway-stripe.php:434
116
  msgid "Please enter your card details to make a payment."
117
  msgstr ""
118
 
119
+ #: includes/class-wc-gateway-stripe.php:426
120
  #: includes/legacy/class-wc-gateway-stripe.php:435
121
  msgid ""
122
  "Developers: Please make sure that you are including jQuery and there are no "
123
  "JavaScript errors on the page."
124
  msgstr ""
125
 
126
+ #: includes/class-wc-gateway-stripe.php:454
127
  msgid "This card is no longer available and has been removed."
128
  msgstr ""
129
 
130
+ #: includes/class-wc-gateway-stripe.php:477
131
  #: includes/legacy/class-wc-gateway-stripe.php:481
132
  msgid "Error: %s"
133
  msgstr ""
134
 
135
+ #: includes/class-wc-gateway-stripe.php:522
136
  #: includes/legacy/class-wc-gateway-stripe.php:526
137
  msgid ""
138
  "Stripe charge authorized (Charge ID: %s). Process order to take payment, or "
139
  "cancel to remove the pre-authorization."
140
  msgstr ""
141
 
142
+ #: includes/class-wc-gateway-stripe.php:536
143
  #: includes/legacy/class-wc-gateway-stripe.php:540
144
  msgid "There was a problem adding the card."
145
  msgstr ""
146
 
147
+ #: includes/class-wc-gateway-stripe.php:586
148
  #: includes/legacy/class-wc-gateway-stripe.php:590
149
  msgid "Refunded %s - Refund ID: %s - Reason: %s"
150
  msgstr ""
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: automattic, woothemes, mikejolley, akeda, royho
3
  Tags: credit card, stripe, woocommerce
4
  Requires at least: 4.4
5
  Tested up to: 4.5
6
- Stable tag: 3.0.0
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -87,6 +87,10 @@ If you get stuck, you can ask for help in the Plugin Forum.
87
 
88
  == Changelog ==
89
 
 
 
 
 
90
  = 3.0.0 =
91
  * First public WordPress.org release.
92
  * Refactor for WC 2.6 and above. Legacy support for 2.5.
3
  Tags: credit card, stripe, woocommerce
4
  Requires at least: 4.4
5
  Tested up to: 4.5
6
+ Stable tag: 3.0.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
87
 
88
  == Changelog ==
89
 
90
+ = 3.0.1 =
91
+ * Backwards compatibility update to prevent error finding WC_Payment_Token_CC.
92
+ * Added inline validation of keys.
93
+
94
  = 3.0.0 =
95
  * First public WordPress.org release.
96
  * Refactor for WC 2.6 and above. Legacy support for 2.5.
woocommerce-gateway-stripe.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Take credit card payments on your store using Stripe.
6
  * Author: Automattic
7
  * Author URI: http://woothemes.com/
8
- * Version: 3.0.0
9
  *
10
  * Copyright (c) 2016 Automattic
11
  *
@@ -30,7 +30,7 @@ if ( ! defined( 'ABSPATH' ) ) {
30
  /**
31
  * Required minimums and constants
32
  */
33
- define( 'WC_STRIPE_VERSION', '3.0.0' );
34
  define( 'WC_STRIPE_MIN_PHP_VER', '5.3.0' );
35
  define( 'WC_STRIPE_MIN_WC_VER', '2.5.0' );
36
  define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
@@ -270,7 +270,7 @@ class WC_Stripe {
270
  include_once( plugin_basename( 'includes/legacy/class-wc-gateway-stripe-saved-cards.php' ) );
271
  }
272
 
273
- load_plugin_textdomain( 'woocommerce-gateway-stripe', false, trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );
274
  add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) );
275
 
276
  if ( $this->subscription_support_enabled ) {
@@ -361,7 +361,7 @@ class WC_Stripe {
361
  * @return array
362
  */
363
  public function woocommerce_get_customer_payment_tokens( $tokens, $customer_id, $gateway_id ) {
364
- if ( is_user_logged_in() && 'stripe' === $gateway_id ) {
365
  $stripe_customer = new WC_Stripe_Customer( $customer_id );
366
  $stripe_cards = $stripe_customer->get_cards();
367
  $stored_tokens = array();
5
  * Description: Take credit card payments on your store using Stripe.
6
  * Author: Automattic
7
  * Author URI: http://woothemes.com/
8
+ * Version: 3.0.1
9
  *
10
  * Copyright (c) 2016 Automattic
11
  *
30
  /**
31
  * Required minimums and constants
32
  */
33
+ define( 'WC_STRIPE_VERSION', '3.0.1' );
34
  define( 'WC_STRIPE_MIN_PHP_VER', '5.3.0' );
35
  define( 'WC_STRIPE_MIN_WC_VER', '2.5.0' );
36
  define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
270
  include_once( plugin_basename( 'includes/legacy/class-wc-gateway-stripe-saved-cards.php' ) );
271
  }
272
 
273
+ load_plugin_textdomain( 'woocommerce-gateway-stripe', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
274
  add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) );
275
 
276
  if ( $this->subscription_support_enabled ) {
361
  * @return array
362
  */
363
  public function woocommerce_get_customer_payment_tokens( $tokens, $customer_id, $gateway_id ) {
364
+ if ( is_user_logged_in() && 'stripe' === $gateway_id && class_exists( 'WC_Payment_Token_CC' ) ) {
365
  $stripe_customer = new WC_Stripe_Customer( $customer_id );
366
  $stripe_cards = $stripe_customer->get_cards();
367
  $stored_tokens = array();