WooCommerce Square - Version 2.1.6

Version Description

  • 2020.07.15 =
  • Fix - Make the "Sync Now" button disabled when no business location is set in Square settings.
  • Fix - Enable checking/unchecking the Manage Stock setting for all variations.
  • Fix - Refunding an order paid with another payment gateway will no longer sync inventory with Square when "Do not sync product data" is selected.
  • Fix - Imported variation products that are out-of-stock will no longer show on the shop page when "Hide out of stock items from the catalog" is selected.
  • Fix - Product images will now sync when Square is in Sandbox mode.
  • Fix - Damaged stock adjustments will now sync properly to WooCommerce when multiple stock adjustments are made.
  • Fix - Improve performance when manually syncing large amount of stock adjustments from Square (some inventory updates were missing).
  • Fix - Quick editing products no longer sets incorrect stock quantities or disables syncing.
  • Fix - Existing customer that have been removed from the connected Square account, or can't be found will now be able to save a new card on the checkout.
  • Fix - When the System of Record is set to WooCommerce, product images will now properly sync to Square.
  • Tweak - Use CSC consistently in all error messages when referring to the Card Security Code.
  • Tweak - Change to using WordPress core methods to import/sync images from Square.
Download this release

Release Info

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

Code changes from version 2.1.5 to 2.1.6

assets/js/admin/wc-square-admin-products.coffee CHANGED
@@ -10,7 +10,6 @@ jQuery( document ).ready ( $ ) ->
10
  typenow = window.typenow ? ''
11
  pagenow = window.pagenow ? ''
12
 
13
-
14
  # bail if not on product admin pages
15
  if 'product' isnt typenow
16
  return
@@ -25,26 +24,22 @@ jQuery( document ).ready ( $ ) ->
25
 
26
 
27
  # when clicking the quick edit button fetch the default Synced with Square checkbox
28
- $( 'button.editinline' ).on 'click', ( e ) ->
29
 
30
  $row = $( this ).closest( 'tr' )
31
  postID = $row.find( 'th.check-column input' ).val()
32
  data =
33
- action : 'wc_square_is_product_synced_with_square'
34
- security : wc_square_admin_products.is_product_synced_with_square_nonce
35
  product_id : $row.find( 'th.check-column input' ).val()
36
 
37
  $.post wc_square_admin_products.ajax_url, data, ( response ) ->
38
 
39
- $editRow = $( 'tr#edit-' + postID )
40
- $squareSynced = $editRow.find( 'select.square-synced' )
41
- $sku = $editRow.find( 'input[name=_sku]' )
42
- $manageStock = $editRow.find( 'input[name=_manage_stock]' )
43
- $stockStatus = $editRow.find( 'select[name=_stock_status]' )
44
- $stockQty = $editRow.find( 'input[name=_stock]' )
45
- $errors = $editRow.find( '.wc-square-sync-with-square-errors' )
46
 
47
- if response and response.data
48
  # if the product has multiple attributes we show an inline error message and bail
49
  if 'multiple_attributes' is response.data
50
  $squareSynced.prop( 'checked', false )
@@ -57,36 +52,62 @@ jQuery( document ).ready ( $ ) ->
57
  $squareSynced.prop( 'disabled', true )
58
  $errors.find( '.missing_variation_sku' ).show()
59
  return
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  else
61
- # a missing sku can be recoverable instead, since the admin can enter one from the quick edit panel
62
- $squareSynced.val( if 'missing_sku' is response.data then 'no' else response.data )
63
-
64
- # if the SKU changes, enabled or disable Synced with Square checkbox accordingly
65
- $sku.on 'change keyup keypress', ( e ) ->
66
- if '' is $( this ).val()
67
- $squareSynced.val( 'no' )
68
- $squareSynced.prop( 'disabled', true )
69
- $errors.find( '.missing_sku' ).show()
 
 
 
 
 
 
 
 
 
70
  else
71
- $squareSynced.prop( 'disabled', false )
72
- $squareSynced.trigger 'change'
73
- $errors.find( '.missing_sku' ).hide()
74
- .trigger 'change'
75
-
76
- # if Synced with Square is enabled, we might as well disable stock management (without verbose explanations as in the product page)
77
- $squareSynced.on 'change', ( e ) ->
78
- if 'no' is $( this ).val()
79
- $manageStock.prop( 'disabled', false )
80
- $stockStatus.prop( 'disabled', false )
81
- $stockQty.prop( 'disabled', false )
 
 
82
  else
83
- $manageStock.prop( 'checked', true )
84
- $( '.stock_qty_field' ).show()
85
- $manageStock.prop( 'disabled', true )
86
- $stockStatus.prop( 'disabled', true )
87
- $stockQty.prop( 'disabled', true )
88
- .trigger 'change'
89
-
90
 
91
  # individual product edit screen
92
  if 'product' is pagenow
@@ -340,7 +361,7 @@ jQuery( document ).ready ( $ ) ->
340
  $variationStockInput.prop( 'readonly', false )
341
  $variationManageInput.prop( 'disabled', false )
342
  $variationManageInput.next( '.description' ).remove()
343
- $( '#wc_square_variation_manage_stock' ).prop( 'disabled', true )
344
 
345
 
346
  # initial page load handling
10
  typenow = window.typenow ? ''
11
  pagenow = window.pagenow ? ''
12
 
 
13
  # bail if not on product admin pages
14
  if 'product' isnt typenow
15
  return
24
 
25
 
26
  # when clicking the quick edit button fetch the default Synced with Square checkbox
27
+ $( '#the-list' ).on 'click', '.editinline', ->
28
 
29
  $row = $( this ).closest( 'tr' )
30
  postID = $row.find( 'th.check-column input' ).val()
31
  data =
32
+ action : 'wc_square_get_quick_edit_product_details'
33
+ security : wc_square_admin_products.get_quick_edit_product_details_nonce
34
  product_id : $row.find( 'th.check-column input' ).val()
35
 
36
  $.post wc_square_admin_products.ajax_url, data, ( response ) ->
37
 
38
+ $editRow = $( 'tr#edit-' + postID )
39
+ $squareSynced = $editRow.find( 'select.square-synced' )
40
+ $errors = $editRow.find( '.wc-square-sync-with-square-errors' )
 
 
 
 
41
 
42
+ if ! response.success and response.data
43
  # if the product has multiple attributes we show an inline error message and bail
44
  if 'multiple_attributes' is response.data
45
  $squareSynced.prop( 'checked', false )
52
  $squareSynced.prop( 'disabled', true )
53
  $errors.find( '.missing_variation_sku' ).show()
54
  return
55
+
56
+ $sku = $editRow.find( 'input[name=_sku]' )
57
+ $stockStatus = $editRow.find( 'select[name=_stock_status]' )
58
+ $stockQty = $editRow.find( 'input[name=_stock]' )
59
+ $manageStockLabel = $editRow.find( '.manage_stock_field .manage_stock' )
60
+ $manageStockInput = $editRow.find( 'input[name=_manage_stock]' )
61
+ $manageStockDesc = '<span class="description"><a href="' + wc_square_admin_products.settings_url + '">' + wc_square_admin_products.i18n.synced_with_square + '</a></span>'
62
+ edit_url = response.data.edit_url
63
+ i18n = response.data.i18n
64
+ is_variable = response.data.is_variable
65
+
66
+ $squareSynced.val( response.data.is_synced_with_square )
67
+
68
+ # if the SKU changes, enabled or disable Synced with Square checkbox accordingly
69
+ $sku.on 'change keyup keypress', ( e ) ->
70
+ if '' is $( this ).val() and ! is_variable
71
+ $squareSynced.val( 'no' )
72
+ $squareSynced.prop( 'disabled', true )
73
+ $errors.find( '.missing_sku' ).show()
74
  else
75
+ $squareSynced.prop( 'disabled', false )
76
+ $squareSynced.trigger 'change'
77
+ $errors.find( '.missing_sku' ).hide()
78
+ .trigger 'change'
79
+
80
+ # if Synced with Square is enabled, we might as well disable stock management (without verbose explanations as in the product page)
81
+ $squareSynced.on 'change', ( e ) ->
82
+ if 'no' is $( this ).val()
83
+ $manageStockInput.off()
84
+ $manageStockInput.add( $stockQty ).css( { 'opacity': 1 } )
85
+ $manageStockLabel.find( '.description' ).remove()
86
+ # Stock input manipulation will differ depending on whether product is variable or simple
87
+ if is_variable
88
+ if $manageStockInput.is( ':checked' )
89
+ $( '.stock_qty_field' ).show()
90
+ $( '.backorder_field' ).show()
91
+ else
92
+ $( '.stock_status_field' ).show()
93
  else
94
+ $stockQty.prop( 'readonly', false )
95
+ $stockStatus.prop( 'readonly', false )
96
+ else
97
+ $manageStockInput.prop( 'checked', true );
98
+ $manageStockInput.on 'click', -> false
99
+ $manageStockInput.add( $stockQty ).css( { 'opacity': '0.5' } )
100
+ $manageStockLabel.append( $manageStockDesc )
101
+ if wc_square_admin_products.is_woocommerce_sor and edit_url and i18n
102
+ $manageStockLabel.append( '<p class="description"><a href="' + edit_url + '">' + i18n + '</a></p>' )
103
+ if is_variable
104
+ $( '.stock_status_field' ).hide()
105
+ $( '.stock_qty_field' ).hide()
106
+ $( '.backorder_field' ).hide()
107
  else
108
+ $stockQty.prop( 'readonly', true )
109
+ $stockStatus.prop( 'readonly', true )
110
+ .trigger 'change'
 
 
 
 
111
 
112
  # individual product edit screen
113
  if 'product' is pagenow
361
  $variationStockInput.prop( 'readonly', false )
362
  $variationManageInput.prop( 'disabled', false )
363
  $variationManageInput.next( '.description' ).remove()
364
+ $( this ).find( '#wc_square_variation_manage_stock' ).prop( 'disabled', true )
365
 
366
 
367
  # initial page load handling
assets/js/admin/wc-square-admin-products.min.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";(function(){var e=[].indexOf;jQuery(document).ready(function(r){var t,i,a,s,n,o,c,d,_,p,u,l,h,f,m,w,v;if(v=null!=(f=window.typenow)?f:"",h=null!=(m=window.pagenow)?m:"","product"===v&&wc_square_admin_products.is_product_sync_enabled)return"edit-product"===h&&r("button.editinline").on("click",function(e){var t,i,a;return t=r(this).closest("tr"),a=t.find("th.check-column input").val(),i={action:"wc_square_is_product_synced_with_square",security:wc_square_admin_products.is_product_synced_with_square_nonce,product_id:t.find("th.check-column input").val()},r.post(wc_square_admin_products.ajax_url,i,function(e){var t,i,s,n,o,c,d;if(t=r("tr#edit-"+a),o=t.find("select.square-synced"),n=t.find("input[name=_sku]"),s=t.find("input[name=_manage_stock]"),d=t.find("select[name=_stock_status]"),c=t.find("input[name=_stock]"),i=t.find(".wc-square-sync-with-square-errors"),e&&e.data)return"multiple_attributes"===e.data?(o.prop("checked",!1),o.prop("disabled",!0),void i.find(".multiple_attributes").show()):"missing_variation_sku"===e.data?(o.prop("checked",!1),o.prop("disabled",!0),void i.find(".missing_variation_sku").show()):(o.val("missing_sku"===e.data?"no":e.data),n.on("change keyup keypress",function(e){return""===r(this).val()?(o.val("no"),o.prop("disabled",!0),i.find(".missing_sku").show()):(o.prop("disabled",!1),o.trigger("change"),i.find(".missing_sku").hide())}).trigger("change"),o.on("change",function(e){return"no"===r(this).val()?(s.prop("disabled",!1),d.prop("disabled",!1),c.prop("disabled",!1)):(s.prop("checked",!0),r(".stock_qty_field").show(),s.prop("disabled",!0),d.prop("disabled",!0),c.prop("disabled",!0))}).trigger("change"))})}),"product"===h?(w="#_"+wc_square_admin_products.synced_with_square_taxonomy,p=function(){var t;return t=r("#product-type").val(),e.call(wc_square_admin_products.variable_product_types,t)>=0},_=function(){return""!==r("#_sku").val()},d=function(){var e;return e=r('.woocommerce_attribute_data input[name^="attribute_variation"]:checked'),p()&&e&&e.length>1},c=function(e){if(!p())return r("#_sku").on("change keypress keyup",function(t){return""===r(this).val()?(r(".wc-square-sync-with-square-error.missing_sku").show(),r(e).prop("disabled",!0),r(e).prop("checked",!1)):(r(".wc-square-sync-with-square-error.missing_sku").hide(),d()||r(e).prop("disabled",!1)),r(e).trigger("change")}).trigger("change")},o=function(e){return r("#variable_product_options").on("reload",function(t){return d()?(r(".wc-square-sync-with-square-error.multiple_attributes").show(),r(e).prop("disabled",!0),r(e).prop("checked",!1)):(r(".wc-square-sync-with-square-error.multiple_attributes").hide(),_()&&r(e).prop("disabled",!1)),r(e).trigger("change")}).trigger("reload")},c(w),o(w),s=r(".stock_fields"),n=s.find("#_stock"),i=r("._manage_stock_field"),a=i.find("#_manage_stock"),t=i.find(".description"),u=t.text(),l=r("#_manage_stock").is(":checked"),r(w).on("change",function(e){var i,o;if(wc_square_admin_products.is_inventory_sync_enabled)return o=-1!==r.inArray(r("#product-type").val(),wc_square_admin_products.variable_product_types),r(this).is(":checked")&&r("#_square_item_variation_id").length>0?(i=!0,t.html('<a href="'+wc_square_admin_products.settings_url+'">'+wc_square_admin_products.i18n.synced_with_square+"</a>"),a.prop("disabled",!0).prop("checked",!o).change(),n.prop("readonly",!0),o||s.show(),wc_square_admin_products.is_woocommerce_sor&&!o?(0===r("p._stock_field span.description").length&&n.after('<span class="description" style="display:block;clear:both;"><a href="#" id="fetch-stock-with-square">'+wc_square_admin_products.i18n.fetch_stock_with_square+'</a><div class="spinner" style="float:none;"></div></span>'),r("#fetch-stock-with-square").on("click",function(e){var t,i;return e.preventDefault(),(t=r("p._stock_field span.description .spinner")).css("visibility","visible"),i={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:r("#post_ID").val()},r.post(wc_square_admin_products.ajax_url,i,function(e){var i;return e&&e.success?(i=e.data,n.val(i),s.find("input[name=_original_stock]").val(i),n.prop("readonly",!1),r("p._stock_field span.description").remove()):(e.data&&(r(".inventory-fetch-error").remove(),t.after('<span class="inventory-fetch-error" style="display:inline-block;color:red;">'+e.data+"</span>")),t.css("visibility","hidden"),console.log(e))})})):wc_square_admin_products.is_square_sor&&0===r("p._stock_field span.description").length&&n.after('<span class="description" style="display:block;clear:both;">'+wc_square_admin_products.i18n.managed_by_square+"</span>")):(i=!1,r("p._stock_field span.description").remove(),n.prop("readonly",!1),t.html(u),a.prop("disabled",!1).prop("checked",l),l&&s.show()),r(".woocommerce_variation").each(function(){var e,t,a,s,n,o;return o=r(this).find("h3 > a").attr("rel"),t=r(".variable_manage_stock"),e=t.parent(),s=r(this).find(".wc_input_stock"),a=s.parent(),i?(t.prop("disabled",!0).prop("checked",!0).change(),s.prop("readonly",!0),r("#wc_square_variation_manage_stock").prop("disabled",!1),0===e.find(".description").length&&t.after('<span class="description">('+wc_square_admin_products.i18n.managed_by_square+")</span>"),wc_square_admin_products.is_woocommerce_sor?(n="fetch-stock-with-square-"+o,0===a.find("span.description").length&&s.after('<span class="description" style="display:block;clear:both;"><a href="#" id="'+n+'">'+wc_square_admin_products.i18n.fetch_stock_with_square+'</a><div class="spinner" style="float:none;"></div></span>'),r("#"+n).on("click",function(e){var t,i;return e.preventDefault(),(t=r(this).next(".spinner")).css("visibility","visible"),i={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:o},r.post(wc_square_admin_products.ajax_url,i,function(e){var i;return e&&e.success?(i=e.data,s.val(i),a.parent().find('input[name^="variable_original_stock"]').val(i),s.prop("readonly",!1),a.find(".description").remove()):(e.data&&(r(".inventory-fetch-error").remove(),t.after('<span class="inventory-fetch-error" style="display:inline-block;color:red;">'+e.data+"</span>")),t.css("visibility","hidden"),console.log(e))})})):void 0):(s.prop("readonly",!1),t.prop("disabled",!1),t.next(".description").remove(),r("#wc_square_variation_manage_stock").prop("disabled",!0))})}).trigger("change"),r("#product-type").on("change",function(e){return r(w).trigger("change")}),r("#woocommerce-product-data").on("woocommerce_variations_loaded",function(e){return r(w).trigger("change")})):void 0})}).call(void 0);
2
  //# sourceMappingURL=wc-square-admin-products.min.js.map
