WooCommerce Square - Version 1.0.29

Version Description

  • 2018-04-17 =
  • Fix - If more than 1000 items, next batch is ignored.
  • Fix - Wrong setting used when syncing product.
  • Fix - Japan locale does not support Diners/Discover, so do not show these brands on checkout.

=

Download this release

Release Info

Developer royho
Plugin Icon 128x128 WooCommerce Square
Version 1.0.29
Comparing to
See all releases

Code changes from version 1.0.28 to 1.0.29

changelog.txt CHANGED
@@ -1,5 +1,10 @@
1
  *** WooCommerce Square Changelog ***
2
 
 
 
 
 
 
3
  2018-04-04 - version 1.0.28
4
  * Fix - Double inventory sync for newly created products.
5
  * Fix - Infinite loop with pagination, where Square keeps sending the same link.
1
  *** WooCommerce Square Changelog ***
2
 
3
+ = 1.0.29 - 2018-04-17 =
4
+ * Fix - If more than 1000 items, next batch is ignored.
5
+ * Fix - Wrong setting used when syncing product.
6
+ * Fix - Japan locale does not support Diners/Discover, so do not show these brands on checkout.
7
+
8
  2018-04-04 - version 1.0.28
9
  * Fix - Double inventory sync for newly created products.
10
  * Fix - Infinite loop with pagination, where Square keeps sending the same link.
