WooCommerce Square - Version 2.2.3

Version Description

  • 2020.10.23 =
  • Fix - Display the correct stock quantity amount on all variations when product data is sent to Square. PR#503
  • Fix - Avoid IDEMPOTENCY_KEY_REUSED API errors when syncing product data from WooCommerce to Square by using a more unique API request key. PR#528
  • Fix - Added customer_id to Orders API to link Customers & Transactions on Square Dashboard and Transactions CSV Export. PR#527
  • Fix - Issues with the postal code not matching WooCommerce data while saving cards. PR#501
  • Fix - Prevents the "Send product data to Square" checkbox from being enabled when products and variations contain empty or duplicate SKUs. PR#525
  • Fix - Issues that caused the Square Payment Form to be unclickable on the checkout page. PR#530
  • Fix - Compatibility issues with the Square Payment form and conditional payment gateway extensions. PR#530
Download this release

Release Info

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

Code changes from version 2.2.2 to 2.2.3

assets/js/admin/wc-square-admin-products.coffee CHANGED
@@ -125,7 +125,38 @@ jQuery( document ).ready ( $ ) ->
125
  # @since 2.0.0
126
  ###
127
  hasSKU = ->
128
- return $( '#_sku' ).val() isnt ''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
 
131
  ###*
@@ -140,6 +171,30 @@ jQuery( document ).ready ( $ ) ->
140
  return isVariable() and $variation_attributes and $variation_attributes.length > 1
141
 
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  ###*
144
  # Handle SKU.
145
  #
@@ -149,22 +204,31 @@ jQuery( document ).ready ( $ ) ->
149
  ###
150
  handleSKU = ( syncCheckboxID ) ->
151
 
152
- return if isVariable()
 
 
153
 
154
- $( '#_sku' ).on 'change keypress keyup', ( e ) ->
155
 
156
- if '' is $( this ).val()
157
- $( '.wc-square-sync-with-square-error.missing_sku' ).show()
158
- $( syncCheckboxID ).prop( 'disabled', true )
159
- $( syncCheckboxID ).prop( 'checked', false )
160
- else
161
- $( '.wc-square-sync-with-square-error.missing_sku' ).hide()
162
- if not hasMultipleAttributes()
163
- $( syncCheckboxID ).prop( 'disabled', false )
164
 
165
- $( syncCheckboxID ).trigger( 'change' )
 
 
166
 
167
- .trigger 'change'
 
 
 
 
 
 
168
 
169
 
170
  ###*
@@ -179,19 +243,27 @@ jQuery( document ).ready ( $ ) ->
179
  $( '#variable_product_options' ).on 'reload', ( e ) ->
180
 
181
  if hasMultipleAttributes()
182
- $( '.wc-square-sync-with-square-error.multiple_attributes' ).show()
183
- $( syncCheckboxID ).prop( 'disabled', true )
184
- $( syncCheckboxID ).prop( 'checked', false )
185
  else
186
- $( '.wc-square-sync-with-square-error.multiple_attributes' ).hide()
187
- if hasSKU()
188
- $( syncCheckboxID ).prop( 'disabled', false )
189
-
190
  $( syncCheckboxID ).trigger( 'change' )
191
 
192
  .trigger( 'reload' )
193
 
194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  # fire once on page load
196
  handleSKU( syncCheckboxID )
197
  handleAttributes( syncCheckboxID )
@@ -298,7 +370,7 @@ jQuery( document ).ready ( $ ) ->
298
 
299
  # fetch relevant variables for each variation
300
  variationID = $( this ).find( 'h3 > a' ).attr( 'rel' )
301
- $variationManageInput = $( '.variable_manage_stock' )
302
  $variationManageField = $variationManageInput.parent()
303
  $variationStockInput = $( this ).find( '.wc_input_stock' )
304
  $variationStockField = $variationStockInput.parent()
@@ -363,14 +435,14 @@ jQuery( document ).ready ( $ ) ->
363
  $variationManageInput.next( '.description' ).remove()
364
  $( this ).find( '#wc_square_variation_manage_stock' ).prop( 'disabled', true )
365
 
366
-
367
  # initial page load handling
368
  .trigger 'change'
369
 
 
370
  # trigger an update if the product type changes
371
  $( '#product-type' ).on 'change', ( e ) ->
372
- $( syncCheckboxID ).trigger 'change'
373
 
374
- # trigger an update for variable products when variations are loaded
375
- $( '#woocommerce-product-data' ).on 'woocommerce_variations_loaded', ( e ) ->
376
- $( syncCheckboxID ).trigger 'change'
125
  # @since 2.0.0
126
  ###
127
  hasSKU = ->
128
+ return $( '#_sku' ).val().trim() isnt ''
129
+
130
+
131
+ ###*
132
+ # Checks whether the product variations all have SKUs.
133
+ #
134
+ # @since 2.2.3
135
+ ###
136
+ hasVariableSKUs = ( skus ) ->
137
+
138
+ return false if not skus.length
139
+
140
+ valid = skus.filter ->
141
+ return true if $( this ).val().trim() isnt ''
142
+
143
+ return valid.length is skus.length
144
+
145
+
146
+ ###*
147
+ # Checks whether the given skus are unique.
148
+ #
149
+ # @since 2.2.3
150
+ ###
151
+ hasUniqueSKUs = ( skus ) ->
152
+
153
+ skuValues = skus.map ( sku ) ->
154
+ $( this ).val()
155
+
156
+ skuValues = $.makeArray( skuValues )
157
+
158
+ return skuValues.every ( sku ) ->
159
+ skuValues.indexOf( sku ) is skuValues.lastIndexOf( sku )
160
 
161
 
162
  ###*
171
  return isVariable() and $variation_attributes and $variation_attributes.length > 1
172
 
173
 
