WooCommerce Square - Version 3.1.0

Version Description

  • 2022-06-09 =
  • Fix - Hide shipping options in Google Pay form for virtual products. #800
  • Fix - State-specific tax calculation when using Google Pay. #778
  • Add - Validation that Business Location or SOR is set and Square settings are saved before enabling Import Products button. #463
Download this release

Release Info

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

Code changes from version 3.0.3 to 3.1.0

assets/js/admin/wc-square-admin-settings.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";jQuery(document).ready($=>{var pagenow=window.pagenow||"";if("woocommerce_page_wc-settings"!==pagenow){return}if(!wc_square_admin_settings.is_sandbox){$("#wc_square_sandbox_settings").hide();$("#wc_square_sandbox_settings").next().hide();$(".wc_square_sandbox_settings").closest("tr").hide()}$("#wc_square_system_of_record").on("change",e=>{var system_of_record=$(e.target).val();var $inventory_sync=$("#wc_square_enable_inventory_sync");var $inventory_sync_row=$inventory_sync.closest("tr");if("square"===system_of_record||"woocommerce"===system_of_record){$inventory_sync.next("span").html(wc_square_admin_settings.i18n.sync_inventory_label[system_of_record]);$inventory_sync_row.find(".description").html(wc_square_admin_settings.i18n.sync_inventory_description[system_of_record]);$inventory_sync_row.show()}else{$inventory_sync.prop("checked",false);$inventory_sync_row.hide()}if("square"===system_of_record){$("#wc_square_hide_missing_products").closest("tr").show()}else{$("#wc_square_hide_missing_products").closest("tr").hide()}}).trigger("change");$(".js-import-square-products").on("click",e=>{e.preventDefault();new $.WCBackboneModal.View({target:"wc-square-import-products"});$("#btn-close").on("click",e=>{e.preventDefault();$("button.modal-close").trigger("click")})});$("#wc-square-sync").on("click",e=>{e.preventDefault();new $.WCBackboneModal.View({target:"wc-square-sync"});$("#btn-close").on("click",e=>{e.preventDefault();$("button.modal-close").trigger("click")})});$(document.body).on("wc_backbone_modal_response",(e,target)=>{var data;switch(target){case"wc-square-import-products":$("#wpbody").block({message:null,overlayCSS:{opacity:"0.2"},onBlock:function onBlock(){$(".blockUI.blockOverlay").css({position:"fixed"})}});var update_during_import=$("#wc-square-import-product-updates").prop("checked");data={action:"wc_square_import_products_from_square",security:wc_square_admin_settings.import_products_from_square,update_during_import};$.post(wc_square_admin_settings.ajax_url,data,response=>{var message=response.data?response.data:null;if(message){alert(message)}location.reload()});break;case"wc-square-sync":$("table.sync").block({message:null,overlayCSS:{opacity:"0.2"}});$("table.records").block({message:null,overlayCSS:{opacity:"0.2"}});$("#wc-square_clear-sync-records").prop("disabled",true);data={action:"wc_square_sync_products_with_square",security:wc_square_admin_settings.sync_products_with_square};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.success){location.reload()}else{$("#wc-square_clear-sync-records").prop("disabled",false);$("table.sync").unblock();$("table.records").unblock()}});break;}});var noRecordsFoundRow="<tr><td colspan=\"4\"><em>"+wc_square_admin_settings.i18n.no_records_found+"</em></td></tr>";$("#wc-square_clear-sync-records").on("click",e=>{e.preventDefault();$("table.records").block({message:null,overlayCSS:{opacity:"0.2"}});var data={action:"wc_square_handle_sync_records",id:"all",handle:"delete",security:wc_square_admin_settings.handle_sync_with_square_records};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.success){$("table.records tbody").html(noRecordsFoundRow);$("#wc-square_clear-sync-records").prop("disabled",true)}else{if(response.data){alert(response.data)}console.log(response)}$("table.records").unblock()})});$(".records .actions button.action").on("click",e=>{e.preventDefault();$("table.records").block({message:null,overlayCSS:{opacity:"0.2"}});var recordId=$(e.currentTarget).data("id");var action=$(e.currentTarget).data("action");var data={action:"wc_square_handle_sync_records",id:recordId,handle:action,security:wc_square_admin_settings.handle_sync_with_square_records};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.success){var rowId="#record-"+recordId;if("delete"===action){$(rowId).remove();if(!$("table.records tbody tr").length){$("table.records tbody").html(noRecordsFoundRow);$("#wc-square_clear-sync-records").prop("disabled",true)}}else if("resolve"===action||"unsync"===action){$(rowId+" .type").html("<mark class=\"resolved\"><span>"+wc_square_admin_settings.i18n.resolved+"</span></mark>");$(rowId+" .actions").html("&mdash;")}}else{if(response&&response.data){alert(response.data)}console.log({record:recordId,action,response})}$("table.records").unblock()})});$("form").on("submit",e=>{var environment=$("#wc_square_enable_sandbox").is(":checked")?"sandbox":"production";$(e.target).append($("<input>",{type:"hidden",name:"wc_square_environment",value:environment}))});var getSyncStatus=job_id=>{var $progress=$("span.progress");if(!$progress||0===$progress.length){$("p.sync-result").append(" <span class=\"progress\" style=\"display:block\"></span>");$progress=$("span.progress")}var data={action:"wc_square_get_sync_with_square_status",security:wc_square_admin_settings.get_sync_with_square_status_nonce,job_id};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.data){if(response.success&&response.data.id){$("table.sync .spinner").css("visibility","visible");$("#wc-square_clear-sync-records").prop("disabled",true);$("table.records .actions button").prop("disabled",true);if("completed"!==response.data.status&&"failed"!==response.data.status){var progress=" ";if("product_import"===response.data.action){progress+=wc_square_admin_settings.i18n.skipped+": "+parseInt(response.data.skipped_products_count,10)+"<br/>";progress+=wc_square_admin_settings.i18n.updated+": "+parseInt(response.data.updated_products_count,10)+"<br/>";progress+=wc_square_admin_settings.i18n.imported+": "+parseInt(response.data.imported_products_count,10)}else if(response.data.percentage){progress+=parseInt(response.data.percentage,10)+"%"}$progress.html(progress);setTimeout(()=>{getSyncStatus(response.data.id)},30*1000)}else{location.reload()}}else{$("#wc-square_clear-sync-records").prop("disabled",false);$("table.records .actions button").prop("disabled",false);$("table.sync .spinner").css("visibility","hidden");console.log(response)}}})};if(wc_square_admin_settings.existing_sync_job_id){getSyncStatus(wc_square_admin_settings.existing_sync_job_id)}$("#woocommerce_square_credit_card_enable_digital_wallets").on("change",()=>{var wallet_settings=$(".wc-square-digital-wallet-options");if($("#woocommerce_square_credit_card_enable_digital_wallets").is(":checked")){wallet_settings.closest("tr").show()}else{wallet_settings.closest("tr").hide()}}).trigger("change")});
1
+ "use strict";jQuery(document).ready($=>{var pagenow=window.pagenow||"";if("woocommerce_page_wc-settings"!==pagenow){return}window.serialize_form=form=>{var form_data=$(form).serializeArray();form_data=$.grep(form_data,e=>{return e.name!=="_wp_http_referer"&&e.name!=="_wpnonce"});form_data.sort((a,b)=>a.name>b.name?1:-1);return form_data};var is_square_settings_page=false;var url_params=new window.URLSearchParams(window.location.search);var new_square_settings;var current_square_settings;var is_sor_set;var location_id=$("#wc_square_location_id, #wc_square_sandbox_location_id").val();var show_changes_message=$(".wc_square_save_changes_message");if("square"===url_params.get("tab")&&(!url_params.get("section")||""!==url_params.get("section"))){is_square_settings_page=true;current_square_settings=serialize_form($("#mainform"))}$(document).on("change",function(e,ignore){if(ignore){return}var $import_products=$("#wc_square_import_products");var $import_products_row=$import_products.closest("tr");if(is_sor_set&&location_id&&location_id.length){$import_products_row.show()}else{$import_products_row.hide()}});$("#mainform :input").on("change",function(e,ignore){if(ignore){return}var $import_products=$("#wc_square_import_products");new_square_settings=serialize_form("#mainform");if(JSON.stringify(current_square_settings)!==JSON.stringify(new_square_settings)){if(e.target.name==="wc_square_sandbox_location_id"||e.target.name==="wc_square_location_id"){return}show_changes_message.show();$import_products.addClass("disabled")}else{show_changes_message.hide();$import_products.removeClass("disabled")}});$("#wc_square_sandbox_location_id, #wc_square_location_id").on("change",function(){location_id=$(this).val()});if(!wc_square_admin_settings.is_sandbox){$("#wc_square_sandbox_settings").hide();$("#wc_square_sandbox_settings").next().hide();$(".wc_square_sandbox_settings").closest("tr").hide()}$("#wc_square_system_of_record").on("change",e=>{var system_of_record=$(e.target).val();var $inventory_sync=$("#wc_square_enable_inventory_sync");var $inventory_sync_row=$inventory_sync.closest("tr");var $import_products=$("#wc_square_import_products");var $import_products_row=$import_products.closest("tr");if("square"===system_of_record||"woocommerce"===system_of_record){is_sor_set=true;$inventory_sync.next("span").html(wc_square_admin_settings.i18n.sync_inventory_label[system_of_record]);$inventory_sync_row.find(".description").html(wc_square_admin_settings.i18n.sync_inventory_description[system_of_record]);$inventory_sync_row.show();$import_products_row.show()}else{is_sor_set=false;$inventory_sync.prop("checked",false);$inventory_sync_row.hide();$import_products_row.hide()}if("square"===system_of_record){$("#wc_square_hide_missing_products").closest("tr").show()}else{$("#wc_square_hide_missing_products").closest("tr").hide()}}).trigger("change",[true]);$(".js-import-square-products").on("click",function(e){e.preventDefault();if($(this).hasClass("disabled")){return}new $.WCBackboneModal.View({target:"wc-square-import-products"});$("#btn-close").on("click",e=>{e.preventDefault();$("button.modal-close").trigger("click")})});$("#wc-square-sync").on("click",e=>{e.preventDefault();new $.WCBackboneModal.View({target:"wc-square-sync"});$("#btn-close").on("click",e=>{e.preventDefault();$("button.modal-close").trigger("click")})});$(document.body).on("wc_backbone_modal_response",(e,target)=>{var data;switch(target){case"wc-square-import-products":$("#wpbody").block({message:null,overlayCSS:{opacity:"0.2"},onBlock:function onBlock(){$(".blockUI.blockOverlay").css({position:"fixed"})}});var update_during_import=$("#wc-square-import-product-updates").prop("checked");data={action:"wc_square_import_products_from_square",security:wc_square_admin_settings.import_products_from_square,update_during_import};$.post(wc_square_admin_settings.ajax_url,data,response=>{var message=response.data?response.data:null;if(message){alert(message)}location.reload()});break;case"wc-square-sync":$("table.sync").block({message:null,overlayCSS:{opacity:"0.2"}});$("table.records").block({message:null,overlayCSS:{opacity:"0.2"}});$("#wc-square_clear-sync-records").prop("disabled",true);data={action:"wc_square_sync_products_with_square",security:wc_square_admin_settings.sync_products_with_square};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.success){location.reload()}else{$("#wc-square_clear-sync-records").prop("disabled",false);$("table.sync").unblock();$("table.records").unblock()}});break;}});var noRecordsFoundRow="<tr><td colspan=\"4\"><em>"+wc_square_admin_settings.i18n.no_records_found+"</em></td></tr>";$("#wc-square_clear-sync-records").on("click",e=>{e.preventDefault();$("table.records").block({message:null,overlayCSS:{opacity:"0.2"}});var data={action:"wc_square_handle_sync_records",id:"all",handle:"delete",security:wc_square_admin_settings.handle_sync_with_square_records};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.success){$("table.records tbody").html(noRecordsFoundRow);$("#wc-square_clear-sync-records").prop("disabled",true)}else{if(response.data){alert(response.data)}console.log(response)}$("table.records").unblock()})});$(".records .actions button.action").on("click",e=>{e.preventDefault();$("table.records").block({message:null,overlayCSS:{opacity:"0.2"}});var recordId=$(e.currentTarget).data("id");var action=$(e.currentTarget).data("action");var data={action:"wc_square_handle_sync_records",id:recordId,handle:action,security:wc_square_admin_settings.handle_sync_with_square_records};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.success){var rowId="#record-"+recordId;if("delete"===action){$(rowId).remove();if(!$("table.records tbody tr").length){$("table.records tbody").html(noRecordsFoundRow);$("#wc-square_clear-sync-records").prop("disabled",true)}}else if("resolve"===action||"unsync"===action){$(rowId+" .type").html("<mark class=\"resolved\"><span>"+wc_square_admin_settings.i18n.resolved+"</span></mark>");$(rowId+" .actions").html("&mdash;")}}else{if(response&&response.data){alert(response.data)}console.log({record:recordId,action,response})}$("table.records").unblock()})});$("form").on("submit",e=>{var environment=$("#wc_square_enable_sandbox").is(":checked")?"sandbox":"production";$(e.target).append($("<input>",{type:"hidden",name:"wc_square_environment",value:environment}))});var getSyncStatus=job_id=>{var $progress=$("span.progress");if(!$progress||0===$progress.length){$("p.sync-result").append(" <span class=\"progress\" style=\"display:block\"></span>");$progress=$("span.progress")}var data={action:"wc_square_get_sync_with_square_status",security:wc_square_admin_settings.get_sync_with_square_status_nonce,job_id};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.data){if(response.success&&response.data.id){$("table.sync .spinner").css("visibility","visible");$("#wc-square_clear-sync-records").prop("disabled",true);$("table.records .actions button").prop("disabled",true);if("completed"!==response.data.status&&"failed"!==response.data.status){var progress=" ";if("product_import"===response.data.action){progress+=wc_square_admin_settings.i18n.skipped+": "+parseInt(response.data.skipped_products_count,10)+"<br/>";progress+=wc_square_admin_settings.i18n.updated+": "+parseInt(response.data.updated_products_count,10)+"<br/>";progress+=wc_square_admin_settings.i18n.imported+": "+parseInt(response.data.imported_products_count,10)}else if(response.data.percentage){progress+=parseInt(response.data.percentage,10)+"%"}$progress.html(progress);setTimeout(()=>{getSyncStatus(response.data.id)},30*1000)}else{location.reload()}}else{$("#wc-square_clear-sync-records").prop("disabled",false);$("table.records .actions button").prop("disabled",false);$("table.sync .spinner").css("visibility","hidden");console.log(response)}}})};if(wc_square_admin_settings.existing_sync_job_id){getSyncStatus(wc_square_admin_settings.existing_sync_job_id)}$("#woocommerce_square_credit_card_enable_digital_wallets").on("change",()=>{var wallet_settings=$(".wc-square-digital-wallet-options");if($("#woocommerce_square_credit_card_enable_digital_wallets").is(":checked")){wallet_settings.closest("tr").show()}else{wallet_settings.closest("tr").hide()}}).trigger("change",[false])});
changelog.txt CHANGED
@@ -1,5 +1,10 @@
1
  *** WooCommerce Square Changelog ***