1
+ "use strict";(function(){var e=[].indexOf;jQuery(document).ready(function(r){var t,i,a,s,n,c,o,d,_,p,u,l,h,f,m,w,k;if(k=null!=(f=window.typenow)?f:"",h=null!=(m=window.pagenow)?m:"","product"===k&&wc_square_admin_products.is_product_sync_enabled)return"edit-product"===h&&r("#the-list").on("click",".editinline",function(){var e,t,i;return e=r(this).closest("tr"),i=e.find("th.check-column input").val(),t={action:"wc_square_get_quick_edit_product_details",security:wc_square_admin_products.get_quick_edit_product_details_nonce,product_id:e.find("th.check-column input").val()},r.post(wc_square_admin_products.ajax_url,t,function(e){var t,a,s,n,c,o,d,_,p,u,l,h;if(t=r("tr#edit-"+i),d=t.find("select.square-synced"),a=t.find(".wc-square-sync-with-square-errors"),!e.success&&e.data){if("multiple_attributes"===e.data)return d.prop("checked",!1),d.prop("disabled",!0),void a.find(".multiple_attributes").show();if("missing_variation_sku"===e.data)return d.prop("checked",!1),d.prop("disabled",!0),void a.find(".missing_variation_sku").show()}return o=t.find("input[name=_sku]"),p=t.find("select[name=_stock_status]"),_=t.find("input[name=_stock]"),c=t.find(".manage_stock_field .manage_stock"),n=t.find("input[name=_manage_stock]"),s='<span class="description"><a href="'+wc_square_admin_products.settings_url+'">'+wc_square_admin_products.i18n.synced_with_square+"</a></span>",u=e.data.edit_url,l=e.data.i18n,h=e.data.is_variable,d.val(e.data.is_synced_with_square),o.on("change keyup keypress",function(e){return""!==r(this).val()||h?(d.prop("disabled",!1),d.trigger("change"),a.find(".missing_sku").hide()):(d.val("no"),d.prop("disabled",!0),a.find(".missing_sku").show())}).trigger("change"),d.on("change",function(e){return"no"===r(this).val()?(n.off(),n.add(_).css({opacity:1}),c.find(".description").remove(),h?n.is(":checked")?(r(".stock_qty_field").show(),r(".backorder_field").show()):r(".stock_status_field").show():(_.prop("readonly",!1),p.prop("readonly",!1))):(n.prop("checked",!0),n.on("click",function(){return!1}),n.add(_).css({opacity:"0.5"}),c.append(s),wc_square_admin_products.is_woocommerce_sor&&u&&l&&c.append('<p class="description"><a href="'+u+'">'+l+"</a></p>"),h?(r(".stock_status_field").hide(),r(".stock_qty_field").hide(),r(".backorder_field").hide()):(_.prop("readonly",!0),p.prop("readonly",!0)))}).trigger("change")})}),"product"===h?(w="#_"+wc_square_admin_products.synced_with_square_taxonomy,p=function(){var t;return t=r("#product-type").val(),e.call(wc_square_admin_products.variable_product_types,t)>=0},_=function(){return""!==r("#_sku").val()},d=function(){var e;return e=r('.woocommerce_attribute_data input[name^="attribute_variation"]:checked'),p()&&e&&e.length>1},o=function(e){if(!p())return r("#_sku").on("change keypress keyup",function(t){return""===r(this).val()?(r(".wc-square-sync-with-square-error.missing_sku").show(),r(e).prop("disabled",!0),r(e).prop("checked",!1)):(r(".wc-square-sync-with-square-error.missing_sku").hide(),d()||r(e).prop("disabled",!1)),r(e).trigger("change")}).trigger("change")},c=function(e){return r("#variable_product_options").on("reload",function(t){return d()?(r(".wc-square-sync-with-square-error.multiple_attributes").show(),r(e).prop("disabled",!0),r(e).prop("checked",!1)):(r(".wc-square-sync-with-square-error.multiple_attributes").hide(),_()&&r(e).prop("disabled",!1)),r(e).trigger("change")}).trigger("reload")},o(w),c(w),s=r(".stock_fields"),n=s.find("#_stock"),i=r("._manage_stock_field"),a=i.find("#_manage_stock"),t=i.find(".description"),u=t.text(),l=r("#_manage_stock").is(":checked"),r(w).on("change",function(e){var i,c;if(wc_square_admin_products.is_inventory_sync_enabled)return c=-1!==r.inArray(r("#product-type").val(),wc_square_admin_products.variable_product_types),r(this).is(":checked")&&r("#_square_item_variation_id").length>0?(i=!0,t.html('<a href="'+wc_square_admin_products.settings_url+'">'+wc_square_admin_products.i18n.synced_with_square+"</a>"),a.prop("disabled",!0).prop("checked",!c).change(),n.prop("readonly",!0),c||s.show(),wc_square_admin_products.is_woocommerce_sor&&!c?(0===r("p._stock_field span.description").length&&n.after('<span class="description" style="display:block;clear:both;"><a href="#" id="fetch-stock-with-square">'+wc_square_admin_products.i18n.fetch_stock_with_square+'</a><div class="spinner" style="float:none;"></div></span>'),r("#fetch-stock-with-square").on("click",function(e){var t,i;return e.preventDefault(),(t=r("p._stock_field span.description .spinner")).css("visibility","visible"),i={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:r("#post_ID").val()},r.post(wc_square_admin_products.ajax_url,i,function(e){var i;return e&&e.success?(i=e.data,n.val(i),s.find("input[name=_original_stock]").val(i),n.prop("readonly",!1),r("p._stock_field span.description").remove()):(e.data&&(r(".inventory-fetch-error").remove(),t.after('<span class="inventory-fetch-error" style="display:inline-block;color:red;">'+e.data+"</span>")),t.css("visibility","hidden"),console.log(e))})})):wc_square_admin_products.is_square_sor&&0===r("p._stock_field span.description").length&&n.after('<span class="description" style="display:block;clear:both;">'+wc_square_admin_products.i18n.managed_by_square+"</span>")):(i=!1,r("p._stock_field span.description").remove(),n.prop("readonly",!1),t.html(u),a.prop("disabled",!1).prop("checked",l),l&&s.show()),r(".woocommerce_variation").each(function(){var e,t,a,s,n,c;return c=r(this).find("h3 > a").attr("rel"),t=r(".variable_manage_stock"),e=t.parent(),s=r(this).find(".wc_input_stock"),a=s.parent(),i?(t.prop("disabled",!0).prop("checked",!0).change(),s.prop("readonly",!0),r("#wc_square_variation_manage_stock").prop("disabled",!1),0===e.find(".description").length&&t.after('<span class="description">('+wc_square_admin_products.i18n.managed_by_square+")</span>"),wc_square_admin_products.is_woocommerce_sor?(n="fetch-stock-with-square-"+c,0===a.find("span.description").length&&s.after('<span class="description" style="display:block;clear:both;"><a href="#" id="'+n+'">'+wc_square_admin_products.i18n.fetch_stock_with_square+'</a><div class="spinner" style="float:none;"></div></span>'),r("#"+n).on("click",function(e){var t,i;return e.preventDefault(),(t=r(this).next(".spinner")).css("visibility","visible"),i={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:c},r.post(wc_square_admin_products.ajax_url,i,function(e){var i;return e&&e.success?(i=e.data,s.val(i),a.parent().find('input[name^="variable_original_stock"]').val(i),s.prop("readonly",!1),a.find(".description").remove()):(e.data&&(r(".inventory-fetch-error").remove(),t.after('<span class="inventory-fetch-error" style="display:inline-block;color:red;">'+e.data+"</span>")),t.css("visibility","hidden"),console.log(e))})})):void 0):(s.prop("readonly",!1),t.prop("disabled",!1),t.next(".description").remove(),r(this).find("#wc_square_variation_manage_stock").prop("disabled",!0))})}).trigger("change"),r("#product-type").on("change",function(e){return r(w).trigger("change")}),r("#woocommerce-product-data").on("woocommerce_variations_loaded",function(e){return r(w).trigger("change")})):void 0})}).call(void 0);
2
  //# sourceMappingURL=wc-square-admin-products.min.js.map
