WooCommerce Square - Version 2.0.6

Version Description

  • 2019.11.07 =
  • Fix - Access token renewal schedule action duplication.
Download this release

Release Info

Developer automattic
Plugin Icon 128x128 WooCommerce Square
Version 2.0.6
Comparing to
See all releases

Code changes from version 2.0.5 to 2.0.6

assets/css/frontend/wc-square.min.css CHANGED
@@ -1,2 +1,2 @@
1
- .woocommerce #payment div.payment_method_square_credit_card div.form-row{padding:3px}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field{height:3em;padding:5px;border:1px solid #ccc;border-radius:3px;transition:border-color .16s;-webkit-transition:border-color .16s;background-color:#fff}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number{padding-right:55px;background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-cc-plain.svg);background-repeat:no-repeat;background-position:99%;background-size:50px 31px}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-visa{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-visa.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-mastercard{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-mastercard.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-amex{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-amex.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-diners-club{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-dinersclub.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-maestro{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-maestro.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-jcb{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-jcb.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-discover{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-discover.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-invalid{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-cc-invalid.svg)}@media only screen and (max-width:320px){.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number{background-image:none}}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-payment-field--error{border-color:#a00}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-card-postal-code-parent.hidden{display:none}
2
  /*# sourceMappingURL=wc-square.min.css.map */
1
+ .woocommerce #payment div.payment_method_square_credit_card div.form-row{padding:3px}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field{height:3em;padding:5px;border:1px solid #ccc;border-radius:3px;transition:border-color .16s;-webkit-transition:border-color .16s;background-color:#fff}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number{padding-right:55px;background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-cc-plain.svg);background-repeat:no-repeat;background-position:99%;background-size:50px 31px}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-visa{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-visa.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-mastercard{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-mastercard.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-amex{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-amex.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-diners-club{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-dinersclub.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-maestro{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-maestro.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-jcb{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-jcb.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-discover{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-discover.svg)}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number.card-type-invalid{background-image:url(../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-cc-invalid.svg)}@media only screen and (max-width:320px){.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-hosted-field-card-number{background-image:none}}.woocommerce #payment div.payment_method_square_credit_card .wc-square-credit-card-payment-field--error{border-color:#a00}.woocommerce #payment div.payment_method_square_credit_card
2
  /*# sourceMappingURL=wc-square.min.css.map */
assets/css/frontend/wc-square.scss CHANGED
@@ -73,8 +73,4 @@ $image_path: '../../../vendor/skyverge/wc-plugin-framework/woocommerce/payment-g
73
  .wc-square-credit-card-payment-field--error {
74
  border-color: #a00;
75
  }
76
-
77
- .wc-square-credit-card-card-postal-code-parent.hidden {
78
- display: none;
79
- }
80
  }
73
  .wc-square-credit-card-payment-field--error {
74
  border-color: #a00;
75
  }
 
 
 
 
76
  }
i18n/languages/woocommerce-square.pot CHANGED
@@ -2,7 +2,7 @@
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Square 2.0.4\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/woocommerce/woocommerce-square/issues\n"
8
  "POT-Creation-Date: 2019-08-19 13:09:58+00:00\n"
@@ -3112,4 +3112,4 @@ msgstr ""
3112
  #. translators: https:www.skyverge.com/for-translators-environments/
3113
  msgctxt "software environment"
3114
  msgid "Production"
3115
- msgstr ""
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Square 2.0.6\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/woocommerce/woocommerce-square/issues\n"
8
  "POT-Creation-Date: 2019-08-19 13:09:58+00:00\n"
3112
  #. translators: https:www.skyverge.com/for-translators-environments/
3113
  msgctxt "software environment"
3114
  msgid "Production"