2
 
 
 
 
 
 
3
  = 3.0.3 - 2022-06-01 =
4
  * Fix - Customer Token Editor wasn't loading for some stores after updating to Square 3.0.0. #799
5
  * Fix - No such file or directory warnings on case-sensitive filesystems. #799
1
  *** WooCommerce Square Changelog ***
2
 
3
+ = 3.1.0 - 2022-06-09 =
4
+ * Fix - Hide shipping options in Google Pay form for virtual products. #800
5
+ * Fix - State-specific tax calculation when using Google Pay. #778
6
+ * Add - Validation that Business Location or SOR is set and Square settings are saved before enabling Import Products button. #463
7
+
8
  = 3.0.3 - 2022-06-01 =
9
  * Fix - Customer Token Editor wasn't loading for some stores after updating to Square 3.0.0. #799
10
  * Fix - No such file or directory warnings on case-sensitive filesystems. #799
i18n/languages/woocommerce-square.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Square 3.0.3\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-square\n"
8
- "POT-Creation-Date: 2022-06-01 06:05:29+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:43 includes/Admin/Settings_Page.php:54
72
- #: includes/Gateway.php:82 includes/Settings.php:221 includes/Settings.php:757
73
  msgid "Square"
74
  msgstr ""
75
 
@@ -105,8 +105,7 @@ msgstr ""
105
  msgid "Close modal window"