assets/js/admin/wc-square-admin-products.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["wc-square-admin-products.min.js"],"names":["indexOf","jQuery","document","ready","$","$manageDesc","$manageField","$manageInput","$stockFields","$stockInput","handleAttributes","handleSKU","hasMultipleAttributes","hasSKU","isVariable","manageDescOriginal","manageStockOriginal","pagenow","ref","ref1","syncCheckboxID","typenow","window","wc_square_admin_products","is_product_sync_enabled","on","e","$row","data","postID","this","closest","find","val","action","security","is_product_synced_with_square_nonce","product_id","post","ajax_url","response","$editRow","$errors","$manageStock","$sku","$squareSynced","$stockQty","$stockStatus","prop","show","trigger","hide","synced_with_square_taxonomy","ref2","call","variable_product_types","$variation_attributes","length","text","is","useSquare","variableProduct","is_inventory_sync_enabled","inArray","html","settings_url","i18n","synced_with_square","change","is_woocommerce_sor","after","fetch_stock_with_square","$spinner","preventDefault","css","fetch_product_stock_with_square_nonce","quantity","success","remove","console","log","is_square_sor","managed_by_square","each","$variationManageField","$variationManageInput","$variationStockField","$variationStockInput","fetchVariationStockActionID","variationID","attr","parent","next","undefined"],"mappings":"AAAA,cAEA,WAGE,IAAIA,KAAaA,QAOjBC,OAAOC,UAAUC,MAAM,SAAUC,GA8B/B,IA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AqBtD,KAAK,oBAAoByB,QACtD8B,EAAqBjB,MAAM,+EAAiFkB,EAA8B,KAAOjE,yBAAyB2C,KAAKK,wBAA0B,8DAGpMnE,EAAE,IAAMoF,GAA6B/D,GAAG,QAAS,SAAUC,GAChE,IAAI8C,EAAU5C,EASd,OARAF,EAAE+C,kBACFD,EAAWpE,EAAE0B,MAAM8D,KAAK,aACflB,IAAI,aAAc,WAC3B9C,GACEM,OAAQ,4CACRC,SAAUZ,yBAAyBoD,sCACnCtC,WAAYoD,GAEPrF,EAAEkC,KAAKf,yBAAyBgB,SAAUX,EAAM,SAAUY,GAC/D,IAAIoC,EACJ,OAAIpC,GAAYA,EAASqC,SACvBD,EAAWpC,EAASZ,KACpB2D,EAAqBtD,IAAI2C,GACzBU,EAAqBK,SAAS3D,KAAK,0CAA0CC,IAAI2C,GACjFW,EAAqBvC,KAAK,YAAY,GAC/BsC,EAAqBtD,KAAK,gBAAgB8C,WAE7CtC,EAASZ,OACXxB,EAAE,0BAA0B0E,SAC5BN,EAASF,MAAM,+EAAiF9B,EAASZ,KAAO,YAElH4C,EAASE,IAAI,aAAc,UACpBK,QAAQC,IAAIxC,cA/B3B,IAsCA+C,EAAqBvC,KAAK,YAAY,GACtCqC,EAAsBrC,KAAK,YAAY,GACvCqC,EAAsBO,KAAK,gBAAgBd,SACpC1E,EAAE,qCAAqC4C,KAAK,YAAY,QAIlEE,QAAQ,UAEX9C,EAAE,iBAAiBqB,GAAG,SAAU,SAAUC,GACxC,OAAOtB,EAAEgB,GAAgB8B,QAAQ,YAG5B9C,EAAE,6BAA6BqB,GAAG,gCAAiC,SAAUC,GAClF,OAAOtB,EAAEgB,GAAgB8B,QAAQ,kBAtMrC,MA0MDI,UAAKuC","file":"wc-square-admin-products.min.js"}
1
+ {"version":3,"sources":["wc-square-admin-products.min.js"],"names":["indexOf","jQuery","document","ready","$","$manageDesc","$manageField","$manageInput","$stockFields","$stockInput","handleAttributes","handleSKU","hasMultipleAttributes","hasSKU","isVariable","manageDescOriginal","manageStockOriginal","pagenow","ref","ref1","syncCheckboxID","typenow","window","wc_square_admin_products","is_product_sync_enabled","on","$row","data","postID","this","closest","find","val","action","security","get_quick_edit_product_details_nonce","product_id","post","ajax_url","response","$editRow","$errors","$manageStockDesc","$manageStockInput","$manageStockLabel","$sku","$squareSynced","$stockQty","$stockStatus","edit_url","i18n","is_variable","success","prop","show","settings_url","synced_with_square","is_synced_with_square","e","trigger","hide","off","add","css","opacity","remove","is","append","is_woocommerce_sor","synced_with_square_taxonomy","ref2","call","variable_product_types","$variation_attributes","length","text","useSquare","variableProduct","is_inventory_sync_enabled","inArray","html","change","after","fetch_stock_with_square","$spinner","preventDefault","fetch_product_stock_with_square_nonce","quantity","console","log","is_square_sor","managed_by_square","each","$variationManageField","$variationManageInput","$variationStockField","$variationStockInput","fetchVariationStockActionID","variationID","attr","parent","next","undefined"],"mappings":"AAAA,cAEA,WAGE,IAAIA,KAAaA,QAOjBC,OAAOC,UAAUC,MAAM,SAAUC,GA8B/B,IAAIC,EAAaC,EAAcC,EAAcC,EAAcC,EAAaC,EAAkBC,EAAWC,EAAuBC,EAAQC,EAAYC,EAAoBC,EAAqBC,EAASC,EAAKC,EAAMC,EAAgBC,EAI7N,GAHAA,EAAoC,OAAzBH,EAAMI,OAAOD,SAAmBH,EAAM,GACjDD,EAAqC,OAA1BE,EAAOG,OAAOL,SAAmBE,EAAO,GAE/C,YAAcE,GAIbE,yBAAyBC,wBAuG9B,MAnGI,iBAAmBP,GAErBb,EAAE,aAAaqB,GAAG,QAAS,cAAe,WACxC,IAAIC,EAAMC,EAAMC,EAQhB,OAPAF,EAAOtB,EAAEyB,MAAMC,QAAQ,MACvBF,EAASF,EAAKK,KAAK,yBAAyBC,MAC5CL,GACEM,OAAQ,2CACRC,SAAUX,yBAAyBY,qCACnCC,WAAYV,EAAKK,KAAK,yBAAyBC,OAE1C5B,EAAEiC,KAAKd,yBAAyBe,SAAUX,EAAM,SAAUY,GAC/D,IAAIC,EAAU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ffee CHANGED
@@ -33,6 +33,9 @@ jQuery( document ).ready ( $ ) ->
33
 
34
  $inventory_sync_row.show()
35
  else
 
 
 
36
  $inventory_sync_row.hide()
37
 
38
  # toggle the "Hide missing products" setting depending on the SOR
33
 
34
  $inventory_sync_row.show()
35
  else
36
+
37
+ $inventory_sync.prop( 'checked', false )
38
+
39
  $inventory_sync_row.hide()
40
 
41
  # toggle the "Hide missing products" setting depending on the SOR
assets/js/admin/wc-square-admin-settings.min.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";(function(){jQuery(document).ready(function(e){var s,t,r,n;if(null!=(r=window.typenow)?r:"","woocommerce_page_wc-settings"===(null!=(n=window.pagenow)?n:""))return e("#wc_square_system_of_record").change(function(){var s,t,r;return r=e(this).val(),s=e("#wc_square_enable_inventory_sync"),t=s.closest("tr"),"square"===r||"woocommerce"===r?(s.next("span").html(wc_square_admin_settings.i18n.sync_inventory_label[r]),t.find(".description").html(wc_square_admin_settings.i18n.sync_inventory_description[r]),t.show()):t.hide(),"square"===r?e("#wc_square_hide_missing_products").closest("tr").show():e("#wc_square_hide_missing_products").closest("tr").hide()}).change(),e(".js-import-square-products").on("click",function(s){return s.preventDefault(),new e.WCBackboneModal.View({target:"wc-square-import-products"}),e("#btn-close").on("click",function(s){return s.preventDefault(),e("button.modal-close").trigger("click")}),e("#btn-ok").on("click",function(s){var t;return s.preventDefault(),e(this).unbind(),t={action:"wc_square_import_products_from_square",dispatch:wc_square_admin_settings.sync_in_background,security:wc_square_admin_settings.import_products_from_square},e.post(wc_square_admin_settings.ajax_url,t,function(e){var s;return s=e.data?e.data:null,e.success&&s?alert(s):!e.success&&s&&alert(s),location.reload()})})}),e("#wc-square-sync").on("click",function(s){return s.preventDefault(),new e.WCBackboneModal.View({target:"wc-square-sync"}),e("#btn-close").on("click",function(s){return s.preventDefault(),e("button.modal-close").trigger("click")}),e("#btn-ok").on("click",function(s){var t;return s.preventDefault(),e(this).unbind(),e("table.sync").block({message:null,overlayCSS:{opacity:"0.2"}}),e("table.records").block({message:null,overlayCSS:{opacity:"0.2"}}),e("#wc-square_clear-sync-records").prop("disabled",!0),t={action:"wc_square_sync_products_with_square",dispatch:wc_square_admin_settings.sync_in_background,security:wc_square_admin_settings.sync_products_with_square},e.post(wc_square_admin_settings.ajax_url,t,function(s){return s&&s.success?location.reload():(e("#wc-square_clear-sync-records").prop("disabled",!1),e("table.sync").unblock(),e("table.records").unblock(),console.log(s))})})}),t='<tr><td colspan="4"><em>'+wc_square_admin_settings.i18n.no_records_found+"</em></td></tr>",e("#wc-square_clear-sync-records").on("click",function(s){var r;return s.preventDefault(),e("table.records").block({message:null,overlayCSS:{opacity:"0.2"}}),r={action:"wc_square_handle_sync_records",id:"all",handle:"delete",security:wc_square_admin_settings.handle_sync_with_square_records},e.post(wc_square_admin_settings.ajax_url,r,function(s){return s&&s.success?(e("table.records tbody").html(t),e("#wc-square_clear-sync-records").prop("disabled",!0)):(s.data&&alert(s.data),console.log(s)),e("table.records").unblock()})}),e(".records .actions button.action").on("click",function(s){var r,n,a;return s.preventDefault(),e("table.records").block({message:null,overlayCSS:{opacity:"0.2"}}),a=e(this).data("id"),r=e(this).data("action"),n={action:"wc_square_handle_sync_records",id:a,handle:r,security:wc_square_admin_settings.handle_sync_with_square_records},e.post(wc_square_admin_settings.ajax_url,n,function(s){var n;return s&&s.success?(n="#record-"+a,"delete"===r?(e(n).remove(),e("table.records tbody tr").length||(e("table.records tbody").html(t),e("#wc-square_clear-sync-records").prop("disabled",!0))):"resolve"!==r&&"unsync"!==r||(e(n+" .type").html('<mark class="resolved"><span>'+wc_square_admin_settings.i18n.resolved+"</span></mark>"),e(n+" .actions").html("&mdash;"))):(s&&s.data&&alert(s.data),console.log({record:a,action:r,response:s})),e("table.records").unblock()})}),s=function(t){var r,n;return(r=e("span.progress"))&&0!==r.length||(e("p.sync-result").append(' <span class="progress" style="display:block"></span>'),r=e("span.progress")),n={action:"wc_square_get_sync_with_square_status",security:wc_square_admin_settings.get_sync_with_square_status_nonce,job_id:t},e.post(wc_square_admin_settings.ajax_url,n,function(t){var n,a;if(t&&t.data)return t.success&&t.data.id?(e("table.sync .spinner").css("visibility","visible"),e("#wc-square_clear-sync-records").prop("disabled",!0),e("table.records .actions button").prop("disabled",!0),"completed"!==(a=t.data.status)&&"failed"!==a?(n=" ","product_import"===t.data.action?(n+=wc_square_admin_settings.i18n.skipped+": "+parseInt(t.data.skipped_products_count,10)+"<br/>",n+=wc_square_admin_settings.i18n.imported+": "+parseInt(t.data.processed_products_count,10)):t.data.percentage&&(n+=parseInt(t.data.percentage,10)+"%"),r.html(n),setTimeout(function(){return s(t.data.id)},3e4)):location.reload()):(e("#wc-square_clear-sync-records").prop("disabled",!1),e("table.records .actions button").prop("disabled",!1),e("table.sync .spinner").css("visibility","hidden"),console.log(t))})},wc_square_admin_settings.existing_sync_job_id?s(wc_square_admin_settings.existing_sync_job_id):void 0})}).call(void 0);
2
  //# sourceMappingURL=wc-square-admin-settings.min.js.map
1
+ "use strict";(function(){jQuery(document).ready(function(e){var s,t,r,n;if(null!=(r=window.typenow)?r:"","woocommerce_page_wc-settings"===(null!=(n=window.pagenow)?n:""))return e("#wc_square_system_of_record").change(function(){var s,t,r;return r=e(this).val(),s=e("#wc_square_enable_inventory_sync"),t=s.closest("tr"),"square"===r||"woocommerce"===r?(s.next("span").html(wc_square_admin_settings.i18n.sync_inventory_label[r]),t.find(".description").html(wc_square_admin_settings.i18n.sync_inventory_description[r]),t.show()):(s.prop("checked",!1),t.hide()),"square"===r?e("#wc_square_hide_missing_products").closest("tr").show():e("#wc_square_hide_missing_products").closest("tr").hide()}).change(),e(".js-import-square-products").on("click",function(s){return s.preventDefault(),new e.WCBackboneModal.View({target:"wc-square-import-products"}),e("#btn-close").on("click",function(s){return s.preventDefault(),e("button.modal-close").trigger("click")}),e("#btn-ok").on("click",function(s){var t;return s.preventDefault(),e(this).unbind(),t={action:"wc_square_import_products_from_square",dispatch:wc_square_admin_settings.sync_in_background,security:wc_square_admin_settings.import_products_from_square},e.post(wc_square_admin_settings.ajax_url,t,function(e){var s;return s=e.data?e.data:null,e.success&&s?alert(s):!e.success&&s&&alert(s),location.reload()})})}),e("#wc-square-sync").on("click",function(s){return s.preventDefault(),new e.WCBackboneModal.View({target:"wc-square-sync"}),e("#btn-close").on("click",function(s){return s.preventDefault(),e("button.modal-close").trigger("click")}),e("#btn-ok").on("click",function(s){var t;return s.preventDefault(),e(this).unbind(),e("table.sync").block({message:null,overlayCSS:{opacity:"0.2"}}),e("table.records").block({message:null,overlayCSS:{opacity:"0.2"}}),e("#wc-square_clear-sync-records").prop("disabled",!0),t={action:"wc_square_sync_products_with_square",dispatch:wc_square_admin_settings.sync_in_background,security:wc_square_admin_settings.sync_products_with_square},e.post(wc_square_admin_settings.ajax_url,t,function(s){return s&&s.success?location.reload():(e("#wc-square_clear-sync-records").prop("disabled",!1),e("table.sync").unblock(),e("table.records").unblock(),console.log(s))})})}),t='<tr><td colspan="4"><em>'+wc_square_admin_settings.i18n.no_records_found+"</em></td></tr>",e("#wc-square_clear-sync-records").on("click",function(s){var r;return s.preventDefault(),e("table.records").block({message:null,overlayCSS:{opacity:"0.2"}}),r={action:"wc_square_handle_sync_records",id:"all",handle:"delete",security:wc_square_admin_settings.handle_sync_with_square_records},e.post(wc_square_admin_settings.ajax_url,r,function(s){return s&&s.success?(e("table.records tbody").html(t),e("#wc-square_clear-sync-records").prop("disabled",!0)):(s.data&&alert(s.data),console.log(s)),e("table.records").unblock()})}),e(".records .actions button.action").on("click",function(s){var r,n,a;return s.preventDefault(),e("table.records").block({message:null,overlayCSS:{opacity:"0.2"}}),a=e(this).data("id"),r=e(this).data("action"),n={action:"wc_square_handle_sync_records",id:a,handle:r,security:wc_square_admin_settings.handle_sync_with_square_records},e.post(wc_square_admin_settings.ajax_url,n,function(s){var n;return s&&s.success?(n="#record-"+a,"delete"===r?(e(n).remove(),e("table.records tbody tr").length||(e("table.records tbody").html(t),e("#wc-square_clear-sync-records").prop("disabled",!0))):"resolve"!==r&&"unsync"!==r||(e(n+" .type").html('<mark class="resolved"><span>'+wc_square_admin_settings.i18n.resolved+"</span></mark>"),e(n+" .actions").html("&mdash;"))):(s&&s.data&&alert(s.data),console.log({record:a,action:r,response:s})),e("table.records").unblock()})}),s=function(t){var r,n;return(r=e("span.progress"))&&0!==r.length||(e("p.sync-result").append(' <span class="progress" style="display:block"></span>'),r=e("span.progress")),n={action:"wc_square_get_sync_with_square_status",security:wc_square_admin_settings.get_sync_with_square_status_nonce,job_id:t},e.post(wc_square_admin_settings.ajax_url,n,function(t){var n,a;if(t&&t.data)return t.success&&t.data.id?(e("table.sync .spinner").css("visibility","visible"),e("#wc-square_clear-sync-records").prop("disabled",!0),e("table.records .actions button").prop("disabled",!0),"completed"!==(a=t.data.status)&&"failed"!==a?(n=" ","product_import"===t.data.action?(n+=wc_square_admin_settings.i18n.skipped+": "+parseInt(t.data.skipped_products_count,10)+"<br/>",n+=wc_square_admin_settings.i18n.imported+": "+parseInt(t.data.processed_products_count,10)):t.data.percentage&&(n+=parseInt(t.data.percentage,10)+"%"),r.html(n),setTimeout(function(){return s(t.data.id)},3e4)):location.reload()):(e("#wc-square_clear-sync-records").prop("disabled",!1),e("table.records .actions button").prop("disabled",!1),e("table.sync .spinner").css("visibility","hidden"),console.log(t))})},wc_square_admin_settings.existing_sync_job_id?s(wc_square_admin_settings.existing_sync_job_id):void 0})}).call(void 0);
2
  //# sourceMappingURL=wc-square-admin-settings.min.js.map
assets/js/admin/wc-square-admin-settings.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["wc-square-admin-settings.min.js"],"names":["jQuery","document","ready","$","_getSyncStatus","noRecordsFoundRow","ref","ref1","window","typenow","pagenow","change","$inventory_sync","$inventory_sync_row","system_of_record","this","val","closest","next","html","wc_square_admin_settings","i18n","sync_inventory_label","find","sync_inventory_description","show","hide","on","e","preventDefault","WCBackboneModal","View","target","trigger","data","unbind","action","dispatch","sync_in_background","security","import_products_from_square","post","ajax_url","response","message","success","alert","location","reload","block","overlayCSS","opacity","prop","sync_products_with_square","unblock","console","log","no_records_found","id","handle","handle_sync_with_square_records","recordId","rowId","remove","length","resolved","record","job_id","$progress","append","get_sync_with_square_status_nonce","progress","ref2","css","status","skipped","parseInt","skipped_products_count","imported","processed_products_count","percentage","setTimeout","existing_sync_job_id","call","undefined"],"mappings":"AAAA,cAEA,WAQEA,OAAOC,UAAUC,MAAM,SAAUC,GAQ/B,IAAIC,EAAgBC,EAA4BC,EAAKC,EAIrD,GAHoC,OAAzBD,EAAME,OAAOC,SAAmBH,EAAM,GAG7C,kCAFiC,OAA1BC,EAAOC,OAAOE,SAAmBH,EAAO,IAsOnD,OAhOAJ,EAAE,+BAA+BQ,OAAO,WACtC,IAAIC,EAAiBC,EAAqBC,EAa1C,OAZAA,EAAmBX,EAAEY,MAAMC,MAC3BJ,EAAkBT,EAAE,oCACpBU,EAAsBD,EAAgBK,QAAQ,MAErB,WAArBH,GAAsD,gBAArBA,GACnCF,EAAgBM,KAAK,QAAQC,KAAKC,yBAAyBC,KAAKC,qBAAqBR,IACrFD,EAAoBU,KAAK,gBAAgBJ,KAAKC,yBAAyBC,KAAKG,2BAA2BV,IACvGD,EAAoBY,QAEpBZ,EAAoBa,OAGlB,WAAaZ,EACRX,EAAE,oCAAoCc,QAAQ,MAAMQ,OAEpDtB,EAAE,oCAAoCc,QAAQ,MAAMS,SAE5Df,SACHR,EAAE,8BAA8BwB,GAAG,QAAS,SAAUC,GASpD,OARAA,EAAEC,iBACF,IAAI1B,EAAE2B,gBAAgBC,MACpBC,OAAQ,8BAEV7B,EAAE,cAAcwB,GAAG,QAAS,SAAUC,GAEpC,OADAA,EAAEC,iBACK1B,EAAE,sBAAsB8B,QAAQ,WAElC9B,EAAE,WAAWwB,GAAG,QAAS,SAAUC,GACxC,IAAIM,EAQJ,OAPAN,EAAEC,iBACF1B,EAAEY,MAAMoB,SACRD,GACEE,OAAQ,wCACRC,SAAUjB,yBAAyBkB,mBACnCC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B+B,GACEE,OAAQ,wCACRG,SAAUnB,yBAAyBkD,kCACnCH,OAAQA,GAEHhE,EAAEsC,KAAKrB,yBAAyBsB,SAAUR,EAAM,SAAUS,GAC/D,IAAI4B,EAAUC,EACd,GAAI7B,GAAYA,EAAST,KACvB,OAAIS,EAASE,SAAWF,EAAST,KAAKwB,IAEpCvD,EAAE,uBAAuBsE,IAAI,aAAc,WAE3CtE,EAAE,iCAAiCiD,KAAK,YAAY,GACpDjD,EAAE,iCAAiCiD,KAAK,YAAY,GAEd,eAAjCoB,EAAO7B,EAAST,KAAKwC,SAAoC,WAATF,GACnDD,EAAW,IAEP,mBAAqB5B,EAAST,KAAKE,QACrCmC,GAAYnD,yBAAyBC,KAAKsD,QAAU,KAAOC,SAASjC,EAAST,KAAK2C,uBAAwB,IAAM,QAChHN,GAAYnD,yBAAyBC,KAAKyD,SAAW,KAAOF,SAASjC,EAAST,KAAK6C,yBAA0B,KACpGpC,EAAST,KAAK8C,aACvBT,GAAYK,SAASjC,EAAST,KAAK8C,WAAY,IAAM,KAEvDZ,EAAUjD,KAAKoD,GAERU,WAAW,WAChB,OAAO7E,EAAeuC,EAAST,KAAKwB,KACnC,MAGIX,SAASC,WAGlB7C,EAAE,iCAAiCiD,KAAK,YAAY,GACpDjD,EAAE,iCAAiCiD,KAAK,YAAY,GACpDjD,EAAE,uBAAuBsE,IAAI,aAAc,UACpClB,QAAQC,IAAIb,OAMvBvB,yBAAyB8D,qBACpB9E,EAAegB,yBAAyB8D,2BADjD,MAIDC,UAAKC","file":"wc-square-admin-settings.min.js"}
1
+ {"version":3,"sources":["wc-square-admin-settings.min.js"],"names":["jQuery","document","ready","$","_getSyncStatus","noRecordsFoundRow","ref","ref1","window","typenow","pagenow","change","$inventory_sync","$inventory_sync_row","system_of_record","this","val","closest","next","html","wc_square_admin_settings","i18n","sync_inventory_label","find","sync_inventory_description","show","prop","hide","on","e","preventDefault","WCBackboneModal","View","target","trigger","data","unbind","action","dispatch","sync_in_background","security","import_products_from_square","post","ajax_url","response","message","success","alert","location","reload","block","overlayCSS","opacity","sync_products_with_square","unblock","console","log","no_records_found","id","handle","handle_sync_with_square_records","recordId","rowId","remove","length","resolved","record","job_id","$progress","append","get_sync_with_square_status_nonce","progress","ref2","css","status","skipped","parseInt","skipped_products_count","imported","processed_products_count","percentage","setTimeout","existing_sync_job_id","call","undefined"],"mappings":"AAAA,cAEA,WAQEA,OAAOC,UAAUC,MAAM,SAAUC,GAQ/B,IAAIC,EAAgBC,EAA4BC,EAAKC,EAIrD,GAHoC,OAAzBD,EAAME,OAAOC,SAAmBH,EAAM,GAG7C,kCAFiC,OAA1BC,EAAOC,OAAOE,SAAmBH,EAAO,IAuOnD,OAjOAJ,EAAE,+BAA+BQ,OAAO,WACtC,IAAIC,EAAiBC,EAAqBC,EAc1C,OAbAA,EAAmBX,EAAEY,MAAMC,MAC3BJ,EAAkBT,EAAE,oCACpBU,EAAsBD,EAAgBK,QAAQ,MAErB,WAArBH,GAAsD,gBAArBA,GACnCF,EAAgBM,KAAK,QAAQC,KAAKC,yBAAyBC,KAAKC,qBAAqBR,IACrFD,EAAoBU,KAAK,gBAAgBJ,KAAKC,yBAAyBC,KAAKG,2BAA2BV,IACvGD,EAAoBY,SAEpBb,EAAgBc,KAAK,WAAW,GAChCb,EAAoBc,QAGlB,WAAab,EACRX,EAAE,oCAAoCc,QAAQ,MAAMQ,OAEpDtB,EAAE,oCAAoCc,QAAQ,MAAMU,SAE5DhB,SACHR,EAAE,8BAA8ByB,GAAG,QAAS,SAAUC,GASpD,OARAA,EAAEC,iBACF,IAAI3B,EAAE4B,gBAAgBC,MACpBC,OAAQ,8BAEV9B,EAAE,cAAcyB,GAAG,QAAS,SAAUC,GAEpC,OADAA,EAAEC,iBACK3B,EAAE,sBAAsB+B,QAAQ,WAElC/B,EAAE,WAAWyB,GAAG,QAAS,SAAUC,GACxC,IAAIM,EAQJ,OAPAN,EAAEC,iBACF3B,EAAEY,MAAMqB,SACRD,GACEE,OAAQ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E,OAAO,yDAC1BD,EAAYjE,EAAE,kBAEhBgC,GACEE,OAAQ,wCACRG,SAAUpB,yBAAyBkD,kCACnCH,OAAQA,GAEHhE,EAAEuC,KAAKtB,yBAAyBuB,SAAUR,EAAM,SAAUS,GAC/D,IAAI2B,EAAUC,EACd,GAAI5B,GAAYA,EAAST,KACvB,OAAIS,EAASE,SAAWF,EAAST,KAAKuB,IAEpCvD,EAAE,uBAAuBsE,IAAI,aAAc,WAE3CtE,EAAE,iCAAiCuB,KAAK,YAAY,GACpDvB,EAAE,iCAAiCuB,KAAK,YAAY,GAEd,eAAjC8C,EAAO5B,EAAST,KAAKuC,SAAoC,WAATF,GACnDD,EAAW,IAEP,mBAAqB3B,EAAST,KAAKE,QACrCkC,GAAYnD,yBAAyBC,KAAKsD,QAAU,KAAOC,SAAShC,EAAST,KAAK0C,uBAAwB,IAAM,QAChHN,GAAYnD,yBAAyBC,KAAKyD,SAAW,KAAOF,SAAShC,EAAST,KAAK4C,yBAA0B,KACpGnC,EAAST,KAAK6C,aACvBT,GAAYK,SAAShC,EAAST,KAAK6C,WAAY,IAAM,KAEvDZ,EAAUjD,KAAKoD,GAERU,WAAW,WAChB,OAAO7E,EAAewC,EAAST,KAAKuB,KACnC,MAGIV,SAASC,WAGlB9C,EAAE,iCAAiCuB,KAAK,YAAY,GACpDvB,EAAE,iCAAiCuB,KAAK,YAAY,GACpDvB,EAAE,uBAAuBsE,IAAI,aAAc,UACpClB,QAAQC,IAAIZ,OAMvBxB,yBAAyB8D,qBACpB9E,EAAegB,yBAAyB8D,2BADjD,MAIDC,UAAKC","file":"wc-square-admin-settings.min.js"}
assets/js/frontend/wc-square.coffee CHANGED
@@ -502,6 +502,12 @@ jQuery( document ).ready ( $ ) ->
502
 