includes/class-wc-square-client.php CHANGED
@@ -229,21 +229,21 @@ class WC_Square_Client {
229
  $link_header = wp_remote_retrieve_header( $response, 'Link' );
230
 
231
  // Look for the next page, if specified
232
- if ( ! preg_match( '/Link:( |)<(.+)>;rel=("|\')next("|\')/i', $link_header ) ) {
233
  return $return_data;
234
  }
235
 
236
  $rel_link_matches = array();
237
 
238
  // Set up the next page URL for the following loop
239
- if ( ( 'GET' === $method ) && preg_match( '/Link:( |)<(.+)>;rel=("|\')next("|\')/i', $link_header, $rel_link_matches ) ) {
240
 
241
  // Check if we're at the end of pagination.
242
- if ( $request_url === $rel_link_matches[2] ) {
243
  return $return_data;
244
  }
245
 
246
- $request_url = $rel_link_matches[2];
247
  $body = null;
248
  $page_count++;
249
  $page_label = sprintf( ' - Fetching page %d', $page_count );
229
  $link_header = wp_remote_retrieve_header( $response, 'Link' );
230
 
231
  // Look for the next page, if specified
232
+ if ( ! preg_match( '/<(.+)>;rel=("|\')next("|\')/i', $link_header ) ) {
233
  return $return_data;
234
  }
235
 
236
  $rel_link_matches = array();
237
 
238
  // Set up the next page URL for the following loop
239
+ if ( ( 'GET' === $method ) && preg_match( '/<(.+)>;rel=("|\')next("|\')/i', $link_header, $rel_link_matches ) ) {
240
 
241
  // Check if we're at the end of pagination.
242
+ if ( $request_url === $rel_link_matches[1] ) {
243
  return $return_data;
244
  }
245
 
246
+ $request_url = $rel_link_matches[1];
247
  $body = null;
248
  $page_count++;
249
  $page_label = sprintf( ' - Fetching page %d', $page_count );
includes/class-wc-square-sync-to-square-wp-hooks.php CHANGED
@@ -154,7 +154,7 @@ class WC_Square_Sync_To_Square_WordPress_Hooks {
154
  }
155
 
156
  if ( is_object( $wc_product ) && ! empty( $wc_product ) ) {
157
- $this->square->sync_product( $wc_product, $this->sync_categories, $this->sync_categories, $this->sync_images );
158
  }
159
 
160
  WC_Square_Utils::delete_transients();
154
  }
155
 
156
  if ( is_object( $wc_product ) && ! empty( $wc_product ) ) {
157
+ $this->square->sync_product( $wc_product, $this->sync_categories, $this->sync_inventory, $this->sync_images );
158
  }
159
 
160
  WC_Square_Utils::delete_transients();
includes/payment/class-wc-square-gateway.php CHANGED
@@ -62,8 +62,11 @@ class WC_Square_Gateway extends WC_Payment_Gateway {
62
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/mastercard.svg' ) . '" alt="Mastercard" width="32" style="margin-left: 0.3em" />';
63
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/amex.svg' ) . '" alt="Amex" width="32" style="margin-left: 0.3em" />';
64
 
65
- $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/discover.svg' ) . '" alt="Discover" width="32" style="margin-left: 0.3em" />';
66
-
 
 
 
67
  return apply_filters( 'woocommerce_gateway_icon', $icon, $this->id );
68
  }
69
 
62
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/mastercard.svg' ) . '" alt="Mastercard" width="32" style="margin-left: 0.3em" />';
63
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/amex.svg' ) . '" alt="Amex" width="32" style="margin-left: 0.3em" />';
64
 
65
+ // Do not show Discover/Diners for Japan since it's not available
66
+ if ( 'JP' !== WC()->countries->get_base_country() ) {
67
+ $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/discover.svg' ) . '" alt="Discover" width="32" style="margin-left: 0.3em" />';
68
+ $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/diners.svg' ) . '" alt="Diners" width="32" style="margin-left: 0.3em" />';
69
+ }
70
  return apply_filters( 'woocommerce_gateway_icon', $icon, $this->id );
71
  }
72
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: credit card, square, woocommerce, inventory sync
4
  Requires at least: 4.4
5
  Tested up to: 4.9
6
  Requires PHP: 5.6
7
- Stable tag: 1.0.28
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -57,23 +57,10 @@ If you get stuck, you can ask for help in the Plugin Forum.
57
 
58
  == Changelog ==
59
 
60
- = 1.0.28 - 2018-04-04 =
61
- * Fix - Double inventory sync for newly created products.
62
- * Fix - Infinite loop with pagination, where Square keeps sending the same link.
63
- * Fix - Remove usage of deprecated jQuery method.
64
- * Fix - Sync job should not be sending anything if there are no stock changes.
65
- * Fix - Trigger to decrease stock upon purchase not working
66
- * Tweak - Add logging and skip sync in case store's currency/country is not allowed.
67
- * Tweak - Improve debug logging when fetching inventory
68
- * Tweak - Inventory reduction in Square will be treated as stock sale.
69
-
70
- = 1.0.27 - 2018-02-19 =
71
- * Fix - In some cases request timeouts are not set long enough causing timeout errors.
72
- * Fix - Square to WC sync sets products with 0 quantity to In Stock.
73
- * Fix - Potential issue with Square to WC sync when response is not an array.
74
- * Fix - When description is more than 4095 characters, sync fails to Square.
75
- * Fix - Add checks to product object before scheduling an event to prevent errors in cron job.
76
- * Fix - Add check to prevent auto inventory poll from running when a manual sync is in progress.
77
 
78
  == Upgrade Notice ==
79
 
4
  Requires at least: 4.4
5
  Tested up to: 4.9
6
  Requires PHP: 5.6
7
+ Stable tag: 1.0.29
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
57
 
58
  == Changelog ==
59
 
60
+ = 1.0.29 - 2018-04-17 =
61
+ * Fix - If more than 1000 items, next batch is ignored.
62
+ * Fix - Wrong setting used when syncing product.
63
+ * Fix - Japan locale does not support Diners/Discover, so do not show these brands on checkout.
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  == Upgrade Notice ==
66
 
woocommerce-square.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
- * Version: 1.0.28
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
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
23
 
24
  if ( ! class_exists( 'Woocommerce_Square' ) ) :
25
 
26
- define( 'WC_SQUARE_VERSION', '1.0.28' );
27
 
28
  /**
29
  * Main class.
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
+ * Version: 1.0.29
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
23
 
24
  if ( ! class_exists( 'Woocommerce_Square' ) ) :
25
 
26
+ define( 'WC_SQUARE_VERSION', '1.0.29' );
27
 
28
  /**
29
  * Main class.