106
  msgstr ""
107
 
108
- #: includes/Admin/Settings_Page.php:179
109
- #. translators: Placeholders: %1$s - <strong>, %2%s - </strong>
110
  msgid ""
111
  "You are about to import all new products, variations and categories from "
112
  "Square. This will create a new product in WooCommerce for every product "
@@ -114,11 +113,11 @@ msgid ""
114
  "imports, these will be ignored in the import."
115
  msgstr ""
116
 
117
- #: includes/Admin/Settings_Page.php:181
118
  msgid "Do you wish to import existing product updates from Square?"
119
  msgstr ""
120
 
121
- #: includes/Admin/Settings_Page.php:183
122
  #. translators: Placeholders: %1$s - <a> tag linking to WooCommerce Square
123
  #. docs, %2%s - closing </a> tag
124
  msgid ""
@@ -126,18 +125,18 @@ msgid ""
126
  "information from Square. %1$sView Documentation%2$s."
127
  msgstr ""
128
 
129
- #: includes/Admin/Settings_Page.php:184
130
  msgid "Update existing products during import."
131
  msgstr ""
132
 
133
- #: includes/Admin/Settings_Page.php:188 includes/Admin/Sync_Page.php:392
134
  #: includes/Framework/PaymentGateway/Admin/views/html-order-partial-capture.php:41
135
  #: includes/Framework/PaymentGateway/Payment_Gateway_My_Payment_Methods.php:203
136
  #: vendor/woocommerce/action-scheduler/classes/ActionScheduler_ListTable.php:133
137
  msgid "Cancel"
138
  msgstr ""
139
 
140
- #: includes/Admin/Settings_Page.php:189 includes/Settings.php:242
141
  msgid "Import Products"
142
  msgstr ""
143
 
@@ -834,17 +833,17 @@ msgstr ""
834
 
835
  #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:541
836
  #: includes/Gateway/API/Requests/Orders.php:77
837
- #: includes/Gateway/Digital_Wallet.php:426
838
  msgid "Discount"
839
  msgstr ""
840
 
841
  #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:551
842
- #: includes/Gateway/Digital_Wallet.php:410
843
  msgid "Shipping"
844
  msgstr ""
845
 
846
  #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:561
847
- #: includes/Gateway/Digital_Wallet.php:434
848
  msgid "Fees"
849
  msgstr ""
850
 
@@ -1084,7 +1083,7 @@ msgstr ""
1084
  #: includes/Framework/PaymentGateway/Integrations/Payment_Gateway_Integration_Subscriptions.php:353
1085
  #: includes/Framework/PaymentGateway/Payment_Gateway.php:2523
1086
  #: includes/Gateway/Blocks_Handler.php:137
1087
- #: includes/Gateway/Digital_Wallet.php:208
1088
  #: includes/Gateway/Payment_Form.php:238 includes/Gateway.php:251
1089
  msgid "An error occurred, please try again or try an alternate form of payment."
1090
  msgstr ""
@@ -1920,7 +1919,7 @@ msgid ""
1920
  "version of WooCommerce Blocks or WooCommerce to fix these issues."
1921
  msgstr ""
1922
 
1923
- #: includes/Gateway/Digital_Wallet.php:114
1924
  #. Translators: %1$s: expected location of apple pay verification file, %2$s:
1925
  #. opening href tag with link to Square documentation, %3$s: closing href tag
1926
  msgid ""
@@ -1929,7 +1928,7 @@ msgid ""
1929
  "information, please read our documentation on %2$sSetting up Apple Pay%3$s."
1930
  msgstr ""
1931
 
1932
- #: includes/Gateway/Digital_Wallet.php:130
1933
  #. Translators: %1$s: opening bold tags, %2$s: closing strong/bold tags, %3$s:
1934
  #. expected location of apple pay verification file, %4$s: opening href tag
1935
  #. with link to Square documentation, %5$s: closing href tag
@@ -1939,51 +1938,51 @@ msgid ""
1939
  "logs%2$s to find out what caused the registration to fail."
1940
  msgstr ""
1941
 
1942
- #: includes/Gateway/Digital_Wallet.php:177
1943
  msgid "OR"
1944
  msgstr ""
1945
 
1946
- #: includes/Gateway/Digital_Wallet.php:279
1947
  #. translators: product ID
1948
  msgid "Product with the ID (%d) cannot be found."
1949
  msgstr ""
1950
 
1951
- #: includes/Gateway/Digital_Wallet.php:295
1952
  #. translators: 1: product name 2: quantity in stock
1953
  msgid ""
1954
  "You cannot add that amount of \"%1$s\"; to the cart because there is not "
1955
  "enough stock (%2$s remaining)."
1956
  msgstr ""
1957
 
1958
- #: includes/Gateway/Digital_Wallet.php:300
1959
  #. translators: 1: product name
1960
  msgid "You cannot purchase \"%1$s\" because it is currently not available."
1961
  msgstr ""
1962
 
1963
- #: includes/Gateway/Digital_Wallet.php:322
1964
- #: includes/Gateway/Digital_Wallet.php:418
1965
  msgid "Tax"
1966
  msgstr ""
1967
 
1968
- #: includes/Gateway/Digital_Wallet.php:357
1969
  msgid "This payment method cannot be used for multiple shipments."
1970
  msgstr ""
1971
 
1972
- #: includes/Gateway/Digital_Wallet.php:368
1973
  #: vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Store.php:378
1974
  msgid "Pending"
1975
  msgstr ""
1976
 
1977
- #: includes/Gateway/Digital_Wallet.php:469
1978
  #. translators: Context (product, cart, checkout or page)
1979
  msgid "Empty payment request data for %s."
1980
  msgstr ""
1981
 
1982
- #: includes/Gateway/Digital_Wallet.php:663
1983
  msgid "Empty cart"
1984
  msgstr ""
1985
 
1986
- #: includes/Gateway/Digital_Wallet.php:797
1987
  msgid "Unable to verify domain with Apple Pay - missing access token."
1988
  msgstr ""
1989
 
@@ -2441,10 +2440,16 @@ msgstr ""
2441
  msgid "Please choose a location"
2442
  msgstr ""
2443
 
2444
- #: includes/Settings.php:353
2445
  msgid "Import all products from Square"
2446
  msgstr ""