503
  if errors
504
 
 
 
 
 
 
 
505
  console.error errors
506
 
507
  $( errors ).each ( index, error ) =>
@@ -509,7 +515,8 @@ jQuery( document ).ready ( $ ) ->
509
  # only display the errors that can be helped by the customer
510
  if error.type in [ 'UNSUPPORTED_CARD_BRAND', 'VALIDATION_ERROR' ]
511
 
512
- messages.push( error.message )
 
513
 
514
  # otherwise, log more serious errors to the debug log
515
  else
502
 
503
  if errors
504
 
505
+ field_order = [ "cardNumber", "expirationDate", "cvv", "postalCode" ]
506
+
507
+ # sort based on the field order
508
+ # without the brackets around a.field and b.field the precedence is different and gives different results
509
+ errors.sort (a,b) -> field_order.indexOf(a.field) - field_order.indexOf(b.field)
510
+
511
  console.error errors
512
 
513
  $( errors ).each ( index, error ) =>
515
  # only display the errors that can be helped by the customer
516
  if error.type in [ 'UNSUPPORTED_CARD_BRAND', 'VALIDATION_ERROR' ]
517
 
518
+ # To avoid confusion between CSC used in the frontend and CVV that is used in the error message
519
+ messages.push( error.message.replace /CVV/, 'CSC' )
520
 
521
  # otherwise, log more serious errors to the debug log
522
  else
assets/js/frontend/wc-square.min.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();(function(){var e=[].indexOf;jQuery(document).ready(function(t){return window.WC_Square_Payment_Form_Handler=function(){function n(e){if(_classCallCheck(this,n),this.set_payment_fields=this.set_payment_fields.bind(this),this.get_form_params=this.get_form_params.bind(this),this.handle_input_event=this.handle_input_event.bind(this),this.handle_verify_buyer_response=this.handle_verify_buyer_response.bind(this),this.id=e.id,this.id_dasherized=e.id_dasherized,this.csc_required=e.csc_required,this.enabled_card_types=e.enabled_card_types,this.square_card_types=e.square_card_types,this.ajax_log_nonce=e.ajax_log_nonce,this.ajax_url=e.ajax_url,this.application_id=e.application_id,this.currency_code=e.currency_code,this.general_error=e.general_error,this.input_styles=e.input_styles,this.is_3ds_enabled=e.is_3d_secure_enabled,this.is_add_payment_method_page=e.is_add_payment_method_page,this.is_checkout_registration_enabled=e.is_checkout_registration_enabled,this.is_user_logged_in=e.is_user_logged_in,this.location_id=e.location_id,this.logging_enabled=e.logging_enabled,t("form.checkout").length)this.form=t("form.checkout"),this.handle_checkout_page();else if(t("form#order_review").length)this.form=t("form#order_review"),this.handle_pay_page();else{if(!t("form#add_payment_method").length)return void this.log("No payment form found!");this.form=t("form#add_payment_method"),this.handle_add_payment_method_page()}this.params=window.sv_wc_payment_gateway_payment_form_params,t(document.body).on("checkout_error",function(){return t("input[name=wc-square-credit-card-payment-nonce]").val(""),t("input[name=wc-square-credit-card-buyer-verification-token]").val("")}),t(document.body).on("click","#payment_method_"+this.id,function(){if(this.payment_form)return this.log("Recalculating payment form size"),this.payment_form.recalculateSize()})}return _createClass(n,[{key:"handle_checkout_page",value:function(){var e=this;return t(document.body).on("updated_checkout",function(){return e.set_payment_fields()}),t(document.body).on("updated_checkout",function(){return e.handle_saved_payment_methods()}),this.form.on("checkout_place_order_"+this.id,function(){return e.validate_payment_data()})}},{key:"handle_saved_payment_methods",value:function(){var e,n,i;if(i=this.id_dasherized,n=this,e=t("div.js-wc-"+i+"-new-payment-method-form"),t("input.js-wc-"+this.id_dasherized+"-payment-token").change(function(){return t("input.js-wc-"+i+"-payment-token:checked").val()?e.slideUp(200):e.slideDown(200)}).change(),t("input#createaccount").change(function(){return t(this).is(":checked")?n.show_save_payment_checkbox(i):n.hide_save_payment_checkbox(i)}),t("input#createaccount").is(":checked")||t("input#createaccount").change(),!this.is_user_logged_in&&!this.is_checkout_registration_enabled)return this.hide_save_payment_checkbox(i)}},{key:"handle_pay_page",value:function(){var e=this;return this.set_payment_fields(),this.handle_saved_payment_methods(),this.form.submit(function(){if(t("#order_review input[name=payment_method]:checked").val()===e.id)return e.validate_payment_data()})}},{key:"handle_add_payment_method_page",value:function(){var e=this;return this.set_payment_fields(),this.form.submit(function(){if(t("#add_payment_method input[name=payment_method]:checked").val()===e.id)return e.validate_payment_data()})}},{key:"set_payment_fields",value:function(){var e,n,i;if(t("#wc-"+this.id_dasherized+"-account-number-hosted").is("iframe")){this.log("Re-adding payment form"),i=this.form_fields;for(e in i)n=i[e],t(n.attr("id")).replaceWith(n);return this.handle_form_loaded()}return this.payment_form&&(this.log("Destroying payment form"),this.payment_form.destroy()),this.log("Building payment form"),this.payment_form=new SqPaymentForm(this.get_form_params()),this.payment_form.build()}},{key:"get_form_params",value:function(){var e=this;return this.form_fields={card_number:t("#wc-"+this.id_dasherized+"-account-number-hosted"),expiration:t("#wc-"+this.id_dasherized+"-expiry-hosted"),csc:t("#wc-"+this.id_dasherized+"-csc-hosted"),postal_code:t("#wc-"+this.id_dasherized+"-postal-code-hosted")},{applicationId:this.application_id,locationId:this.location_id,cardNumber:{elementId:this.form_fields.card_number.attr("id"),placeholder:this.form_fields.card_number.data("placeholder")},expirationDate:{elementId:this.form_fields.expiration.attr("id"),placeholder:this.form_fields.expiration.data("placeholder")},cvv:{elementId:this.form_fields.csc.attr("id"),placeholder:this.form_fields.csc.data("placeholder")},postalCode:{elementId:this.form_fields.postal_code.attr("id"),placeholder:this.form_fields.postal_code.data("placeholder")},inputClass:"wc-"+this.id_dasherized+"-payment-field",inputStyles:this.input_styles,callbacks:{inputEventReceived:function(t){return e.handle_input_event(t)},cardNonceResponseReceived:function(t,n,i){return e.handle_card_nonce_response(t,n,i)},unsupportedBrowserDetected:function(){return e.handle_unsupported_browser()},paymentFormLoaded:function(){return e.handle_form_loaded()}}}}},{key:"handle_form_loaded",value:function(){if(this.log("Payment form loaded"),this.payment_form.setPostalCode(t("#billing_postcode").val()),t("form.checkout").length||t("#billing_postcode").val())return t(".wc-square-credit-card-card-postal-code-parent").addClass("hidden")}},{key:"handle_input_event",value:function(e){var n;if(n=t("#"+e.elementId),"cardBrandChanged"===e.eventType)return this.handle_card_brand_change(e.cardBrand,n)}},{key:"handle_card_brand_change",value:function(n,i){var a;return this.log("Card brand changed to "+n),i.attr("class",function(e,t){return t.replace(/(^|\s)card-type-\S+/g,"")}),a="plain",null!=n&&"unknown"!==n||(n=""),null!=this.square_card_types[n]&&(n=this.square_card_types[n]),a=n&&e.call(this.enabled_card_types,n)<0?"invalid":n,t("input[name=wc-"+this.id_dasherized+"-card-type]").val(n),i.addClass("card-type-"+a)}},{key:"validate_payment_data",value:function(){var e;return!this.form.is(".processing")&&(this.has_nonce()?(this.log("Payment nonce present, placing order"),!0):(e=this.get_tokenized_payment_method_id())?!this.is_3ds_enabled||(this.has_verification_token()?(this.log("Tokenized payment verification token present, placing order"),!0):(this.log("Requesting verification token for tokenized payment"),this.block_ui(),this.payment_form.verifyBuyer(e,this.get_verification_details(),this.handle_verify_buyer_response),!1)):(this.log("Requesting payment nonce"),this.block_ui(),this.payment_form.requestCardNonce(),!1))}},{key:"get_tokenized_payment_method_id",value:function(){return t(".payment_method_"+this.id).find(".js-wc-square-credit-card-payment-token:checked").val()}},{key:"handle_card_nonce_response",value:function(e,n,i){var a;return e?this.handle_errors(e):n?(this.log("Card data received"),this.log(i),this.log_data(i,"response"),i.last_4&&t("input[name=wc-"+this.id_dasherized+"-last-four]").val(i.last_4),i.exp_month&&t("input[name=wc-"+this.id_dasherized+"-exp-month]").val(i.exp_month),i.exp_year&&t("input[name=wc-"+this.id_dasherized+"-exp-year]").val(i.exp_year),i.billing_postal_code&&t("input[name=wc-square-credit-card-payment-postcode]").val(i.billing_postal_code),t("input[name=wc-"+this.id_dasherized+"-payment-nonce]").val(n),this.is_3ds_enabled?(this.log("Verifying buyer"),void this.payment_form.verifyBuyer(n,this.get_verification_details(),this.handle_verify_buyer_response)):this.form.submit()):(a="Nonce is missing from the Square response",this.log(a,"error"),this.log_data(a,"response"),this.handle_errors())}},{key:"handle_verify_buyer_response",value:function(e,n){var i;return e?this.handle_errors(e):n&&n.token?(this.log("Verification result received"),this.log(n),t("input[name=wc-"+this.id_dasherized+"-buyer-verification-token]").val(n.token),this.form.submit()):(i="Verification token is missing from the Square response",this.log(i,"error"),this.log_data(i,"response"),this.handle_errors())}},{key:"get_verification_details",value:function(){var e,n,i,a,r,o,s,d,l,_,c;return"CHARGE"===(c={billingContact:{familyName:null!=(e=t("#billing_last_name").val())?e:"",givenName:null!=(n=t("#billing_first_name").val())?n:"",email:null!=(i=t("#billing_email").val())?i:"",country:null!=(a=t("#billing_country").val())?a:"",region:null!=(r=t("#billing_state").val())?r:"",city:null!=(o=t("#billing_city").val())?o:"",postalCode:null!=(s=t("#billing_postcode").val())?s:"",phone:null!=(d=t("#billing_phone").val())?d:"",addressLines:[null!=(l=t("#billing_address_1").val())?l:"",null!=(_=t("#billing_address_2").val())?_:""]},intent:this.get_intent()}).intent&&(c.amount=this.get_amount(),c.currencyCode=this.currency_code),this.log(c),c}},{key:"get_intent",value:function(){var e,n;return e=t("#wc-square-credit-card-tokenize-payment-method"),n=e.is("input:checkbox")?e.is(":checked"):"true"===e.val(),!this.get_tokenized_payment_method_id()&&n?"STORE":"CHARGE"}},{key:"get_amount",value:function(){return t("input[name=wc-"+this.id_dasherized+"-amount]").val()}},{key:"handle_unsupported_browser",value:function(){}},{key:"handle_errors",value:function(){var e,n=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.log("Error getting payment data","error"),t("input[name=wc-square-credit-card-payment-nonce]").val(""),t("input[name=wc-square-credit-card-buyer-verification-token]").val(""),e=[],i&&(console.error(i),t(i).each(function(t,a){var r;return"UNSUPPORTED_CARD_BRAND"===(r=a.type)||"VALIDATION_ERROR"===r?e.push(a.message):n.log_data(i,"response")})),0===e.length&&e.push(this.general_error),this.render_errors(e),this.unblock_ui()}},{key:"render_errors",value:function(e){return t(".woocommerce-error, .woocommerce-message").remove(),this.form.prepend('<ul class="woocommerce-error"><li>'+e.join("</li><li>")+"</li></ul>"),this.form.removeClass("processing").unblock(),this.form.find(".input-text, select").blur(),t("html, body").animate({scrollTop:this.form.offset().top-100},1e3)}},{key:"block_ui",value:function(){return this.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}},{key:"unblock_ui",value:function(){return this.form.unblock()}},{key:"hide_save_payment_checkbox",value:function(e){var n;return(n=t("input.js-wc-"+e+"-tokenize-payment-method").closest("p.form-row")).hide(),n.next().hide()}},{key:"show_save_payment_checkbox",value:function(e){var n;return(n=t("input.js-wc-"+e+"-tokenize-payment-method").closest("p.form-row")).slideDown(),n.next().show()}},{key:"has_nonce",value:function(){return t("input[name=wc-"+this.id_dasherized+"-payment-nonce]").val()}},{key:"has_verification_token",value:function(){return t("input[name=wc-"+this.id_dasherized+"-buyer-verification-token]").val()}},{key:"log_data",value:function(e,n){var i;if(this.logging_enabled)return i={action:"wc_"+this.id+"_log_js_data",security:this.ajax_log_nonce,type:n,data:e},t.ajax({url:this.ajax_url,data:i})}},{key:"log",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"notice";if(this.logging_enabled)return"error"===t?console.error("Square Error: "+e):console.log("Square: "+e)}}]),n}()})}).call(void 0);
2
  //# sourceMappingURL=wc-square.min.js.map