174
+ ###*
175
+ # Displays the given error and disables the sync checkbox
176
+ # Accepted errors are 'missing_sku', 'missing_variation_sku', and 'multiple_attributes'
177
+ #
178
+ # @since 2.2.3
179
+ ###
180
+ showError = ( error ) ->
181
+ $( '.wc-square-sync-with-square-error.' + error ).show()
182
+ $( syncCheckboxID ).prop( 'disabled', true )
183
+ $( syncCheckboxID ).prop( 'checked', false )
184
+
185
+
186
+ ###*
187
+ # Hides the given error and maybe enables the sync checkbox
188
+ # Accepted errors are 'missing_sku', 'missing_variation_sku', and 'multiple_attributes'
189
+ #
190
+ # @since 2.2.3
191
+ ###
192
+ hideError = ( error, enable = true ) ->
193
+ $( '.wc-square-sync-with-square-error.' + error ).hide()
194
+ if enable
195
+ $( syncCheckboxID ).prop( 'disabled', false )
196
+
197
+
198
  ###*
199
  # Handle SKU.
200
  #
204
  ###
205
  handleSKU = ( syncCheckboxID ) ->
206
 
207
+ if isVariable()
208
+ $( '#_sku' ).off 'change keypress keyup'
209
+ hideError( 'missing_sku', not hasMultipleAttributes() )
210
 
211
+ skus = $( 'input[id^="variable_sku"]' )
212
 
213
+ skus.on 'change keypress keyup', ( e ) ->
214
+ if not hasVariableSKUs( skus ) or not hasUniqueSKUs( skus )
215
+ showError( 'missing_variation_sku' )
216
+ else
217
+ hideError( 'missing_variation_sku', not hasMultipleAttributes() )
218
+ $( syncCheckboxID ).trigger( 'change' )
219
+ .trigger 'change'
 
220
 
221
+ else
222
+ $( 'input[id^="variable_sku"]' ).off 'change keypress keyup'
223
+ hideError( 'missing_variation_sku', not hasMultipleAttributes() )
224
 
225
+ $( '#_sku' ).on 'change keypress keyup', ( e ) ->
226
+ if '' is $( this ).val().trim()
227
+ showError( 'missing_sku' )
228
+ else
229
+ hideError( 'missing_sku', not hasMultipleAttributes() )
230
+ $( syncCheckboxID ).trigger( 'change' )
231
+ .trigger 'change'
232
 
233
 
234
  ###*
243
  $( '#variable_product_options' ).on 'reload', ( e ) ->
244
 
245
  if hasMultipleAttributes()
246
+ showError( 'multiple_attributes' )
 
 
247
  else
248
+ hideError( 'multiple_attributes', if isVariable() then hasVariableSKUs else hasSKU() )
 
 
 
249
  $( syncCheckboxID ).trigger( 'change' )
250
 
251
  .trigger( 'reload' )
252
 
253
 
254
+ ###*
255
+ # Triggers an update to the sync checkbox, checking for relevant errors.
256
+ #
257
+ # @since 2.2.3
258
+ ###
259
+ triggerUpdate = ->
260
+ handleSKU( syncCheckboxID )
261
+ $( syncCheckboxID ).trigger 'change'
262
+ # handleSKU misses cases where product is variable with no variations
263
+ if isVariable() and not $( 'input[id^="variable_sku"]' ).length
264
+ showError( 'missing_variation_sku' )
265
+
266
+
267
  # fire once on page load
268
  handleSKU( syncCheckboxID )
269
  handleAttributes( syncCheckboxID )
370
 
371
  # fetch relevant variables for each variation
372
  variationID = $( this ).find( 'h3 > a' ).attr( 'rel' )
373
+ $variationManageInput = $( this ).find( '#wc_square_variation_manage_stock' )
374
  $variationManageField = $variationManageInput.parent()
375
  $variationStockInput = $( this ).find( '.wc_input_stock' )
376
  $variationStockField = $variationStockInput.parent()
435
  $variationManageInput.next( '.description' ).remove()
436
  $( this ).find( '#wc_square_variation_manage_stock' ).prop( 'disabled', true )
437
 
 
438
  # initial page load handling
439
  .trigger 'change'
440
 
441
+
442
  # trigger an update if the product type changes
443
  $( '#product-type' ).on 'change', ( e ) ->
444
+ triggerUpdate()
445
 