2447
 
 
 
 
 
 
 
2448
  #: includes/Sync/Interval_Polling.php:98
2449
  msgid "Updated data for %d category."
2450
  msgid_plural "Updated data for %d categories."
@@ -3236,19 +3241,22 @@ msgstr[1] ""
3236
  msgid "Migrated action with ID %1$d in %2$s to ID %3$d in %4$s"
3237
  msgstr ""
3238
 
3239
- #: woocommerce-square.php:344
 
3240
  msgid ""
3241
  "<strong>All features in %1$s have been disabled</strong> due to unsupported "
3242
  "settings:<br>"
3243
  msgstr ""
3244
 
3245
- #: woocommerce-square.php:351
 
3246
  msgid ""
3247
  "&bull;&nbsp;<strong>Invalid PHP version: </strong>The minimum PHP version "
3248
  "required is %1$s. You are running %2$s.<br>"
3249
  msgstr ""
3250
 
3251
- #: woocommerce-square.php:359
 
3252
  msgid ""
3253
  "&bull;&nbsp;<strong>Invalid OPcache config: </strong><a href=\"%s\" "
3254
  "target=\"_blank\">Please ensure the <code>save_comments</code> PHP option "
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Square 3.1.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-square\n"
8
+ "POT-Creation-Date: 2022-06-09 01:29:29+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:43 includes/Admin/Settings_Page.php:54
72
+ #: includes/Gateway.php:82 includes/Settings.php:221 includes/Settings.php:762
73
  msgid "Square"
74
  msgstr ""
75
 
105
  msgid "Close modal window"
106
  msgstr ""
107
 
108
+ #: includes/Admin/Settings_Page.php:178
 
109
  msgid ""
110
  "You are about to import all new products, variations and categories from "
111
  "Square. This will create a new product in WooCommerce for every product "
113
  "imports, these will be ignored in the import."
114
  msgstr ""
115
 
116
+ #: includes/Admin/Settings_Page.php:180
117
  msgid "Do you wish to import existing product updates from Square?"
118
  msgstr ""
119
 
120
+ #: includes/Admin/Settings_Page.php:182
121
  #. translators: Placeholders: %1$s - <a> tag linking to WooCommerce Square
122
  #. docs, %2%s - closing </a> tag
123
  msgid ""
125
  "information from Square. %1$sView Documentation%2$s."
126
  msgstr ""
127
 
128
+ #: includes/Admin/Settings_Page.php:183
129
  msgid "Update existing products during import."
130
  msgstr ""
131
 
132
+ #: includes/Admin/Settings_Page.php:187 includes/Admin/Sync_Page.php:392
133
  #: includes/Framework/PaymentGateway/Admin/views/html-order-partial-capture.php:41
134
  #: includes/Framework/PaymentGateway/Payment_Gateway_My_Payment_Methods.php:203
135
  #: vendor/woocommerce/action-scheduler/classes/ActionScheduler_ListTable.php:133
136
  msgid "Cancel"
137
  msgstr ""
138
 
139
+ #: includes/Admin/Settings_Page.php:188 includes/Settings.php:242
140
  msgid "Import Products"
141
  msgstr ""
142
 
833
 
834
  #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:541
835
  #: includes/Gateway/API/Requests/Orders.php:77
836
+ #: includes/Gateway/Digital_Wallet.php:427
837
  msgid "Discount"
838
  msgstr ""
839
 
840
  #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:551
841
+ #: includes/Gateway/Digital_Wallet.php:411
842
  msgid "Shipping"
843
  msgstr ""
844
 
845
  #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:561
846
+ #: includes/Gateway/Digital_Wallet.php:435
847
  msgid "Fees"
848
  msgstr ""
849
 
1083
  #: includes/Framework/PaymentGateway/Integrations/Payment_Gateway_Integration_Subscriptions.php:353
1084
  #: includes/Framework/PaymentGateway/Payment_Gateway.php:2523
1085
  #: includes/Gateway/Blocks_Handler.php:137
1086
+ #: includes/Gateway/Digital_Wallet.php:209
1087
  #: includes/Gateway/Payment_Form.php:238 includes/Gateway.php:251
1088
  msgid "An error occurred, please try again or try an alternate form of payment."
1089
  msgstr ""
1919
  "version of WooCommerce Blocks or WooCommerce to fix these issues."
1920
  msgstr ""
1921
 
1922
+ #: includes/Gateway/Digital_Wallet.php:115
1923
  #. Translators: %1$s: expected location of apple pay verification file, %2$s:
1924
  #. opening href tag with link to Square documentation, %3$s: closing href tag
1925
  msgid ""
1928
  "information, please read our documentation on %2$sSetting up Apple Pay%3$s."
1929
  msgstr ""
1930
 
1931
+ #: includes/Gateway/Digital_Wallet.php:131
1932
  #. Translators: %1$s: opening bold tags, %2$s: closing strong/bold tags, %3$s:
1933
  #. expected location of apple pay verification file, %4$s: opening href tag
1934
  #. with link to Square documentation, %5$s: closing href tag
1938
  "logs%2$s to find out what caused the registration to fail."
1939
  msgstr ""
1940
 
1941
+ #: includes/Gateway/Digital_Wallet.php:178
1942
  msgid "OR"
1943
  msgstr ""
1944
 
1945
+ #: includes/Gateway/Digital_Wallet.php:280
1946
  #. translators: product ID
1947
  msgid "Product with the ID (%d) cannot be found."
1948
  msgstr ""
1949
 
1950
+ #: includes/Gateway/Digital_Wallet.php:296
1951
  #. translators: 1: product name 2: quantity in stock
1952
  msgid ""
1953
  "You cannot add that amount of \"%1$s\"; to the cart because there is not "
1954
  "enough stock (%2$s remaining)."
1955
  msgstr ""
1956
 
1957
+ #: includes/Gateway/Digital_Wallet.php:301
1958
  #. translators: 1: product name
1959
  msgid "You cannot purchase \"%1$s\" because it is currently not available."
1960
  msgstr ""
1961
 
1962
+ #: includes/Gateway/Digital_Wallet.php:323
1963
+ #: includes/Gateway/Digital_Wallet.php:419
1964
  msgid "Tax"
1965
  msgstr ""
1966
 
1967
+ #: includes/Gateway/Digital_Wallet.php:358
1968
  msgid "This payment method cannot be used for multiple shipments."
1969
  msgstr ""
1970
 
1971
+ #: includes/Gateway/Digital_Wallet.php:369
1972
  #: vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Store.php:378
1973
  msgid "Pending"
1974
  msgstr ""
1975
 
1976
+ #: includes/Gateway/Digital_Wallet.php:470
1977
  #. translators: Context (product, cart, checkout or page)
1978
  msgid "Empty payment request data for %s."
1979
  msgstr ""
1980
 
1981
+ #: includes/Gateway/Digital_Wallet.php:734
1982
  msgid "Empty cart"
1983
  msgstr ""
1984
 
1985
+ #: includes/Gateway/Digital_Wallet.php:868
1986
  msgid "Unable to verify domain with Apple Pay - missing access token."
1987
  msgstr ""
1988
 
2440
  msgid "Please choose a location"
2441
  msgstr ""
2442
 
2443
+ #: includes/Settings.php:357
2444
  msgid "Import all products from Square"
2445
  msgstr ""
2446
 
2447
+ #: includes/Settings.php:359
2448
+ msgid ""
2449
+ "You have made changes to the settings. Please save the changes to enable "
2450
+ "the button."
2451
+ msgstr ""
2452
+
2453
  #: includes/Sync/Interval_Polling.php:98
2454
  msgid "Updated data for %d category."
2455
  msgid_plural "Updated data for %d categories."