1
+ "use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();(function(){var e=[].indexOf;jQuery(document).ready(function(t){return window.WC_Square_Payment_Form_Handler=function(){function n(e){if(_classCallCheck(this,n),this.set_payment_fields=this.set_payment_fields.bind(this),this.get_form_params=this.get_form_params.bind(this),this.handle_input_event=this.handle_input_event.bind(this),this.handle_verify_buyer_response=this.handle_verify_buyer_response.bind(this),this.id=e.id,this.id_dasherized=e.id_dasherized,this.csc_required=e.csc_required,this.enabled_card_types=e.enabled_card_types,this.square_card_types=e.square_card_types,this.ajax_log_nonce=e.ajax_log_nonce,this.ajax_url=e.ajax_url,this.application_id=e.application_id,this.currency_code=e.currency_code,this.general_error=e.general_error,this.input_styles=e.input_styles,this.is_3ds_enabled=e.is_3d_secure_enabled,this.is_add_payment_method_page=e.is_add_payment_method_page,this.is_checkout_registration_enabled=e.is_checkout_registration_enabled,this.is_user_logged_in=e.is_user_logged_in,this.location_id=e.location_id,this.logging_enabled=e.logging_enabled,t("form.checkout").length)this.form=t("form.checkout"),this.handle_checkout_page();else if(t("form#order_review").length)this.form=t("form#order_review"),this.handle_pay_page();else{if(!t("form#add_payment_method").length)return void this.log("No payment form found!");this.form=t("form#add_payment_method"),this.handle_add_payment_method_page()}this.params=window.sv_wc_payment_gateway_payment_form_params,t(document.body).on("checkout_error",function(){return t("input[name=wc-square-credit-card-payment-nonce]").val(""),t("input[name=wc-square-credit-card-buyer-verification-token]").val("")}),t(document.body).on("click","#payment_method_"+this.id,function(){if(this.payment_form)return this.log("Recalculating payment form size"),this.payment_form.recalculateSize()})}return _createClass(n,[{key:"handle_checkout_page",value:function(){var e=this;return t(document.body).on("updated_checkout",function(){return e.set_payment_fields()}),t(document.body).on("updated_checkout",function(){return e.handle_saved_payment_methods()}),this.form.on("checkout_place_order_"+this.id,function(){return e.validate_payment_data()})}},{key:"handle_saved_payment_methods",value:function(){var e,n,i;if(i=this.id_dasherized,n=this,e=t("div.js-wc-"+i+"-new-payment-method-form"),t("input.js-wc-"+this.id_dasherized+"-payment-token").change(function(){return t("input.js-wc-"+i+"-payment-token:checked").val()?e.slideUp(200):e.slideDown(200)}).change(),t("input#createaccount").change(function(){return t(this).is(":checked")?n.show_save_payment_checkbox(i):n.hide_save_payment_checkbox(i)}),t("input#createaccount").is(":checked")||t("input#createaccount").change(),!this.is_user_logged_in&&!this.is_checkout_registration_enabled)return this.hide_save_payment_checkbox(i)}},{key:"handle_pay_page",value:function(){var e=this;return this.set_payment_fields(),this.handle_saved_payment_methods(),this.form.submit(function(){if(t("#order_review input[name=payment_method]:checked").val()===e.id)return e.validate_payment_data()})}},{key:"handle_add_payment_method_page",value:function(){var e=this;return this.set_payment_fields(),this.form.submit(function(){if(t("#add_payment_method input[name=payment_method]:checked").val()===e.id)return e.validate_payment_data()})}},{key:"set_payment_fields",value:function(){var e,n,i;if(t("#wc-"+this.id_dasherized+"-account-number-hosted").is("iframe")){this.log("Re-adding payment form"),i=this.form_fields;for(e in i)n=i[e],t(n.attr("id")).replaceWith(n);return this.handle_form_loaded()}return this.payment_form&&(this.log("Destroying payment form"),this.payment_form.destroy()),this.log("Building payment form"),this.payment_form=new SqPaymentForm(this.get_form_params()),this.payment_form.build()}},{key:"get_form_params",value:function(){var e=this;return this.form_fields={card_number:t("#wc-"+this.id_dasherized+"-account-number-hosted"),expiration:t("#wc-"+this.id_dasherized+"-expiry-hosted"),csc:t("#wc-"+this.id_dasherized+"-csc-hosted"),postal_code:t("#wc-"+this.id_dasherized+"-postal-code-hosted")},{applicationId:this.application_id,locationId:this.location_id,cardNumber:{elementId:this.form_fields.card_number.attr("id"),placeholder:this.form_fields.card_number.data("placeholder")},expirationDate:{elementId:this.form_fields.expiration.attr("id"),placeholder:this.form_fields.expiration.data("placeholder")},cvv:{elementId:this.form_fields.csc.attr("id"),placeholder:this.form_fields.csc.data("placeholder")},postalCode:{elementId:this.form_fields.postal_code.attr("id"),placeholder:this.form_fields.postal_code.data("placeholder")},inputClass:"wc-"+this.id_dasherized+"-payment-field",inputStyles:this.input_styles,callbacks:{inputEventReceived:function(t){return e.handle_input_event(t)},cardNonceResponseReceived:function(t,n,i){return e.handle_card_nonce_response(t,n,i)},unsupportedBrowserDetected:function(){return e.handle_unsupported_browser()},paymentFormLoaded:function(){return e.handle_form_loaded()}}}}},{key:"handle_form_loaded",value:function(){if(this.log("Payment form loaded"),this.payment_form.setPostalCode(t("#billing_postcode").val()),t("form.checkout").length||t("#billing_postcode").val())return t(".wc-square-credit-card-card-postal-code-parent").addClass("hidden")}},{key:"handle_input_event",value:function(e){var n;if(n=t("#"+e.elementId),"cardBrandChanged"===e.eventType)return this.handle_card_brand_change(e.cardBrand,n)}},{key:"handle_card_brand_change",value:function(n,i){var a;return this.log("Card brand changed to "+n),i.attr("class",function(e,t){return t.replace(/(^|\s)card-type-\S+/g,"")}),a="plain",null!=n&&"unknown"!==n||(n=""),null!=this.square_card_types[n]&&(n=this.square_card_types[n]),a=n&&e.call(this.enabled_card_types,n)<0?"invalid":n,t("input[name=wc-"+this.id_dasherized+"-card-type]").val(n),i.addClass("card-type-"+a)}},{key:"validate_payment_data",value:function(){var e;return!this.form.is(".processing")&&(this.has_nonce()?(this.log("Payment nonce present, placing order"),!0):(e=this.get_tokenized_payment_method_id())?!this.is_3ds_enabled||(this.has_verification_token()?(this.log("Tokenized payment verification token present, placing order"),!0):(this.log("Requesting verification token for tokenized payment"),this.block_ui(),this.payment_form.verifyBuyer(e,this.get_verification_details(),this.handle_verify_buyer_response),!1)):(this.log("Requesting payment nonce"),this.block_ui(),this.payment_form.requestCardNonce(),!1))}},{key:"get_tokenized_payment_method_id",value:function(){return t(".payment_method_"+this.id).find(".js-wc-square-credit-card-payment-token:checked").val()}},{key:"handle_card_nonce_response",value:function(e,n,i){var a;return e?this.handle_errors(e):n?(this.log("Card data received"),this.log(i),this.log_data(i,"response"),i.last_4&&t("input[name=wc-"+this.id_dasherized+"-last-four]").val(i.last_4),i.exp_month&&t("input[name=wc-"+this.id_dasherized+"-exp-month]").val(i.exp_month),i.exp_year&&t("input[name=wc-"+this.id_dasherized+"-exp-year]").val(i.exp_year),i.billing_postal_code&&t("input[name=wc-square-credit-card-payment-postcode]").val(i.billing_postal_code),t("input[name=wc-"+this.id_dasherized+"-payment-nonce]").val(n),this.is_3ds_enabled?(this.log("Verifying buyer"),void this.payment_form.verifyBuyer(n,this.get_verification_details(),this.handle_verify_buyer_response)):this.form.submit()):(a="Nonce is missing from the Square response",this.log(a,"error"),this.log_data(a,"response"),this.handle_errors())}},{key:"handle_verify_buyer_response",value:function(e,n){var i;return e?this.handle_errors(e):n&&n.token?(this.log("Verification result received"),this.log(n),t("input[name=wc-"+this.id_dasherized+"-buyer-verification-token]").val(n.token),this.form.submit()):(i="Verification token is missing from the Square response",this.log(i,"error"),this.log_data(i,"response"),this.handle_errors())}},{key:"get_verification_details",value:function(){var e,n,i,a,r,o,s,d,l,_,c;return"CHARGE"===(c={billingContact:{familyName:null!=(e=t("#billing_last_name").val())?e:"",givenName:null!=(n=t("#billing_first_name").val())?n:"",email:null!=(i=t("#billing_email").val())?i:"",country:null!=(a=t("#billing_country").val())?a:"",region:null!=(r=t("#billing_state").val())?r:"",city:null!=(o=t("#billing_city").val())?o:"",postalCode:null!=(s=t("#billing_postcode").val())?s:"",phone:null!=(d=t("#billing_phone").val())?d:"",addressLines:[null!=(l=t("#billing_address_1").val())?l:"",null!=(_=t("#billing_address_2").val())?_:""]},intent:this.get_intent()}).intent&&(c.amount=this.get_amount(),c.currencyCode=this.currency_code),this.log(c),c}},{key:"get_intent",value:function(){var e,n;return e=t("#wc-square-credit-card-tokenize-payment-method"),n=e.is("input:checkbox")?e.is(":checked"):"true"===e.val(),!this.get_tokenized_payment_method_id()&&n?"STORE":"CHARGE"}},{key:"get_amount",value:function(){return t("input[name=wc-"+this.id_dasherized+"-amount]").val()}},{key:"handle_unsupported_browser",value:function(){}},{key:"handle_errors",value:function(){var e,n,i=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.log("Error getting payment data","error"),t("input[name=wc-square-credit-card-payment-nonce]").val(""),t("input[name=wc-square-credit-card-buyer-verification-token]").val(""),n=[],a&&(e=["cardNumber","expirationDate","cvv","postalCode"],a.sort(function(t,n){return e.indexOf(t.field)-e.indexOf(n.field)}),console.error(a),t(a).each(function(e,t){var r;return"UNSUPPORTED_CARD_BRAND"===(r=t.type)||"VALIDATION_ERROR"===r?n.push(t.message.replace(/CVV/,"CSC")):i.log_data(a,"response")})),0===n.length&&n.push(this.general_error),this.render_errors(n),this.unblock_ui()}},{key:"render_errors",value:function(e){return t(".woocommerce-error, .woocommerce-message").remove(),this.form.prepend('<ul class="woocommerce-error"><li>'+e.join("</li><li>")+"</li></ul>"),this.form.removeClass("processing").unblock(),this.form.find(".input-text, select").blur(),t("html, body").animate({scrollTop:this.form.offset().top-100},1e3)}},{key:"block_ui",value:function(){return this.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}},{key:"unblock_ui",value:function(){return this.form.unblock()}},{key:"hide_save_payment_checkbox",value:function(e){var n;return(n=t("input.js-wc-"+e+"-tokenize-payment-method").closest("p.form-row")).hide(),n.next().hide()}},{key:"show_save_payment_checkbox",value:function(e){var n;return(n=t("input.js-wc-"+e+"-tokenize-payment-method").closest("p.form-row")).slideDown(),n.next().show()}},{key:"has_nonce",value:function(){return t("input[name=wc-"+this.id_dasherized+"-payment-nonce]").val()}},{key:"has_verification_token",value:function(){return t("input[name=wc-"+this.id_dasherized+"-buyer-verification-token]").val()}},{key:"log_data",value:function(e,n){var i;if(this.logging_enabled)return i={action:"wc_"+this.id+"_log_js_data",security:this.ajax_log_nonce,type:n,data:e},t.ajax({url:this.ajax_url,data:i})}},{key:"log",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"notice";if(this.logging_enabled)return"error"===t?console.error("Square Error: "+e):console.log("Square: "+e)}}]),n}()})}).call(void 0);
2
  //# sourceMappingURL=wc-square.min.js.map
