Version Description
- 2021.02.09 =
- Fix - Uncaught PHP error when attempting to setup Apple Pay and Square is not properly connected (i.e. no valid access token found). PR#587
- Fix - Improve error logging when the request to verify the store's domain with Square/Apple Pay fails. PR#587
- Fix - Allow variable products to be previewed when Square is active. PR#554
Download this release
Release Info
Developer | automattic |
Plugin | WooCommerce Square |
Version | 2.3.3 |
Comparing to | |
See all releases |
Code changes from version 2.3.2 to 2.3.3
- assets/js/admin/wc-square-admin-products.coffee +12 -7
- assets/js/admin/wc-square-admin-products.min.js +1 -1
- assets/js/admin/wc-square-admin-products.min.js.map +1 -1
- i18n/languages/woocommerce-square.pot +4 -4
- includes/Gateway/Digital_Wallet.php +9 -4
- includes/Plugin.php +1 -1
- readme.txt +6 -1
- woocommerce-square.php +1 -1
assets/js/admin/wc-square-admin-products.coffee
CHANGED
@@ -215,8 +215,8 @@ jQuery( document ).ready ( $ ) ->
|
|
215 |
showError( 'missing_variation_sku' )
|
216 |
else
|
217 |
hideError( 'missing_variation_sku', not hasMultipleAttributes() )
|
218 |
-
$( syncCheckboxID ).
|
219 |
-
.
|
220 |
|
221 |
else
|
222 |
$( 'input[id^="variable_sku"]' ).off 'change keypress keyup'
|
@@ -227,7 +227,7 @@ jQuery( document ).ready ( $ ) ->
|
|
227 |
showError( 'missing_sku' )
|
228 |
else
|
229 |
hideError( 'missing_sku', not hasMultipleAttributes() )
|
230 |
-
$( syncCheckboxID ).trigger
|
231 |
.trigger 'change'
|
232 |
|
233 |
|
@@ -258,14 +258,12 @@ jQuery( document ).ready ( $ ) ->
|
|
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 )
|
270 |
|
271 |
|
@@ -276,6 +274,7 @@ jQuery( document ).ready ( $ ) ->
|
|
276 |
###
|
277 |
$stockFields = $( '.stock_fields' )
|
278 |
$stockInput = $stockFields.find( '#_stock' )
|
|
|
279 |
$manageField = $( '._manage_stock_field' )
|
280 |
$manageInput = $manageField.find( '#_manage_stock' )
|
281 |
$manageDesc = $manageField.find( '.description' )
|
@@ -297,7 +296,9 @@ jQuery( document ).ready ( $ ) ->
|
|
297 |
useSquare = true
|
298 |
|
299 |
$manageDesc.html( '<a href="' + wc_square_admin_products.settings_url + '">' + wc_square_admin_products.i18n.synced_with_square + '</a>' )
|
300 |
-
$manageInput.prop( 'disabled', true ).prop( 'checked', not variableProduct )
|
|
|
|
|
301 |
$stockInput.prop( 'readonly', true )
|
302 |
|
303 |
if not variableProduct
|
@@ -363,6 +364,10 @@ jQuery( document ).ready ( $ ) ->
|
|
363 |
|
364 |
if manageStockOriginal
|
365 |
$stockFields.show()
|
|
|
|
|
|
|
|
|
366 |
|
367 |
|
368 |
# handle variations data separately (HTML differs from parent UI!)
|
@@ -379,7 +384,7 @@ jQuery( document ).ready ( $ ) ->
|
|
379 |
if useSquare
|
380 |
|
381 |
# disable stock management inputs
|
382 |
-
$variationManageInput.prop( 'disabled', true ).prop( 'checked', true )
|
383 |
$variationStockInput.prop( 'readonly', true )
|
384 |
$( '#wc_square_variation_manage_stock' ).prop( 'disabled', false )
|
385 |
|
215 |
showError( 'missing_variation_sku' )
|
216 |
else
|
217 |
hideError( 'missing_variation_sku', not hasMultipleAttributes() )
|
218 |
+
$( syncCheckboxID ).triggerHandler 'change'
|
219 |
+
.triggerHandler 'change'
|
220 |
|
221 |
else
|
222 |
$( 'input[id^="variable_sku"]' ).off 'change keypress keyup'
|
227 |
showError( 'missing_sku' )
|
228 |
else
|
229 |
hideError( 'missing_sku', not hasMultipleAttributes() )
|
230 |
+
$( syncCheckboxID ).trigger 'change'
|
231 |
.trigger 'change'
|
232 |
|
233 |
|
258 |
###
|
259 |
triggerUpdate = ->
|
260 |
handleSKU( syncCheckboxID )
|
|
|
261 |
# handleSKU misses cases where product is variable with no variations
|
262 |
if isVariable() and not $( 'input[id^="variable_sku"]' ).length
|
263 |
showError( 'missing_variation_sku' )
|
264 |
|
265 |
|
266 |
# fire once on page load
|
|
|
267 |
handleAttributes( syncCheckboxID )
|
268 |
|
269 |
|
274 |
###
|
275 |
$stockFields = $( '.stock_fields' )
|
276 |
$stockInput = $stockFields.find( '#_stock' )
|
277 |
+
$stockStatus = $( '.stock_status_field' )
|
278 |
$manageField = $( '._manage_stock_field' )
|
279 |
$manageInput = $manageField.find( '#_manage_stock' )
|
280 |
$manageDesc = $manageField.find( '.description' )
|
296 |
useSquare = true
|
297 |
|
298 |
$manageDesc.html( '<a href="' + wc_square_admin_products.settings_url + '">' + wc_square_admin_products.i18n.synced_with_square + '</a>' )
|
299 |
+
$manageInput.prop( 'disabled', true ).prop( 'checked', not variableProduct )
|
300 |
+
$stockFields.hide()
|
301 |
+
$stockStatus.hide()
|
302 |
$stockInput.prop( 'readonly', true )
|
303 |
|
304 |
if not variableProduct
|
364 |
|
365 |
if manageStockOriginal
|
366 |
$stockFields.show()
|
367 |
+
$stockStatus.hide()
|
368 |
+
else
|
369 |
+
$stockStatus.show()
|
370 |
+
$stockFields.hide()
|
371 |
|
372 |
|
373 |
# handle variations data separately (HTML differs from parent UI!)
|
384 |
if useSquare
|
385 |
|
386 |
# disable stock management inputs
|
387 |
+
$variationManageInput.prop( 'disabled', true ).prop( 'checked', true )
|
388 |
$variationStockInput.prop( 'readonly', true )
|
389 |
$( '#wc_square_variation_manage_stock' ).prop( 'disabled', false )
|
390 |
|
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(i){var r,t,n,a,s,o,c,d,_,u,p,l,f,h,m,k,v,g,w,y,q,b;if(
|
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,x;if(x=null!=(g=window.typenow)?g:"",v=null!=(w=window.pagenow)?w:"","product"===x&&wc_square_admin_products.is_product_sync_enabled)return"edit-product"===v&&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"===v?(q="#_"+wc_square_admin_products.synced_with_square_taxonomy,h=function(){var r;return r=i("#product-type").val(),e.call(wc_square_admin_products.variable_product_types,r)>=0},u=function(){return""!==i("#_sku").val().trim()},l=function(e){return!!e.length&&e.filter(function(){if(""!==i(this).val().trim())return!0}).length===e.length},p=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)})},_=function(){var e;return e=i('.woocommerce_attribute_data input[name^="attribute_variation"]:checked'),h()&&e&&e.length>1},y=function(e){return i(".wc-square-sync-with-square-error."+e).show(),i(q).prop("disabled",!0),i(q).prop("checked",!1)},f=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(q).prop("disabled",!1)},d=function(e){var r;return h()?(i("#_sku").off("change keypress keyup"),f("missing_sku",!_()),(r=i('input[id^="variable_sku"]')).on("change keypress keyup",function(t){return l(r)&&p(r)?f("missing_variation_sku",!_()):y("missing_variation_sku"),i(e).triggerHandler("change")}).triggerHandler("change")):(i('input[id^="variable_sku"]').off("change keypress keyup"),f("missing_variation_sku",!_()),i("#_sku").on("change keypress keyup",function(r){return""===i(this).val().trim()?y("missing_sku"):f("missing_sku",!_()),i(e).trigger("change")}).trigger("change"))},c=function(e){return i("#variable_product_options").on("reload",function(r){return _()?y("multiple_attributes"):f("multiple_attributes",h()?l:u()),i(e).trigger("change")}).trigger("reload")},b=function(){if(d(q),h()&&!i('input[id^="variable_sku"]').length)return y("missing_variation_sku")},c(q),a=i(".stock_fields"),s=a.find("#_stock"),o=i(".stock_status_field"),t=i("._manage_stock_field"),n=t.find("#_manage_stock"),r=t.find(".description"),m=r.text(),k=i("#_manage_stock").is(":checked"),i(q).on("change",function(e){var t,c;if(wc_square_admin_products.is_inventory_sync_enabled)return c=-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",!c),a.hide(),o.hide(),s.prop("readonly",!0),c||a.show(),wc_square_admin_products.is_woocommerce_sor&&!c?(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(m),n.prop("disabled",!1).prop("checked",k),k?(a.show(),o.hide()):(o.show(),a.hide())),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),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 b()}),i("#woocommerce-product-data").on("woocommerce_variations_loaded woocommerce_variations_added woocommerce_variations_removed",function(e){return b()})):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","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","
|
1 |
+
{"version":3,"sources":["wc-square-admin-products.min.js"],"names":["indexOf","jQuery","document","ready","$","$manageDesc","$manageField","$manageInput","$stockFields","$stockInput","$stockStatus","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","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","triggerHandler","text","useSquare","variableProduct","is_inventory_sync_enabled","inArray","html","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"],"mappings":"AAAA,cAEA,WAGE,IAAIA,KAAaA,QAOjBC,OAAOC,UAAUC,MAAM,SAAUC,GAyD/B,IAAIC,EAAaC,EAAcC,EAAcC,EAAcC,EAAaC,EAAcC,EAAkBC,EAAWC,EAAuBC,EAAQC,EAAeC,EAAiBC,EAAWC,EAAYC,EAAoBC,EAAqBC,EAASC,EAAKC,EAAMC,EAAWC,EAAgBC,EAAeC,EAIhT,GAHAA,EAAoC,OAAzBL,EAAMM,OAAOD,SAAmBL,EAAM,GACjDD,EAAqC,OAA1BE,EAAOK,OAAOP,SAAmBE,EAA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18n/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.3.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-square\n"
|
8 |
-
"POT-Creation-Date: 2021-02-04
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -521,8 +521,8 @@ msgstr ""
|
|
521 |
msgid "Empty cart"
|
522 |
msgstr ""
|
523 |
|
524 |
-
#: includes/Gateway/Digital_Wallet.php:
|
525 |
-
msgid "Unable to verify domain - missing access token."
|
526 |
msgstr ""
|
527 |
|
528 |
#: includes/Gateway/Payment_Form.php:182
|
2 |
# This file is distributed under the GNU General Public License v3.0.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce Square 2.3.3\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-square\n"
|
8 |
+
"POT-Creation-Date: 2021-02-09 04:04: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"
|
521 |
msgid "Empty cart"
|
522 |
msgstr ""
|
523 |
|
524 |
+
#: includes/Gateway/Digital_Wallet.php:780
|
525 |
+
msgid "Unable to verify domain with Apple Pay - missing access token."
|
526 |
msgstr ""
|
527 |
|
528 |
#: includes/Gateway/Payment_Form.php:182
|
includes/Gateway/Digital_Wallet.php
CHANGED
@@ -770,9 +770,14 @@ class Digital_Wallet {
|
|
770 |
private function register_apple_pay_domain() {
|
771 |
$access_token = $this->gateway->get_plugin()->get_settings_handler()->get_access_token();
|
772 |
$is_sandbox = $this->gateway->get_plugin()->get_settings_handler()->is_sandbox();
|
|
|
|
|
|
|
|
|
|
|
773 |
|
774 |
if ( empty( $access_token ) ) {
|
775 |
-
throw new Exception( __( 'Unable to verify domain - missing access token.', 'woocommerce-square' ) );
|
776 |
}
|
777 |
|
778 |
$response = wp_remote_post(
|
@@ -785,7 +790,7 @@ class Digital_Wallet {
|
|
785 |
),
|
786 |
'body' => wp_json_encode(
|
787 |
array(
|
788 |
-
'domain_name' =>
|
789 |
)
|
790 |
),
|
791 |
)
|
@@ -793,14 +798,14 @@ class Digital_Wallet {
|
|
793 |
|
794 |
if ( is_wp_error( $response ) ) {
|
795 |
/* translators: error message */
|
796 |
-
throw new \Exception( sprintf( 'Unable to verify domain - %s', $response->get_error_message() ) );
|
797 |
}
|
798 |
|
799 |
$parsed_response = json_decode( $response['body'], true );
|
800 |
|
801 |
if ( 200 !== $response['response']['code'] || empty( $parsed_response['status'] ) || 'VERIFIED' !== $parsed_response['status'] ) {
|
802 |
/* translators: error message */
|
803 |
-
throw new \Exception( sprintf( 'Unable to verify domain - %s', $parsed_response
|
804 |
}
|
805 |
}
|
806 |
|
770 |
private function register_apple_pay_domain() {
|
771 |
$access_token = $this->gateway->get_plugin()->get_settings_handler()->get_access_token();
|
772 |
$is_sandbox = $this->gateway->get_plugin()->get_settings_handler()->is_sandbox();
|
773 |
+
$domain_name = ! empty( $_SERVER['HTTP_HOST'] ) ? wc_clean( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
|
774 |
+
|
775 |
+
if ( empty( $domain_name ) ) {
|
776 |
+
throw new \Exception( 'Unable to verify domain with Apple Pay - no domain found in $_SERVER[\'HTTP_HOST\'].' );
|
777 |
+
}
|
778 |
|
779 |
if ( empty( $access_token ) ) {
|
780 |
+
throw new \Exception( __( 'Unable to verify domain with Apple Pay - missing access token.', 'woocommerce-square' ) );
|
781 |
}
|
782 |
|
783 |
$response = wp_remote_post(
|
790 |
),
|
791 |
'body' => wp_json_encode(
|
792 |
array(
|
793 |
+
'domain_name' => $domain_name,
|
794 |
)
|
795 |
),
|
796 |
)
|
798 |
|
799 |
if ( is_wp_error( $response ) ) {
|
800 |
/* translators: error message */
|
801 |
+
throw new \Exception( sprintf( 'Unable to verify domain %s - %s', $domain_name, $response->get_error_message() ) );
|
802 |
}
|
803 |
|
804 |
$parsed_response = json_decode( $response['body'], true );
|
805 |
|
806 |
if ( 200 !== $response['response']['code'] || empty( $parsed_response['status'] ) || 'VERIFIED' !== $parsed_response['status'] ) {
|
807 |
/* translators: error message */
|
808 |
+
throw new \Exception( sprintf( 'Unable to verify domain %s - response = %s', $domain_name, print_r( $parsed_response, true ) ) ); //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
|
809 |
}
|
810 |
}
|
811 |
|
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.3.
|
46 |
|
47 |
/** plugin ID */
|
48 |
const PLUGIN_ID = 'square';
|
42 |
|
43 |
|
44 |
/** plugin version number */
|
45 |
+
const VERSION = '2.3.3';
|
46 |
|
47 |
/** plugin ID */
|
48 |
const PLUGIN_ID = 'square';
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: credit card, square, woocommerce, inventory sync
|
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.6
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 2.3.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -72,6 +72,11 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
|
|
75 |
= 2.3.2 - 2021.02.04 =
|
76 |
* Fix - PHP error on the My Account > Payment Methods page when saving a new card. PR#585
|
77 |
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.6
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 2.3.3
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 2.3.3 - 2021.02.09 =
|
76 |
+
* Fix - Uncaught PHP error when attempting to setup Apple Pay and Square is not properly connected (i.e. no valid access token found). PR#587
|
77 |
+
* Fix - Improve error logging when the request to verify the store's domain with Square/Apple Pay fails. PR#587
|
78 |
+
* Fix - Allow variable products to be previewed when Square is active. PR#554
|
79 |
+
|
80 |
= 2.3.2 - 2021.02.04 =
|
81 |
* Fix - PHP error on the My Account > Payment Methods page when saving a new card. PR#585
|
82 |
|
woocommerce-square.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Square
|
4 |
-
* Version: 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
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Square
|
4 |
+
* Version: 2.3.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
|