3241
  msgid "Migrated action with ID %1$d in %2$s to ID %3$d in %4$s"
3242
  msgstr ""
3243
 
3244
+ #: woocommerce-square.php:349
3245
+ #. translators: plugin name
3246
  msgid ""
3247
  "<strong>All features in %1$s have been disabled</strong> due to unsupported "
3248
  "settings:<br>"
3249
  msgstr ""
3250
 
3251
+ #: woocommerce-square.php:357
3252
+ #. translators: minimum PHP version, current PHP version
3253
  msgid ""
3254
  "&bull;&nbsp;<strong>Invalid PHP version: </strong>The minimum PHP version "
3255
  "required is %1$s. You are running %2$s.<br>"
3256
  msgstr ""
3257
 
3258
+ #: woocommerce-square.php:366
3259
+ #. translators: link to documentation
3260
  msgid ""
3261
  "&bull;&nbsp;<strong>Invalid OPcache config: </strong><a href=\"%s\" "
3262
  "target=\"_blank\">Please ensure the <code>save_comments</code> PHP option "
includes/Admin/Settings_Page.php CHANGED
@@ -175,8 +175,7 @@ class Settings_Page extends \WC_Settings_Page {
175
  </button>
176
  </header>
177
  <article>
178
- <?php /* translators: Placeholders: %1$s - <strong>, %2%s - </strong> */ ?>
179
- <p><?php printf( esc_html__( 'You are about to import all new products, variations and categories from Square. This will create a new product in WooCommerce for every product retrieved from Square. If you have products in the trash from the previous imports, these will be ignored in the import.', 'woocommerce-square' ), '<strong>', '</strong>' ); ?></p>
180
  <hr>
181
  <h4><?php esc_html_e( 'Do you wish to import existing product updates from Square?', 'woocommerce-square' ); ?></h4>
182
  <?php /* translators: Placeholders: %1$s - <a> tag linking to WooCommerce Square docs, %2%s - closing </a> tag */ ?>
@@ -196,6 +195,4 @@ class Settings_Page extends \WC_Settings_Page {
196
  </script>
197
  <?php
198
  }
199
-
200
-
201
  }
175
  </button>
176
  </header>
177
  <article>
178
+ <p><?php esc_html_e( 'You are about to import all new products, variations and categories from Square. This will create a new product in WooCommerce for every product retrieved from Square. If you have products in the trash from the previous imports, these will be ignored in the import.', 'woocommerce-square' ); ?></p>
 
179
  <hr>
180
  <h4><?php esc_html_e( 'Do you wish to import existing product updates from Square?', 'woocommerce-square' ); ?></h4>
181
  <?php /* translators: Placeholders: %1$s - <a> tag linking to WooCommerce Square docs, %2%s - closing </a> tag */ ?>
195
  </script>
196
  <?php
197
  }
 
 
198
  }
includes/Gateway/Digital_Wallet.php CHANGED
@@ -65,6 +65,7 @@ class Digital_Wallet {
65
 
66
  // Calculate the value of option `wc_square_apple_pay_enabled` which is not stored in the DB for WC Admin inbox notifications
67
  add_filter( 'pre_option_wc_square_apple_pay_enabled', array( $this, 'get_option_is_apple_pay_enabled' ), 10, 1 );
 
68
  }
69
 
70
  /**
@@ -325,7 +326,7 @@ class Digital_Wallet {
325
  );
326
  }
327
 
328
- $data['requestShippingContact'] = true;
329
  $data['lineItems'] = $items;
330
 
331
  return $this->build_payment_request( $amount, $data );
@@ -345,7 +346,7 @@ class Digital_Wallet {
345
  $data = wp_parse_args(
346
  $data,
347
  array(
348
- 'requestShippingContact' => wc_shipping_enabled() && isset( WC()->cart ) && WC()->cart->needs_shipping(),
349
  'requestEmailAddress' => true,
350
  'requestBillingContact' => true,
351
  'countryCode' => substr( get_option( 'woocommerce_default_country' ), 0, 2 ),
@@ -572,6 +573,37 @@ class Digital_Wallet {
572
  WC()->shipping->calculate_shipping( $packages );
573
  }
574
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
575
  /**
576
  * Recalculate shipping methods and cart totals and send the updated information
577
  * data as a square payment request json object.
@@ -586,58 +618,70 @@ class Digital_Wallet {
586
  $shipping_address = array();
587
  $payment_request = array();
588
 
589
- if ( ! empty( $_POST['shipping_contact'] ) ) {
590
- $shipping_address = wp_parse_args(
591
- wc_clean( wp_unslash( $_POST['shipping_contact'] ) ),
592
- array(
593
- 'countryCode' => null,
594
- 'state' => null,
595
- 'city' => null,
596
- 'postalCode' => null,
597
- 'address' => null,
598
- 'address_2' => null,
599
- )
600
- );
 
601
 
602
- $this->calculate_shipping( $shipping_address );
 
 
 
 
 
 
 
 
 
 
603
 
604
- $packages = WC()->shipping->get_packages();
605
 
606
- if ( ! empty( $packages ) ) {
607
- foreach ( $packages[0]['rates'] as $method ) {
608
- $payment_request['shippingOptions'][] = array(
609
- 'id' => $method->id,
610
- 'label' => $method->get_label(),
611
- 'amount' => number_format( $method->cost, 2, '.', '' ),
612
- );
 
613
  }
614
- }
615
 
616
- // sort the shippingOptions so that the default/chosen shipping method is the first option so that it's displayed first in the Apple Pay/Google Pay window
617
- if ( isset( $payment_request['shippingOptions'][0] ) ) {
618
- if ( isset( $chosen_methods[0] ) ) {
619
- $chosen_method_id = $chosen_methods[0];
620
- $compare_shipping_options = function ( $a, $b ) use ( $chosen_method_id ) {
621
- if ( $a['id'] === $chosen_method_id ) {
622
- return -1;
623
- }
624
 
625
- if ( $b['id'] === $chosen_method_id ) {
626
- return 1;
627
- }
628
 
629
- return 0;
630
- };
631
 
632
- usort( $payment_request['shippingOptions'], $compare_shipping_options );
633
- }
634
 
635
- $first_shipping_method_id = $payment_request['shippingOptions'][0]['id'];
636
- $this->update_shipping_method( array( $first_shipping_method_id ) );
 
 
 
 
637
  }
638
- } elseif ( ! empty( $_POST['shipping_option'] ) ) {
639
- $chosen_methods = array( wc_clean( wp_unslash( $_POST['shipping_option'] ) ) );
640
- $this->update_shipping_method( $chosen_methods );
641
  }
642
 
643
  WC()->cart->calculate_totals();
@@ -652,6 +696,33 @@ class Digital_Wallet {
652
  wp_send_json_success( $payment_request );
653
  }
654
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
655
  /**
656
  * Process the digital wallet checkout
657
  *
65
 
66
  // Calculate the value of option `wc_square_apple_pay_enabled` which is not stored in the DB for WC Admin inbox notifications
67
  add_filter( 'pre_option_wc_square_apple_pay_enabled', array( $this, 'get_option_is_apple_pay_enabled' ), 10, 1 );
68
+ add_filter( 'woocommerce_checkout_posted_data', array( $this, 'filter_posted_data' ) );
69
  }
70
 
71
  /**
326
  );
327
  }
328
 
329
+ $data['requestShippingContact'] = $product->needs_shipping();
330
  $data['lineItems'] = $items;
331
 
332
  return $this->build_payment_request( $amount, $data );
346
  $data = wp_parse_args(
347
  $data,
348
  array(
349
+ 'requestShippingContact' => isset( WC()->cart ) && WC()->cart->needs_shipping(),
350
  'requestEmailAddress' => true,
351
  'requestBillingContact' => true,
352
  'countryCode' => substr( get_option( 'woocommerce_default_country' ), 0, 2 ),
573
  WC()->shipping->calculate_shipping( $packages );
574
  }
575
 
576
+ /**
577
+ * Returns location's state code by state name.
578
+ *
579
+ * @param string $country_code The country's 2 letter ISO 3166-1 alpha-2 code.
580
+ * @param string $state_name The full name of the state that is to be search for its code.
581
+ *
582
+ * @return string|null
583
+ */
584
+ public static function get_state_code_by_name( $country_code = '', $state_name = '' ) {
585
+ if ( empty( $country_code ) || empty( $state_name ) ) {
586
+ return null;
587
+ }
588
+
589
+ $states = WC()->countries->get_states( $country_code );
590
+
591
+ /**
592
+ * Return the state code if $state_name already contains a valid state code.
593
+ */
594
+ if ( isset( $states[ $state_name ] ) ) {
595
+ return $state_name;
596
+ }
597
+
598
+ foreach ( $states as $code => $name ) {
599
+ if ( $name === $state_name ) {
600
+ return $code;
601
+ }
602
+ }
603
+
604
+ return null;
605
+ }
606
+
607
  /**
608
  * Recalculate shipping methods and cart totals and send the updated information
609
  * data as a square payment request json object.
618
  $shipping_address = array();
619
  $payment_request = array();
620
 
621
+ if ( WC()->cart->needs_shipping() ) {
622
+ if ( ! empty( $_POST['shipping_contact'] ) ) {
623
+ $shipping_address = wp_parse_args(
624
+ wc_clean( wp_unslash( $_POST['shipping_contact'] ) ),
625
+ array(
626
+ 'countryCode' => null,
627
+ 'state' => null,
628
+ 'city' => null,
629
+ 'postalCode' => null,
630
+ 'address' => null,
631
+ 'address_2' => null,
632
+ )
633
+ );
634
 
635
+ /**
636
+ * WooCommerce requires state code but for few countries, Google Pay
637
+ * returns the state's full name instead of the state code.
638
+ *
639
+ * The following line converts state name to code.
640
+ */
641
+ if ( isset( $shipping_address['countryCode'] ) && isset( $shipping_address['state'] ) ) {
642
+ $shipping_address['state'] = self::get_state_code_by_name( $shipping_address['countryCode'], $shipping_address['state'] );
643
+ }
644
+
645
+ $this->calculate_shipping( $shipping_address );
646
 