3115
+ msgstr ""
includes/Admin/Settings_Page.php CHANGED
@@ -177,7 +177,7 @@ class Settings_Page extends \WC_Settings_Page {
177
  </header>
178
  <article>
179
  <?php /* translators: Placeholders: %1$s - <strong>, %2%s - </strong> */ ?>
180
- <?php printf( esc_html__( 'You are about to import all products from Square. This will create a new product in WooCommerce for every product retrieved from Square. %1$sOnly use this action to perform a one-time import!%2$s', 'woocommerce-square' ), '<strong>', '</strong>' ); ?>
181
  </article>
182
  <footer>
183
  <div class="inner">
177
  </header>
178
  <article>
179
  <?php /* translators: Placeholders: %1$s - <strong>, %2%s - </strong> */ ?>
180
+ <?php printf( esc_html__( 'You are about to import all products from Square. This will create a new product in WooCommerce for every product retrieved from Square. If you have products in the trash from the previous imports, these will be ignored in the import. %1$sOnly use this action to perform a one-time import!%2$s', 'woocommerce-square' ), '<strong>', '</strong>' ); ?>
181
  </article>
182
  <footer>
183
  <div class="inner">
includes/Handlers/Connection.php CHANGED
@@ -86,9 +86,6 @@ class Connection {
86
 
87
  add_action( 'admin_action_wc_' . $this->get_plugin()->get_id() . '_disconnect', [ $this, 'handle_disconnect' ] );
88
 
89
- // ensure the token refresh is scheduled whenever Square is connected
90
- add_action( 'init', [ $this, 'schedule_refresh' ] );
91
-
92
  // refresh the connection, triggered by Action Scheduler
93
  add_action( 'wc_' . $this->get_plugin()->get_id() . '_refresh_connection', [ $this, 'refresh_connection' ] );
94
 
@@ -138,6 +135,7 @@ class Connection {
138
  $this->get_plugin()->log( 'Refresh token successfully received.' );
139
  }
140
 
 
141
  $this->schedule_customer_index();
142
 
143
  // on connect after upgrading to v2.0 from v1.0, initiate a catalog sync to refresh the Square item IDs
@@ -256,9 +254,10 @@ class Connection {
256
  */
257
  $interval = apply_filters( 'wc_' . $this->get_plugin()->get_id() . '_connection_refresh_interval', WEEK_IN_SECONDS );
258
 
259
- if ( false === as_next_scheduled_action( 'wc_' . $this->get_plugin()->get_id() . '_refresh_connection' ) ) {
260
- as_schedule_recurring_action( time() + $interval, $interval, 'wc_' . $this->get_plugin()->get_id() . '_refresh_connection', [], $this->get_plugin()->get_id() );
261
- }
 
262
  }
263
 
264
 
@@ -327,6 +326,8 @@ class Connection {
327
 
328
  update_option( 'wc_' . $this->get_plugin()->get_id() . '_refresh_failed', 'yes' );
329
  }
 
 
330
  }
331
 
332
 
@@ -336,8 +337,7 @@ class Connection {
336
  * @since 2.0.0
337
  */
338
  protected function unschedule_refresh() {
339
-
340
- as_unschedule_action( 'wc_' . $this->get_plugin()->get_id() . '_refresh_connection', [], $this->get_plugin()->get_id() );
341
  }
342
 
343
 
86
 
87
  add_action( 'admin_action_wc_' . $this->get_plugin()->get_id() . '_disconnect', [ $this, 'handle_disconnect' ] );
88
 
 
 
 
89
  // refresh the connection, triggered by Action Scheduler
90
  add_action( 'wc_' . $this->get_plugin()->get_id() . '_refresh_connection', [ $this, 'refresh_connection' ] );
91
 
135
  $this->get_plugin()->log( 'Refresh token successfully received.' );
136
  }
137
 
138
+ $this->schedule_refresh();
139
  $this->schedule_customer_index();
140
 
141
  // on connect after upgrading to v2.0 from v1.0, initiate a catalog sync to refresh the Square item IDs
254
  */
255
  $interval = apply_filters( 'wc_' . $this->get_plugin()->get_id() . '_connection_refresh_interval', WEEK_IN_SECONDS );
256
 
257
+ // Make sure that all refresh actions are cancelled before scheduling it.
258
+ $this->unschedule_refresh();
259
+
260
+ as_schedule_single_action( time() + $interval, 'wc_' . $this->get_plugin()->get_id() . '_refresh_connection', [], $this->get_plugin()->get_id() );
261
  }
262
 
263
 
326
 
327
  update_option( 'wc_' . $this->get_plugin()->get_id() . '_refresh_failed', 'yes' );
328
  }
329
+
330
+ $this->schedule_refresh();
331
  }
332
 
333
 
337
  * @since 2.0.0
338
  */
339
  protected function unschedule_refresh() {
340
+ as_unschedule_all_actions( 'wc_' . $this->get_plugin()->get_id() . '_refresh_connection', [], $this->get_plugin()->get_id() );
 
341
  }
342
 
343
 
includes/Plugin.php CHANGED
@@ -41,7 +41,7 @@ class Plugin extends Framework\SV_WC_Payment_Gateway_Plugin {
41
 
42
 
43
  /** plugin version number */
44
- const VERSION = '2.0.5';
45
 
46
  /** plugin ID */
47
  const PLUGIN_ID = 'square';
41
 
42
 
43
  /** plugin version number */
44
+ const VERSION = '2.0.6';
45
 
46
  /** plugin ID */
47
  const PLUGIN_ID = 'square';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: credit card, square, woocommerce, inventory sync
4
  Requires at least: 4.6
5
  Tested up to: 5.2.3
6
  Requires PHP: 5.6
7
- Stable tag: 2.0.5
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -72,6 +72,9 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
72
 
73
  == Changelog ==
74
 
 
 
 
75
  = 2.0.5 - 2019.10.16 =
76
  * Fix - Access token renewal by adding support for refresh tokens as per the new Square API
77
  * Fix - Variable pricing import and adding an alert when these type of products are ignored.
4
  Requires at least: 4.6
5
  Tested up to: 5.2.3
6
  Requires PHP: 5.6
7
+ Stable tag: 2.0.6
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
72
 
73
  == Changelog ==
74
 
75
+ = 2.0.6 - 2019.11.07 =
76
+ * Fix - Access token renewal schedule action duplication.
77
+
78
  = 2.0.5 - 2019.10.16 =
79
  * Fix - Access token renewal by adding support for refresh tokens as per the new Square API
80
  * Fix - Variable pricing import and adding an alert when these type of products are ignored.
woocommerce-square.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
- * Version: 2.0.5
5
  * Plugin URI: https://woocommerce.com/products/square/
6
  * Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
7
  * Author: WooCommerce
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
+ * Version: 2.0.6
5
  * Plugin URI: https://woocommerce.com/products/square/
6
  * Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
7
  * Author: WooCommerce