assets/js/frontend/wc-square.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["wc-square.min.js"],"names":["_classCallCheck","instance","Constructor","TypeError","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","prototype","indexOf","jQuery","document","ready","$","window","WC_Square_Payment_Form_Handler","args","this","set_payment_fields","bind","get_form_params","handle_input_event","handle_verify_buyer_response","id","id_dasherized","csc_required","enabled_card_types","square_card_types","ajax_log_nonce","ajax_url","application_id","currency_code","general_error","input_styles","is_3ds_enabled","is_3d_secure_enabled","is_add_payment_method_page","is_checkout_registration_enabled","is_user_logged_in","location_id","logging_enabled","form","handle_checkout_page","handle_pay_page","log","handle_add_payment_method_page","params","body","on","val","payment_form","recalculateSize","value","_this","handle_saved_payment_methods","validate_payment_data","$new_payment_method_selection","form_handler","change","slideUp","slideDown","is","show_save_payment_checkbox","hide_save_payment_checkbox","_this2","submit","_this3","_","field","ref","form_fields","attr","replaceWith","handle_form_loaded","destroy","SqPaymentForm","build","_this4","card_number","expiration","csc","postal_code","applicationId","locationId","cardNumber","elementId","placeholder","data","expirationDate","cvv","postalCode","inputClass","inputStyles","callbacks","inputEventReceived","event","cardNonceResponseReceived","errors","nonce","cardData","handle_card_nonce_response","unsupportedBrowserDetected","handle_unsupported_browser","paymentFormLoaded","setPostalCode","addClass","$input","eventType","handle_card_brand_change","cardBrand","brand","card_class","c","replace","call","tokenized_card_id","has_nonce","get_tokenized_payment_method_id","has_verification_token","block_ui","verifyBuyer","get_verification_details","requestCardNonce","find","message","handle_errors","log_data","last_4","exp_month","exp_year","billing_postal_code","verification_result","token","ref1","ref2","ref3","ref4","ref5","ref6","ref7","ref8","ref9","verification_details","billingContact","familyName","givenName","email","country","region","city","phone","addressLines","intent","get_intent","amount","get_amount","currencyCode","$save_method_input","save_payment_method","messages","_this5","arguments","undefined","console","error","each","index","type","push","render_errors","unblock_ui","remove","prepend","join","removeClass","unblock","blur","animate","scrollTop","offset","top","block","overlayCSS","background","opacity","$parent_row","closest","hide","next","show","ajax_data","action","security","ajax","url"],"mappings":"AAAA,aAIA,SAASA,gBAAgBC,EAAUC,GAAe,KAAMD,aAAoBC,GAAgB,MAAM,IAAIC,UAAU,qCAFhH,IAAIC,aAAe,WAAc,SAASC,EAAiBC,EAAQC,GAAS,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,IAAIE,EAAaH,EAAMC,GAAIE,EAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,UAAWF,IAAYA,EAAWG,UAAW,GAAMC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,IAAiB,OAAO,SAAUR,EAAae,EAAYC,GAAiJ,OAA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"}
1
+ {"version":3,"sources":["wc-square.min.js"],"names":["_classCallCheck","instance","Constructor","TypeError","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","prototype","indexOf","jQuery","document","ready","$","window","WC_Square_Payment_Form_Handler","args","this","set_payment_fields","bind","get_form_params","handle_input_event","handle_verify_buyer_response","id","id_dasherized","csc_required","enabled_card_types","square_card_types","ajax_log_nonce","ajax_url","application_id","currency_code","general_error","input_styles","is_3ds_enabled","is_3d_secure_enabled","is_add_payment_method_page","is_checkout_registration_enabled","is_user_logged_in","location_id","logging_enabled","form","handle_checkout_page","handle_pay_page","log","handle_add_payment_method_page","params","body","on","val","payment_form","recalculateSize","value","_this","handle_saved_payment_methods","validate_payment_data","$new_payment_method_selection","form_handler","change","slideUp","slideDown","is","show_save_payment_checkbox","hide_save_payment_checkbox","_this2","submit","_this3","_","field","ref","form_fields","attr","replaceWith","handle_form_loaded","destroy","SqPaymentForm","build","_this4","card_number","expiration","csc","postal_code","applicationId","locationId","cardNumber","elementId","placeholder","data","expirationDate","cvv","postalCode","inputClass","inputStyles","callbacks","inputEventReceived","event","cardNonceResponseReceived","errors","nonce","cardData","handle_card_nonce_response","unsupportedBrowserDetected","handle_unsupported_browser","paymentFormLoaded","setPostalCode","addClass","$input","eventType","handle_card_brand_change","cardBrand","brand","card_class","c","replace","call","tokenized_card_id","has_nonce","get_tokenized_payment_method_id","has_verification_token","block_ui","verifyBuyer","get_verification_details","requestCardNonce","find","message","handle_errors","log_data","last_4","exp_month","exp_year","billing_postal_code","verification_result","token","ref1","ref2","ref3","ref4","ref5","ref6","ref7","ref8","ref9","verification_details","billingContact","familyName","givenName","email","country","region","city","phone","addressLines","intent","get_intent","amount","get_amount","currencyCode","$save_method_input","save_payment_method","field_order","messages","_this5","arguments","undefined","sort","a","b","console","error","each","index","type","push","render_errors","unblock_ui","remove","prepend","join","removeClass","unblock","blur","animate","scrollTop","offset","top","block","overlayCSS","background","opacity","$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ByB,SAUtE5C,IAAK,yBACL+C,MAAO,WACL,OAAOvC,EAAE,iBAAmBI,KAAKO,cAAgB,8BAA8ByB,SAWjF5C,IAAK,WACL+C,MAAO,SAAkBmC,EAAMoF,GAC7B,IAAIuB,EAEJ,GAAKjL,KAAKuB,gBASV,OANA0J,GACEC,OAAU,MAAQlL,KAAKM,GAAK,eAC5B6K,SAAYnL,KAAKW,eACjB+I,KAAQA,EACRpF,KAAQA,GAEH1E,EAAEwL,MACPC,IAAKrL,KAAKY,SACV0D,KAAM2G,OASV7L,IAAK,MACL+C,MAAO,SAAawE,GAClB,IAAI+C,EAAOT,UAAUpK,OAAS,QAAsBqK,IAAjBD,UAAU,GAAmBA,UAAU,GAAK,SAG/E,GAAKjJ,KAAKuB,gBAGV,MAAa,UAATmI,EACKJ,QAAQC,MAAM,iBAAmB5C,GAEjC2C,QAAQ3H,IAAI,WAAagF,OAK/B7G,EAprBsC,OAurBhDmG,UAAKiD","file":"wc-square.min.js"}
i18n/languages/woocommerce-square.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Square 2.1.5\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/woocommerce/woocommerce-square/issues\n"
8
- "POT-Creation-Date: 2020-05-15 06:52:57+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -14,56 +14,60 @@ msgstr ""
14
  "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
15
  "X-Generator: grunt-wp-i18n 1.0.3\n"
16
 
17
- #: includes/AJAX.php:109
18
  msgid "Please mark product as un-synced and save, then synced again."
19
  msgstr ""
20
 
21
- #: includes/AJAX.php:122
22
  #. translators: Placeholders: %1$s = error message, %2$s = help text
23
  msgid "Unable to fetch inventory: %1$s. %2$s"
24
  msgstr ""
25
 
26
- #: includes/AJAX.php:127
27
  #. translators: Placeholders: %s = help text
28
  msgid "Error finding item in Square. %s"
29
  msgstr ""
30
 
31
- #: includes/AJAX.php:145
32
  msgid "Could not start import. Please try again."
33
  msgstr ""
34
 
35
- #: includes/AJAX.php:148
36
  msgid ""
37
  "Your products are being imported in the background! This may take some time "
38
  "to complete."
39
  msgstr ""
40
 
41
- #: includes/AJAX.php:194
42
  msgid "Could not delete records."
43
  msgstr ""
44
 
45
- #: includes/AJAX.php:203
46
  msgid "Could not delete record."
47
  msgstr ""
48
 
49
- #: includes/AJAX.php:214
50
  msgid "Could not resolve record."
51
  msgstr ""
52
 
53
- #: includes/AJAX.php:227
54
  msgid "Could not unsync product."
55
  msgstr ""
56
 
57
- #: includes/AJAX.php:239
58
  #. translators: Placeholder: %s - error message
59
  msgid "An error occurred. %s"
60
  msgstr ""
61
 
62
- #: includes/AJAX.php:284
63
  #. translators: Placeholder: %s - sync job ID
64
  msgid "No sync job in progress found %s"
65
  msgstr ""
66
 
 
 
 
 
67
  #: includes/Admin/Privacy.php:46 includes/Admin/Settings_Page.php:55
68
  #: includes/Gateway.php:58 includes/Settings.php:190 includes/Settings.php:686
69
  msgid "Square"
@@ -97,7 +101,7 @@ msgstr ""
97
  msgid "Import Products From Square"
98
  msgstr ""
99
 
100
- #: includes/Admin/Settings_Page.php:175 includes/Admin/Sync_Page.php:334
101
  msgid "Close modal window"
102
  msgstr ""
103
 
@@ -110,7 +114,7 @@ msgid ""
110
  "the import. %1$sOnly use this action to perform a one-time import!%2$s"
111
  msgstr ""
112
 
113
- #: includes/Admin/Settings_Page.php:184 includes/Admin/Sync_Page.php:366
114
  #: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:133
115
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-order-partial-capture.php:66
116
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:227
@@ -164,37 +168,41 @@ msgid "Please connect to Square to enable product sync."
164
  msgstr ""
165
 
166
  #: includes/Admin/Sync_Page.php:147
167
- msgid "There are currently no products marked to be synced with Square."
168
  msgstr ""
169
 
170
  #: includes/Admin/Sync_Page.php:149
 
 
 
 
171
  msgid "A sync is currently in progress. Please try again later."
172
  msgstr ""
173
 
174
- #: includes/Admin/Sync_Page.php:154
175
  #. translators: Placeholder: %s - reason text
176
  msgid "Product sync between WooCommerce and Square is currently unavailable. %s"
177
  msgstr ""
178
 
179
- #: includes/Admin/Sync_Page.php:161
180
  msgid "Synced products"
181
  msgstr ""
182
 
183
- #: includes/Admin/Sync_Page.php:162
184
  msgid "Latest sync"
185
  msgstr ""
186
 
187
- #: includes/Admin/Sync_Page.php:163
188
  msgid "Next sync"
189
  msgstr ""
190
 
191
- #: includes/Admin/Sync_Page.php:164 includes/Admin/Sync_Page.php:270
192
- #: includes/Admin/Sync_Page.php:311
193
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:426
194
  msgid "Actions"
195
  msgstr ""
196
 
197
- #: includes/Admin/Sync_Page.php:173 includes/Emails/Sync_Completed.php:204
198
  #. translators: Placeholder: %d number of products synced with Square
199
  #. translators: Placeholder: %d products count
200
  msgid "%d product"
@@ -202,66 +210,66 @@ msgid_plural "%d products"
202
  msgstr[0] ""
203
  msgstr[1] ""
204
 
205
- #: includes/Admin/Sync_Page.php:190
206
  msgid "Importing now&hellip;"
207
  msgstr ""
208
 
209
- #: includes/Admin/Sync_Page.php:192
210
  msgid "Syncing now&hellip;"
211
  msgstr ""
212
 
213
- #: includes/Admin/Sync_Page.php:207
214
  msgid "Not synced yet."
215
  msgstr ""
216
 
217
- #: includes/Admin/Sync_Page.php:239
218
  msgid "Sync now"
219
  msgstr ""
220
 
221
- #: includes/Admin/Sync_Page.php:268 includes/Admin/Sync_Page.php:309
222
  #: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:97
223
  msgid "Status"
224
  msgstr ""
225
 
226
- #: includes/Admin/Sync_Page.php:269 includes/Admin/Sync_Page.php:310
227
  msgid "Message"
228
  msgstr ""
229
 
230
- #: includes/Admin/Sync_Page.php:300
231
  msgid "No records found."
232
  msgstr ""
233
 
234
- #: includes/Admin/Sync_Page.php:332
235
  msgid "Sync products with Square"
236
  msgstr ""
237
 
238
- #: includes/Admin/Sync_Page.php:342
239
  msgid ""
240
  "If a match is found in Square, product data in WooCommerce will be "
241
  "overwritten with Square data."
242
  msgstr ""
243
 
244
- #: includes/Admin/Sync_Page.php:344
245
  msgid ""
246
  "If a match is found in WooCommerce, product data in Square will be "
247
  "overwritten with WooCommerce data."
248
  msgstr ""
249
 
250
- #: includes/Admin/Sync_Page.php:348
251
  msgid ""
252
  "If a match is not found in Square, the product will be hidden from the "
253
  "catalog in WooCommerce."
254
  msgstr ""
255
 
256
- #: includes/Admin/Sync_Page.php:350
257
  msgid "If a match is not found in Square, the product will be skipped in the sync."
258
  msgstr ""
259
 
260
- #: includes/Admin/Sync_Page.php:353
261
  msgid "If a match is not found, a new product will be created in Square."
262
  msgstr ""
263
 
264
- #: includes/Admin/Sync_Page.php:359
265
  #. translators: Placeholders: %1$s - the system of record name (e.g. Square or
266
  #. WooCommerce), %3%s - unordered HTML list of additional information item(s)
267
  msgid ""
@@ -269,51 +277,51 @@ msgid ""
269
  "For all products synced with Square: %2$s"
270
  msgstr ""
271
 
272
- #: includes/Admin/Sync_Page.php:367
273
  msgid "Start sync"
274
  msgstr ""
275
 
276
- #: includes/Admin.php:116 includes/Handlers/Products.php:176
277
  msgid "Synced with Square"
278
  msgstr ""
279
 
280
- #: includes/Admin.php:117
281
  msgid "Managed by Square"
282
  msgstr ""
283
 
284
- #: includes/Admin.php:118
285
  msgid "Fetch stock from Square"
286
  msgstr ""
287
 
288
- #: includes/Admin.php:150 includes/Sync/Records/Record.php:206
289
  msgid "Resolved"
290
  msgstr ""
291
 
292
- #: includes/Admin.php:151
293
  msgid "No records found"
294
  msgstr ""
295
 
296
- #: includes/Admin.php:152
297
  msgid "Skipped"
298
  msgstr ""
299
 
300
- #: includes/Admin.php:153
301
  msgid "Imported"
302
  msgstr ""
303
 
304
- #: includes/Admin.php:155
305
  msgid "Enable to fetch inventory changes from Square"
306
  msgstr ""
307
 
308
- #: includes/Admin.php:156
309
  msgid "Enable to push inventory changes to Square"
310
  msgstr ""
311
 
312
- #: includes/Admin.php:159 includes/Settings.php:200
313
  msgid "Inventory is fetched from Square periodically and updated in WooCommerce"
314
  msgstr ""
315
 
316
- #: includes/Admin.php:162
317
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag
318
  msgid ""
319
  "Inventory is %1$salways fetched from Square%2$s periodically to account for "
@@ -488,7 +496,7 @@ msgid ""
488
  "Import Products from Square settings."
489
  msgstr ""
490
 
491
- #: includes/Handlers/Product.php:351
492
  msgid "Product not synced with Square"
493
  msgstr ""
494
 
@@ -820,7 +828,7 @@ msgid_plural "Updated data for %d categories."
820
  msgstr[0] ""
821
  msgstr[1] ""
822
 
823
- #: includes/Sync/Manual_Synchronization.php:1086
824
  #. translators: Placeholder: %s - product ID
825
  msgid "Product %s could not be updated in Square."
826
  msgstr ""
@@ -3029,12 +3037,12 @@ msgstr ""
3029
  msgid "https://www.woocommerce.com/"
3030
  msgstr ""
3031
 
3032
- #: includes/Admin/Sync_Page.php:262
3033
  msgctxt "Delete all records"
3034
  msgid "Clear history"
3035
  msgstr ""
3036
 
3037
- #: includes/Admin/Sync_Page.php:267 includes/Admin/Sync_Page.php:308
3038
  msgctxt "Date - Time"
3039
  msgid "Time"
3040
  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.1.6\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/woocommerce/woocommerce-square/issues\n"
8
+ "POT-Creation-Date: 2020-07-15 06:10:22+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
14
  "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
15
  "X-Generator: grunt-wp-i18n 1.0.3\n"
16
 
17
+ #: includes/AJAX.php:112
18
  msgid "Please mark product as un-synced and save, then synced again."
19
  msgstr ""
20
 
21
+ #: includes/AJAX.php:125
22
  #. translators: Placeholders: %1$s = error message, %2$s = help text
23
  msgid "Unable to fetch inventory: %1$s. %2$s"
24
  msgstr ""
25
 
26
+ #: includes/AJAX.php:130
27
  #. translators: Placeholders: %s = help text
28
  msgid "Error finding item in Square. %s"
29
  msgstr ""
30
 
31
+ #: includes/AJAX.php:148
32
  msgid "Could not start import. Please try again."
33
  msgstr ""
34
 
35
+ #: includes/AJAX.php:151
36
  msgid ""
37
  "Your products are being imported in the background! This may take some time "
38
  "to complete."
39
  msgstr ""
40
 
41
+ #: includes/AJAX.php:197
42
  msgid "Could not delete records."
43
  msgstr ""
44
 
45
+ #: includes/AJAX.php:206
46
  msgid "Could not delete record."
47
  msgstr ""
48
 
49
+ #: includes/AJAX.php:217
50
  msgid "Could not resolve record."
51
  msgstr ""
52
 
53
+ #: includes/AJAX.php:230
54
  msgid "Could not unsync product."
55
  msgstr ""
56
 
57
+ #: includes/AJAX.php:242
58
  #. translators: Placeholder: %s - error message
59
  msgid "An error occurred. %s"
60
  msgstr ""
61
 
62
+ #: includes/AJAX.php:287
63
  #. translators: Placeholder: %s - sync job ID
64
  msgid "No sync job in progress found %s"
65
  msgstr ""
66
 
67
+ #: includes/AJAX.php:324
68
+ msgid "Stock must be fetched from Square before editing stock quantity"
69
+ msgstr ""
70
+
71
  #: includes/Admin/Privacy.php:46 includes/Admin/Settings_Page.php:55
72
  #: includes/Gateway.php:58 includes/Settings.php:190 includes/Settings.php:686
73
  msgid "Square"
101
  msgid "Import Products From Square"
102
  msgstr ""
103
 
104
+ #: includes/Admin/Settings_Page.php:175 includes/Admin/Sync_Page.php:336
105
  msgid "Close modal window"
106
  msgstr ""
107
 
114
  "the import. %1$sOnly use this action to perform a one-time import!%2$s"
115
  msgstr ""
116
 
117
+ #: includes/Admin/Settings_Page.php:184 includes/Admin/Sync_Page.php:368
118
  #: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:133
119
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-order-partial-capture.php:66
120
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:227
168
  msgstr ""
169
 
170
  #: includes/Admin/Sync_Page.php:147
171
+ msgid "Please set the business location to enable product sync."
172
  msgstr ""
173
 
174
  #: includes/Admin/Sync_Page.php:149
175
+ msgid "There are currently no products marked to be synced with Square."
176
+ msgstr ""
177
+
178
+ #: includes/Admin/Sync_Page.php:151
179
  msgid "A sync is currently in progress. Please try again later."
180
  msgstr ""
181
 
182
+ #: includes/Admin/Sync_Page.php:156
183
  #. translators: Placeholder: %s - reason text
184
  msgid "Product sync between WooCommerce and Square is currently unavailable. %s"
185
  msgstr ""
186
 
187
+ #: includes/Admin/Sync_Page.php:163
188
  msgid "Synced products"
189
  msgstr ""
190
 
191
+ #: includes/Admin/Sync_Page.php:164
192
  msgid "Latest sync"
193
  msgstr ""
194
 
195
+ #: includes/Admin/Sync_Page.php:165
196
  msgid "Next sync"
197
  msgstr ""
198
 
199
+ #: includes/Admin/Sync_Page.php:166 includes/Admin/Sync_Page.php:272
200
+ #: includes/Admin/Sync_Page.php:313
201
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:426
202
  msgid "Actions"
203
  msgstr ""
204
 
205
+ #: includes/Admin/Sync_Page.php:175 includes/Emails/Sync_Completed.php:204
206
  #. translators: Placeholder: %d number of products synced with Square
207
  #. translators: Placeholder: %d products count
208
  msgid "%d product"
210
  msgstr[0] ""
211
  msgstr[1] ""
212
 
213
+ #: includes/Admin/Sync_Page.php:192
214
  msgid "Importing now&hellip;"
215
  msgstr ""
216
 
217
+ #: includes/Admin/Sync_Page.php:194
218
  msgid "Syncing now&hellip;"
219
  msgstr ""
220
 
221
+ #: includes/Admin/Sync_Page.php:209
222
  msgid "Not synced yet."
223
  msgstr ""
224
 
225
+ #: includes/Admin/Sync_Page.php:241
226
  msgid "Sync now"
227
  msgstr ""
228
 
229
+ #: includes/Admin/Sync_Page.php:270 includes/Admin/Sync_Page.php:311
230
  #: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:97
231
  msgid "Status"
232
  msgstr ""
233
 
234
+ #: includes/Admin/Sync_Page.php:271 includes/Admin/Sync_Page.php:312
235
  msgid "Message"
236
  msgstr ""
237
 
238
+ #: includes/Admin/Sync_Page.php:302
239
  msgid "No records found."
240
  msgstr ""
241
 
242
+ #: includes/Admin/Sync_Page.php:334
243
  msgid "Sync products with Square"
244
  msgstr ""
245
 
246
+ #: includes/Admin/Sync_Page.php:344
247
  msgid ""
248
  "If a match is found in Square, product data in WooCommerce will be "
249
  "overwritten with Square data."
250
  msgstr ""
251
 
252
+ #: includes/Admin/Sync_Page.php:346
253
  msgid ""
254
  "If a match is found in WooCommerce, product data in Square will be "
255
  "overwritten with WooCommerce data."
256
  msgstr ""
257
 
258
+ #: includes/Admin/Sync_Page.php:350
259
  msgid ""
260
  "If a match is not found in Square, the product will be hidden from the "
261
  "catalog in WooCommerce."
262
  msgstr ""
263
 
264
+ #: includes/Admin/Sync_Page.php:352
265
  msgid "If a match is not found in Square, the product will be skipped in the sync."
266
  msgstr ""
267
 
268
+ #: includes/Admin/Sync_Page.php:355
269
  msgid "If a match is not found, a new product will be created in Square."
270
  msgstr ""
271
 
272
+ #: includes/Admin/Sync_Page.php:361
273
  #. translators: Placeholders: %1$s - the system of record name (e.g. Square or
274
  #. WooCommerce), %3%s - unordered HTML list of additional information item(s)
275
  msgid ""
277
  "For all products synced with Square: %2$s"
278
  msgstr ""
279
 
280
+ #: includes/Admin/Sync_Page.php:369
281
  msgid "Start sync"
282
  msgstr ""
283
 
284
+ #: includes/Admin.php:115 includes/Handlers/Products.php:176
285
  msgid "Synced with Square"
286
  msgstr ""
287
 
288
+ #: includes/Admin.php:116
289
  msgid "Managed by Square"
290
  msgstr ""
291
 
292
+ #: includes/Admin.php:117
293
  msgid "Fetch stock from Square"
294
  msgstr ""
295
 
296
+ #: includes/Admin.php:149 includes/Sync/Records/Record.php:206
297
  msgid "Resolved"
298
  msgstr ""
299
 
300
+ #: includes/Admin.php:150
301
  msgid "No records found"
302
  msgstr ""
303
 
304
+ #: includes/Admin.php:151
305
  msgid "Skipped"
306
  msgstr ""
307
 
308
+ #: includes/Admin.php:152
309
  msgid "Imported"
310
  msgstr ""
311
 
312
+ #: includes/Admin.php:154
313
  msgid "Enable to fetch inventory changes from Square"
314
  msgstr ""
315
 
316
+ #: includes/Admin.php:155
317
  msgid "Enable to push inventory changes to Square"
318
  msgstr ""
319
 
320
+ #: includes/Admin.php:158 includes/Settings.php:200
321
  msgid "Inventory is fetched from Square periodically and updated in WooCommerce"
322
  msgstr ""
323
 
324
+ #: includes/Admin.php:161
325
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag
326
  msgid ""
327
  "Inventory is %1$salways fetched from Square%2$s periodically to account for "
496
  "Import Products from Square settings."
497
  msgstr ""
498
 
499
+ #: includes/Handlers/Product.php:294
500
  msgid "Product not synced with Square"
501
  msgstr ""
502
 
828
  msgstr[0] ""
829
  msgstr[1] ""
830
 
831
+ #: includes/Sync/Manual_Synchronization.php:1099
832
  #. translators: Placeholder: %s - product ID
833
  msgid "Product %s could not be updated in Square."
834
  msgstr ""
3037
  msgid "https://www.woocommerce.com/"
3038
  msgstr ""
3039
 
3040
+ #: includes/Admin/Sync_Page.php:264
3041
  msgctxt "Delete all records"
3042
  msgid "Clear history"
3043
  msgstr ""
3044
 
3045
+ #: includes/Admin/Sync_Page.php:269 includes/Admin/Sync_Page.php:310
3046
  msgctxt "Date - Time"
3047
  msgid "Time"
3048
  msgstr ""
includes/AJAX.php CHANGED
@@ -46,7 +46,7 @@ class AJAX {
46
  public function __construct() {
47
 
48
  // check an individual product sync status
49
- add_action( 'wp_ajax_wc_square_is_product_synced_with_square', [ $this, 'is_product_synced_with_square' ] );
50
 
51
  // fetch product stock from Square
52
  add_action( 'wp_ajax_wc_square_fetch_product_stock_with_square', [ $this, 'fetch_product_stock_with_square' ] );
@@ -70,9 +70,12 @@ class AJAX {
70
  * @internal
71
  *
72
  * @since 2.0.0
 
 
73
  */
74
  public function is_product_synced_with_square() {
75
-
 
76
  check_ajax_referer( 'is-product-synced-with-square', 'security' );
77
 
78
  if ( isset( $_POST['product_id'] ) && ( $product = wc_get_product( $_POST['product_id'] ) ) ) {
@@ -284,5 +287,46 @@ class AJAX {
284
  wp_send_json_error( sprintf( esc_html__( 'No sync job in progress found %s', 'woocommerce-square' ), is_string( $job_id ) ? $job_id : null ) );
285
  }
286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
 
288
  }
46
  public function __construct() {
47
 
48
  // check an individual product sync status
49
+ add_action( 'wp_ajax_wc_square_get_quick_edit_product_details', [ $this, 'get_quick_edit_product_details' ] );
50
 
51
  // fetch product stock from Square
52
  add_action( 'wp_ajax_wc_square_fetch_product_stock_with_square', [ $this, 'fetch_product_stock_with_square' ] );
70
  * @internal
71
  *
72
  * @since 2.0.0
73
+ *
74
+ * @deprecated 2.1.6
75
  */
76
  public function is_product_synced_with_square() {
77
+ _deprecated_function( 'is_product_synced_with_square', '2.1.6', 'get_quick_edit_product_details' );
78
+
79
  check_ajax_referer( 'is-product-synced-with-square', 'security' );
80
 
81
  if ( isset( $_POST['product_id'] ) && ( $product = wc_get_product( $_POST['product_id'] ) ) ) {
287
  wp_send_json_error( sprintf( esc_html__( 'No sync job in progress found %s', 'woocommerce-square' ), is_string( $job_id ) ? $job_id : null ) );
288
  }
289
 
290
+ /**
291
+ * Get sync status, variable status, and edit url for product
292
+ *
293
+ * Used to manipulate quick edit menu for product
294
+ *
295
+ * @since 2.1.6
296
+ */
297
+ public function get_quick_edit_product_details() {
298
+
299
+ check_ajax_referer( 'get-quick-edit-product-details', 'security' );
300
+
301
+ if ( isset( $_POST[ 'product_id' ] ) && ( $product = wc_get_product( $_POST[ 'product_id' ] ) ) ) {
302
+
303
+ $is_variable = $product->is_type( 'variable' );
304
+
305
+ if ( $is_variable && $product->has_child() ) {
306
+ if ( Product::has_multiple_variation_attributes( $product ) ) {
307
+ wp_send_json_error( 'multiple_attributes' );
308
+ }
309
+
310
+ if ( ! Product::has_sku( $product ) ) {
311
+ wp_send_json_error( 'missing_variation_sku' );
312
+ }
313
+ } else {
314
+ if ( ! Product::has_sku( $product ) ) {
315
+ wp_send_json_error( 'missing_sku' );
316
+ }
317
+ }
318
+
319
+ $is_synced_with_square = Product::is_synced_with_square( $product ) ? 'yes' : 'no';
320
+ $is_woocommerce_sor = wc_square()->get_settings_handler()->is_system_of_record_woocommerce();
321
+
322
+ wp_send_json_success( [
323
+ 'edit_url' => $is_woocommerce_sor ? get_edit_post_link( $_POST[ 'product_id' ] ) : null,
324
+ 'i18n' => $is_woocommerce_sor ? __( 'Stock must be fetched from Square before editing stock quantity', 'woocommerce-square' ) : null,
325
+ 'is_synced_with_square' => $is_synced_with_square,
326
+ 'is_variable' => $is_variable,
327
+ ] );
328
+ }
329
+ wp_send_json_error( 'invalid_product' );
330
+ }
331
 
332
  }
includes/API.php CHANGED
@@ -330,12 +330,14 @@ class API extends Framework\SV_WC_API_Base {
330
  $body .= "\r\n";
331
 
332
  $body .= '--boundary' . "\r\n";
333
- $body .= 'Content-Disposition: form-data; name="image"; filename="' . esc_attr( basename( $image_path ) ) . '"' . "\r\n";
334
  $body .= 'Content-Type: image/jpeg' . "\r\n\r\n";
335
  $body .= $image . "\r\n";
336
  $body .= '--boundary--';
337
 
338
- $response = wp_remote_post( 'https://connect.squareup.com/v2/catalog/images', [
 
 
339
  'headers' => $headers,
340
  'body' => $body,
341
  ] );
330
  $body .= "\r\n";
331
 
332
  $body .= '--boundary' . "\r\n";
333
+ $body .= 'Content-Disposition: form-data; name="file"; filename="' . esc_attr( basename( $image_path ) ) . '"' . "\r\n";
334
  $body .= 'Content-Type: image/jpeg' . "\r\n\r\n";
335
  $body .= $image . "\r\n";
336
  $body .= '--boundary--';
337
 
338
+ $url = $this->client->getConfig()->getHost() . '/v2/catalog/images';
339
+
340
+ $response = wp_remote_post( $url, [
341
  'headers' => $headers,
342
  'body' => $body,
343
  ] );
includes/API/Response.php CHANGED
@@ -91,6 +91,24 @@ class Response implements Framework\SV_WC_API_Response {
91
  }
92
 
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  /**
95
  * Gets the response data as a string.
96
  *
91
  }
92
 
93
 
94
+ /**
95
+ * Determines if the API response contains a particular error code.
96
+ *
97
+ * @since 2.1.6
98
+ *
99
+ * @return bool
100
+ */
101
+ public function has_error_code( $error_code ) {
102
+
103
+ foreach( $this->get_errors() as $error ) {
104
+ if ( $error_code === $error->code ) {
105
+ return true;
106
+ }
107
+ }
108
+ return false;
109
+ }
110
+
111
+
112
  /**
113
  * Gets the response data as a string.
114
  *
includes/Admin.php CHANGED
@@ -109,9 +109,8 @@ class Admin {
109
  'is_woocommerce_sor' => $this->get_plugin()->get_settings_handler()->is_system_of_record_woocommerce(),
110
  'is_square_sor' => $this->get_plugin()->get_settings_handler()->is_system_of_record_square(),
111
  'is_inventory_sync_enabled' => $this->get_plugin()->get_settings_handler()->is_inventory_sync_enabled(),
112
- 'is_product_synced_with_square_nonce' => wp_create_nonce( 'is-product-synced-with-square' ),
113
  'fetch_product_stock_with_square_nonce' => wp_create_nonce( 'fetch-product-stock-with-square' ),
114
-
115
  'i18n' => [
116
  'synced_with_square' => __( 'Synced with Square', 'woocommerce-square' ),
117
  'managed_by_square' => __( 'Managed by Square', 'woocommerce-square' ),
109
  'is_woocommerce_sor' => $this->get_plugin()->get_settings_handler()->is_system_of_record_woocommerce(),
110
  'is_square_sor' => $this->get_plugin()->get_settings_handler()->is_system_of_record_square(),
111
  'is_inventory_sync_enabled' => $this->get_plugin()->get_settings_handler()->is_inventory_sync_enabled(),
112
+ 'get_quick_edit_product_details_nonce' => wp_create_nonce( 'get-quick-edit-product-details' ),
113
  'fetch_product_stock_with_square_nonce' => wp_create_nonce( 'fetch-product-stock-with-square' ),
 
114
  'i18n' => [
115
  'synced_with_square' => __( 'Synced with Square', 'woocommerce-square' ),
116
  'managed_by_square' => __( 'Managed by Square', 'woocommerce-square' ),
includes/Admin/Sync_Page.php CHANGED
@@ -143,6 +143,8 @@ class Sync_Page {
143
 
144
  if ( ! $is_connected ) {
145
  $disabled_reason = esc_html__( 'Please connect to Square to enable product sync.', 'woocommerce-square' );
 
 
146
  } elseif ( 0 === $synced_count ) {
147
  $disabled_reason = esc_html__( 'There are currently no products marked to be synced with Square.', 'woocommerce-square' );
148
  } elseif ( $sync_in_progress ) {
143
 
144
  if ( ! $is_connected ) {
145
  $disabled_reason = esc_html__( 'Please connect to Square to enable product sync.', 'woocommerce-square' );
146
+ } elseif ( ! wc_square()->get_settings_handler()->get_location_id() ) {
147
+ $disabled_reason = esc_html__( 'Please set the business location to enable product sync.', 'woocommerce-square' );
148
  } elseif ( 0 === $synced_count ) {
149
  $disabled_reason = esc_html__( 'There are currently no products marked to be synced with Square.', 'woocommerce-square' );
150
  } elseif ( $sync_in_progress ) {
includes/Gateway/API.php CHANGED
@@ -184,18 +184,30 @@ class API extends \WooCommerce\Square\API {
184
  */
185
  public function tokenize_payment_method( \WC_Order $order ) {
186
 
187
- // a customer ID should've already been created, but just in case...
188
- if ( empty( $order->customer_id ) ) {
189
 
190
- $response = $this->create_customer( $order );
191
 
192
- if ( ! $response->transaction_approved() ) {
 
 
193
  return $response;
194
  }
 
 
 
195
 
196
- $order->customer_id = $response->get_customer_id();
 
197
  }
198
 
 
 
 
 
 
 
199
  return $this->create_customer_card( $order );
200
  }
201
 
184
  */
185
  public function tokenize_payment_method( \WC_Order $order ) {
186
 
187
+ // a customer ID should've already been created, but there may be cases where the customer id is deleted/corrupted at Square
188
+ if ( ! empty( $order->customer_id ) ) {
189
 
190
+ $response = $this->create_customer_card( $order );
191
 
192
+ if ( $response->has_error_code( 'NOT_FOUND' ) ) {
193
+ $order->customer_id = '';
194
+ } else {
195
  return $response;
196
  }
197
+ }
198
+
199
+ $response = $this->create_customer( $order );
200
 
201
+ if ( ! $response->transaction_approved() ) {
202
+ return $response;
203
  }
204
 
205
+ // Update the user meta with the new customer id created for further API requests
206
+ update_user_meta( $order->get_user_id(), 'wc_square_customer_id', $response->get_customer_id(), $order->customer_id );
207
+
208
+ // Update the customer id on the order as well
209
+ $order->square_customer_id = $order->customer_id = $response->get_customer_id();
210
+
211
  return $this->create_customer_card( $order );
212
  }
213
 
includes/Handlers/Order.php CHANGED
@@ -262,6 +262,10 @@ class Order {
262
  */
263
  public function maybe_sync_stock_for_refund_from_other_gateway( $order_id, $refund_id ) {
264
 
 
 
 
 
265
  // Confirm we are not processing the order through the Square gateway.
266
  $order = wc_get_order( $order_id );
267
  if ( ! $order instanceof \WC_Order || Plugin::GATEWAY_ID === $order->get_payment_method() ) {
262
  */
263
  public function maybe_sync_stock_for_refund_from_other_gateway( $order_id, $refund_id ) {
264
 
265
+ if ( ! wc_square()->get_settings_handler()->is_inventory_sync_enabled() ) {
266
+ return;
267
+ }
268
+
269
  // Confirm we are not processing the order through the Square gateway.
270
  $order = wc_get_order( $order_id );
271
  if ( ! $order instanceof \WC_Order || Plugin::GATEWAY_ID === $order->get_payment_method() ) {
includes/Handlers/Product.php CHANGED
@@ -249,76 +249,19 @@ class Product {
249
  throw new Framework\SV_WC_Plugin_Exception( 'Square image url empty' );
250
  }
251
 
252
- // grab remote image to upload into WordPress before attaching to product
253
- $url_parts = parse_url( $image_url );
254
- $url_parts = explode( '/', $url_parts['path'] );
255
- $file_name = end( $url_parts );
256
- $upload_dir = wp_upload_dir();
257
- $remote_file_data = file_get_contents( $image_url );
258
-
259
- $iterator = 0;
260
-
261
- do {
262
-
263
- $file_prefix = 0 === $iterator ? '' : $iterator . '_';
264
- $local_file_path = untrailingslashit( $upload_dir['path'] ) . '/' . $file_prefix . $file_name;
265
- $iterator++;
266
-
267
- } while ( file_exists( $local_file_path ) );
268
-
269
- if ( empty( $remote_file_data ) ) {
270
- throw new Framework\SV_WC_Plugin_Exception( 'Could not fetch remote image data' );
271
  }
272
 
273
- $local_file = fopen( $local_file_path, 'wb' );
274
-
275
- if ( ! $local_file ) {
276
- throw new Framework\SV_WC_Plugin_Exception( 'Could not create new file' );
277
- }
278
-
279
- $write = fwrite( $local_file, $remote_file_data );
280
- $close = fclose( $local_file );
281
-
282
- if ( ! $write || ! $close ) {
283
- throw new Framework\SV_WC_Plugin_Exception( 'Could not write to file' );
284
- }
285
-
286
- $wp_file = wp_check_filetype( basename( $local_file_path ) );
287
-
288
- if ( ! $wp_file || ! isset( $wp_file['type'] ) ) {
289
- throw new Framework\SV_WC_Plugin_Exception( 'WordPress could not open the imported file' );
290
- }
291
-
292
- // some attachment media functions may not be available from WordPress core at this time
293
- if ( ! function_exists( 'wp_generate_attachment_metadata' ) || ! function_exists( 'wp_update_attachment_metadata' ) ) {
294
- include_once( ABSPATH . 'wp-admin/includes/image.php' );
295
- }
296
-
297
- $attachment = [
298
- 'post_mime_type' => $wp_file['type'],
299
- 'post_title' => $product->get_title(),
300
- 'post_content' => '',
301
- 'post_status' => 'inherit'
302
- ];
303
-
304
- // create WordPress attachment in database
305
- $attachment_id = wp_insert_attachment( $attachment, $local_file_path );
306
- $attachment_post = ! $attachment_id instanceof \WP_Error ? get_post( $attachment_id ) : null;
307
-
308
- if ( ! $attachment_post ) {
309
- throw new Framework\SV_WC_Plugin_Exception( 'WordPress cold not generate an attachment' );
310
- }
311
-
312
- $full_size_path = get_attached_file( $attachment_post->ID );
313
 
314
- if ( ! $full_size_path ) {
315
- throw new Framework\SV_WC_Plugin_Exception( 'WordPress could not fetch the attached file' );
316
  }
317
 
318
- $attachment_data = wp_generate_attachment_metadata( $attachment_id, $full_size_path );
319
-
320
- wp_update_attachment_metadata( $attachment_id, $attachment_data );
321
-
322
  // attach the newly updated image to product
323
  $product->set_image_id( $attachment_id );
324
 
249
  throw new Framework\SV_WC_Plugin_Exception( 'Square image url empty' );
250
  }
251
 
252
+ if ( ! function_exists( 'media_sideload_image' ) ) {
253
+ require_once( ABSPATH . 'wp-admin/includes/media.php' );
254
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
255
+ require_once( ABSPATH . 'wp-admin/includes/image.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  }
257
 
258
+ // grab remote image to upload into WordPress before attaching to product
259
+ $attachment_id = media_sideload_image( $image_url, $product->get_id(), $product->get_title(), 'id' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
 
261
+ if ( is_wp_error( $attachment_id ) ) {
262
+ throw new Framework\SV_WC_Plugin_Exception( $attachment_id->get_error_message() );
263
  }
264
 
 
 
 
 
265
  // attach the newly updated image to product
266
  $product->set_image_id( $attachment_id );
267
 
includes/Plugin.php CHANGED
@@ -42,7 +42,7 @@ class Plugin extends Framework\SV_WC_Payment_Gateway_Plugin {
42
 
43
 
44
  /** plugin version number */
45
- const VERSION = '2.1.5';
46
 
47
  /** plugin ID */
48
  const PLUGIN_ID = 'square';
42
 
43
 
44
  /** plugin version number */
45
+ const VERSION = '2.1.6';
46
 
47
  /** plugin ID */
48
  const PLUGIN_ID = 'square';
includes/Sync/Manual_Synchronization.php CHANGED
@@ -854,13 +854,14 @@ class Manual_Synchronization extends Stepped_Job {
854
 
855
  wc_square()->log( 'Upserting ' . count( $objects ) . ' catalog objects' );
856
 
857
- $is_delete_action = 'delete' === $this->get_attr( 'action' );
858
- $product_ids = array_keys( $objects );
859
- $staged_product_ids = [];
860
- $successful_product_ids = [];
861
- $total_object_count = 0;
862
- $batches = [];
863
- $result = [
 
864
  'processed' => [],
865
  'unprocessed' => $product_ids,
866
  ];
@@ -908,7 +909,10 @@ class Manual_Synchronization extends Stepped_Job {
908
  $object = $this->convert_to_catalog_object( $object );
909
  }
910
 
911
- $catalog_item = new Catalog_Item( $product_id, $is_delete_action );
 
 
 
912
  $batch = $catalog_item->get_batch( $object );
913
  $object_count = $catalog_item->get_batch_object_count();
914
 
@@ -1060,8 +1064,17 @@ class Manual_Synchronization extends Stepped_Job {
1060
  return $result;
1061
  }
1062
 
1063
- // there is no batch image endpoint
1064
- $this->push_product_image( $product );
 
 
 
 
 
 
 
 
 
1065
 
1066
  $in_progress['processed_remote_catalog_item_ids'][] = $remote_item_id;
1067
 
@@ -1135,11 +1148,6 @@ class Manual_Synchronization extends Stepped_Job {
1135
 
1136
  $local_image_id = $product->get_image_id();
1137
 
1138
- // if there is no image, or if the latest uploaded image is the same
1139
- if ( ! $local_image_id || $local_image_id == $product->get_meta( '_square_uploaded_image_id' ) ) {
1140
- return;
1141
- }
1142
-
1143
  if ( $image_path = get_attached_file( $local_image_id ) ) {
1144
 
1145
  try {
@@ -1526,9 +1534,9 @@ class Manual_Synchronization extends Stepped_Job {
1526
  $product->set_stock_quantity( $count->getQuantity() );
1527
  $product->save();
1528
  }
1529
- }
1530
 
1531
- $in_progress['processed_variation_ids'][] = $count->getCatalogObjectId();
 
1532
 
1533
  $this->set_attr( 'in_progress_pull_inventory', $in_progress );
1534
  }
854
 
855
  wc_square()->log( 'Upserting ' . count( $objects ) . ' catalog objects' );
856
 
857
+ $is_delete_action = 'delete' === $this->get_attr( 'action' );
858
+ $product_ids = array_keys( $objects );
859
+ $original_square_image_ids = [];
860
+ $staged_product_ids = [];
861
+ $successful_product_ids = [];
862
+ $total_object_count = 0;
863
+ $batches = [];
864
+ $result = [
865
  'processed' => [],
866
  'unprocessed' => $product_ids,
867
  ];
909
  $object = $this->convert_to_catalog_object( $object );
910
  }
911
 
912
+ $product = wc_get_product( $product_id );
913
+ $original_square_image_ids[ $product_id ] = $product->get_meta( '_square_item_image_id' );
914
+
915
+ $catalog_item = new Catalog_Item( $product, $is_delete_action );
916
  $batch = $catalog_item->get_batch( $object );
917
  $object_count = $catalog_item->get_batch_object_count();
918
 
1064
  return $result;
1065
  }
1066
 
1067
+ $local_image_id = $product->get_image_id();
1068
+ $product_id = $product->get_id();
1069
+
1070
+ // If there is a local image which is different from the last uploaded image
1071
+ // Or if the remote square image id has changed
1072
+ if ( ( $local_image_id && $local_image_id !== $product->get_meta( '_square_uploaded_image_id' ) ) ||
1073
+ ( ! ( $original_square_image_ids[ $product_id ] && $original_square_image_ids[ $product_id ] === $product->get_meta( '_square_item_image_id' ) ) ) ) {
1074
+ // there is no batch image endpoint
1075
+ $this->push_product_image( $product );
1076
+
1077
+ }
1078
 
1079
  $in_progress['processed_remote_catalog_item_ids'][] = $remote_item_id;
1080
 
1148
 
1149
  $local_image_id = $product->get_image_id();
1150
 
 
 
 
 
 
1151
  if ( $image_path = get_attached_file( $local_image_id ) ) {
1152
 
1153
  try {
1534
  $product->set_stock_quantity( $count->getQuantity() );
1535
  $product->save();
1536
  }
 
1537
 
1538
+ $in_progress['processed_variation_ids'][] = $count->getCatalogObjectId();
1539
+ }
1540
 
1541
  $this->set_attr( 'in_progress_pull_inventory', $in_progress );
1542
  }
includes/Sync/Product_Import.php CHANGED
@@ -874,6 +874,7 @@ class Product_Import extends Stepped_Job {
874
  }
875
 
876
  update_post_meta( $variation_id, '_manage_stock', 'yes' );
 
877
 
878
  $this->wc_save_product_price( $variation_id, $variation['regular_price'] );
879
 
874
  }
875
 
876
  update_post_meta( $variation_id, '_manage_stock', 'yes' );
877
+ update_post_meta( $variation_id, '_backorders', 'no');
878
 
879
  $this->wc_save_product_price( $variation_id, $variation['regular_price'] );
880
 
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.4
6
  Requires PHP: 5.6
7
- Stable tag: 2.1.5
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -72,6 +72,20 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
72
 
73
  == Changelog ==
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  = 2.1.5 - 2020.05.15 =
76
  * Fix - Fatal errors caused by incorrectly fetching locations before plugin init.
77
  * Fix - WordPress database error when creating the Square Customers table on servers using utf8mb4.
4
  Requires at least: 4.6
5
  Tested up to: 5.4
6
  Requires PHP: 5.6
7
+ Stable tag: 2.1.6
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
72
 
73
  == Changelog ==
74
 
75
+ = 2.1.6 - 2020.07.15 =
76
+ * Fix - Make the "Sync Now" button disabled when no business location is set in Square settings.
77
+ * Fix - Enable checking/unchecking the Manage Stock setting for all variations.
78
+ * Fix - Refunding an order paid with another payment gateway will no longer sync inventory with Square when "Do not sync product data" is selected.
79
+ * Fix - Imported variation products that are out-of-stock will no longer show on the shop page when "Hide out of stock items from the catalog" is selected.
80
+ * Fix - Product images will now sync when Square is in Sandbox mode.
81
+ * Fix - Damaged stock adjustments will now sync properly to WooCommerce when multiple stock adjustments are made.
82
+ * Fix - Improve performance when manually syncing large amount of stock adjustments from Square (some inventory updates were missing).
83
+ * Fix - Quick editing products no longer sets incorrect stock quantities or disables syncing.
84
+ * Fix - Existing customer that have been removed from the connected Square account, or can't be found will now be able to save a new card on the checkout.
85
+ * Fix - When the System of Record is set to WooCommerce, product images will now properly sync to Square.
86
+ * Tweak - Use CSC consistently in all error messages when referring to the Card Security Code.
87
+ * Tweak - Change to using WordPress core methods to import/sync images from Square.
88
+
89
  = 2.1.5 - 2020.05.15 =
90
  * Fix - Fatal errors caused by incorrectly fetching locations before plugin init.
91
  * Fix - WordPress database error when creating the Square Customers table on servers using utf8mb4.
woocommerce-square.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
- * Version: 2.1.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
@@ -19,7 +19,7 @@
19
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
20
  *
21
  * WC requires at least: 3.0
22
- * WC tested up to: 4.1
23
  */
24
 
25
  defined( 'ABSPATH' ) or exit;
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
+ * Version: 2.1.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
19
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
20
  *
21
  * WC requires at least: 3.0
22
+ * WC tested up to: 4.3
23
  */
24
 
25
  defined( 'ABSPATH' ) or exit;