647
+ $packages = WC()->shipping->get_packages();
648
 
649
+ if ( ! empty( $packages ) ) {
650
+ foreach ( $packages[0]['rates'] as $method ) {
651
+ $payment_request['shippingOptions'][] = array(
652
+ 'id' => $method->id,
653
+ 'label' => $method->get_label(),
654
+ 'amount' => number_format( $method->cost, 2, '.', '' ),
655
+ );
656
+ }
657
  }
 
658
 
659
+ // sort the shippingOptions so that the default/chosen shipping method is the first option so that it's displayed first in the Apple Pay/Google Pay window
660
+ if ( isset( $payment_request['shippingOptions'][0] ) ) {
661
+ if ( isset( $chosen_methods[0] ) ) {
662
+ $chosen_method_id = $chosen_methods[0];
663
+ $compare_shipping_options = function ( $a, $b ) use ( $chosen_method_id ) {
664
+ if ( $a['id'] === $chosen_method_id ) {
665
+ return -1;
666
+ }
667
 
668
+ if ( $b['id'] === $chosen_method_id ) {
669
+ return 1;
670
+ }
671
 
672
+ return 0;
673
+ };
674
 
675
+ usort( $payment_request['shippingOptions'], $compare_shipping_options );
676
+ }
677
 
678
+ $first_shipping_method_id = $payment_request['shippingOptions'][0]['id'];
679
+ $this->update_shipping_method( array( $first_shipping_method_id ) );
680
+ }
681
+ } elseif ( ! empty( $_POST['shipping_option'] ) ) {
682
+ $chosen_methods = array( wc_clean( wp_unslash( $_POST['shipping_option'] ) ) );
683
+ $this->update_shipping_method( $chosen_methods );
684
  }
 
 
 
685
  }
686
 
687
  WC()->cart->calculate_totals();
696
  wp_send_json_success( $payment_request );
697
  }
698
 
699
+ /**
700
+ * Filters the post data just before checkout.
701
+ *
702
+ * WooCommerce requires the state code but Google Pay returns
703
+ * the full name of the state. We filter the post data to convert
704
+ * the full state name into its equivalent state code.
705
+ *
706
+ * @param array $posted_data The $_POST data submitted at checkout.
707
+ *
708
+ * @return array
709
+ */
710
+ public function filter_posted_data( $posted_data ) {
711
+ if ( isset( $posted_data['payment_method'] ) && 'square_credit_card' !== $posted_data['payment_method'] ) {
712
+ return $posted_data;
713
+ }
714
+
715
+ if ( isset( $posted_data['shipping_country'] ) && isset( $posted_data['shipping_state'] ) ) {
716
+ $posted_data['shipping_state'] = self::get_state_code_by_name( $posted_data['shipping_country'], $posted_data['shipping_state'] );
717
+ }
718
+
719
+ if ( isset( $posted_data['billing_country'] ) && isset( $posted_data['billing_state'] ) ) {
720
+ $posted_data['billing_state'] = self::get_state_code_by_name( $posted_data['billing_country'], $posted_data['billing_state'] );
721
+ }
722
+
723
+ return $posted_data;
724
+ }
725
+
726
  /**
727
  * Process the digital wallet checkout
728
  *
includes/Plugin.php CHANGED
@@ -43,7 +43,7 @@ class Plugin extends Payment_Gateway_Plugin {
43
 
44
 
45
  /** plugin version number */
46
- const VERSION = '3.0.3';
47
 
48
  /** plugin ID */
49
  const PLUGIN_ID = 'square';
43
 
44
 
45
  /** plugin version number */
46
+ const VERSION = '3.1.0';
47
 
48
  /** plugin ID */
49
  const PLUGIN_ID = 'square';