446
+ # trigger an update for variable products when variations are loaded, added, or removed.
447
+ $( '#woocommerce-product-data' ).on 'woocommerce_variations_loaded woocommerce_variations_added woocommerce_variations_removed', ( e ) ->
448
+ triggerUpdate()
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,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
1
+ "use strict";(function(){var e=[].indexOf;jQuery(document).ready(function(i){var r,t,n,a,s,o,c,d,_,u,p,l,f,h,m,k,v,g,w,y,q,b;if(b=null!=(v=window.typenow)?v:"",k=null!=(g=window.pagenow)?g:"","product"===b&&wc_square_admin_products.is_product_sync_enabled)return"edit-product"===k&&i("#the-list").on("click",".editinline",function(){var e,r,t;return e=i(this).closest("tr"),t=e.find("th.check-column input").val(),r={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()},i.post(wc_square_admin_products.ajax_url,r,function(e){var r,n,a,s,o,c,d,_,u,p,l,f;if(r=i("tr#edit-"+t),d=r.find("select.square-synced"),n=r.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 n.find(".multiple_attributes").show();if("missing_variation_sku"===e.data)return d.prop("checked",!1),d.prop("disabled",!0),void n.find(".missing_variation_sku").show()}return c=r.find("input[name=_sku]"),u=r.find("select[name=_stock_status]"),_=r.find("input[name=_stock]"),o=r.find(".manage_stock_field .manage_stock"),s=r.find("input[name=_manage_stock]"),a='<span class="description"><a href="'+wc_square_admin_products.settings_url+'">'+wc_square_admin_products.i18n.synced_with_square+"</a></span>",p=e.data.edit_url,l=e.data.i18n,f=e.data.is_variable,d.val(e.data.is_synced_with_square),c.on("change keyup keypress",function(e){return""!==i(this).val()||f?(d.prop("disabled",!1),d.trigger("change"),n.find(".missing_sku").hide()):(d.val("no"),d.prop("disabled",!0),n.find(".missing_sku").show())}).trigger("change"),d.on("change",function(e){return"no"===i(this).val()?(s.off(),s.add(_).css({opacity:1}),o.find(".description").remove(),f?s.is(":checked")?(i(".stock_qty_field").show(),i(".backorder_field").show()):i(".stock_status_field").show():(_.prop("readonly",!1),u.prop("readonly",!1))):(s.prop("checked",!0),s.on("click",function(){return!1}),s.add(_).css({opacity:"0.5"}),o.append(a),wc_square_admin_products.is_woocommerce_sor&&p&&l&&o.append('<p class="description"><a href="'+p+'">'+l+"</a></p>"),f?(i(".stock_status_field").hide(),i(".stock_qty_field").hide(),i(".backorder_field").hide()):(_.prop("readonly",!0),u.prop("readonly",!0)))}).trigger("change")})}),"product"===k?(y="#_"+wc_square_admin_products.synced_with_square_taxonomy,f=function(){var r;return r=i("#product-type").val(),e.call(wc_square_admin_products.variable_product_types,r)>=0},_=function(){return""!==i("#_sku").val().trim()},p=function(e){return!!e.length&&e.filter(function(){if(""!==i(this).val().trim())return!0}).length===e.length},u=function(e){var r;return r=e.map(function(e){return i(this).val()}),(r=i.makeArray(r)).every(function(e){return r.indexOf(e)===r.lastIndexOf(e)})},d=function(){var e;return e=i('.woocommerce_attribute_data input[name^="attribute_variation"]:checked'),f()&&e&&e.length>1},w=function(e){return i(".wc-square-sync-with-square-error."+e).show(),i(y).prop("disabled",!0),i(y).prop("checked",!1)},l=function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(i(".wc-square-sync-with-square-error."+e).hide(),r)return i(y).prop("disabled",!1)},c=function(e){var r;return f()?(i("#_sku").off("change keypress keyup"),l("missing_sku",!d()),(r=i('input[id^="variable_sku"]')).on("change keypress keyup",function(t){return p(r)&&u(r)?l("missing_variation_sku",!d()):w("missing_variation_sku"),i(e).trigger("change")}).trigger("change")):(i('input[id^="variable_sku"]').off("change keypress keyup"),l("missing_variation_sku",!d()),i("#_sku").on("change keypress keyup",function(r){return""===i(this).val().trim()?w("missing_sku"):l("missing_sku",!d()),i(e).trigger("change")}).trigger("change"))},o=function(e){return i("#variable_product_options").on("reload",function(r){return d()?w("multiple_attributes"):l("multiple_attributes",f()?p:_()),i(e).trigger("change")}).trigger("reload")},q=function(){if(c(y),i(y).trigger("change"),f()&&!i('input[id^="variable_sku"]').length)return w("missing_variation_sku")},c(y),o(y),a=i(".stock_fields"),s=a.find("#_stock"),t=i("._manage_stock_field"),n=t.find("#_manage_stock"),r=t.find(".description"),h=r.text(),m=i("#_manage_stock").is(":checked"),i(y).on("change",function(e){var t,o;if(wc_square_admin_products.is_inventory_sync_enabled)return o=-1!==i.inArray(i("#product-type").val(),wc_square_admin_products.variable_product_types),i(this).is(":checked")&&i("#_square_item_variation_id").length>0?(t=!0,r.html('<a href="'+wc_square_admin_products.settings_url+'">'+wc_square_admin_products.i18n.synced_with_square+"</a>"),n.prop("disabled",!0).prop("checked",!o).change(),s.prop("readonly",!0),o||a.show(),wc_square_admin_products.is_woocommerce_sor&&!o?(0===i("p._stock_field span.description").length&&s.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>'),i("#fetch-stock-with-square").on("click",function(e){var r,t;return e.preventDefault(),(r=i("p._stock_field span.description .spinner")).css("visibility","visible"),t={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:i("#post_ID").val()},i.post(wc_square_admin_products.ajax_url,t,function(e){var t;return e&&e.success?(t=e.data,s.val(t),a.find("input[name=_original_stock]").val(t),s.prop("readonly",!1),i("p._stock_field span.description").remove()):(e.data&&(i(".inventory-fetch-error").remove(),r.after('<span class="inventory-fetch-error" style="display:inline-block;color:red;">'+e.data+"</span>")),r.css("visibility","hidden"),console.log(e))})})):wc_square_admin_products.is_square_sor&&0===i("p._stock_field span.description").length&&s.after('<span class="description" style="display:block;clear:both;">'+wc_square_admin_products.i18n.managed_by_square+"</span>")):(t=!1,i("p._stock_field span.description").remove(),s.prop("readonly",!1),r.html(h),n.prop("disabled",!1).prop("checked",m),m&&a.show()),i(".woocommerce_variation").each(function(){var e,r,n,a,s,o;return o=i(this).find("h3 > a").attr("rel"),r=i(this).find("#wc_square_variation_manage_stock"),e=r.parent(),a=i(this).find(".wc_input_stock"),n=a.parent(),t?(r.prop("disabled",!0).prop("checked",!0).change(),a.prop("readonly",!0),i("#wc_square_variation_manage_stock").prop("disabled",!1),0===e.find(".description").length&&r.after('<span class="description">('+wc_square_admin_products.i18n.managed_by_square+")</span>"),wc_square_admin_products.is_woocommerce_sor?(s="fetch-stock-with-square-"+o,0===n.find("span.description").length&&a.after('<span class="description" style="display:block;clear:both;"><a href="#" id="'+s+'">'+wc_square_admin_products.i18n.fetch_stock_with_square+'</a><div class="spinner" style="float:none;"></div></span>'),i("#"+s).on("click",function(e){var r,t;return e.preventDefault(),(r=i(this).next(".spinner")).css("visibility","visible"),t={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:o},i.post(wc_square_admin_products.ajax_url,t,function(e){var t;return e&&e.success?(t=e.data,a.val(t),n.parent().find('input[name^="variable_original_stock"]').val(t),a.prop("readonly",!1),n.find(".description").remove()):(e.data&&(i(".inventory-fetch-error").remove(),r.after('<span class="inventory-fetch-error" style="display:inline-block;color:red;">'+e.data+"</span>")),r.css("visibility","hidden"),console.log(e))})})):void 0):(a.prop("readonly",!1),r.prop("disabled",!1),r.next(".description").remove(),i(this).find("#wc_square_variation_manage_stock").prop("disabled",!0))})}).trigger("change"),i("#product-type").on("change",function(e){return q()}),i("#woocommerce-product-data").on("woocommerce_variations_loaded woocommerce_variations_added woocommerce_variations_removed",function(e){return q()})):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","$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,EAAS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F,MAAM,+EAAiF3C,EAASZ,KAAO,YAElHyD,EAASrB,IAAI,aAAc,UACpByB,QAAQC,IAAIlD,cA/B3B,IAsCAyD,EAAqB3C,KAAK,YAAY,GACtCyC,EAAsBzC,KAAK,YAAY,GACvCyC,EAAsBO,KAAK,gBAAgBpC,SACpC7D,EAAEyB,MAAME,KAAK,qCAAqCsB,KAAK,YAAY,QAI7EM,QAAQ,UAEXvD,EAAE,iBAAiBqB,GAAG,SAAU,SAAUiC,GACxC,OAAOtD,EAAEgB,GAAgBuC,QAAQ,YAG5BvD,EAAE,6BAA6BqB,GAAG,gCAAiC,SAAUiC,GAClF,OAAOtD,EAAEgB,GAAgBuC,QAAQ,kBAtMrC,MA0MDY,UAAK+B","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","hasUniqueSKUs","hasVariableSKUs","hideError","isVariable","manageDescOriginal","manageStockOriginal","pagenow","ref","ref1","showError","syncCheckboxID","triggerUpdate","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","trim","skus","length","filter","skuValues","map","sku","makeArray","every","lastIndexOf","$variation_attributes","error","enable","arguments","undefined","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","fetchVariation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B3B,IAsCAsE,EAAqBxD,KAAK,YAAY,GACtCsD,EAAsBtD,KAAK,YAAY,GACvCsD,EAAsBO,KAAK,gBAAgBjD,SACpClE,EAAE8B,MAAME,KAAK,qCAAqCsB,KAAK,YAAY,QAI7EM,QAAQ,UAEX5D,EAAE,iBAAiB0B,GAAG,SAAU,SAAUiC,GACxC,OAAOtC,MAGFrB,EAAE,6BAA6B0B,GAAG,4FAA6F,SAAUiC,GAC9I,OAAOtC,YArPX,MAyPDmD,UAAKgB","file":"wc-square-admin-products.min.js"}
assets/js/frontend/wc-square.coffee CHANGED
@@ -170,6 +170,8 @@ jQuery( document ).ready ( $ ) ->
170
  #
171
  # @since 2.0.0
172
  set_payment_fields: =>
 
 
173
 
174
  if $( "#wc-#{@id_dasherized}-account-number-hosted" ).is( 'iframe' )
175
 
@@ -186,6 +188,7 @@ jQuery( document ).ready ( $ ) ->
186
  this.log 'Destroying payment form'
187
 
188
  @payment_form.destroy()
 
189
 
190
  this.log 'Building payment form'
191
 
@@ -373,7 +376,7 @@ jQuery( document ).ready ( $ ) ->
373
  $( "input[name=wc-#{@id_dasherized}-exp-year]" ).val( cardData.exp_year )
374
 
375
  if cardData.billing_postal_code
376
- $( "input[name=wc-square-credit-card-payment-postcode]" ).val( cardData.billing_postal_code )
377
 
378
  # payment nonce data
379
  $( "input[name=wc-#{@id_dasherized}-payment-nonce]" ).val( nonce )
170
  #
171
  # @since 2.0.0
172
  set_payment_fields: =>
173
+ if not $( "#wc-#{@id_dasherized}-account-number-hosted" ).length
174
+ return
175
 
176
  if $( "#wc-#{@id_dasherized}-account-number-hosted" ).is( 'iframe' )
177
 
188
  this.log 'Destroying payment form'
189
 
190
  @payment_form.destroy()
191
+ @payment_form = null
192
 
193
  this.log 'Building payment form'
194
 
376
  $( "input[name=wc-#{@id_dasherized}-exp-year]" ).val( cardData.exp_year )
377
 
378
  if cardData.billing_postal_code
379
+ $( "input[name=wc-#{@id_dasherized}-payment-postcode]" ).val( cardData.billing_postal_code )
380
 
381
  # payment nonce data
382
  $( "input[name=wc-#{@id_dasherized}-payment-nonce]" ).val( nonce )
assets/js/frontend/wc-square.min.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}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,this.ajax_wc_checkout_validate_nonce=e.ajax_wc_checkout_validate_nonce,this.is_manual_order_payment=e.is_manual_order_payment,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?(t(e).each(function(e,t){if(!t.field)return t.field="none"}),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=["none","cardNumber","expirationDate","cvv","postalCode"],a.length>=1&&a.sort(function(t,n){return e.indexOf(t.field)-e.indexOf(n.field)}),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.is_add_payment_method_page||this.is_manual_order_payment?this.render_errors(n):this.render_checkout_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)}},{key:"render_checkout_errors",value:function(e){var n,i,a;return n=wc_cart_fragments_params.wc_ajax_url.toString().replace("%%endpoint%%",this.id+"_checkout_handler"),i=this.form.serializeArray(),a=this,i.push({name:"wc_"+this.id+"_checkout_validate_nonce",value:this.ajax_wc_checkout_validate_nonce}),t.ajax({url:n,method:"post",cache:!1,data:i,complete:function(n){var i;return(i=n.responseJSON).hasOwnProperty("result")&&"failure"===i.result?t(i.messages).map(function(){var n;return n=[],t(this).children("li").each(function(){return n.push(t(this).text().trim())}),e.unshift.apply(e,_toConsumableArray(n))}):i.hasOwnProperty("success")&&!i.success&&e.unshift.apply(e,_toConsumableArray(i.data.messages)),a.render_errors(e)}})}}]),n}()})}).call(void 0);
2
  //# sourceMappingURL=wc-square.min.js.map