includes/Settings.php CHANGED
@@ -342,16 +342,21 @@ class Settings extends \WC_Settings_API {
342
  */
343
  public function generate_import_products_html( $id, $field ) {
344
 
 
 
 
 
345
  ob_start();
346
  ?>
347
- <tr valign="top">
348
  <th scope="row" class="titledesc">
349
  <label for="<?php echo esc_attr( $id ); ?>"><?php echo wp_kses_post( $field['title'] ); ?> <?php echo $this->get_tooltip_html( $field ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></label>
350
  </th>
351
  <td class="forminp">
352
- <a href='#' class='button js-import-square-products'>
353
  <?php echo esc_html__( 'Import all products from Square', 'woocommerce-square' ); ?>
354
  </a>
 
355
  </td>
356
  </tr>
357
  <?php
342
  */
343
  public function generate_import_products_html( $id, $field ) {
344
 
345
+ $is_location_set = (bool)$this->get_location_id();
346
+ $is_sor_set = (bool)$this->get_system_of_record_name();
347
+ $display = $is_location_set && $is_sor_set ? '' : 'display: none';
348
+
349
  ob_start();
350
  ?>
351
+ <tr valign="top" style="<?php echo esc_attr( $display ); ?>">
352
  <th scope="row" class="titledesc">
353
  <label for="<?php echo esc_attr( $id ); ?>"><?php echo wp_kses_post( $field['title'] ); ?> <?php echo $this->get_tooltip_html( $field ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></label>
354
  </th>
355
  <td class="forminp">
356
+ <a id="wc_square_import_products" href='#' class='button js-import-square-products <?php echo ( ! $this->get_location_id() ? 'disabled' : '' ); ?>'>
357
  <?php echo esc_html__( 'Import all products from Square', 'woocommerce-square' ); ?>
358
  </a>
359
+ <p class="description wc_square_save_changes_message" style="display: none;"><?php esc_html_e( 'You have made changes to the settings. Please save the changes to enable the button.', 'woocommerce-square' ); ?></p>
360
  </td>
361
  </tr>
362
  <?php
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: credit card, square, woocommerce, inventory sync
4
  Requires at least: 4.6
5
  Tested up to: 6.0
6
  Requires PHP: 7.2
7
- Stable tag: 3.0.3
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -71,6 +71,11 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
71
  2. The payment gateway settings.
72
 
73
  == Changelog ==
 
 
 
 
 
74
  = 3.0.3 - 2022-06-01 =
75
  * Fix - Customer Token Editor wasn't loading for some stores after updating to Square 3.0.0. #799
76
  * Fix - No such file or directory warnings on case-sensitive filesystems. #799
4
  Requires at least: 4.6
5
  Tested up to: 6.0
6
  Requires PHP: 7.2
7
+ Stable tag: 3.1.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
71
  2. The payment gateway settings.
72
 
73
  == Changelog ==
74
+ = 3.1.0 - 2022-06-09 =
75
+ * Fix - Hide shipping options in Google Pay form for virtual products. #800
76
+ * Fix - State-specific tax calculation when using Google Pay. #778
77
+ * Add - Validation that Business Location or SOR is set and Square settings are saved before enabling Import Products button. #463
78
+
79
  = 3.0.3 - 2022-06-01 =
80
  * Fix - Customer Token Editor wasn't loading for some stores after updating to Square 3.0.0. #799
81
  * Fix - No such file or directory warnings on case-sensitive filesystems. #799
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit6c004c5aa07454b927fc64c1448a79c5::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInite7caf2f4fab3115779a90b736801dd4b::getLoader();
vendor/composer/InstalledVersions.php CHANGED
@@ -249,13 +249,7 @@ class InstalledVersions
249
  @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
250
 
251
  if (null === self::$installed) {
252
- // only require the installed.php file if this file is loaded from its dumped location,
253
- // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
254
- if (substr(__DIR__, -8, 1) !== 'C') {
255
- self::$installed = include __DIR__ . '/installed.php';
256
- } else {
257
- self::$installed = array();
258
- }
259
  }
260
 
261
  return self::$installed;
@@ -322,13 +316,7 @@ class InstalledVersions
322
  }
323
 
324
  if (null === self::$installed) {
325
- // only require the installed.php file if this file is loaded from its dumped location,
326
- // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
327
- if (substr(__DIR__, -8, 1) !== 'C') {
328
- self::$installed = require __DIR__ . '/installed.php';
329
- } else {
330
- self::$installed = array();
331
- }
332
  }
333
  $installed[] = self::$installed;
334
 
249
  @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
250
 
251
  if (null === self::$installed) {
252
+ self::$installed = include __DIR__ . '/installed.php';
 
 
 
 
 
 
253
  }
254
 
255
  return self::$installed;
316
  }
317
 
318
  if (null === self::$installed) {
319
+ self::$installed = require __DIR__ . '/installed.php';
 
 
 
 
 
 
320
  }
321
  $installed[] = self::$installed;
322
 
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit6c004c5aa07454b927fc64c1448a79c5
6
  {
7
  private static $loader;
8
 
@@ -24,15 +24,15 @@ class ComposerAutoloaderInit6c004c5aa07454b927fc64c1448a79c5
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
- spl_autoload_register(array('ComposerAutoloaderInit6c004c5aa07454b927fc64c1448a79c5', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
- spl_autoload_unregister(array('ComposerAutoloaderInit6c004c5aa07454b927fc64c1448a79c5', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
  require __DIR__ . '/autoload_static.php';
34
 
35
- call_user_func(\Composer\Autoload\ComposerStaticInit6c004c5aa07454b927fc64c1448a79c5::getInitializer($loader));
36
  } else {
37
  $map = require __DIR__ . '/autoload_namespaces.php';
38
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInite7caf2f4fab3115779a90b736801dd4b
6
  {
7
  private static $loader;
8
 
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
+ spl_autoload_register(array('ComposerAutoloaderInite7caf2f4fab3115779a90b736801dd4b', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
+ spl_autoload_unregister(array('ComposerAutoloaderInite7caf2f4fab3115779a90b736801dd4b', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
  require __DIR__ . '/autoload_static.php';
34
 
35
+ call_user_func(\Composer\Autoload\ComposerStaticInite7caf2f4fab3115779a90b736801dd4b::getInitializer($loader));
36
  } else {
37
  $map = require __DIR__ . '/autoload_namespaces.php';
38
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit6c004c5aa07454b927fc64c1448a79c5
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'a' =>
@@ -45,10 +45,10 @@ class ComposerStaticInit6c004c5aa07454b927fc64c1448a79c5
45
  public static function getInitializer(ClassLoader $loader)
46
  {
47
  return \Closure::bind(function () use ($loader) {
48
- $loader->prefixLengthsPsr4 = ComposerStaticInit6c004c5aa07454b927fc64c1448a79c5::$prefixLengthsPsr4;
49
- $loader->prefixDirsPsr4 = ComposerStaticInit6c004c5aa07454b927fc64c1448a79c5::$prefixDirsPsr4;
50
- $loader->prefixesPsr0 = ComposerStaticInit6c004c5aa07454b927fc64c1448a79c5::$prefixesPsr0;
51
- $loader->classMap = ComposerStaticInit6c004c5aa07454b927fc64c1448a79c5::$classMap;
52
 
53
  }, null, ClassLoader::class);
54
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInite7caf2f4fab3115779a90b736801dd4b
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'a' =>
45
  public static function getInitializer(ClassLoader $loader)
46
  {
47
  return \Closure::bind(function () use ($loader) {
48
+ $loader->prefixLengthsPsr4 = ComposerStaticInite7caf2f4fab3115779a90b736801dd4b::$prefixLengthsPsr4;
49
+ $loader->prefixDirsPsr4 = ComposerStaticInite7caf2f4fab3115779a90b736801dd4b::$prefixDirsPsr4;
50
+ $loader->prefixesPsr0 = ComposerStaticInite7caf2f4fab3115779a90b736801dd4b::$prefixesPsr0;
51
+ $loader->classMap = ComposerStaticInite7caf2f4fab3115779a90b736801dd4b::$classMap;
52
 
53
  }, null, ClassLoader::class);
54
  }
vendor/composer/installed.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php return array(
2
  'root' => array(
3
- 'pretty_version' => 'dev-release/3.0.3',
4
- 'version' => 'dev-release/3.0.3',
5
  'type' => 'library',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => 'd7da55b543afbd20c255db4adb43cbaba1af8cb9',
9
  'name' => 'woocommerce/woocommerce-square',
10
  'dev' => false,
11
  ),
@@ -47,12 +47,12 @@
47
  'dev_requirement' => false,
48
  ),
49
  'woocommerce/woocommerce-square' => array(
50
- 'pretty_version' => 'dev-release/3.0.3',
51
- 'version' => 'dev-release/3.0.3',
52
  'type' => 'library',
53
  'install_path' => __DIR__ . '/../../',
54
  'aliases' => array(),
55
- 'reference' => 'd7da55b543afbd20c255db4adb43cbaba1af8cb9',
56
  'dev_requirement' => false,
57
  ),
58
  ),
1
  <?php return array(
2
  'root' => array(
3
+ 'pretty_version' => 'dev-release/3.1.0',
4
+ 'version' => 'dev-release/3.1.0',
5
  'type' => 'library',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
+ 'reference' => '9d99889923ef103d2bdea1a828aa4845ad234d21',
9
  'name' => 'woocommerce/woocommerce-square',
10
  'dev' => false,
11
  ),
47
  'dev_requirement' => false,
48
  ),
49
  'woocommerce/woocommerce-square' => array(
50
+ 'pretty_version' => 'dev-release/3.1.0',
51
+ 'version' => 'dev-release/3.1.0',
52
  'type' => 'library',
53
  'install_path' => __DIR__ . '/../../',
54
  'aliases' => array(),
55
+ 'reference' => '9d99889923ef103d2bdea1a828aa4845ad234d21',
56
  'dev_requirement' => false,
57
  ),
58
  ),
woocommerce-square.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
- * Version: 3.0.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
@@ -25,7 +25,7 @@
25
 
26
  defined( 'ABSPATH' ) || exit;
27
 
28
- require_once( plugin_dir_path( __FILE__ ) . 'vendor/woocommerce/action-scheduler/action-scheduler.php' );
29
 
30
  if ( ! defined( 'WC_SQUARE_PLUGIN_URL' ) ) {
31
  define( 'WC_SQUARE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
@@ -93,6 +93,7 @@ class WooCommerce_Square_Loader {
93
  */
94
  public function __clone() {
95
 
 
96
  _doing_it_wrong( __FUNCTION__, sprintf( 'You cannot clone instances of %s.', get_class( $this ) ), '2.0.0' );
97
  }
98
 
@@ -104,6 +105,7 @@ class WooCommerce_Square_Loader {
104
  */
105
  public function __wakeup() {
106
 
 
107
  _doing_it_wrong( __FUNCTION__, sprintf( 'You cannot unserialize instances of %s.', get_class( $this ) ), '2.0.0' );
108
  }
109
 
@@ -122,12 +124,12 @@ class WooCommerce_Square_Loader {
122
  $this->load_framework();
123
 
124
  // autoload plugin and vendor files
125
- $loader = require_once( plugin_dir_path( __FILE__ ) . 'vendor/autoload.php' );
126
 
127
  // register plugin namespace with autoloader
128
  $loader->addPsr4( 'WooCommerce\\Square\\', __DIR__ . '/includes' );
129
 
130
- require_once( plugin_dir_path( __FILE__ ) . 'includes/Functions.php' );
131
 
132
  // fire it up!
133
  wc_square();
@@ -140,8 +142,8 @@ class WooCommerce_Square_Loader {
140
  * @since 2.0.0
141
  */
142
  protected function load_framework() {
143
- require_once( plugin_dir_path( __FILE__ ) . 'includes/Framework/Plugin.php' );
144
- require_once( plugin_dir_path( __FILE__ ) . 'includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php' );
145
  }
146
 
147
 
@@ -268,7 +270,9 @@ class WooCommerce_Square_Loader {
268
 
269
  deactivate_plugins( plugin_basename( __FILE__ ) );
270
 
 
271
  if ( isset( $_GET['activate'] ) ) {
 
272
  unset( $_GET['activate'] );
273
  }
274
  }
@@ -341,14 +345,16 @@ class WooCommerce_Square_Loader {
341
 
342
  if ( ! $is_php_valid || ! $is_opcache_config_valid ) {
343
  $error_message .= sprintf(
344
- __( '<strong>All features in %1$s have been disabled</strong> due to unsupported settings:<br>', 'woocommerce-square' ),
 
345
  self::PLUGIN_NAME
346
  );
347
  }
348
 
349
  if ( ! $is_php_valid ) {
350
  $error_message .= sprintf(
351
- __( '&bull;&nbsp;<strong>Invalid PHP version: </strong>The minimum PHP version required is %1$s. You are running %2$s.<br>', 'woocommerce-square' ),
 
352
  self::MINIMUM_PHP_VERSION,
353
  PHP_VERSION
354
  );
@@ -356,7 +362,8 @@ class WooCommerce_Square_Loader {
356
 
357
  if ( ! $is_opcache_config_valid ) {
358
  $error_message .= sprintf(
359
- __( '&bull;&nbsp;<strong>Invalid OPcache config: </strong><a href="%s" target="_blank">Please ensure the <code>save_comments</code> PHP option is enabled.</a> You may need to contact your hosting provider to change caching options.', 'woocommerce-square' ),
 
360
  'https://woocommerce.com/document/woocommerce-square/#section-43'
361
  );
362
  }
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
+ * Version: 3.1.0
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
25
 
26
  defined( 'ABSPATH' ) || exit;
27
 
28
+ require_once plugin_dir_path( __FILE__ ) . 'vendor/woocommerce/action-scheduler/action-scheduler.php';
29
 
30
  if ( ! defined( 'WC_SQUARE_PLUGIN_URL' ) ) {
31
  define( 'WC_SQUARE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
93
  */
94
  public function __clone() {
95
 
96
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
97
  _doing_it_wrong( __FUNCTION__, sprintf( 'You cannot clone instances of %s.', get_class( $this ) ), '2.0.0' );
98
  }
99
 
105
  */
106
  public function __wakeup() {
107
 
108
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
109
  _doing_it_wrong( __FUNCTION__, sprintf( 'You cannot unserialize instances of %s.', get_class( $this ) ), '2.0.0' );
110
  }
111
 
124
  $this->load_framework();
125
 
126
  // autoload plugin and vendor files
127
+ $loader = require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
128
 
129
  // register plugin namespace with autoloader
130
  $loader->addPsr4( 'WooCommerce\\Square\\', __DIR__ . '/includes' );
131
 
132
+ require_once plugin_dir_path( __FILE__ ) . 'includes/Functions.php';
133
 
134
  // fire it up!
135
  wc_square();
142
  * @since 2.0.0
143
  */
144
  protected function load_framework() {
145
+ require_once plugin_dir_path( __FILE__ ) . 'includes/Framework/Plugin.php';
146
+ require_once plugin_dir_path( __FILE__ ) . 'includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php';
147
  }
148
 
149
 
270
 
271
  deactivate_plugins( plugin_basename( __FILE__ ) );
272
 
273
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
274
  if ( isset( $_GET['activate'] ) ) {
275
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
276
  unset( $_GET['activate'] );
277
  }
278
  }
345
 
346
  if ( ! $is_php_valid || ! $is_opcache_config_valid ) {
347
  $error_message .= sprintf(
348
+ // translators: plugin name
349
+ esc_html__( '<strong>All features in %1$s have been disabled</strong> due to unsupported settings:<br>', 'woocommerce-square' ),
350
  self::PLUGIN_NAME
351
  );
352
  }
353
 
354
  if ( ! $is_php_valid ) {
355
  $error_message .= sprintf(
356
+ // translators: minimum PHP version, current PHP version
357
+ esc_html__( '&bull;&nbsp;<strong>Invalid PHP version: </strong>The minimum PHP version required is %1$s. You are running %2$s.<br>', 'woocommerce-square' ),
358
  self::MINIMUM_PHP_VERSION,
359
  PHP_VERSION
360
  );
362
 
363
  if ( ! $is_opcache_config_valid ) {
364
  $error_message .= sprintf(
365
+ // translators: link to documentation
366
+ esc_html__( '&bull;&nbsp;<strong>Invalid OPcache config: </strong><a href="%s" target="_blank">Please ensure the <code>save_comments</code> PHP option is enabled.</a> You may need to contact your hosting provider to change caching options.', 'woocommerce-square' ),
367
  'https://woocommerce.com/document/woocommerce-square/#section-43'
368
  );
369
  }