1
+ "use strict";function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}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,this.ajax_wc_checkout_validate_nonce=e.ajax_wc_checkout_validate_nonce,this.is_manual_order_payment=e.is_manual_order_payment,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").length){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.payment_form=null),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-"+this.id_dasherized+"-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?(t(e).each(function(e,t){if(!t.field)return t.field="none"}),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=["none","cardNumber","expirationDate","cvv","postalCode"],a.length>=1&&a.sort(function(t,n){return e.indexOf(t.field)-e.indexOf(n.field)}),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.is_add_payment_method_page||this.is_manual_order_payment?this.render_errors(n):this.render_checkout_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)}},{key:"render_checkout_errors",value:function(e){var n,i,a;return n=wc_cart_fragments_params.wc_ajax_url.toString().replace("%%endpoint%%",this.id+"_checkout_handler"),i=this.form.serializeArray(),a=this,i.push({name:"wc_"+this.id+"_checkout_validate_nonce",value:this.ajax_wc_checkout_validate_nonce}),t.ajax({url:n,method:"post",cache:!1,data:i,complete:function(n){var i;return(i=n.responseJSON).hasOwnProperty("result")&&"failure"===i.result?t(i.messages).map(function(){var n;return n=[],t(this).children("li").each(function(){return n.push(t(this).text().trim())}),e.unshift.apply(e,_toConsumableArray(n))}):i.hasOwnProperty("success")&&!i.success&&e.unshift.apply(e,_toConsumableArray(i.data.messages)),a.render_errors(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":["_toConsumableArray","arr","Array","isArray","i","arr2","length","from","_classCallCheck","instance","Constructor","TypeError","_createClass","defineProperties","target","props","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","ajax_wc_checkout_validate_nonce","is_manual_order_payment","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","each","index","error","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","type","push","render_errors","render_checkout_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","console","square_errors","form_data","square_handler","wc_cart_fragments_params","wc_ajax_url","toString","serializeArray","name","method","cache","complete","response","result","responseJSON","hasOwnProperty","map","children","text","trim","unshift","apply","success"],"mappings":"AAAA,aAIA,SAASA,mBAAmBC,GAAO,GAAIC,MAAMC,QAAQF,GAAM,CAAE,IAAK,IAAIG,EAAI,EAAGC,EAAOH,MAAMD,EAAIK,QAASF,EAAIH,EAAIK,OAAQF,IAAOC,EAAKD,GAAKH,EAAIG,GAAM,OAAOC,EAAe,OAAOH,MAAMK,KAAKN,GAE1L,SAASO,gBAAgBC,EAAUC,GAAe,KAAMD,aAAoBC,GAAgB,MAAM,IAAIC,UAAU,qCAJhH,IAAIC,aAAe,WAAc,SAASC,EAAiBC,EAAQC,GAAS,IAAK,IAAIX,EAAI,EAAGA,EAAIW,EA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AAcmB,QAAQC,MAAMpB,EAAe3N,mBAAmBoH,MAG9DmH,EAAOE,eAAe,aAAeF,EAAOS,SACrDrB,EAAcmB,QAAQC,MAAMpB,EAAe3N,mBAAmBuO,EAAO7H,KAAK4E,WAErEuC,EAAe9B,cAAc4B,UAMrC3L,EAjvBsC,OAovBhDqG,UAAKoD","file":"wc-square.min.js"}
1
+ {"version":3,"sources":["wc-square.min.js"],"names":["_toConsumableArray","arr","Array","isArray","i","arr2","length","from","_classCallCheck","instance","Constructor","TypeError","_createClass","defineProperties","target","props","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","ajax_wc_checkout_validate_nonce","is_manual_order_payment","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","each","index","error","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","type","push","render_errors","render_checkout_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","console","square_errors","form_data","square_handler","wc_cart_fragments_params","wc_ajax_url","toString","serializeArray","name","method","cache","complete","response","result","responseJSON","hasOwnProperty","map","children","text","trim","unshift","apply","success"],"mappings":"AAAA,aAIA,SAASA,mBAAmBC,GAAO,GAAIC,MAAMC,QAAQF,GAAM,CAAE,IAAK,IAAIG,EAAI,EAAGC,EAAOH,MAAMD,EAAIK,QAASF,EAAIH,EAAIK,OAAQF,IAAOC,EAAKD,GAAKH,EAAIG,GAAM,OAAOC,EAAe,OAAOH,MAAMK,KAAKN,GAE1L,SAASO,gBAAgBC,EAAUC,GAAe,KAAMD,aAAoBC,GAAgB,MAAM,IAAIC,UAAU,qCAJhH,IAAIC,aAAe,WAAc,SAASC,EAAiBC,EAAQC,GAAS,IAAK,IAAIX,EAAI,EAAGA,EAAIW,EAAMT,OAAQF,IAAK,CAAE,IAAIY,EAAaD,EAAMX,GAAIY,EAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,UAAWF,IAAYA,EAAWG,UAAW,GAAMC,OAAOC,eAAeP,EAAQE,EAAWM,IAAKN,IAAiB,OAAO,SAAUN,EAAaa,EAAYC,GAAiJ,OAA9HD,GAAYV,EAAiBH,EAAYe,UAAWF,GAAiBC,GAAaX,EAAiBH,EAAac,GAAqBd,GAA7gB,IAMnB,WAME,IAAIgB,KAAaA,QAEjBC,OAAOC,UAAUC,MAAM,SAAUC,GAM/B,OAAOC,OAAOC,+B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GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Square 2.2.2\n"
6
  "Report-Msgid-Bugs-To: "
7
- "https://github.com/woocommerce/woocommerce-square/issues\n"
8
- "POT-Creation-Date: 2020-09-15 02:53:36+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -69,7 +69,7 @@ msgid "Stock must be fetched from Square before editing stock quantity"
69
  msgstr ""
70
 
71
  #: includes/Admin/Privacy.php:45 includes/Admin/Settings_Page.php:55
72
- #: includes/Gateway.php:70 includes/Settings.php:223 includes/Settings.php:757
73
  msgid "Square"
74
  msgstr ""
75
 
@@ -433,46 +433,46 @@ msgstr ""
433
  msgid "The sync job has failed. Check sync records, or %s."
434
  msgstr ""
435
 
436
- #: includes/Gateway/API/Requests/Orders.php:85
437
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:555
438
  msgid "Discount"
439
  msgstr ""
440
 
441
- #: includes/Gateway/API/Requests/Orders.php:294
442
- #: includes/Gateway/API/Requests/Orders.php:340
443
  msgid "Adjustment"
444
  msgstr ""
445
 
446
- #: includes/Gateway/Payment_Form.php:152
447
  msgid "Postal code"
448
  msgstr ""
449
 
450
- #: includes/Gateway/Payment_Form.php:210 includes/Gateway.php:229
451
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php:216
452
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:2758
453
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:376
454
  msgid "An error occurred, please try again or try an alternate form of payment."
455
  msgstr ""
456
 
457
- #: includes/Gateway.php:71
458
  msgid "Allow customers to use Square to securely pay with their credit cards"
459
  msgstr ""
460
 
461
- #: includes/Gateway.php:426
462
  msgid "Refunds must be made within %s of the original payment date."
463
  msgstr ""
464
 
465
- #: includes/Gateway.php:450
466
  msgid ""
467
  "Could not find original transaction tender. Please refund this transaction "
468
  "from your Square dashboard."
469
  msgstr ""
470
 
471
- #: includes/Gateway.php:565
472
  msgid "Customer Profiles"
473
  msgstr ""
474
 
475
- #: includes/Gateway.php:864
476
  msgid " An error occurred, please try again or try an alternate form of payment."
477
  msgstr ""
478
 
@@ -534,7 +534,8 @@ msgstr ""
534
  #. translators: Placeholder: %s - product name
535
  msgid ""
536
  "Please add an SKU to every variation of %s for syncing with Square. Each "
537
- "SKU must match the corresponding item's SKU in your Square account."
 
538
  msgstr ""
539
 
540
  #: includes/Handlers/Products.php:72
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Square 2.2.3\n"
6
  "Report-Msgid-Bugs-To: "
7
+ "https://wordpress.org/support/plugin/woocommerce-square\n"
8
+ "POT-Creation-Date: 2020-10-23 04:51:08+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
69
  msgstr ""
70
 
71
  #: includes/Admin/Privacy.php:45 includes/Admin/Settings_Page.php:55
72
+ #: includes/Gateway.php:79 includes/Settings.php:223 includes/Settings.php:757
73
  msgid "Square"
74
  msgstr ""
75
 
433
  msgid "The sync job has failed. Check sync records, or %s."
434
  msgstr ""
435
 
436
+ #: includes/Gateway/API/Requests/Orders.php:88
437
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:555
438
  msgid "Discount"
439
  msgstr ""
440
 
441
+ #: includes/Gateway/API/Requests/Orders.php:297
442
+ #: includes/Gateway/API/Requests/Orders.php:343
443
  msgid "Adjustment"
444
  msgstr ""
445
 
446
+ #: includes/Gateway/Payment_Form.php:182
447
  msgid "Postal code"
448
  msgstr ""
449
 
450
+ #: includes/Gateway/Payment_Form.php:240 includes/Gateway.php:241
451
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php:216
452
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:2758
453
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:376
454
  msgid "An error occurred, please try again or try an alternate form of payment."
455
  msgstr ""
456
 
457
+ #: includes/Gateway.php:80
458
  msgid "Allow customers to use Square to securely pay with their credit cards"
459
  msgstr ""
460
 
461
+ #: includes/Gateway.php:439
462
  msgid "Refunds must be made within %s of the original payment date."
463
  msgstr ""
464
 
465
+ #: includes/Gateway.php:463
466
  msgid ""
467
  "Could not find original transaction tender. Please refund this transaction "
468
  "from your Square dashboard."
469
  msgstr ""
470
 
471
+ #: includes/Gateway.php:578
472
  msgid "Customer Profiles"
473
  msgstr ""
474
 
475
+ #: includes/Gateway.php:881
476
  msgid " An error occurred, please try again or try an alternate form of payment."
477
  msgstr ""
478
 
534
  #. translators: Placeholder: %s - product name
535
  msgid ""
536
  "Please add an SKU to every variation of %s for syncing with Square. Each "
537
+ "SKU must be unique and match the corresponding item's SKU in your Square "
538
+ "account."
539
  msgstr ""
540
 
541
  #: includes/Handlers/Products.php:72
includes/Gateway.php CHANGED
@@ -56,6 +56,15 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
56
  */
57
  private $sca_supported_currencies = array( 'GBP' );
58
 
 
 
 
 
 
 
 
 
 
59
  /**
60
  * Constructs the class.
61
  *
@@ -195,6 +204,9 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
195
  wp_enqueue_script( 'wc-' . $this->get_plugin()->get_id_dasherized() . '-payment-form', $url, array(), Plugin::VERSION );
196
 
197
  parent::enqueue_gateway_assets();
 
 
 
198
  }
199
 
200
 
@@ -259,6 +271,7 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
259
  $order->payment->account_number = $order->payment->last_four = substr( Framework\SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-last-four' ), -4 );
260
  $order->payment->exp_month = Framework\SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-exp-month' );
261
  $order->payment->exp_year = Framework\SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-exp-year' );
 
262
  }
263
 
264
  $order->square_customer_id = $order->customer_id;
@@ -735,7 +748,11 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
735
  */
736
  public function get_payment_form_instance() {
737
 
738
- return new Payment_Form( $this );
 
 
 
 
739
  }
740
 
741
 
56
  */
57
  private $sca_supported_currencies = array( 'GBP' );
58
 
59
+ /**
60
+ * Square Payment Form instance
61
+ * Null by default.
62
+ *
63
+ * @since 2.2.3
64
+ *
65
+ */
66
+ private $payment_form = null;
67
+
68
  /**
69
  * Constructs the class.
70
  *
204
  wp_enqueue_script( 'wc-' . $this->get_plugin()->get_id_dasherized() . '-payment-form', $url, array(), Plugin::VERSION );
205
 
206
  parent::enqueue_gateway_assets();
207
+
208
+ // Render PaymentForm JS
209
+ $this->get_payment_form_instance()->render_js();
210
  }
211
 
212
 
271
  $order->payment->account_number = $order->payment->last_four = substr( Framework\SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-last-four' ), -4 );
272
  $order->payment->exp_month = Framework\SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-exp-month' );
273
  $order->payment->exp_year = Framework\SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-exp-year' );
274
+ $order->payment->postcode = Framework\SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-payment-postcode' );
275
  }
276
 
277
  $order->square_customer_id = $order->customer_id;
748
  */
749
  public function get_payment_form_instance() {
750
 
751
+ if ( empty( $this->payment_form ) ) {
752
+ $this->payment_form = new Payment_Form( $this );
753
+ }
754
+
755
+ return $this->payment_form;
756
  }
757
 
758
 
includes/Gateway/API/Requests/Customers.php CHANGED
@@ -153,7 +153,11 @@ class Customers extends API\Requests\Customers {
153
  $address->setAddressLine2( $order->get_billing_address_2() );
154
  $address->setLocality( $order->get_billing_city() );
155
  $address->setAdministrativeDistrictLevel1( $order->get_billing_state() );
156
- $address->setPostalCode( $order->get_billing_postcode() );
 
 
 
 
157
 
158
  if ( $order->get_billing_country() ) {
159
  $address->setCountry( $order->get_billing_country() );
153
  $address->setAddressLine2( $order->get_billing_address_2() );
154
  $address->setLocality( $order->get_billing_city() );
155
  $address->setAdministrativeDistrictLevel1( $order->get_billing_state() );
156
+ if ( ! empty( $order->payment->postcode ) ) {
157
+ $address->setPostalCode( $order->payment->postcode );
158
+ } else {
159
+ $address->setPostalCode( $order->get_billing_postcode() );
160
+ }
161
 
162
  if ( $order->get_billing_country() ) {
163
  $address->setCountry( $order->get_billing_country() );
includes/Gateway/API/Requests/Orders.php CHANGED
@@ -68,6 +68,9 @@ class Orders extends API\Request {
68
 
69
  $order_model = new SquareModel\Order();
70
  $order_model->setReferenceId( $order->get_order_number() );
 
 
 
71
 
72
  $line_items = array_merge( $this->get_product_line_items( $order ), $this->get_fee_line_items( $order ), $this->get_shipping_line_items( $order ) );
73
  $taxes = $this->get_order_taxes( $order );
68
 
69
  $order_model = new SquareModel\Order();
70
  $order_model->setReferenceId( $order->get_order_number() );
71
+ if ( ! empty( $order->square_customer_id ) ) {
72
+ $order_model->setCustomerId( $order->square_customer_id );
73
+ }
74
 
75
  $line_items = array_merge( $this->get_product_line_items( $order ), $this->get_fee_line_items( $order ), $this->get_shipping_line_items( $order ) );
76
  $taxes = $this->get_order_taxes( $order );
includes/Gateway/Payment_Form.php CHANGED
@@ -36,6 +36,36 @@ use SkyVerge\WooCommerce\PluginFramework\v5_4_0 as Framework;
36
  */
37
  class Payment_Form extends Framework\SV_WC_Payment_Gateway_Payment_Form {
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  /**
41
  * Renders any additional billing information we need for processing on pages other than checkout
36
  */
37
  class Payment_Form extends Framework\SV_WC_Payment_Gateway_Payment_Form {
38
 
39
+ /**
40
+ * Adds hooks for rendering the payment form.
41
+ * Extended from SV framework and remove render_js action
42
+ *
43
+ * @see SV_WC_Payment_Gateway_Payment_Form::render()
44
+ *
45
+ * @since 2.2.3
46
+ */
47
+ protected function add_hooks() {
48
+
49
+ $gateway_id = $this->get_gateway()->get_id();
50
+
51
+ // payment form description
52
+ add_action( "wc_{$gateway_id}_payment_form_start", array( $this, 'render_payment_form_description' ), 15 );
53
+
54
+ // saved payment methods
55
+ add_action( "wc_{$gateway_id}_payment_form_start", array( $this, 'render_saved_payment_methods' ), 20 );
56
+
57
+ // sample eCheck image (if eCheck gateway)
58
+ add_action( "wc_{$gateway_id}_payment_form_start", array( $this, 'render_sample_check' ), 25 );
59
+
60
+ // fieldset start
61
+ add_action( "wc_{$gateway_id}_payment_form_start", array( $this, 'render_fieldset_start' ), 30 );
62
+
63
+ // payment fields
64
+ add_action( "wc_{$gateway_id}_payment_form", array( $this, 'render_payment_fields' ), 0 );
65
+
66
+ // fieldset end
67
+ add_action( "wc_{$gateway_id}_payment_form_end", array( $this, 'render_fieldset_end' ), 5 );
68
+ }
69
 
70
  /**
71
  * Renders any additional billing information we need for processing on pages other than checkout
includes/Handlers/Products.php CHANGED
@@ -67,7 +67,7 @@ class Products {
67
  /* translators: Placeholder: %s - product name */
68
  'missing_sku' => __( "Please add an SKU to sync %s with Square. The SKU must match the item's SKU in your Square account.", 'woocommerce-square' ),
69
  /* translators: Placeholder: %s - product name */
70
- 'missing_variation_sku' => __( "Please add an SKU to every variation of %s for syncing with Square. Each SKU must match the corresponding item's SKU in your Square account.", 'woocommerce-square' ),
71
  /* translators: Placeholder: %s - product name */
72
  'multiple_attributes' => __( '%s has multiple variation attributes and cannot be synced with Square.', 'woocommerce-square' ),
73
  );
67
  /* translators: Placeholder: %s - product name */
68
  'missing_sku' => __( "Please add an SKU to sync %s with Square. The SKU must match the item's SKU in your Square account.", 'woocommerce-square' ),
69
  /* translators: Placeholder: %s - product name */
70
+ 'missing_variation_sku' => __( "Please add an SKU to every variation of %s for syncing with Square. Each SKU must be unique and match the corresponding item's SKU in your Square account.", 'woocommerce-square' ),
71
  /* translators: Placeholder: %s - product name */
72
  'multiple_attributes' => __( '%s has multiple variation attributes and cannot be synced with Square.', 'woocommerce-square' ),
73
  );
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.2.2';
46
 
47
  /** plugin ID */
48
  const PLUGIN_ID = 'square';
42
 
43
 
44
  /** plugin version number */
45
+ const VERSION = '2.2.3';
46
 
47
  /** plugin ID */
48
  const PLUGIN_ID = 'square';
includes/Sync/Manual_Synchronization.php CHANGED
@@ -965,7 +965,7 @@ class Manual_Synchronization extends Stepped_Job {
965
 
966
  $start = microtime( true );
967
 
968
- $idempotency_key = wc_square()->get_idempotency_key( md5( serialize( $batches ) ) . '_upsert_products' );
969
  $response = wc_square()->get_api()->batch_upsert_catalog_objects( $idempotency_key, $batches );
970
  $upsert_response = $response->get_data();
971
 
965
 
966
  $start = microtime( true );
967
 
968
+ $idempotency_key = wc_square()->get_idempotency_key( md5( serialize( $batches ) ) . time() . '_upsert_products' );
969
  $response = wc_square()->get_api()->batch_upsert_catalog_objects( $idempotency_key, $batches );
970
  $upsert_response = $response->get_data();
971
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WooCommerce Square ===
2
- Contributors: woocommerce, automattic, royho, woothemes, bor0, mattdallan, menakas, chickenn00dle, jorgeatorres, jamesgallan
3
  Tags: credit card, square, woocommerce, inventory sync
4
  Requires at least: 4.6
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
- Stable tag: 2.2.2
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -72,6 +72,15 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
72
 
73
  == Changelog ==
74
 
 
 
 
 
 
 
 
 
 
75
  = 2.2.2 - 2020.09.15 =
76
  * Fix - Don't import a new copy of each product image from Square when updating products during the import process. PR#513
77
 
1
  === WooCommerce Square ===
2
+ Contributors: woocommerce, automattic, royho, woothemes, bor0, mattdallan, menakas, chickenn00dle, jorgeatorres, jamesgallan, achyuthajoy
3
  Tags: credit card, square, woocommerce, inventory sync
4
  Requires at least: 4.6
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
+ Stable tag: 2.2.3
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
72
 
73
  == Changelog ==
74
 
75
+ = 2.2.3 - 2020.10.23 =
76
+ * Fix - Display the correct stock quantity amount on all variations when product data is sent to Square. PR#503
77
+ * Fix - Avoid IDEMPOTENCY_KEY_REUSED API errors when syncing product data from WooCommerce to Square by using a more unique API request key. PR#528
78
+ * Fix - Added customer_id to Orders API to link Customers & Transactions on Square Dashboard and Transactions CSV Export. PR#527
79
+ * Fix - Issues with the postal code not matching WooCommerce data while saving cards. PR#501
80
+ * Fix - Prevents the "Send product data to Square" checkbox from being enabled when products and variations contain empty or duplicate SKUs. PR#525
81
+ * Fix - Issues that caused the Square Payment Form to be unclickable on the checkout page. PR#530
82
+ * Fix - Compatibility issues with the Square Payment form and conditional payment gateway extensions. PR#530
83
+
84
  = 2.2.2 - 2020.09.15 =
85
  * Fix - Don't import a new copy of each product image from Square when updating products during the import process. PR#513
86
 
woocommerce-square.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
- * Version: 2.2.2
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.5
23
  */
24
 
25
  defined( 'ABSPATH' ) || exit;
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
+ * Version: 2.2.3
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.6
23
  */
24
 
25
  defined( 'ABSPATH' ) || exit;