Version Description
- 2022-09-14 =
- Add - Ensure the
via WooCommercetext can be translated and introduce a new filter to update that text while paying with Apple Pay. - Add - Missing square_customers table.
- Dev - Remove unnecessary build process files.
- Fix - Add notice when trying to import CSV and product sync is turned on.
- Fix - Invalid object with ID error while syncing variable products with Woo as SOR.
- Fix - Issue where
woocommerce_order_status_refundedhook previously ran twice after successful refund. - Fix - Multiple digital wallet buttons shown when quantity is updated.
- Fix - Tax computation error caused by tax ID set to 0.
- Fix - The
Repeated field must have at least one valueerror. - Update - Deprecates the method
get_max_objects_per_batch.
Download this release
Release Info
| Developer | automattic |
| Plugin | |
| Version | 3.2.0 |
| Comparing to | |
| See all releases | |
Code changes from version 3.1.0 to 3.2.0
- assets/css/mixins.scss +0 -61
- assets/js/admin/wc-square-admin-products.min.js +1 -1
- assets/js/frontend/wc-square-digital-wallet.min.js +1 -1
- changelog.txt +12 -0
- i18n/languages/woocommerce-square.pot +34 -29
- includes/Framework/Lifecycle.php +2 -0
- includes/Gateway.php +17 -0
- includes/Gateway/API/Requests/Orders.php +5 -1
- includes/Gateway/Digital_Wallet.php +19 -2
- includes/Handlers/Product/Woo_SOR.php +10 -2
- includes/Lifecycle.php +11 -0
- includes/Plugin.php +1 -1
- includes/Sync/Catalog_Item.php +1 -1
- includes/Sync/Manual_Synchronization.php +32 -26
- readme.txt +13 -1
- vendor/autoload.php +6 -1
- vendor/composer/ClassLoader.php +102 -11
- vendor/composer/InstalledVersions.php +35 -8
- vendor/composer/autoload_classmap.php +1 -1
- vendor/composer/autoload_namespaces.php +1 -1
- vendor/composer/autoload_psr4.php +1 -1
- vendor/composer/autoload_real.php +7 -26
- vendor/composer/autoload_static.php +5 -5
- vendor/composer/installed.php +11 -11
- woocommerce-square.php +1 -1
assets/css/mixins.scss
DELETED
|
@@ -1,61 +0,0 @@
|
|
| 1 |
-
// Use this mixin to import font-awesome from their CDN
|
| 2 |
-
@mixin import-fontawesome {
|
| 3 |
-
@import url("//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css");
|
| 4 |
-
}
|
| 5 |
-
|
| 6 |
-
// Use this mixin to create a font-awesome icon
|
| 7 |
-
// sample usage:
|
| 8 |
-
//
|
| 9 |
-
// .a-selector a:before {
|
| 10 |
-
// @include fa-icon( "\f0f6" );
|
| 11 |
-
// }
|
| 12 |
-
@mixin fa-icon( $icon ) {
|
| 13 |
-
font-family: FontAwesome;
|
| 14 |
-
font-weight: normal;
|
| 15 |
-
font-style: normal;
|
| 16 |
-
font-variant: normal;
|
| 17 |
-
text-transform: none;
|
| 18 |
-
text-decoration: inherit;
|
| 19 |
-
-webkit-font-smoothing: antialiased;
|
| 20 |
-
*margin-right: .3em;
|
| 21 |
-
line-height: 1;
|
| 22 |
-
content: $icon;
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
// Use this mixin to create dashicon icon
|
| 26 |
-
// sample usage:
|
| 27 |
-
//
|
| 28 |
-
// .a-selector a:before {
|
| 29 |
-
// @include dashicon( "\f460" );
|
| 30 |
-
// }
|
| 31 |
-
@mixin dashicon( $icon ) {
|
| 32 |
-
font-family: 'dashicons';
|
| 33 |
-
speak: none;
|
| 34 |
-
font-weight: normal;
|
| 35 |
-
font-variant: normal;
|
| 36 |
-
text-transform: none;
|
| 37 |
-
-webkit-font-smoothing: antialiased;
|
| 38 |
-
margin:0;
|
| 39 |
-
text-indent: 0;
|
| 40 |
-
position: absolute;
|
| 41 |
-
top:0;
|
| 42 |
-
left:0;
|
| 43 |
-
width:100%;
|
| 44 |
-
height: 100%;
|
| 45 |
-
text-align: center;
|
| 46 |
-
content: $icon;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
// Use this mixin when using a dashicon inside of an existing image, like WC order status icons or order action icons
|
| 50 |
-
// sample usage
|
| 51 |
-
//
|
| 52 |
-
// mark {
|
| 53 |
-
// @include dashicon-ir;
|
| 54 |
-
// }
|
| 55 |
-
@mixin dashicon-ir() {
|
| 56 |
-
display: block;
|
| 57 |
-
text-indent: -9999px;
|
| 58 |
-
position: relative;
|
| 59 |
-
height:1em;
|
| 60 |
-
width:1em;
|
| 61 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/admin/wc-square-admin-products.min.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
"use strict";jQuery(document).ready($=>{var typenow=window.typenow||"";var pagenow=window.pagenow||"";if("product"!==typenow){return}if(!wc_square_admin_products.is_product_sync_enabled){return}if("edit-product"===pagenow){$("#the-list").on("click",".editinline",e=>{var $row=$(e.target).closest("tr");var postID=$row.find("th.check-column input").val();var data={action:"wc_square_get_quick_edit_product_details",security:wc_square_admin_products.get_quick_edit_product_details_nonce,product_id:$row.find("th.check-column input").val()};$.post(wc_square_admin_products.ajax_url,data,response=>{var $editRow=$("tr#edit-"+postID);var $squareSynced=$editRow.find("select.square-synced");var $errors=$editRow.find(".wc-square-sync-with-square-errors");if(!response.success&&response.data){if("multiple_attributes"===response.data){$squareSynced.prop("checked",false);$squareSynced.prop("disabled",true);$errors.find(".multiple_attributes").show();return}else if("missing_variation_sku"===response.data){$squareSynced.prop("checked",false);$squareSynced.prop("disabled",true);$errors.find(".missing_variation_sku").show();return}}var $sku=$editRow.find("input[name=_sku]");var $stockStatus=$editRow.find("select[name=_stock_status]");var $stockQty=$editRow.find("input[name=_stock]");var $manageStockLabel=$editRow.find(".manage_stock_field .manage_stock");var $manageStockInput=$editRow.find("input[name=_manage_stock]");var $manageStockDesc="<span class=\"description\"><a href=\""+wc_square_admin_products.settings_url+"\">"+wc_square_admin_products.i18n.synced_with_square+"</a></span>";var edit_url=response.data.edit_url;var i18n=response.data.i18n;var is_variable=response.data.is_variable;$squareSynced.val(response.data.is_synced_with_square);$sku.on("change keyup keypress",e=>{if(""===$(e.target).val()&&!is_variable){$squareSynced.val("no").trigger("change");$squareSynced.prop("disabled",true);$errors.find(".missing_sku").show()}else{$squareSynced.prop("disabled",false);$squareSynced.trigger("change");return $errors.find(".missing_sku").hide()}}).trigger("change");$squareSynced.on("change",e=>{if("no"===$(e.target).val()){$manageStockInput.off();$manageStockInput.add($stockQty).css({opacity:1});$manageStockLabel.find(".description").remove();if(is_variable){if($manageStockInput.is(":checked")){$(".stock_qty_field").show();$(".backorder_field").show()}else{$(".stock_status_field").show()}}else{$stockQty.prop("readonly",false);$stockStatus.prop("readonly",false)}}else{$manageStockInput.prop("checked",true);$manageStockInput.on("click",()=>{return false});$manageStockInput.add($stockQty).css({opacity:"0.5"});$manageStockLabel.append($manageStockDesc);if(wc_square_admin_products.is_woocommerce_sor&&edit_url&&i18n){$manageStockLabel.append("<p class=\"description\"><a href=\""+edit_url+"\">"+i18n+"</a></p>")}if(is_variable){$(".stock_status_field").hide();$(".stock_qty_field").hide();$(".backorder_field").hide()}else{$stockQty.prop("readonly",true);$stockStatus.prop("readonly",true)}}}).trigger("change")})})}if("product"===pagenow){var syncCheckboxID="#_"+wc_square_admin_products.synced_with_square_taxonomy;var isVariable=()=>{return wc_square_admin_products.variable_product_types.includes($("#product-type").val())};var hasSKU=()=>{return""!==$("#_sku").val().trim()};var hasVariableSKUs=skus=>{if(!skus.length){return false}var valid=skus.filter(sku=>""!==$(sku).val().trim());return valid.length===skus.length};var hasUniqueSKUs=skus=>{var skuValues=skus.map(sku=>$(sku).val());return skuValues.every(sku=>skuValues.indexOf(sku)===skuValues.lastIndexOf(sku))};var hasMultipleAttributes=()=>{var $variation_attributes=$(".woocommerce_attribute_data input[name^=\"attribute_variation\"]:checked");return isVariable()&&$variation_attributes&&$variation_attributes.length>1};var showError=error=>{$(".wc-square-sync-with-square-error."+error).show();$(syncCheckboxID).prop("disabled",true);$(syncCheckboxID).prop("checked",false)};var hideError=function hideError(error){var enable=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;$(".wc-square-sync-with-square-error."+error).hide();if(enable){$(syncCheckboxID).prop("disabled",false)}};var handleSKU=syncCheckboxID=>{if(isVariable()){$("#_sku").off("change keypress keyup");hideError("missing_sku",!hasMultipleAttributes());var skus=$("input[id^=\"variable_sku\"]");skus.on("change keypress keyup",()=>{if(!hasVariableSKUs($.makeArray(skus))||!hasUniqueSKUs($.makeArray(skus))){showError("missing_variation_sku")}else{hideError("missing_variation_sku",!hasMultipleAttributes())}$(syncCheckboxID).triggerHandler("change")}).triggerHandler("change")}else{$("input[id^=\"variable_sku\"]").off("change keypress keyup");hideError("missing_variation_sku",!hasMultipleAttributes());$("#_sku").on("change keypress keyup",e=>{if(""===$(e.target).val().trim()){showError("missing_sku")}else{hideError("missing_sku",!hasMultipleAttributes())}$(syncCheckboxID).trigger("change")}).trigger("change")}};var handleAttributes=syncCheckboxID=>{$("#variable_product_options").on("reload",()=>{if(hasMultipleAttributes()){showError("multiple_attributes")}else{hideError("multiple_attributes",isVariable()?hasVariableSKUs:hasSKU())}$(syncCheckboxID).trigger("change")}).trigger("reload")};var triggerUpdate=()=>{handleSKU(syncCheckboxID);$(syncCheckboxID).trigger("change");if(isVariable()&&!$("input[id^=\"variable_sku\"]").length){showError("missing_variation_sku")}};handleAttributes(syncCheckboxID);var $stockFields=$(".stock_fields");var $stockInput=$stockFields.find("#_stock");var $stockStatus=$(".stock_status_field");var $manageField=$("._manage_stock_field");var $manageInput=$manageField.find("#_manage_stock");var $manageDesc=$manageField.find(".description");var manageDescOriginal=$manageDesc.text();var manageStockOriginal=$("#_manage_stock").is(":checked");$(syncCheckboxID).on("change",e=>{if(!wc_square_admin_products.is_inventory_sync_enabled){return}var variableProduct=wc_square_admin_products.variable_product_types.includes($("#product-type").val());var useSquare;if($(e.target).is(":checked")&&$("#_square_item_variation_id").length>0){useSquare=true;$manageDesc.html("<a href=\""+wc_square_admin_products.settings_url+"\">"+wc_square_admin_products.i18n.synced_with_square+"</a>");$manageInput.prop("disabled",true).prop("checked",!variableProduct);$stockFields.hide();$stockStatus.hide();$stockInput.prop("readonly",true);if(!variableProduct){$stockFields.show()}if(wc_square_admin_products.is_woocommerce_sor&&!variableProduct){if($("p._stock_field span.description").length===0){$stockInput.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>")}$("#fetch-stock-with-square").on("click",e=>{e.preventDefault();var $spinner=$("p._stock_field span.description .spinner");var data={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:$("#post_ID").val()};$spinner.css("visibility","visible");$.post(wc_square_admin_products.ajax_url,data,response=>{if(response&&response.success){var quantity=response.data;$stockInput.val(quantity);$stockFields.find("input[name=_original_stock]").val(quantity);$stockInput.prop("readonly",false);$("p._stock_field span.description").remove()}else{if(response.data){$(".inventory-fetch-error").remove();$spinner.after("<span class=\"inventory-fetch-error\" style=\"display:inline-block;color:red;\">"+response.data+"</span>")}$spinner.css("visibility","hidden")}})})}else if(wc_square_admin_products.is_square_sor){if($("p._stock_field span.description").length===0){$stockInput.after("<span class=\"description\" style=\"display:block;clear:both;\">"+wc_square_admin_products.i18n.managed_by_square+"</span>")}}}else{useSquare=false;$("p._stock_field span.description").remove();$stockInput.prop("readonly",false);$manageDesc.html(manageDescOriginal);$manageInput.prop("disabled",false).prop("checked",manageStockOriginal);if(manageStockOriginal){$stockFields.show();$stockStatus.hide()}else{$stockStatus.show();$stockFields.hide()}}$(".woocommerce_variation").each((index,e)=>{var variationID=$(e).find("h3 > a").attr("rel");var $variationManageInput=$(e).find(".variable_manage_stock");var $variationManageField=$variationManageInput.parent();var $variationStockInput=$(e).find(".wc_input_stock");var $variationStockField=$variationStockInput.parent();if(useSquare){$("#wc_square_variation_manage_stock").prop("disabled",false);$variationStockInput.prop("readonly",true);$variationManageInput.prop("disabled",true).prop("checked",true);if(0===$variationManageField.find(".description").length){$variationManageInput.after("<span class=\"description\">("+wc_square_admin_products.i18n.managed_by_square+")</span>")}if(wc_square_admin_products.is_woocommerce_sor){var fetchVariationStockActionID="fetch-stock-with-square-"+variationID;if(0===$variationStockField.find("span.description").length){$variationStockInput.after("<span class=\"description\" style=\"display:block;clear:both;\"><a href=\"#\" id=\""+fetchVariationStockActionID+"\">"+wc_square_admin_products.i18n.fetch_stock_with_square+"</a><div class=\"spinner\" style=\"float:none;\"></div></span>")}$("#"+fetchVariationStockActionID).on("click",e=>{e.preventDefault();var $spinner=$(e.target).next(".spinner");var data={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:variationID};$spinner.css("visibility","visible");$.post(wc_square_admin_products.ajax_url,data,response=>{if(response&&response.success){var quantity=response.data;$variationStockInput.val(quantity);$variationStockField.parent().find("input[name^=\"variable_original_stock\"]").val(quantity);$variationStockInput.prop("readonly",false);$variationStockField.find(".description").remove()}else{if(response.data){$(".inventory-fetch-error").remove();$spinner.after("<span class=\"inventory-fetch-error\" style=\"display:inline-block;color:red;\">"+response.data+"</span>")}$spinner.css("visibility","hidden")}})})}}else{$variationStockInput.prop("readonly",false);$variationManageInput.prop("disabled",false);$variationManageInput.next(".description").remove();$(e.target).find("#wc_square_variation_manage_stock").prop("disabled",true)}})}).trigger("change");$("#product-type").on("change",()=>{triggerUpdate()});$("#woocommerce-product-data").on("woocommerce_variations_loaded woocommerce_variations_added woocommerce_variations_removed",()=>{triggerUpdate()})}});
|
| 1 |
+
"use strict";jQuery(document).ready($=>{var typenow=window.typenow||"";var pagenow=window.pagenow||"";var __=wp.i18n.__;if("product"!==typenow){return}if(!wc_square_admin_products.is_product_sync_enabled){return}else if("product_page_product_importer"===pagenow){var importNotice="<div class=\"error\">"+"<p>"+__("Product syncing with square has been enabled. "+"If you are trying to update product inventory, you should do it in Square. "+"Your existing inventory data in WooCommerce will be overwritten with data from Square products.","woocommerce-square")+"</p>"+"</div>";$(".wc-progress-steps").after(importNotice)}if("edit-product"===pagenow){$("#the-list").on("click",".editinline",e=>{var $row=$(e.target).closest("tr");var postID=$row.find("th.check-column input").val();var data={action:"wc_square_get_quick_edit_product_details",security:wc_square_admin_products.get_quick_edit_product_details_nonce,product_id:$row.find("th.check-column input").val()};$.post(wc_square_admin_products.ajax_url,data,response=>{var $editRow=$("tr#edit-"+postID);var $squareSynced=$editRow.find("select.square-synced");var $errors=$editRow.find(".wc-square-sync-with-square-errors");if(!response.success&&response.data){if("multiple_attributes"===response.data){$squareSynced.prop("checked",false);$squareSynced.prop("disabled",true);$errors.find(".multiple_attributes").show();return}else if("missing_variation_sku"===response.data){$squareSynced.prop("checked",false);$squareSynced.prop("disabled",true);$errors.find(".missing_variation_sku").show();return}}var $sku=$editRow.find("input[name=_sku]");var $stockStatus=$editRow.find("select[name=_stock_status]");var $stockQty=$editRow.find("input[name=_stock]");var $manageStockLabel=$editRow.find(".manage_stock_field .manage_stock");var $manageStockInput=$editRow.find("input[name=_manage_stock]");var $manageStockDesc="<span class=\"description\"><a href=\""+wc_square_admin_products.settings_url+"\">"+wc_square_admin_products.i18n.synced_with_square+"</a></span>";var edit_url=response.data.edit_url;var i18n=response.data.i18n;var is_variable=response.data.is_variable;$squareSynced.val(response.data.is_synced_with_square);$sku.on("change keyup keypress",e=>{if(""===$(e.target).val()&&!is_variable){$squareSynced.val("no").trigger("change");$squareSynced.prop("disabled",true);$errors.find(".missing_sku").show()}else{$squareSynced.prop("disabled",false);$squareSynced.trigger("change");return $errors.find(".missing_sku").hide()}}).trigger("change");$squareSynced.on("change",e=>{if("no"===$(e.target).val()){$manageStockInput.off();$manageStockInput.add($stockQty).css({opacity:1});$manageStockLabel.find(".description").remove();if(is_variable){if($manageStockInput.is(":checked")){$(".stock_qty_field").show();$(".backorder_field").show()}else{$(".stock_status_field").show()}}else{$stockQty.prop("readonly",false);$stockStatus.prop("readonly",false)}}else{$manageStockInput.prop("checked",true);$manageStockInput.on("click",()=>{return false});$manageStockInput.add($stockQty).css({opacity:"0.5"});$manageStockLabel.append($manageStockDesc);if(wc_square_admin_products.is_woocommerce_sor&&edit_url&&i18n){$manageStockLabel.append("<p class=\"description\"><a href=\""+edit_url+"\">"+i18n+"</a></p>")}if(is_variable){$(".stock_status_field").hide();$(".stock_qty_field").hide();$(".backorder_field").hide()}else{$stockQty.prop("readonly",true);$stockStatus.prop("readonly",true)}}}).trigger("change")})})}if("product"===pagenow){var syncCheckboxID="#_"+wc_square_admin_products.synced_with_square_taxonomy;var isVariable=()=>{return wc_square_admin_products.variable_product_types.includes($("#product-type").val())};var hasSKU=()=>{return""!==$("#_sku").val().trim()};var hasVariableSKUs=skus=>{if(!skus.length){return false}var valid=skus.filter(sku=>""!==$(sku).val().trim());return valid.length===skus.length};var hasUniqueSKUs=skus=>{var skuValues=skus.map(sku=>$(sku).val());return skuValues.every(sku=>skuValues.indexOf(sku)===skuValues.lastIndexOf(sku))};var hasMultipleAttributes=()=>{var $variation_attributes=$(".woocommerce_attribute_data input[name^=\"attribute_variation\"]:checked");return isVariable()&&$variation_attributes&&$variation_attributes.length>1};var showError=error=>{$(".wc-square-sync-with-square-error."+error).show();$(syncCheckboxID).prop("disabled",true);$(syncCheckboxID).prop("checked",false)};var hideError=function hideError(error){var enable=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;$(".wc-square-sync-with-square-error."+error).hide();if(enable){$(syncCheckboxID).prop("disabled",false)}};var handleSKU=syncCheckboxID=>{if(isVariable()){$("#_sku").off("change keypress keyup");hideError("missing_sku",!hasMultipleAttributes());var skus=$("input[id^=\"variable_sku\"]");skus.on("change keypress keyup",()=>{if(!hasVariableSKUs($.makeArray(skus))||!hasUniqueSKUs($.makeArray(skus))){showError("missing_variation_sku")}else{hideError("missing_variation_sku",!hasMultipleAttributes())}$(syncCheckboxID).triggerHandler("change")}).triggerHandler("change")}else{$("input[id^=\"variable_sku\"]").off("change keypress keyup");hideError("missing_variation_sku",!hasMultipleAttributes());$("#_sku").on("change keypress keyup",e=>{if(""===$(e.target).val().trim()){showError("missing_sku")}else{hideError("missing_sku",!hasMultipleAttributes())}$(syncCheckboxID).trigger("change")}).trigger("change")}};var handleAttributes=syncCheckboxID=>{$("#variable_product_options").on("reload",()=>{if(hasMultipleAttributes()){showError("multiple_attributes")}else{hideError("multiple_attributes",isVariable()?hasVariableSKUs:hasSKU())}$(syncCheckboxID).trigger("change")}).trigger("reload")};var triggerUpdate=()=>{handleSKU(syncCheckboxID);$(syncCheckboxID).trigger("change");if(isVariable()&&!$("input[id^=\"variable_sku\"]").length){showError("missing_variation_sku")}};handleAttributes(syncCheckboxID);var $stockFields=$(".stock_fields");var $stockInput=$stockFields.find("#_stock");var $stockStatus=$(".stock_status_field");var $manageField=$("._manage_stock_field");var $manageInput=$manageField.find("#_manage_stock");var $manageDesc=$manageField.find(".description");var manageDescOriginal=$manageDesc.text();var manageStockOriginal=$("#_manage_stock").is(":checked");$(syncCheckboxID).on("change",e=>{if(!wc_square_admin_products.is_inventory_sync_enabled){return}var variableProduct=wc_square_admin_products.variable_product_types.includes($("#product-type").val());var useSquare;if($(e.target).is(":checked")&&$("#_square_item_variation_id").length>0){useSquare=true;$manageDesc.html("<a href=\""+wc_square_admin_products.settings_url+"\">"+wc_square_admin_products.i18n.synced_with_square+"</a>");$manageInput.prop("disabled",true).prop("checked",!variableProduct);$stockFields.hide();$stockStatus.hide();$stockInput.prop("readonly",true);if(!variableProduct){$stockFields.show()}if(wc_square_admin_products.is_woocommerce_sor&&!variableProduct){if($("p._stock_field span.description").length===0){$stockInput.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>")}$("#fetch-stock-with-square").on("click",e=>{e.preventDefault();var $spinner=$("p._stock_field span.description .spinner");var data={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:$("#post_ID").val()};$spinner.css("visibility","visible");$.post(wc_square_admin_products.ajax_url,data,response=>{if(response&&response.success){var quantity=response.data;$stockInput.val(quantity);$stockFields.find("input[name=_original_stock]").val(quantity);$stockInput.prop("readonly",false);$("p._stock_field span.description").remove()}else{if(response.data){$(".inventory-fetch-error").remove();$spinner.after("<span class=\"inventory-fetch-error\" style=\"display:inline-block;color:red;\">"+response.data+"</span>")}$spinner.css("visibility","hidden")}})})}else if(wc_square_admin_products.is_square_sor){if($("p._stock_field span.description").length===0){$stockInput.after("<span class=\"description\" style=\"display:block;clear:both;\">"+wc_square_admin_products.i18n.managed_by_square+"</span>")}}}else{useSquare=false;$("p._stock_field span.description").remove();$stockInput.prop("readonly",false);$manageDesc.html(manageDescOriginal);$manageInput.prop("disabled",false).prop("checked",manageStockOriginal);if(manageStockOriginal){$stockFields.show();$stockStatus.hide()}else{$stockStatus.show();$stockFields.hide()}}$(".woocommerce_variation").each((index,e)=>{var variationID=$(e).find("h3 > a").attr("rel");var $variationManageInput=$(e).find(".variable_manage_stock");var $variationManageField=$variationManageInput.parent();var $variationStockInput=$(e).find(".wc_input_stock");var $variationStockField=$variationStockInput.parent();if(useSquare){$("#wc_square_variation_manage_stock").prop("disabled",false);$variationStockInput.prop("readonly",true);$variationManageInput.prop("disabled",true).prop("checked",true);if(0===$variationManageField.find(".description").length){$variationManageInput.after("<span class=\"description\">("+wc_square_admin_products.i18n.managed_by_square+")</span>")}if(wc_square_admin_products.is_woocommerce_sor){var fetchVariationStockActionID="fetch-stock-with-square-"+variationID;if(0===$variationStockField.find("span.description").length){$variationStockInput.after("<span class=\"description\" style=\"display:block;clear:both;\"><a href=\"#\" id=\""+fetchVariationStockActionID+"\">"+wc_square_admin_products.i18n.fetch_stock_with_square+"</a><div class=\"spinner\" style=\"float:none;\"></div></span>")}$("#"+fetchVariationStockActionID).on("click",e=>{e.preventDefault();var $spinner=$(e.target).next(".spinner");var data={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:variationID};$spinner.css("visibility","visible");$.post(wc_square_admin_products.ajax_url,data,response=>{if(response&&response.success){var quantity=response.data;$variationStockInput.val(quantity);$variationStockField.parent().find("input[name^=\"variable_original_stock\"]").val(quantity);$variationStockInput.prop("readonly",false);$variationStockField.find(".description").remove()}else{if(response.data){$(".inventory-fetch-error").remove();$spinner.after("<span class=\"inventory-fetch-error\" style=\"display:inline-block;color:red;\">"+response.data+"</span>")}$spinner.css("visibility","hidden")}})})}}else{$variationStockInput.prop("readonly",false);$variationManageInput.prop("disabled",false);$variationManageInput.next(".description").remove();$(e.target).find("#wc_square_variation_manage_stock").prop("disabled",true)}})}).trigger("change");$("#product-type").on("change",()=>{triggerUpdate()});$("#woocommerce-product-data").on("woocommerce_variations_loaded woocommerce_variations_added woocommerce_variations_removed",()=>{triggerUpdate()})}});
|
assets/js/frontend/wc-square-digital-wallet.min.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
"use strict";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}jQuery(document).ready($=>{class WC_Square_Digital_Wallet_Handler{constructor(args){this.args=args;this.payment_request=args.payment_request;this.total_amount=args.payment_request.total.amount;this.cartForm=".cart";this.wallet="#wc-square-digital-wallet";this.buttons=".wc-square-wallet-buttons";this.isGooglePayHidden=this.args.hide_button_options.includes("google");this.isApplePayHidden=this.args.hide_button_options.includes("apple");if($(this.wallet).length===0){return}$(this.wallet).hide();$(this.buttons).hide();this.build_digital_wallet();this.attach_page_events();this.buildDigitalWalletDebounced=this.debounce(this.build_digital_wallet,500)}build_digital_wallet(){this.block_ui();this.get_payment_request().then(response=>{this.payment_request=JSON.parse(response);this.total_amount=this.payment_request.total.amount;this.load_square_form()},message=>{this.log("[Square] Could not build payment request. "+message,"error");$(this.wallet).hide()})}attach_page_events(){if(this.args.context==="product"){var addToCartButton=$(".single_add_to_cart_button");$("#apple-pay-button, #wc-square-google-pay").on("click",e=>{if(addToCartButton.is(".disabled")){e.stopImmediatePropagation();if(addToCartButton.is(".wc-variation-is-unavailable")){window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text)}else if(addToCartButton.is(".wc-variation-selection-needed")){window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text)}return}this.add_to_cart()});$(document.body).on("woocommerce_variation_has_changed",()=>this.build_digital_wallet());$(".quantity").on("input",".qty",()=>this.build_digital_wallet())}if(this.args.context==="cart"){$(document.body).on("updated_cart_totals",()=>this.build_digital_wallet())}if(this.args.context==="checkout"){$(document.body).on("updated_checkout",()=>this.build_digital_wallet())}}load_square_form(){if(this.googlePay){this.googlePay.destroy();this.squareFormLoaded=false}if(this.applePay){this.applePay.destroy();this.squareFormLoaded=false}if(this.squareFormLoaded){return}this.squareFormLoaded=true;this.log("[Square] Building digital wallet payment form");var{applicationId,locationId}=this.get_form_params();this.payments=window.Square.payments(applicationId,locationId);this.initializeDigitalWalletPaymentMethods()}initializeDigitalWalletPaymentMethods(){var _this=this;return _asyncToGenerator(function*(){if(!_this.payments){return}var paymentRequest=_this.payments.paymentRequest(_this.create_payment_request());_this.registerDigitalWalletShippingEventHandlers(paymentRequest);if(!_this.isGooglePayHidden){_this.googlePay=yield _this.payments.googlePay(paymentRequest);_this.googlePay.attach("#wc-square-google-pay",{buttonSizeMode:"fill",buttonType:"long",buttonColor:_this.args.google_pay_color});$("#wc-square-google-pay").on("click",function(){var _ref=_asyncToGenerator(function*(e){return _this.handleGooglePayPaymentMethodSubmission(e,_this.googlePay)});return function(_x){return _ref.apply(this,arguments)}}());$("#wc-square-google-pay").show()}if(!_this.isApplePayHidden){try{_this.applePay=yield _this.payments.applePay(paymentRequest);$("#apple-pay-button").on("click",function(){var _ref2=_asyncToGenerator(function*(e){return _this.handleApplePayPaymentMethodSubmission(e,_this.applePay)});return function(_x2){return _ref2.apply(this,arguments)}}());$("#apple-pay-button").show()}catch(e){console.log(e.message)}}if(_this.googlePay||_this.applePay){$(_this.wallet).show();_this.unblock_ui()}})()}handleGooglePayPaymentMethodSubmission(e){var _arguments=arguments,_this2=this;return _asyncToGenerator(function*(){var googlePay=_arguments.length>1&&_arguments[1]!==undefined?_arguments[1]:null;e.preventDefault();if(!googlePay){return}var result=yield googlePay.tokenize();if(result.status==="OK"){var cardData=_objectSpread(_objectSpread({},result.details.card),{},{digital_wallet_type:result.details.method});var billingAndShippingData={billingContact:result.details.billing};if(result.details.shipping){billingAndShippingData.shippingContact=result.details.shipping.contact;billingAndShippingData.shippingOption=result.details.shipping.option}_this2.handle_card_nonce_response(false,result.token,cardData,billingAndShippingData)}})()}handleApplePayPaymentMethodSubmission(e){var _arguments2=arguments,_this3=this;return _asyncToGenerator(function*(){var applePay=_arguments2.length>1&&_arguments2[1]!==undefined?_arguments2[1]:null;e.preventDefault();if(!applePay){return}var result=yield applePay.tokenize();if(result.status==="OK"){var cardData=_objectSpread(_objectSpread({},result.details.card),{},{digital_wallet_type:result.details.method});var billingAndShippingData={billingContact:result.details.billing};if(result.details.shipping){billingAndShippingData.shippingContact=result.details.shipping.contact;billingAndShippingData.shippingOption=result.details.shipping.option}_this3.handle_card_nonce_response(false,result.token,cardData,billingAndShippingData)}})()}registerDigitalWalletShippingEventHandlers(paymentRequest){paymentRequest.addEventListener("shippingoptionchanged",option=>this.handle_shipping_option_changed(option));paymentRequest.addEventListener("shippingcontactchanged",shippingContact=>this.handle_shipping_address_changed(shippingContact))}get_form_params(){var params={applicationId:this.args.application_id,locationId:this.args.location_id,autobuild:false,applePay:{elementId:"apple-pay-button"},googlePay:{elementId:"wc-square-google-pay"}};if(this.payment_request.requestShippingAddress===false){delete params.callbacks.shippingOptionChanged}if(this.args.hide_button_options.includes("google")){delete params.googlePay}if(this.args.hide_button_options.includes("apple")){delete params.applePay}return params}create_payment_request(){return this.payment_request}methods_supported(methods,unsupportedReason){if(methods.applePay===true||methods.googlePay===true){if(methods.applePay===true){$("#apple-pay-button").show()}if(methods.googlePay===true){$("#wc-square-google-pay").show()}$(this.wallet).show()}else{this.log(unsupportedReason)}}get_payment_request(){return new Promise((resolve,reject)=>{var data={context:this.args.context,security:this.args.payment_request_nonce};if(this.args.context==="product"){var product_data=this.get_product_data();$.extend(data,product_data)}$.post(this.get_ajax_url("get_payment_request"),data,response=>{if(response.success){return resolve(response.data)}return reject(response.data)})})}handle_shipping_address_changed(shippingContact){var _this4=this;return _asyncToGenerator(function*(){var data={context:_this4.args.context,shipping_contact:shippingContact,security:_this4.args.recalculate_totals_nonce};var response=yield _this4.recalculate_totals(data);return response})()}handle_shipping_option_changed(shippingOption){var _this5=this;return _asyncToGenerator(function*(){var data={context:_this5.args.context,shipping_option:shippingOption.id,security:_this5.args.recalculate_totals_nonce};var response=yield _this5.recalculate_totals(data);return response})()}handle_card_nonce_response(){var errors=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var nonce=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var cardData=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var billingAndShippingData=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};if(errors){return this.render_errors(errors)}if(!nonce){return this.render_errors(this.args.general_error)}this.block_ui();var{billingContact={},shippingContact={},shippingOption=null}=billingAndShippingData;var data={action:"",_wpnonce:this.args.process_checkout_nonce,billing_first_name:billingContact.givenName?billingContact.givenName:"",billing_last_name:billingContact.familyName?billingContact.familyName:"",billing_company:"",billing_email:shippingContact.email?shippingContact.email:billingContact.email?billingContact.email:"",billing_phone:shippingContact.phone?shippingContact.phone:"",billing_country:billingContact.countryCode?billingContact.countryCode.toUpperCase():"",billing_address_1:billingContact.addressLines&&billingContact.addressLines[0]?billingContact.addressLines[0]:"",billing_address_2:billingContact.addressLines&&billingContact.addressLines[1]?billingContact.addressLines[1]:"",billing_city:billingContact.city?billingContact.city:"",billing_state:billingContact.state?billingContact.state:"",billing_postcode:billingContact.postalCode?billingContact.postalCode:"",shipping_first_name:shippingContact.givenName?shippingContact.givenName:"",shipping_last_name:shippingContact.familyName?shippingContact.familyName:"",shipping_company:"",shipping_country:shippingContact.countryCode?shippingContact.countryCode.toUpperCase():"",shipping_address_1:shippingContact.addressLines&&shippingContact.addressLines[0]?shippingContact.addressLines[0]:"",shipping_address_2:shippingContact.addressLines&&shippingContact.addressLines[1]?shippingContact.addressLines[1]:"",shipping_city:shippingContact.city?shippingContact.city:"",shipping_state:shippingContact.state?shippingContact.state:"",shipping_postcode:shippingContact.postalCode?shippingContact.postalCode:"",shipping_method:[!shippingOption?null:shippingOption.id],order_comments:"",payment_method:"square_credit_card",ship_to_different_address:1,terms:1,"wc-square-credit-card-payment-nonce":nonce,"wc-square-credit-card-last-four":cardData.last4?cardData.last4:null,"wc-square-credit-card-exp-month":cardData.expMonth?cardData.expMonth:null,"wc-square-credit-card-exp-year":cardData.expYear?cardData.expYear:null,"wc-square-credit-card-payment-postcode":cardData.billing.postalCode?cardData.billing.postalCode:null,"wc-square-digital-wallet-type":cardData.digital_wallet_type};if(cardData.digital_wallet_type==="GOOGLE_PAY"){if(billingContact.givenName){data.billing_first_name=billingContact.givenName.split(" ").slice(0,1).join(" ");data.billing_last_name=billingContact.givenName.split(" ").slice(1).join(" ")}if(shippingContact.givenName){data.shipping_last_name=shippingContact.givenName.split(" ").slice(0,1).join(" ");data.shipping_last_name=shippingContact.givenName.split(" ").slice(1).join(" ")}}if(!data.billing_phone&&billingContact.phone){data.billing_phone=billingContact.phone}if(this.args.is_3d_secure_enabled){this.log("3DS verification enabled. Verifying buyer");var self=this;try{this.payments.verifyBuyer(nonce,self.get_verification_details(billingContact,shippingContact)).then(verificationResult=>{if(verificationResult.token){self.log("3DS verification successful");data["wc-square-credit-card-buyer-verification-token"]=verificationResult.token;self.do_checkout(data)}})}catch(err){self.log("3DS verification failed");self.log(err);self.render_errors([err.message])}}else{this.do_checkout(data)}}do_checkout(data){this.process_digital_wallet_checkout(data).then(response=>{window.location=response.redirect},response=>{this.log(response,"error");this.render_errors_html(response.messages)})}get_verification_details(billingContact,shippingContact){var verification_details={intent:"CHARGE",amount:this.total_amount,currencyCode:this.payment_request.currencyCode,billingContact:{familyName:billingContact.familyName?billingContact.familyName:"",givenName:billingContact.givenName?billingContact.givenName:"",email:shippingContact.email?shippingContact.email:"",countryCode:billingContact.countryCode?billingContact.countryCode.toUpperCase():"",state:billingContact.state?billingContact.state:"",city:billingContact.city?billingContact.city:"",postalCode:billingContact.postalCode?billingContact.postalCode:"",phone:shippingContact.phone?shippingContact.phone:"",addressLines:billingContact.addressLines?billingContact.addressLines:""}};this.log(verification_details);return verification_details}recalculate_totals(data){var _this6=this;return _asyncToGenerator(function*(){return new Promise((resolve,reject)=>{return $.post(_this6.get_ajax_url("recalculate_totals"),data,response=>{if(response.success){_this6.total_amount=response.data.total.amount;return resolve(response.data)}return reject(response.data)})})})()}get_product_data(){var product_id=$(".single_add_to_cart_button").val();var attributes={};if($(".single_variation_wrap").length){product_id=$(".single_variation_wrap").find("input[name=\"product_id\"]").val();if($(".variations_form").length){$(".variations_form").find(".variations select").each((index,select)=>{var attribute_name=$(select).data("attribute_name")||$(select).attr("name");var value=$(select).val()||"";return attributes[attribute_name]=value})}}return{product_id,quantity:$(".quantity .qty").val(),attributes}}add_to_cart(){var data={security:this.args.add_to_cart_nonce};var product_data=this.get_product_data();$.extend(data,product_data);$.post(this.get_ajax_url("add_to_cart"),data,response=>{if(response.error){return window.alert(response.data)}var data=JSON.parse(response.data);this.payment_request=data.payment_request;this.args.payment_request_nonce=data.payment_request_nonce;this.args.add_to_cart_nonce=data.add_to_cart_nonce;this.args.recalculate_totals_nonce=data.recalculate_totals_nonce;this.args.process_checkout_nonce=data.process_checkout_nonce})}process_digital_wallet_checkout(data){return new Promise((resolve,reject)=>{$.post(this.get_ajax_url("process_checkout"),data,response=>{if(response.result==="success"){return resolve(response)}return reject(response)})})}get_ajax_url(request){return this.args.ajax_url.replace("%%endpoint%%","square_digital_wallet_"+request)}render_errors_html(errors_html){$(".woocommerce-error, .woocommerce-message").remove();var element=this.args.context==="product"?$(".product"):$(".shop_table.cart").closest("form");element.before(errors_html);this.unblock_ui();$("html, body").animate({scrollTop:element.offset().top-100},1000)}render_errors(errors){var error_message_html="<ul class=\"woocommerce-error\"><li>"+errors.join("</li><li>")+"</li></ul>";this.render_errors_html(error_message_html)}block_ui(){$(this.buttons).block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}unblock_ui(){$(this.buttons).unblock()}log(message){var type=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"notice";if(!this.args.logging_enabled){return}if(type==="error"){return console.error(message)}return console.log(message)}debounce(func,wait,immediate){var timeout;return function(){var context=this,args=arguments;var later=function later(){timeout=null;if(!immediate)func.apply(context,args)};var callNow=immediate&&!timeout;clearTimeout(timeout);timeout=setTimeout(later,wait);if(callNow)func.apply(context,args)}}}window.WC_Square_Digital_Wallet_Handler=WC_Square_Digital_Wallet_Handler});
|
| 1 |
+
"use strict";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}jQuery(document).ready($=>{class WC_Square_Digital_Wallet_Handler{constructor(args){this.args=args;this.payment_request=args.payment_request;this.total_amount=args.payment_request.total.amount;this.cartForm=".cart";this.wallet="#wc-square-digital-wallet";this.buttons=".wc-square-wallet-buttons";this.isGooglePayHidden=this.args.hide_button_options.includes("google");this.isApplePayHidden=this.args.hide_button_options.includes("apple");if($(this.wallet).length===0){return}$(this.wallet).hide();$(this.buttons).hide();this.build_digital_wallet();this.attach_page_events();this.buildDigitalWalletDebounced=this.debounce(this.build_digital_wallet,500)}build_digital_wallet(){this.block_ui();this.get_payment_request().then(response=>{this.payment_request=JSON.parse(response);this.total_amount=this.payment_request.total.amount;this.load_square_form()},message=>{this.log("[Square] Could not build payment request. "+message,"error");$(this.wallet).hide()})}attach_page_events(){if(this.args.context==="product"){var addToCartButton=$(".single_add_to_cart_button");$("#apple-pay-button, #wc-square-google-pay").on("click",e=>{if(addToCartButton.is(".disabled")){e.stopImmediatePropagation();if(addToCartButton.is(".wc-variation-is-unavailable")){window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text)}else if(addToCartButton.is(".wc-variation-selection-needed")){window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text)}return}this.add_to_cart()});$(document.body).on("woocommerce_variation_has_changed",()=>this.build_digital_wallet());$(".quantity").on("input",".qty",()=>this.buildDigitalWalletDebounced())}if(this.args.context==="cart"){$(document.body).on("updated_cart_totals",()=>this.build_digital_wallet())}if(this.args.context==="checkout"){$(document.body).on("updated_checkout",()=>this.build_digital_wallet())}}load_square_form(){if(this.googlePay){this.googlePay.destroy();this.squareFormLoaded=false}if(this.applePay){this.applePay.destroy();this.squareFormLoaded=false}if(this.squareFormLoaded){return}this.squareFormLoaded=true;this.log("[Square] Building digital wallet payment form");var{applicationId,locationId}=this.get_form_params();this.payments=window.Square.payments(applicationId,locationId);this.initializeDigitalWalletPaymentMethods()}initializeDigitalWalletPaymentMethods(){var _this=this;return _asyncToGenerator(function*(){if(!_this.payments){return}var paymentRequest=_this.payments.paymentRequest(_this.create_payment_request());_this.registerDigitalWalletShippingEventHandlers(paymentRequest);if(!_this.isGooglePayHidden){_this.googlePay=yield _this.payments.googlePay(paymentRequest);_this.googlePay.attach("#wc-square-google-pay",{buttonSizeMode:"fill",buttonType:"long",buttonColor:_this.args.google_pay_color});$("#wc-square-google-pay").on("click",function(){var _ref=_asyncToGenerator(function*(e){return _this.handleGooglePayPaymentMethodSubmission(e,_this.googlePay)});return function(_x){return _ref.apply(this,arguments)}}());$("#wc-square-google-pay").show()}if(!_this.isApplePayHidden){try{_this.applePay=yield _this.payments.applePay(paymentRequest);$("#apple-pay-button").on("click",function(){var _ref2=_asyncToGenerator(function*(e){return _this.handleApplePayPaymentMethodSubmission(e,_this.applePay)});return function(_x2){return _ref2.apply(this,arguments)}}());$("#apple-pay-button").show()}catch(e){console.log(e.message)}}if(_this.googlePay||_this.applePay){$(_this.wallet).show();_this.unblock_ui()}})()}handleGooglePayPaymentMethodSubmission(e){var _arguments=arguments,_this2=this;return _asyncToGenerator(function*(){var googlePay=_arguments.length>1&&_arguments[1]!==undefined?_arguments[1]:null;e.preventDefault();if(!googlePay){return}var result=yield googlePay.tokenize();if(result.status==="OK"){var cardData=_objectSpread(_objectSpread({},result.details.card),{},{digital_wallet_type:result.details.method});var billingAndShippingData={billingContact:result.details.billing};if(result.details.shipping){billingAndShippingData.shippingContact=result.details.shipping.contact;billingAndShippingData.shippingOption=result.details.shipping.option}_this2.handle_card_nonce_response(false,result.token,cardData,billingAndShippingData)}})()}handleApplePayPaymentMethodSubmission(e){var _arguments2=arguments,_this3=this;return _asyncToGenerator(function*(){var applePay=_arguments2.length>1&&_arguments2[1]!==undefined?_arguments2[1]:null;e.preventDefault();if(!applePay){return}var result=yield applePay.tokenize();if(result.status==="OK"){var cardData=_objectSpread(_objectSpread({},result.details.card),{},{digital_wallet_type:result.details.method});var billingAndShippingData={billingContact:result.details.billing};if(result.details.shipping){billingAndShippingData.shippingContact=result.details.shipping.contact;billingAndShippingData.shippingOption=result.details.shipping.option}_this3.handle_card_nonce_response(false,result.token,cardData,billingAndShippingData)}})()}registerDigitalWalletShippingEventHandlers(paymentRequest){paymentRequest.addEventListener("shippingoptionchanged",option=>this.handle_shipping_option_changed(option));paymentRequest.addEventListener("shippingcontactchanged",shippingContact=>this.handle_shipping_address_changed(shippingContact))}get_form_params(){var params={applicationId:this.args.application_id,locationId:this.args.location_id,autobuild:false,applePay:{elementId:"apple-pay-button"},googlePay:{elementId:"wc-square-google-pay"}};if(this.payment_request.requestShippingAddress===false){delete params.callbacks.shippingOptionChanged}if(this.args.hide_button_options.includes("google")){delete params.googlePay}if(this.args.hide_button_options.includes("apple")){delete params.applePay}return params}create_payment_request(){return this.payment_request}methods_supported(methods,unsupportedReason){if(methods.applePay===true||methods.googlePay===true){if(methods.applePay===true){$("#apple-pay-button").show()}if(methods.googlePay===true){$("#wc-square-google-pay").show()}$(this.wallet).show()}else{this.log(unsupportedReason)}}get_payment_request(){return new Promise((resolve,reject)=>{var data={context:this.args.context,security:this.args.payment_request_nonce};if(this.args.context==="product"){var product_data=this.get_product_data();$.extend(data,product_data)}$.post(this.get_ajax_url("get_payment_request"),data,response=>{if(response.success){return resolve(response.data)}return reject(response.data)})})}handle_shipping_address_changed(shippingContact){var _this4=this;return _asyncToGenerator(function*(){var data={context:_this4.args.context,shipping_contact:shippingContact,security:_this4.args.recalculate_totals_nonce};var response=yield _this4.recalculate_totals(data);return response})()}handle_shipping_option_changed(shippingOption){var _this5=this;return _asyncToGenerator(function*(){var data={context:_this5.args.context,shipping_option:shippingOption.id,security:_this5.args.recalculate_totals_nonce};var response=yield _this5.recalculate_totals(data);return response})()}handle_card_nonce_response(){var errors=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var nonce=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var cardData=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var billingAndShippingData=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};if(errors){return this.render_errors(errors)}if(!nonce){return this.render_errors(this.args.general_error)}this.block_ui();var{billingContact={},shippingContact={},shippingOption=null}=billingAndShippingData;var data={action:"",_wpnonce:this.args.process_checkout_nonce,billing_first_name:billingContact.givenName?billingContact.givenName:"",billing_last_name:billingContact.familyName?billingContact.familyName:"",billing_company:"",billing_email:shippingContact.email?shippingContact.email:billingContact.email?billingContact.email:"",billing_phone:shippingContact.phone?shippingContact.phone:"",billing_country:billingContact.countryCode?billingContact.countryCode.toUpperCase():"",billing_address_1:billingContact.addressLines&&billingContact.addressLines[0]?billingContact.addressLines[0]:"",billing_address_2:billingContact.addressLines&&billingContact.addressLines[1]?billingContact.addressLines[1]:"",billing_city:billingContact.city?billingContact.city:"",billing_state:billingContact.state?billingContact.state:"",billing_postcode:billingContact.postalCode?billingContact.postalCode:"",shipping_first_name:shippingContact.givenName?shippingContact.givenName:"",shipping_last_name:shippingContact.familyName?shippingContact.familyName:"",shipping_company:"",shipping_country:shippingContact.countryCode?shippingContact.countryCode.toUpperCase():"",shipping_address_1:shippingContact.addressLines&&shippingContact.addressLines[0]?shippingContact.addressLines[0]:"",shipping_address_2:shippingContact.addressLines&&shippingContact.addressLines[1]?shippingContact.addressLines[1]:"",shipping_city:shippingContact.city?shippingContact.city:"",shipping_state:shippingContact.state?shippingContact.state:"",shipping_postcode:shippingContact.postalCode?shippingContact.postalCode:"",shipping_method:[!shippingOption?null:shippingOption.id],order_comments:"",payment_method:"square_credit_card",ship_to_different_address:1,terms:1,"wc-square-credit-card-payment-nonce":nonce,"wc-square-credit-card-last-four":cardData.last4?cardData.last4:null,"wc-square-credit-card-exp-month":cardData.expMonth?cardData.expMonth:null,"wc-square-credit-card-exp-year":cardData.expYear?cardData.expYear:null,"wc-square-credit-card-payment-postcode":cardData.billing.postalCode?cardData.billing.postalCode:null,"wc-square-digital-wallet-type":cardData.digital_wallet_type};if(cardData.digital_wallet_type==="GOOGLE_PAY"){if(billingContact.givenName){data.billing_first_name=billingContact.givenName.split(" ").slice(0,1).join(" ");data.billing_last_name=billingContact.givenName.split(" ").slice(1).join(" ")}if(shippingContact.givenName){data.shipping_last_name=shippingContact.givenName.split(" ").slice(0,1).join(" ");data.shipping_last_name=shippingContact.givenName.split(" ").slice(1).join(" ")}}if(!data.billing_phone&&billingContact.phone){data.billing_phone=billingContact.phone}if(this.args.is_3d_secure_enabled){this.log("3DS verification enabled. Verifying buyer");var self=this;try{this.payments.verifyBuyer(nonce,self.get_verification_details(billingContact,shippingContact)).then(verificationResult=>{if(verificationResult.token){self.log("3DS verification successful");data["wc-square-credit-card-buyer-verification-token"]=verificationResult.token;self.do_checkout(data)}})}catch(err){self.log("3DS verification failed");self.log(err);self.render_errors([err.message])}}else{this.do_checkout(data)}}do_checkout(data){this.process_digital_wallet_checkout(data).then(response=>{window.location=response.redirect},response=>{this.log(response,"error");this.render_errors_html(response.messages)})}get_verification_details(billingContact,shippingContact){var verification_details={intent:"CHARGE",amount:this.total_amount,currencyCode:this.payment_request.currencyCode,billingContact:{familyName:billingContact.familyName?billingContact.familyName:"",givenName:billingContact.givenName?billingContact.givenName:"",email:shippingContact.email?shippingContact.email:"",countryCode:billingContact.countryCode?billingContact.countryCode.toUpperCase():"",state:billingContact.state?billingContact.state:"",city:billingContact.city?billingContact.city:"",postalCode:billingContact.postalCode?billingContact.postalCode:"",phone:shippingContact.phone?shippingContact.phone:"",addressLines:billingContact.addressLines?billingContact.addressLines:""}};this.log(verification_details);return verification_details}recalculate_totals(data){var _this6=this;return _asyncToGenerator(function*(){return new Promise((resolve,reject)=>{return $.post(_this6.get_ajax_url("recalculate_totals"),data,response=>{if(response.success){_this6.total_amount=response.data.total.amount;return resolve(response.data)}return reject(response.data)})})})()}get_product_data(){var product_id=$(".single_add_to_cart_button").val();var attributes={};if($(".single_variation_wrap").length){product_id=$(".single_variation_wrap").find("input[name=\"product_id\"]").val();if($(".variations_form").length){$(".variations_form").find(".variations select").each((index,select)=>{var attribute_name=$(select).data("attribute_name")||$(select).attr("name");var value=$(select).val()||"";return attributes[attribute_name]=value})}}return{product_id,quantity:$(".quantity .qty").val(),attributes}}add_to_cart(){var data={security:this.args.add_to_cart_nonce};var product_data=this.get_product_data();$.extend(data,product_data);$.post(this.get_ajax_url("add_to_cart"),data,response=>{if(response.error){return window.alert(response.data)}var data=JSON.parse(response.data);this.payment_request=data.payment_request;this.args.payment_request_nonce=data.payment_request_nonce;this.args.add_to_cart_nonce=data.add_to_cart_nonce;this.args.recalculate_totals_nonce=data.recalculate_totals_nonce;this.args.process_checkout_nonce=data.process_checkout_nonce})}process_digital_wallet_checkout(data){return new Promise((resolve,reject)=>{$.post(this.get_ajax_url("process_checkout"),data,response=>{if(response.result==="success"){return resolve(response)}return reject(response)})})}get_ajax_url(request){return this.args.ajax_url.replace("%%endpoint%%","square_digital_wallet_"+request)}render_errors_html(errors_html){$(".woocommerce-error, .woocommerce-message").remove();var element=this.args.context==="product"?$(".product"):$(".shop_table.cart").closest("form");element.before(errors_html);this.unblock_ui();$("html, body").animate({scrollTop:element.offset().top-100},1000)}render_errors(errors){var error_message_html="<ul class=\"woocommerce-error\"><li>"+errors.join("</li><li>")+"</li></ul>";this.render_errors_html(error_message_html)}block_ui(){$(this.buttons).block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}unblock_ui(){$(this.buttons).unblock()}log(message){var type=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"notice";if(!this.args.logging_enabled){return}if(type==="error"){return console.error(message)}return console.log(message)}debounce(func,wait,immediate){var timeout;return function(){var context=this,args=arguments;var later=function later(){timeout=null;if(!immediate)func.apply(context,args)};var callNow=immediate&&!timeout;clearTimeout(timeout);timeout=setTimeout(later,wait);if(callNow)func.apply(context,args)}}}window.WC_Square_Digital_Wallet_Handler=WC_Square_Digital_Wallet_Handler});
|
changelog.txt
CHANGED
|
@@ -1,5 +1,17 @@
|
|
| 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
|
| 1 |
*** WooCommerce Square Changelog ***
|
| 2 |
|
| 3 |
+
= 3.2.0 - 2022-09-14 =
|
| 4 |
+
* Add - Ensure the `via WooCommerce` text can be translated and introduce a new filter to update that text while paying with Apple Pay.
|
| 5 |
+
* Add - Missing square_customers table.
|
| 6 |
+
* Dev - Remove unnecessary build process files.
|
| 7 |
+
* Fix - Add notice when trying to import CSV and product sync is turned on.
|
| 8 |
+
* Fix - Invalid object with ID error while syncing variable products with Woo as SOR.
|
| 9 |
+
* Fix - Issue where `woocommerce_order_status_refunded` hook previously ran twice after successful refund.
|
| 10 |
+
* Fix - Multiple digital wallet buttons shown when quantity is updated.
|
| 11 |
+
* Fix - Tax computation error caused by tax ID set to 0.
|
| 12 |
+
* Fix - The `Repeated field must have at least one value` error.
|
| 13 |
+
* Update - Deprecates the method `get_max_objects_per_batch`.
|
| 14 |
+
|
| 15 |
= 3.1.0 - 2022-06-09 =
|
| 16 |
* Fix - Hide shipping options in Google Pay form for virtual products. #800
|
| 17 |
* Fix - State-specific tax calculation when using Google Pay. #778
|
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.
|
| 6 |
"Report-Msgid-Bugs-To: "
|
| 7 |
"https://wordpress.org/support/plugin/woocommerce-square\n"
|
| 8 |
-
"POT-Creation-Date: 2022-
|
| 9 |
"MIME-Version: 1.0\n"
|
| 10 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 11 |
"Content-Transfer-Encoding: 8bit\n"
|
|
@@ -433,27 +433,27 @@ msgstr ""
|
|
| 433 |
msgid "The sync job has failed. Check sync records, or %s."
|
| 434 |
msgstr ""
|
| 435 |
|
| 436 |
-
#: includes/Framework/Lifecycle.php:
|
| 437 |
msgid "Awesome"
|
| 438 |
msgstr ""
|
| 439 |
|
| 440 |
-
#: includes/Framework/Lifecycle.php:
|
| 441 |
msgid "Fantastic"
|
| 442 |
msgstr ""
|
| 443 |
|
| 444 |
-
#: includes/Framework/Lifecycle.php:
|
| 445 |
msgid "Cowabunga"
|
| 446 |
msgstr ""
|
| 447 |
|
| 448 |
-
#: includes/Framework/Lifecycle.php:
|
| 449 |
msgid "Congratulations"
|
| 450 |
msgstr ""
|
| 451 |
|
| 452 |
-
#: includes/Framework/Lifecycle.php:
|
| 453 |
msgid "Hot dog"
|
| 454 |
msgstr ""
|
| 455 |
|
| 456 |
-
#: includes/Framework/Lifecycle.php:
|
| 457 |
#. translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a>
|
| 458 |
#. tag, %4$s - <a> tag, %5$s - </a> tag
|
| 459 |
msgid ""
|
|
@@ -833,17 +833,17 @@ msgstr ""
|
|
| 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:
|
| 837 |
msgid "Discount"
|
| 838 |
msgstr ""
|
| 839 |
|
| 840 |
#: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:551
|
| 841 |
-
#: includes/Gateway/Digital_Wallet.php:
|
| 842 |
msgid "Shipping"
|
| 843 |
msgstr ""
|
| 844 |
|
| 845 |
#: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:561
|
| 846 |
-
#: includes/Gateway/Digital_Wallet.php:
|
| 847 |
msgid "Fees"
|
| 848 |
msgstr ""
|
| 849 |
|
|
@@ -1083,7 +1083,7 @@ msgstr ""
|
|
| 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:
|
| 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 ""
|
|
@@ -1388,6 +1388,7 @@ msgid "%1$s Refund Failed: %2$s"
|
|
| 1388 |
msgstr ""
|
| 1389 |
|
| 1390 |
#: includes/Framework/PaymentGateway/Payment_Gateway.php:1923
|
|
|
|
| 1391 |
#. translators: Placeholders: %s - payment gateway title (such as
|
| 1392 |
#. Authorize.net, Braintree, etc)
|
| 1393 |
msgid "%s Order completely refunded."
|
|
@@ -1905,8 +1906,8 @@ msgstr ""
|
|
| 1905 |
msgid "Every %d Minutes"
|
| 1906 |
msgstr ""
|
| 1907 |
|
| 1908 |
-
#: includes/Gateway/API/Requests/Orders.php:
|
| 1909 |
-
#: includes/Gateway/API/Requests/Orders.php:
|
| 1910 |
msgid "Adjustment"
|
| 1911 |
msgstr ""
|
| 1912 |
|
|
@@ -1919,7 +1920,11 @@ msgid ""
|
|
| 1919 |
"version of WooCommerce Blocks or WooCommerce to fix these issues."
|
| 1920 |
msgstr ""
|
| 1921 |
|
| 1922 |
-
#: includes/Gateway/Digital_Wallet.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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,7 +1933,7 @@ msgid ""
|
|
| 1928 |
"information, please read our documentation on %2$sSetting up Apple Pay%3$s."
|
| 1929 |
msgstr ""
|
| 1930 |
|
| 1931 |
-
#: includes/Gateway/Digital_Wallet.php:
|
| 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,51 +1943,51 @@ msgid ""
|
|
| 1938 |
"logs%2$s to find out what caused the registration to fail."
|
| 1939 |
msgstr ""
|
| 1940 |
|
| 1941 |
-
#: includes/Gateway/Digital_Wallet.php:
|
| 1942 |
msgid "OR"
|
| 1943 |
msgstr ""
|
| 1944 |
|
| 1945 |
-
#: includes/Gateway/Digital_Wallet.php:
|
| 1946 |
#. translators: product ID
|
| 1947 |
msgid "Product with the ID (%d) cannot be found."
|
| 1948 |
msgstr ""
|
| 1949 |
|
| 1950 |
-
#: includes/Gateway/Digital_Wallet.php:
|
| 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:
|
| 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:
|
| 1963 |
-
#: includes/Gateway/Digital_Wallet.php:
|
| 1964 |
msgid "Tax"
|
| 1965 |
msgstr ""
|
| 1966 |
|
| 1967 |
-
#: includes/Gateway/Digital_Wallet.php:
|
| 1968 |
msgid "This payment method cannot be used for multiple shipments."
|
| 1969 |
msgstr ""
|
| 1970 |
|
| 1971 |
-
#: includes/Gateway/Digital_Wallet.php:
|
| 1972 |
#: vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Store.php:378
|
| 1973 |
msgid "Pending"
|
| 1974 |
msgstr ""
|
| 1975 |
|
| 1976 |
-
#: includes/Gateway/Digital_Wallet.php:
|
| 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:
|
| 1982 |
msgid "Empty cart"
|
| 1983 |
msgstr ""
|
| 1984 |
|
| 1985 |
-
#: includes/Gateway/Digital_Wallet.php:
|
| 1986 |
msgid "Unable to verify domain with Apple Pay - missing access token."
|
| 1987 |
msgstr ""
|
| 1988 |
|
|
@@ -2198,7 +2203,7 @@ msgid_plural "Updated data for %d products."
|
|
| 2198 |
msgstr[0] ""
|
| 2199 |
msgstr[1] ""
|
| 2200 |
|
| 2201 |
-
#: includes/Lifecycle.php:
|
| 2202 |
msgid "Great"
|
| 2203 |
msgstr ""
|
| 2204 |
|
|
@@ -2462,7 +2467,7 @@ msgid ""
|
|
| 2462 |
"response."
|
| 2463 |
msgstr ""
|
| 2464 |
|
| 2465 |
-
#: includes/Sync/Manual_Synchronization.php:
|
| 2466 |
#. translators: Placeholder: %s - product ID
|
| 2467 |
msgid "Product %s could not be updated in Square."
|
| 2468 |
msgstr ""
|
| 2 |
# This file is distributed under the GNU General Public License v3.0.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
+
"Project-Id-Version: WooCommerce Square 3.2.0\n"
|
| 6 |
"Report-Msgid-Bugs-To: "
|
| 7 |
"https://wordpress.org/support/plugin/woocommerce-square\n"
|
| 8 |
+
"POT-Creation-Date: 2022-09-15 01:18:46+00:00\n"
|
| 9 |
"MIME-Version: 1.0\n"
|
| 10 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 11 |
"Content-Transfer-Encoding: 8bit\n"
|
| 433 |
msgid "The sync job has failed. Check sync records, or %s."
|
| 434 |
msgstr ""
|
| 435 |
|
| 436 |
+
#: includes/Framework/Lifecycle.php:305 includes/Lifecycle.php:195
|
| 437 |
msgid "Awesome"
|
| 438 |
msgstr ""
|
| 439 |
|
| 440 |
+
#: includes/Framework/Lifecycle.php:306 includes/Lifecycle.php:198
|
| 441 |
msgid "Fantastic"
|
| 442 |
msgstr ""
|
| 443 |
|
| 444 |
+
#: includes/Framework/Lifecycle.php:307
|
| 445 |
msgid "Cowabunga"
|
| 446 |
msgstr ""
|
| 447 |
|
| 448 |
+
#: includes/Framework/Lifecycle.php:308 includes/Lifecycle.php:196
|
| 449 |
msgid "Congratulations"
|
| 450 |
msgstr ""
|
| 451 |
|
| 452 |
+
#: includes/Framework/Lifecycle.php:309
|
| 453 |
msgid "Hot dog"
|
| 454 |
msgstr ""
|
| 455 |
|
| 456 |
+
#: includes/Framework/Lifecycle.php:316 includes/Lifecycle.php:205
|
| 457 |
#. translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a>
|
| 458 |
#. tag, %4$s - <a> tag, %5$s - </a> tag
|
| 459 |
msgid ""
|
| 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:444
|
| 837 |
msgid "Discount"
|
| 838 |
msgstr ""
|
| 839 |
|
| 840 |
#: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:551
|
| 841 |
+
#: includes/Gateway/Digital_Wallet.php:428
|
| 842 |
msgid "Shipping"
|
| 843 |
msgstr ""
|
| 844 |
|
| 845 |
#: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:561
|
| 846 |
+
#: includes/Gateway/Digital_Wallet.php:452
|
| 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:226
|
| 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 ""
|
| 1388 |
msgstr ""
|
| 1389 |
|
| 1390 |
#: includes/Framework/PaymentGateway/Payment_Gateway.php:1923
|
| 1391 |
+
#: includes/Gateway.php:1160
|
| 1392 |
#. translators: Placeholders: %s - payment gateway title (such as
|
| 1393 |
#. Authorize.net, Braintree, etc)
|
| 1394 |
msgid "%s Order completely refunded."
|
| 1906 |
msgid "Every %d Minutes"
|
| 1907 |
msgstr ""
|
| 1908 |
|
| 1909 |
+
#: includes/Gateway/API/Requests/Orders.php:283
|
| 1910 |
+
#: includes/Gateway/API/Requests/Orders.php:322
|
| 1911 |
msgid "Adjustment"
|
| 1912 |
msgstr ""
|
| 1913 |
|
| 1920 |
"version of WooCommerce Blocks or WooCommerce to fix these issues."
|
| 1921 |
msgstr ""
|
| 1922 |
|
| 1923 |
+
#: includes/Gateway/Digital_Wallet.php:91
|
| 1924 |
+
msgid "via WooCommerce"
|
| 1925 |
+
msgstr ""
|
| 1926 |
+
|
| 1927 |
+
#: includes/Gateway/Digital_Wallet.php:132
|
| 1928 |
#. Translators: %1$s: expected location of apple pay verification file, %2$s:
|
| 1929 |
#. opening href tag with link to Square documentation, %3$s: closing href tag
|
| 1930 |
msgid ""
|
| 1933 |
"information, please read our documentation on %2$sSetting up Apple Pay%3$s."
|
| 1934 |
msgstr ""
|
| 1935 |
|
| 1936 |
+
#: includes/Gateway/Digital_Wallet.php:148
|
| 1937 |
#. Translators: %1$s: opening bold tags, %2$s: closing strong/bold tags, %3$s:
|
| 1938 |
#. expected location of apple pay verification file, %4$s: opening href tag
|
| 1939 |
#. with link to Square documentation, %5$s: closing href tag
|
| 1943 |
"logs%2$s to find out what caused the registration to fail."
|
| 1944 |
msgstr ""
|
| 1945 |
|
| 1946 |
+
#: includes/Gateway/Digital_Wallet.php:195
|
| 1947 |
msgid "OR"
|
| 1948 |
msgstr ""
|
| 1949 |
|
| 1950 |
+
#: includes/Gateway/Digital_Wallet.php:297
|
| 1951 |
#. translators: product ID
|
| 1952 |
msgid "Product with the ID (%d) cannot be found."
|
| 1953 |
msgstr ""
|
| 1954 |
|
| 1955 |
+
#: includes/Gateway/Digital_Wallet.php:313
|
| 1956 |
#. translators: 1: product name 2: quantity in stock
|
| 1957 |
msgid ""
|
| 1958 |
"You cannot add that amount of \"%1$s\"; to the cart because there is not "
|
| 1959 |
"enough stock (%2$s remaining)."
|
| 1960 |
msgstr ""
|
| 1961 |
|
| 1962 |
+
#: includes/Gateway/Digital_Wallet.php:318
|
| 1963 |
#. translators: 1: product name
|
| 1964 |
msgid "You cannot purchase \"%1$s\" because it is currently not available."
|
| 1965 |
msgstr ""
|
| 1966 |
|
| 1967 |
+
#: includes/Gateway/Digital_Wallet.php:340
|
| 1968 |
+
#: includes/Gateway/Digital_Wallet.php:436
|
| 1969 |
msgid "Tax"
|
| 1970 |
msgstr ""
|
| 1971 |
|
| 1972 |
+
#: includes/Gateway/Digital_Wallet.php:375
|
| 1973 |
msgid "This payment method cannot be used for multiple shipments."
|
| 1974 |
msgstr ""
|
| 1975 |
|
| 1976 |
+
#: includes/Gateway/Digital_Wallet.php:386
|
| 1977 |
#: vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Store.php:378
|
| 1978 |
msgid "Pending"
|
| 1979 |
msgstr ""
|
| 1980 |
|
| 1981 |
+
#: includes/Gateway/Digital_Wallet.php:487
|
| 1982 |
#. translators: Context (product, cart, checkout or page)
|
| 1983 |
msgid "Empty payment request data for %s."
|
| 1984 |
msgstr ""
|
| 1985 |
|
| 1986 |
+
#: includes/Gateway/Digital_Wallet.php:751
|
| 1987 |
msgid "Empty cart"
|
| 1988 |
msgstr ""
|
| 1989 |
|
| 1990 |
+
#: includes/Gateway/Digital_Wallet.php:885
|
| 1991 |
msgid "Unable to verify domain with Apple Pay - missing access token."
|
| 1992 |
msgstr ""
|
| 1993 |
|
| 2203 |
msgstr[0] ""
|
| 2204 |
msgstr[1] ""
|
| 2205 |
|
| 2206 |
+
#: includes/Lifecycle.php:197
|
| 2207 |
msgid "Great"
|
| 2208 |
msgstr ""
|
| 2209 |
|
| 2467 |
"response."
|
| 2468 |
msgstr ""
|
| 2469 |
|
| 2470 |
+
#: includes/Sync/Manual_Synchronization.php:928
|
| 2471 |
#. translators: Placeholder: %s - product ID
|
| 2472 |
msgid "Product %s could not be updated in Square."
|
| 2473 |
msgstr ""
|
includes/Framework/Lifecycle.php
CHANGED
|
@@ -87,6 +87,8 @@ class Lifecycle {
|
|
| 87 |
|
| 88 |
if ( ! $installed_version ) {
|
| 89 |
|
|
|
|
|
|
|
| 90 |
// store the upgrade event regardless if there was a routine for it
|
| 91 |
$this->store_event( 'install' );
|
| 92 |
|
| 87 |
|
| 88 |
if ( ! $installed_version ) {
|
| 89 |
|
| 90 |
+
$this->install();
|
| 91 |
+
|
| 92 |
// store the upgrade event regardless if there was a routine for it
|
| 93 |
$this->store_event( 'install' );
|
| 94 |
|
includes/Gateway.php
CHANGED
|
@@ -1145,4 +1145,21 @@ class Gateway extends Payment_Gateway_Direct {
|
|
| 1145 |
$order->unique_transaction_ref = time() . '-' . $order_id . ( $retry_count >= 0 ? '-' . $retry_count : '' );
|
| 1146 |
return $order;
|
| 1147 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1148 |
}
|
| 1145 |
$order->unique_transaction_ref = time() . '-' . $order_id . ( $retry_count >= 0 ? '-' . $retry_count : '' );
|
| 1146 |
return $order;
|
| 1147 |
}
|
| 1148 |
+
|
| 1149 |
+
/**
|
| 1150 |
+
* Mark an order as refunded. This should only be used when the full order
|
| 1151 |
+
* amount has been refunded.
|
| 1152 |
+
*
|
| 1153 |
+
* @since 3.2.0
|
| 1154 |
+
*
|
| 1155 |
+
* @param \WC_Order $order order object
|
| 1156 |
+
*/
|
| 1157 |
+
public function mark_order_as_refunded( $order ) {
|
| 1158 |
+
|
| 1159 |
+
/* translators: Placeholders: %s - payment gateway title (such as Authorize.net, Braintree, etc) */
|
| 1160 |
+
$order_note = sprintf( esc_html__( '%s Order completely refunded.', 'woocommerce-square' ), $this->get_method_title() );
|
| 1161 |
+
|
| 1162 |
+
// Add order note and continue with WC refund process.
|
| 1163 |
+
$order->add_order_note( $order_note );
|
| 1164 |
+
}
|
| 1165 |
}
|
includes/Gateway/API/Requests/Orders.php
CHANGED
|
@@ -250,10 +250,14 @@ class Orders extends API\Request {
|
|
| 250 |
$applied_taxes = array();
|
| 251 |
|
| 252 |
foreach ( $tax_ids as $tax_id ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
$applied_taxes[] = new \Square\Models\OrderLineItemAppliedTax( $taxes[ $tax_id ]->getUid() );
|
| 254 |
};
|
| 255 |
|
| 256 |
-
return $applied_taxes;
|
| 257 |
}
|
| 258 |
|
| 259 |
|
| 250 |
$applied_taxes = array();
|
| 251 |
|
| 252 |
foreach ( $tax_ids as $tax_id ) {
|
| 253 |
+
if ( empty( $tax_id ) ) {
|
| 254 |
+
continue;
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
$applied_taxes[] = new \Square\Models\OrderLineItemAppliedTax( $taxes[ $tax_id ]->getUid() );
|
| 258 |
};
|
| 259 |
|
| 260 |
+
return empty( $applied_taxes ) ? null : $applied_taxes;
|
| 261 |
}
|
| 262 |
|
| 263 |
|
includes/Gateway/Digital_Wallet.php
CHANGED
|
@@ -40,6 +40,11 @@ class Digital_Wallet {
|
|
| 40 |
*/
|
| 41 |
public $is_available = null;
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
/**
|
| 44 |
* Setup the Digital Wallet class
|
| 45 |
*
|
|
@@ -74,6 +79,18 @@ class Digital_Wallet {
|
|
| 74 |
* @since 2.3
|
| 75 |
*/
|
| 76 |
public function init() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
$is_user_logged_in = is_user_logged_in();
|
| 78 |
$is_registration_required = WC()->checkout->is_registration_required();
|
| 79 |
$is_registration_enabled = WC()->checkout->is_registration_enabled();
|
|
@@ -374,7 +391,7 @@ class Digital_Wallet {
|
|
| 374 |
}
|
| 375 |
|
| 376 |
$data['total'] = array(
|
| 377 |
-
'label' => get_bloginfo( 'name', 'display' ) .
|
| 378 |
'amount' => number_format( $amount, 2, '.', '' ),
|
| 379 |
'pending' => false,
|
| 380 |
);
|
|
@@ -688,7 +705,7 @@ class Digital_Wallet {
|
|
| 688 |
|
| 689 |
$payment_request['lineItems'] = $this->build_payment_request_line_items();
|
| 690 |
$payment_request['total'] = array(
|
| 691 |
-
'label' => get_bloginfo( 'name', 'display' ) .
|
| 692 |
'amount' => number_format( WC()->cart->total, 2, '.', '' ),
|
| 693 |
'pending' => false,
|
| 694 |
);
|
| 40 |
*/
|
| 41 |
public $is_available = null;
|
| 42 |
|
| 43 |
+
/**
|
| 44 |
+
* @var string just a simple text, 'via WooCommerce'.
|
| 45 |
+
*/
|
| 46 |
+
public $total_label_suffix;
|
| 47 |
+
|
| 48 |
/**
|
| 49 |
* Setup the Digital Wallet class
|
| 50 |
*
|
| 79 |
* @since 2.3
|
| 80 |
*/
|
| 81 |
public function init() {
|
| 82 |
+
|
| 83 |
+
/**
|
| 84 |
+
* Filter to update the 'via WooCommerce' text.
|
| 85 |
+
*
|
| 86 |
+
* 'woocommerce_square_payment_request_total_label_suffix' is the filter hook.
|
| 87 |
+
* 'via WooCommerce' is the value being filtered.
|
| 88 |
+
*
|
| 89 |
+
* @since 3.2
|
| 90 |
+
*/
|
| 91 |
+
$total_label_suffix = apply_filters( 'woocommerce_square_payment_request_total_label_suffix', __( 'via WooCommerce', 'woocommerce-square' ) );
|
| 92 |
+
$this->total_label_suffix = $total_label_suffix ? " ($total_label_suffix)" : '';
|
| 93 |
+
|
| 94 |
$is_user_logged_in = is_user_logged_in();
|
| 95 |
$is_registration_required = WC()->checkout->is_registration_required();
|
| 96 |
$is_registration_enabled = WC()->checkout->is_registration_enabled();
|
| 391 |
}
|
| 392 |
|
| 393 |
$data['total'] = array(
|
| 394 |
+
'label' => get_bloginfo( 'name', 'display' ) . esc_html( $this->total_label_suffix ),
|
| 395 |
'amount' => number_format( $amount, 2, '.', '' ),
|
| 396 |
'pending' => false,
|
| 397 |
);
|
| 705 |
|
| 706 |
$payment_request['lineItems'] = $this->build_payment_request_line_items();
|
| 707 |
$payment_request['total'] = array(
|
| 708 |
+
'label' => get_bloginfo( 'name', 'display' ) . esc_html( $this->total_label_suffix ),
|
| 709 |
'amount' => number_format( WC()->cart->total, 2, '.', '' ),
|
| 710 |
'pending' => false,
|
| 711 |
);
|
includes/Handlers/Product/Woo_SOR.php
CHANGED
|
@@ -46,6 +46,10 @@ class Woo_SOR extends \WooCommerce\Square\Handlers\Product {
|
|
| 46 |
// ensure the product meta is persisted
|
| 47 |
self::update_product( $product, $catalog_object );
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
$is_delete = 'trash' === $product->get_status();
|
| 50 |
|
| 51 |
$catalog_object = self::set_catalog_object_location_ids( $catalog_object, $is_delete );
|
|
@@ -120,7 +124,7 @@ class Woo_SOR extends \WooCommerce\Square\Handlers\Product {
|
|
| 120 |
|
| 121 |
$variation_object = new CatalogObject(
|
| 122 |
'ITEM_VARIATION',
|
| 123 |
-
|
| 124 |
);
|
| 125 |
|
| 126 |
$catalog_item_variation = new \Square\Models\CatalogItemVariation();
|
|
@@ -139,7 +143,7 @@ class Woo_SOR extends \WooCommerce\Square\Handlers\Product {
|
|
| 139 |
|
| 140 |
$variation_object = new CatalogObject(
|
| 141 |
'ITEM_VARIATION',
|
| 142 |
-
|
| 143 |
);
|
| 144 |
|
| 145 |
$catalog_item_variation = new \Square\Models\CatalogItemVariation();
|
|
@@ -187,6 +191,10 @@ class Woo_SOR extends \WooCommerce\Square\Handlers\Product {
|
|
| 187 |
// ensure the variation meta is persisted
|
| 188 |
self::update_variation( $product, $catalog_object );
|
| 189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
if ( ! $catalog_object->getVersion() ) {
|
| 191 |
$catalog_object->setVersion( self::get_square_variation_version( $product ) );
|
| 192 |
}
|
| 46 |
// ensure the product meta is persisted
|
| 47 |
self::update_product( $product, $catalog_object );
|
| 48 |
|
| 49 |
+
if ( ! $catalog_object->getId() ) {
|
| 50 |
+
$catalog_object->setId( self::get_square_item_id( $product ) );
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
$is_delete = 'trash' === $product->get_status();
|
| 54 |
|
| 55 |
$catalog_object = self::set_catalog_object_location_ids( $catalog_object, $is_delete );
|
| 124 |
|
| 125 |
$variation_object = new CatalogObject(
|
| 126 |
'ITEM_VARIATION',
|
| 127 |
+
''
|
| 128 |
);
|
| 129 |
|
| 130 |
$catalog_item_variation = new \Square\Models\CatalogItemVariation();
|
| 143 |
|
| 144 |
$variation_object = new CatalogObject(
|
| 145 |
'ITEM_VARIATION',
|
| 146 |
+
''
|
| 147 |
);
|
| 148 |
|
| 149 |
$catalog_item_variation = new \Square\Models\CatalogItemVariation();
|
| 191 |
// ensure the variation meta is persisted
|
| 192 |
self::update_variation( $product, $catalog_object );
|
| 193 |
|
| 194 |
+
if ( ! $catalog_object->getId() ) {
|
| 195 |
+
$catalog_object->setId( self::get_square_item_variation_id( $product ) );
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
if ( ! $catalog_object->getVersion() ) {
|
| 199 |
$catalog_object->setVersion( self::get_square_variation_version( $product ) );
|
| 200 |
}
|
includes/Lifecycle.php
CHANGED
|
@@ -55,6 +55,7 @@ class Lifecycle extends \WooCommerce\Square\Framework\Lifecycle {
|
|
| 55 |
'2.2.0',
|
| 56 |
'2.3.0',
|
| 57 |
'3.0.2',
|
|
|
|
| 58 |
);
|
| 59 |
}
|
| 60 |
|
|
@@ -165,6 +166,16 @@ class Lifecycle extends \WooCommerce\Square\Framework\Lifecycle {
|
|
| 165 |
Gateway\Customer_Helper::create_table();
|
| 166 |
}
|
| 167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
/**
|
| 169 |
* Generates a milestone notice message.
|
| 170 |
*
|
| 55 |
'2.2.0',
|
| 56 |
'2.3.0',
|
| 57 |
'3.0.2',
|
| 58 |
+
'3.2.0',
|
| 59 |
);
|
| 60 |
}
|
| 61 |
|
| 166 |
Gateway\Customer_Helper::create_table();
|
| 167 |
}
|
| 168 |
|
| 169 |
+
/**
|
| 170 |
+
* Adds the missing Square customer table.
|
| 171 |
+
*
|
| 172 |
+
* @see https://github.com/woocommerce/woocommerce-square/issues/825
|
| 173 |
+
* @since 3.2.0
|
| 174 |
+
*/
|
| 175 |
+
protected function upgrade_to_3_2_0() {
|
| 176 |
+
Gateway\Customer_Helper::create_table();
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
/**
|
| 180 |
* Generates a milestone notice message.
|
| 181 |
*
|
includes/Plugin.php
CHANGED
|
@@ -43,7 +43,7 @@ class Plugin extends Payment_Gateway_Plugin {
|
|
| 43 |
|
| 44 |
|
| 45 |
/** plugin version number */
|
| 46 |
-
const VERSION = '3.
|
| 47 |
|
| 48 |
/** plugin ID */
|
| 49 |
const PLUGIN_ID = 'square';
|
| 43 |
|
| 44 |
|
| 45 |
/** plugin version number */
|
| 46 |
+
const VERSION = '3.2.0';
|
| 47 |
|
| 48 |
/** plugin ID */
|
| 49 |
const PLUGIN_ID = 'square';
|
includes/Sync/Catalog_Item.php
CHANGED
|
@@ -126,7 +126,7 @@ class Catalog_Item {
|
|
| 126 |
|
| 127 |
if ( ! $catalog_object ) {
|
| 128 |
$catalog_id = Product\Woo_SOR::get_square_item_id( $this->product );
|
| 129 |
-
$catalog_object = new \Square\Models\CatalogObject( 'ITEM',
|
| 130 |
}
|
| 131 |
|
| 132 |
// update the object data from the Woo product
|
| 126 |
|
| 127 |
if ( ! $catalog_object ) {
|
| 128 |
$catalog_id = Product\Woo_SOR::get_square_item_id( $this->product );
|
| 129 |
+
$catalog_object = new \Square\Models\CatalogObject( 'ITEM', '' );
|
| 130 |
}
|
| 131 |
|
| 132 |
// update the object data from the Woo product
|
includes/Sync/Manual_Synchronization.php
CHANGED
|
@@ -180,49 +180,52 @@ class Manual_Synchronization extends Stepped_Job {
|
|
| 180 |
)
|
| 181 |
);
|
| 182 |
|
| 183 |
-
|
| 184 |
|
| 185 |
-
|
| 186 |
-
$mapped_category_audit = array();
|
| 187 |
|
| 188 |
-
|
| 189 |
-
$mapped_category_audit
|
| 190 |
-
}
|
| 191 |
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
|
| 200 |
-
|
| 201 |
-
|
| 202 |
|
| 203 |
-
|
| 204 |
|
| 205 |
-
|
| 206 |
-
|
|
|
|
| 207 |
}
|
| 208 |
}
|
| 209 |
-
}
|
| 210 |
|
| 211 |
-
|
| 212 |
-
|
|
|
|
|
|
|
| 213 |
|
| 214 |
-
|
| 215 |
|
| 216 |
-
|
| 217 |
|
| 218 |
-
|
|
|
|
| 219 |
|
| 220 |
-
$unmapped_category_ids
|
| 221 |
}
|
| 222 |
|
| 223 |
-
$unmapped_category_ids = array_unique( $unmapped_category_ids );
|
| 224 |
}
|
| 225 |
-
|
| 226 |
// update unmapped list
|
| 227 |
}
|
| 228 |
|
|
@@ -1532,12 +1535,15 @@ class Manual_Synchronization extends Stepped_Job {
|
|
| 1532 |
/**
|
| 1533 |
* Gets the maximum number of objects per batch in a single sync job.
|
| 1534 |
*
|
|
|
|
| 1535 |
* @since 2.0.0
|
| 1536 |
*
|
| 1537 |
* @return int
|
| 1538 |
*/
|
| 1539 |
protected function get_max_objects_per_batch() {
|
| 1540 |
|
|
|
|
|
|
|
| 1541 |
$max = $this->get_attr( 'max_objects_per_batch', 1000 );
|
| 1542 |
|
| 1543 |
/**
|
| 180 |
)
|
| 181 |
);
|
| 182 |
|
| 183 |
+
if ( ! empty( $square_ids ) ) {
|
| 184 |
|
| 185 |
+
$response = wc_square()->get_api()->batch_retrieve_catalog_objects( $square_ids );
|
|
|
|
| 186 |
|
| 187 |
+
// swap the square ID into the array key for quick lookup
|
| 188 |
+
$mapped_category_audit = array();
|
|
|
|
| 189 |
|
| 190 |
+
foreach ( $mapped_categories as $mapped_category_id => $mapped_category ) {
|
| 191 |
+
$mapped_category_audit[ $mapped_category['square_id'] ] = $mapped_category_id;
|
| 192 |
+
}
|
| 193 |
|
| 194 |
+
if ( ! $response->get_data() instanceof BatchRetrieveCatalogObjectsResponse ) {
|
| 195 |
+
throw new \Exception( 'Could not fetch category data from Square. Response data is missing' );
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
// handle response
|
| 199 |
+
if ( is_array( $response->get_data()->getObjects() ) ) {
|
| 200 |
+
foreach ( $response->get_data()->getObjects() as $category ) {
|
| 201 |
|
| 202 |
+
// don't check for the name, it will get overwritten by the Woo value anyway
|
| 203 |
+
if ( isset( $mapped_category_audit[ $category->getId() ] ) ) {
|
| 204 |
|
| 205 |
+
$category_id = $mapped_category_audit[ $category->getId() ];
|
| 206 |
|
| 207 |
+
$map[ $category_id ]['square_version'] = $category->getVersion();
|
| 208 |
+
unset( $mapped_category_audit[ $category->getId() ] );
|
| 209 |
+
}
|
| 210 |
}
|
| 211 |
}
|
|
|
|
| 212 |
|
| 213 |
+
// any remaining categories were not found in Square and should have their local mapping data removed
|
| 214 |
+
if ( ! empty( $mapped_category_audit ) ) {
|
| 215 |
+
|
| 216 |
+
$outdated_category_ids = array_values( $mapped_category_audit );
|
| 217 |
|
| 218 |
+
foreach ( $outdated_category_ids as $outdated_category_id ) {
|
| 219 |
|
| 220 |
+
unset( $map[ $outdated_category_id ], $mapped_categories[ $outdated_category_id ] );
|
| 221 |
|
| 222 |
+
$unmapped_category_ids[] = $outdated_category_id;
|
| 223 |
+
}
|
| 224 |
|
| 225 |
+
$unmapped_category_ids = array_unique( $unmapped_category_ids );
|
| 226 |
}
|
| 227 |
|
|
|
|
| 228 |
}
|
|
|
|
| 229 |
// update unmapped list
|
| 230 |
}
|
| 231 |
|
| 1535 |
/**
|
| 1536 |
* Gets the maximum number of objects per batch in a single sync job.
|
| 1537 |
*
|
| 1538 |
+
* @deprecated 3.2
|
| 1539 |
* @since 2.0.0
|
| 1540 |
*
|
| 1541 |
* @return int
|
| 1542 |
*/
|
| 1543 |
protected function get_max_objects_per_batch() {
|
| 1544 |
|
| 1545 |
+
wc_deprecated_function( __METHOD__, '3.2' );
|
| 1546 |
+
|
| 1547 |
$max = $this->get_attr( 'max_objects_per_batch', 1000 );
|
| 1548 |
|
| 1549 |
/**
|
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.
|
| 8 |
License: GPLv3
|
| 9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
| 10 |
|
|
@@ -71,6 +71,18 @@ 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.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
|
| 4 |
Requires at least: 4.6
|
| 5 |
Tested up to: 6.0
|
| 6 |
Requires PHP: 7.2
|
| 7 |
+
Stable tag: 3.2.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.2.0 - 2022-09-14 =
|
| 75 |
+
* Add - Ensure the `via WooCommerce` text can be translated and introduce a new filter to update that text while paying with Apple Pay.
|
| 76 |
+
* Add - Missing square_customers table.
|
| 77 |
+
* Dev - Remove unnecessary build process files.
|
| 78 |
+
* Fix - Add notice when trying to import CSV and product sync is turned on.
|
| 79 |
+
* Fix - Invalid object with ID error while syncing variable products with Woo as SOR.
|
| 80 |
+
* Fix - Issue where `woocommerce_order_status_refunded` hook previously ran twice after successful refund.
|
| 81 |
+
* Fix - Multiple digital wallet buttons shown when quantity is updated.
|
| 82 |
+
* Fix - Tax computation error caused by tax ID set to 0.
|
| 83 |
+
* Fix - The `Repeated field must have at least one value` error.
|
| 84 |
+
* Update - Deprecates the method `get_max_objects_per_batch`.
|
| 85 |
+
|
| 86 |
= 3.1.0 - 2022-06-09 =
|
| 87 |
* Fix - Hide shipping options in Google Pay form for virtual products. #800
|
| 88 |
* Fix - State-specific tax calculation when using Google Pay. #778
|
vendor/autoload.php
CHANGED
|
@@ -2,6 +2,11 @@
|
|
| 2 |
|
| 3 |
// autoload.php @generated by Composer
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
| 6 |
|
| 7 |
-
return
|
| 2 |
|
| 3 |
// autoload.php @generated by Composer
|
| 4 |
|
| 5 |
+
if (PHP_VERSION_ID < 50600) {
|
| 6 |
+
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
| 7 |
+
exit(1);
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
require_once __DIR__ . '/composer/autoload_real.php';
|
| 11 |
|
| 12 |
+
return ComposerAutoloaderInit0f8c28c28637f6e40856be06392fc25b::getLoader();
|
vendor/composer/ClassLoader.php
CHANGED
|
@@ -42,30 +42,75 @@ namespace Composer\Autoload;
|
|
| 42 |
*/
|
| 43 |
class ClassLoader
|
| 44 |
{
|
|
|
|
| 45 |
private $vendorDir;
|
| 46 |
|
| 47 |
// PSR-4
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
private $prefixLengthsPsr4 = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
private $prefixDirsPsr4 = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
private $fallbackDirsPsr4 = array();
|
| 51 |
|
| 52 |
// PSR-0
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
private $prefixesPsr0 = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
private $fallbackDirsPsr0 = array();
|
| 55 |
|
|
|
|
| 56 |
private $useIncludePath = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
private $classMap = array();
|
|
|
|
|
|
|
| 58 |
private $classMapAuthoritative = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
private $missingClasses = array();
|
|
|
|
|
|
|
| 60 |
private $apcuPrefix;
|
| 61 |
|
|
|
|
|
|
|
|
|
|
| 62 |
private static $registeredLoaders = array();
|
| 63 |
|
|
|
|
|
|
|
|
|
|
| 64 |
public function __construct($vendorDir = null)
|
| 65 |
{
|
| 66 |
$this->vendorDir = $vendorDir;
|
| 67 |
}
|
| 68 |
|
|
|
|
|
|
|
|
|
|
| 69 |
public function getPrefixes()
|
| 70 |
{
|
| 71 |
if (!empty($this->prefixesPsr0)) {
|
|
@@ -75,28 +120,47 @@ class ClassLoader
|
|
| 75 |
return array();
|
| 76 |
}
|
| 77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
public function getPrefixesPsr4()
|
| 79 |
{
|
| 80 |
return $this->prefixDirsPsr4;
|
| 81 |
}
|
| 82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
public function getFallbackDirs()
|
| 84 |
{
|
| 85 |
return $this->fallbackDirsPsr0;
|
| 86 |
}
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
public function getFallbackDirsPsr4()
|
| 89 |
{
|
| 90 |
return $this->fallbackDirsPsr4;
|
| 91 |
}
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
public function getClassMap()
|
| 94 |
{
|
| 95 |
return $this->classMap;
|
| 96 |
}
|
| 97 |
|
| 98 |
/**
|
| 99 |
-
* @param
|
|
|
|
|
|
|
|
|
|
| 100 |
*/
|
| 101 |
public function addClassMap(array $classMap)
|
| 102 |
{
|
|
@@ -111,9 +175,11 @@ class ClassLoader
|
|
| 111 |
* Registers a set of PSR-0 directories for a given prefix, either
|
| 112 |
* appending or prepending to the ones previously set for this prefix.
|
| 113 |
*
|
| 114 |
-
* @param string
|
| 115 |
-
* @param
|
| 116 |
-
* @param bool
|
|
|
|
|
|
|
| 117 |
*/
|
| 118 |
public function add($prefix, $paths, $prepend = false)
|
| 119 |
{
|
|
@@ -156,11 +222,13 @@ class ClassLoader
|
|
| 156 |
* Registers a set of PSR-4 directories for a given namespace, either
|
| 157 |
* appending or prepending to the ones previously set for this namespace.
|
| 158 |
*
|
| 159 |
-
* @param string
|
| 160 |
-
* @param
|
| 161 |
-
* @param bool
|
| 162 |
*
|
| 163 |
* @throws \InvalidArgumentException
|
|
|
|
|
|
|
| 164 |
*/
|
| 165 |
public function addPsr4($prefix, $paths, $prepend = false)
|
| 166 |
{
|
|
@@ -204,8 +272,10 @@ class ClassLoader
|
|
| 204 |
* Registers a set of PSR-0 directories for a given prefix,
|
| 205 |
* replacing any others previously set for this prefix.
|
| 206 |
*
|
| 207 |
-
* @param string
|
| 208 |
-
* @param
|
|
|
|
|
|
|
| 209 |
*/
|
| 210 |
public function set($prefix, $paths)
|
| 211 |
{
|
|
@@ -220,10 +290,12 @@ class ClassLoader
|
|
| 220 |
* Registers a set of PSR-4 directories for a given namespace,
|
| 221 |
* replacing any others previously set for this namespace.
|
| 222 |
*
|
| 223 |
-
* @param string
|
| 224 |
-
* @param
|
| 225 |
*
|
| 226 |
* @throws \InvalidArgumentException
|
|
|
|
|
|
|
| 227 |
*/
|
| 228 |
public function setPsr4($prefix, $paths)
|
| 229 |
{
|
|
@@ -243,6 +315,8 @@ class ClassLoader
|
|
| 243 |
* Turns on searching the include path for class files.
|
| 244 |
*
|
| 245 |
* @param bool $useIncludePath
|
|
|
|
|
|
|
| 246 |
*/
|
| 247 |
public function setUseIncludePath($useIncludePath)
|
| 248 |
{
|
|
@@ -265,6 +339,8 @@ class ClassLoader
|
|
| 265 |
* that have not been registered with the class map.
|
| 266 |
*
|
| 267 |
* @param bool $classMapAuthoritative
|
|
|
|
|
|
|
| 268 |
*/
|
| 269 |
public function setClassMapAuthoritative($classMapAuthoritative)
|
| 270 |
{
|
|
@@ -285,6 +361,8 @@ class ClassLoader
|
|
| 285 |
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
| 286 |
*
|
| 287 |
* @param string|null $apcuPrefix
|
|
|
|
|
|
|
| 288 |
*/
|
| 289 |
public function setApcuPrefix($apcuPrefix)
|
| 290 |
{
|
|
@@ -305,6 +383,8 @@ class ClassLoader
|
|
| 305 |
* Registers this instance as an autoloader.
|
| 306 |
*
|
| 307 |
* @param bool $prepend Whether to prepend the autoloader or not
|
|
|
|
|
|
|
| 308 |
*/
|
| 309 |
public function register($prepend = false)
|
| 310 |
{
|
|
@@ -324,6 +404,8 @@ class ClassLoader
|
|
| 324 |
|
| 325 |
/**
|
| 326 |
* Unregisters this instance as an autoloader.
|
|
|
|
|
|
|
| 327 |
*/
|
| 328 |
public function unregister()
|
| 329 |
{
|
|
@@ -403,6 +485,11 @@ class ClassLoader
|
|
| 403 |
return self::$registeredLoaders;
|
| 404 |
}
|
| 405 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 406 |
private function findFileWithExtension($class, $ext)
|
| 407 |
{
|
| 408 |
// PSR-4 lookup
|
|
@@ -474,6 +561,10 @@ class ClassLoader
|
|
| 474 |
* Scope isolated include.
|
| 475 |
*
|
| 476 |
* Prevents access to $this/self from included files.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 477 |
*/
|
| 478 |
function includeFile($file)
|
| 479 |
{
|
| 42 |
*/
|
| 43 |
class ClassLoader
|
| 44 |
{
|
| 45 |
+
/** @var ?string */
|
| 46 |
private $vendorDir;
|
| 47 |
|
| 48 |
// PSR-4
|
| 49 |
+
/**
|
| 50 |
+
* @var array[]
|
| 51 |
+
* @psalm-var array<string, array<string, int>>
|
| 52 |
+
*/
|
| 53 |
private $prefixLengthsPsr4 = array();
|
| 54 |
+
/**
|
| 55 |
+
* @var array[]
|
| 56 |
+
* @psalm-var array<string, array<int, string>>
|
| 57 |
+
*/
|
| 58 |
private $prefixDirsPsr4 = array();
|
| 59 |
+
/**
|
| 60 |
+
* @var array[]
|
| 61 |
+
* @psalm-var array<string, string>
|
| 62 |
+
*/
|
| 63 |
private $fallbackDirsPsr4 = array();
|
| 64 |
|
| 65 |
// PSR-0
|
| 66 |
+
/**
|
| 67 |
+
* @var array[]
|
| 68 |
+
* @psalm-var array<string, array<string, string[]>>
|
| 69 |
+
*/
|
| 70 |
private $prefixesPsr0 = array();
|
| 71 |
+
/**
|
| 72 |
+
* @var array[]
|
| 73 |
+
* @psalm-var array<string, string>
|
| 74 |
+
*/
|
| 75 |
private $fallbackDirsPsr0 = array();
|
| 76 |
|
| 77 |
+
/** @var bool */
|
| 78 |
private $useIncludePath = false;
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* @var string[]
|
| 82 |
+
* @psalm-var array<string, string>
|
| 83 |
+
*/
|
| 84 |
private $classMap = array();
|
| 85 |
+
|
| 86 |
+
/** @var bool */
|
| 87 |
private $classMapAuthoritative = false;
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* @var bool[]
|
| 91 |
+
* @psalm-var array<string, bool>
|
| 92 |
+
*/
|
| 93 |
private $missingClasses = array();
|
| 94 |
+
|
| 95 |
+
/** @var ?string */
|
| 96 |
private $apcuPrefix;
|
| 97 |
|
| 98 |
+
/**
|
| 99 |
+
* @var self[]
|
| 100 |
+
*/
|
| 101 |
private static $registeredLoaders = array();
|
| 102 |
|
| 103 |
+
/**
|
| 104 |
+
* @param ?string $vendorDir
|
| 105 |
+
*/
|
| 106 |
public function __construct($vendorDir = null)
|
| 107 |
{
|
| 108 |
$this->vendorDir = $vendorDir;
|
| 109 |
}
|
| 110 |
|
| 111 |
+
/**
|
| 112 |
+
* @return string[]
|
| 113 |
+
*/
|
| 114 |
public function getPrefixes()
|
| 115 |
{
|
| 116 |
if (!empty($this->prefixesPsr0)) {
|
| 120 |
return array();
|
| 121 |
}
|
| 122 |
|
| 123 |
+
/**
|
| 124 |
+
* @return array[]
|
| 125 |
+
* @psalm-return array<string, array<int, string>>
|
| 126 |
+
*/
|
| 127 |
public function getPrefixesPsr4()
|
| 128 |
{
|
| 129 |
return $this->prefixDirsPsr4;
|
| 130 |
}
|
| 131 |
|
| 132 |
+
/**
|
| 133 |
+
* @return array[]
|
| 134 |
+
* @psalm-return array<string, string>
|
| 135 |
+
*/
|
| 136 |
public function getFallbackDirs()
|
| 137 |
{
|
| 138 |
return $this->fallbackDirsPsr0;
|
| 139 |
}
|
| 140 |
|
| 141 |
+
/**
|
| 142 |
+
* @return array[]
|
| 143 |
+
* @psalm-return array<string, string>
|
| 144 |
+
*/
|
| 145 |
public function getFallbackDirsPsr4()
|
| 146 |
{
|
| 147 |
return $this->fallbackDirsPsr4;
|
| 148 |
}
|
| 149 |
|
| 150 |
+
/**
|
| 151 |
+
* @return string[] Array of classname => path
|
| 152 |
+
* @psalm-return array<string, string>
|
| 153 |
+
*/
|
| 154 |
public function getClassMap()
|
| 155 |
{
|
| 156 |
return $this->classMap;
|
| 157 |
}
|
| 158 |
|
| 159 |
/**
|
| 160 |
+
* @param string[] $classMap Class to filename map
|
| 161 |
+
* @psalm-param array<string, string> $classMap
|
| 162 |
+
*
|
| 163 |
+
* @return void
|
| 164 |
*/
|
| 165 |
public function addClassMap(array $classMap)
|
| 166 |
{
|
| 175 |
* Registers a set of PSR-0 directories for a given prefix, either
|
| 176 |
* appending or prepending to the ones previously set for this prefix.
|
| 177 |
*
|
| 178 |
+
* @param string $prefix The prefix
|
| 179 |
+
* @param string[]|string $paths The PSR-0 root directories
|
| 180 |
+
* @param bool $prepend Whether to prepend the directories
|
| 181 |
+
*
|
| 182 |
+
* @return void
|
| 183 |
*/
|
| 184 |
public function add($prefix, $paths, $prepend = false)
|
| 185 |
{
|
| 222 |
* Registers a set of PSR-4 directories for a given namespace, either
|
| 223 |
* appending or prepending to the ones previously set for this namespace.
|
| 224 |
*
|
| 225 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
| 226 |
+
* @param string[]|string $paths The PSR-4 base directories
|
| 227 |
+
* @param bool $prepend Whether to prepend the directories
|
| 228 |
*
|
| 229 |
* @throws \InvalidArgumentException
|
| 230 |
+
*
|
| 231 |
+
* @return void
|
| 232 |
*/
|
| 233 |
public function addPsr4($prefix, $paths, $prepend = false)
|
| 234 |
{
|
| 272 |
* Registers a set of PSR-0 directories for a given prefix,
|
| 273 |
* replacing any others previously set for this prefix.
|
| 274 |
*
|
| 275 |
+
* @param string $prefix The prefix
|
| 276 |
+
* @param string[]|string $paths The PSR-0 base directories
|
| 277 |
+
*
|
| 278 |
+
* @return void
|
| 279 |
*/
|
| 280 |
public function set($prefix, $paths)
|
| 281 |
{
|
| 290 |
* Registers a set of PSR-4 directories for a given namespace,
|
| 291 |
* replacing any others previously set for this namespace.
|
| 292 |
*
|
| 293 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
| 294 |
+
* @param string[]|string $paths The PSR-4 base directories
|
| 295 |
*
|
| 296 |
* @throws \InvalidArgumentException
|
| 297 |
+
*
|
| 298 |
+
* @return void
|
| 299 |
*/
|
| 300 |
public function setPsr4($prefix, $paths)
|
| 301 |
{
|
| 315 |
* Turns on searching the include path for class files.
|
| 316 |
*
|
| 317 |
* @param bool $useIncludePath
|
| 318 |
+
*
|
| 319 |
+
* @return void
|
| 320 |
*/
|
| 321 |
public function setUseIncludePath($useIncludePath)
|
| 322 |
{
|
| 339 |
* that have not been registered with the class map.
|
| 340 |
*
|
| 341 |
* @param bool $classMapAuthoritative
|
| 342 |
+
*
|
| 343 |
+
* @return void
|
| 344 |
*/
|
| 345 |
public function setClassMapAuthoritative($classMapAuthoritative)
|
| 346 |
{
|
| 361 |
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
| 362 |
*
|
| 363 |
* @param string|null $apcuPrefix
|
| 364 |
+
*
|
| 365 |
+
* @return void
|
| 366 |
*/
|
| 367 |
public function setApcuPrefix($apcuPrefix)
|
| 368 |
{
|
| 383 |
* Registers this instance as an autoloader.
|
| 384 |
*
|
| 385 |
* @param bool $prepend Whether to prepend the autoloader or not
|
| 386 |
+
*
|
| 387 |
+
* @return void
|
| 388 |
*/
|
| 389 |
public function register($prepend = false)
|
| 390 |
{
|
| 404 |
|
| 405 |
/**
|
| 406 |
* Unregisters this instance as an autoloader.
|
| 407 |
+
*
|
| 408 |
+
* @return void
|
| 409 |
*/
|
| 410 |
public function unregister()
|
| 411 |
{
|
| 485 |
return self::$registeredLoaders;
|
| 486 |
}
|
| 487 |
|
| 488 |
+
/**
|
| 489 |
+
* @param string $class
|
| 490 |
+
* @param string $ext
|
| 491 |
+
* @return string|false
|
| 492 |
+
*/
|
| 493 |
private function findFileWithExtension($class, $ext)
|
| 494 |
{
|
| 495 |
// PSR-4 lookup
|
| 561 |
* Scope isolated include.
|
| 562 |
*
|
| 563 |
* Prevents access to $this/self from included files.
|
| 564 |
+
*
|
| 565 |
+
* @param string $file
|
| 566 |
+
* @return void
|
| 567 |
+
* @private
|
| 568 |
*/
|
| 569 |
function includeFile($file)
|
| 570 |
{
|
vendor/composer/InstalledVersions.php
CHANGED
|
@@ -20,12 +20,27 @@ use Composer\Semver\VersionParser;
|
|
| 20 |
*
|
| 21 |
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
| 22 |
*
|
| 23 |
-
* To require
|
|
|
|
|
|
|
| 24 |
*/
|
| 25 |
class InstalledVersions
|
| 26 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
private static $installed;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
private static $canGetVendors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
private static $installedByVendor = array();
|
| 30 |
|
| 31 |
/**
|
|
@@ -228,7 +243,7 @@ class InstalledVersions
|
|
| 228 |
|
| 229 |
/**
|
| 230 |
* @return array
|
| 231 |
-
* @psalm-return array{name: string, version: string, reference: string,
|
| 232 |
*/
|
| 233 |
public static function getRootPackage()
|
| 234 |
{
|
|
@@ -242,14 +257,20 @@ class InstalledVersions
|
|
| 242 |
*
|
| 243 |
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
| 244 |
* @return array[]
|
| 245 |
-
* @psalm-return array{root: array{name: string, version: string, reference: string,
|
| 246 |
*/
|
| 247 |
public static function getRawData()
|
| 248 |
{
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
}
|
| 254 |
|
| 255 |
return self::$installed;
|
|
@@ -259,7 +280,7 @@ class InstalledVersions
|
|
| 259 |
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
| 260 |
*
|
| 261 |
* @return array[]
|
| 262 |
-
* @psalm-return list<array{root: array{name: string, version: string, reference: string,
|
| 263 |
*/
|
| 264 |
public static function getAllRawData()
|
| 265 |
{
|
|
@@ -282,7 +303,7 @@ class InstalledVersions
|
|
| 282 |
* @param array[] $data A vendor/composer/installed.php data set
|
| 283 |
* @return void
|
| 284 |
*
|
| 285 |
-
* @psalm-param array{root: array{name: string, version: string, reference: string,
|
| 286 |
*/
|
| 287 |
public static function reload($data)
|
| 288 |
{
|
|
@@ -292,7 +313,7 @@ class InstalledVersions
|
|
| 292 |
|
| 293 |
/**
|
| 294 |
* @return array[]
|
| 295 |
-
* @psalm-return list<array{root: array{name: string, version: string, reference: string,
|
| 296 |
*/
|
| 297 |
private static function getInstalled()
|
| 298 |
{
|
|
@@ -316,7 +337,13 @@ class InstalledVersions
|
|
| 316 |
}
|
| 317 |
|
| 318 |
if (null === self::$installed) {
|
| 319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
}
|
| 321 |
$installed[] = self::$installed;
|
| 322 |
|
| 20 |
*
|
| 21 |
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
| 22 |
*
|
| 23 |
+
* To require its presence, you can require `composer-runtime-api ^2.0`
|
| 24 |
+
*
|
| 25 |
+
* @final
|
| 26 |
*/
|
| 27 |
class InstalledVersions
|
| 28 |
{
|
| 29 |
+
/**
|
| 30 |
+
* @var mixed[]|null
|
| 31 |
+
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
|
| 32 |
+
*/
|
| 33 |
private static $installed;
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* @var bool|null
|
| 37 |
+
*/
|
| 38 |
private static $canGetVendors;
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* @var array[]
|
| 42 |
+
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
| 43 |
+
*/
|
| 44 |
private static $installedByVendor = array();
|
| 45 |
|
| 46 |
/**
|
| 243 |
|
| 244 |
/**
|
| 245 |
* @return array
|
| 246 |
+
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
|
| 247 |
*/
|
| 248 |
public static function getRootPackage()
|
| 249 |
{
|
| 257 |
*
|
| 258 |
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
| 259 |
* @return array[]
|
| 260 |
+
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
|
| 261 |
*/
|
| 262 |
public static function getRawData()
|
| 263 |
{
|
| 264 |
@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);
|
| 265 |
|
| 266 |
if (null === self::$installed) {
|
| 267 |
+
// only require the installed.php file if this file is loaded from its dumped location,
|
| 268 |
+
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
| 269 |
+
if (substr(__DIR__, -8, 1) !== 'C') {
|
| 270 |
+
self::$installed = include __DIR__ . '/installed.php';
|
| 271 |
+
} else {
|
| 272 |
+
self::$installed = array();
|
| 273 |
+
}
|
| 274 |
}
|
| 275 |
|
| 276 |
return self::$installed;
|
| 280 |
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
| 281 |
*
|
| 282 |
* @return array[]
|
| 283 |
+
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
| 284 |
*/
|
| 285 |
public static function getAllRawData()
|
| 286 |
{
|
| 303 |
* @param array[] $data A vendor/composer/installed.php data set
|
| 304 |
* @return void
|
| 305 |
*
|
| 306 |
+
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
|
| 307 |
*/
|
| 308 |
public static function reload($data)
|
| 309 |
{
|
| 313 |
|
| 314 |
/**
|
| 315 |
* @return array[]
|
| 316 |
+
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
| 317 |
*/
|
| 318 |
private static function getInstalled()
|
| 319 |
{
|
| 337 |
}
|
| 338 |
|
| 339 |
if (null === self::$installed) {
|
| 340 |
+
// only require the installed.php file if this file is loaded from its dumped location,
|
| 341 |
+
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
| 342 |
+
if (substr(__DIR__, -8, 1) !== 'C') {
|
| 343 |
+
self::$installed = require __DIR__ . '/installed.php';
|
| 344 |
+
} else {
|
| 345 |
+
self::$installed = array();
|
| 346 |
+
}
|
| 347 |
}
|
| 348 |
$installed[] = self::$installed;
|
| 349 |
|
vendor/composer/autoload_classmap.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
// autoload_classmap.php @generated by Composer
|
| 4 |
|
| 5 |
-
$vendorDir = dirname(
|
| 6 |
$baseDir = dirname($vendorDir);
|
| 7 |
|
| 8 |
return array(
|
| 2 |
|
| 3 |
// autoload_classmap.php @generated by Composer
|
| 4 |
|
| 5 |
+
$vendorDir = dirname(__DIR__);
|
| 6 |
$baseDir = dirname($vendorDir);
|
| 7 |
|
| 8 |
return array(
|
vendor/composer/autoload_namespaces.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
// autoload_namespaces.php @generated by Composer
|
| 4 |
|
| 5 |
-
$vendorDir = dirname(
|
| 6 |
$baseDir = dirname($vendorDir);
|
| 7 |
|
| 8 |
return array(
|
| 2 |
|
| 3 |
// autoload_namespaces.php @generated by Composer
|
| 4 |
|
| 5 |
+
$vendorDir = dirname(__DIR__);
|
| 6 |
$baseDir = dirname($vendorDir);
|
| 7 |
|
| 8 |
return array(
|
vendor/composer/autoload_psr4.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
// autoload_psr4.php @generated by Composer
|
| 4 |
|
| 5 |
-
$vendorDir = dirname(
|
| 6 |
$baseDir = dirname($vendorDir);
|
| 7 |
|
| 8 |
return array(
|
| 2 |
|
| 3 |
// autoload_psr4.php @generated by Composer
|
| 4 |
|
| 5 |
+
$vendorDir = dirname(__DIR__);
|
| 6 |
$baseDir = dirname($vendorDir);
|
| 7 |
|
| 8 |
return array(
|
vendor/composer/autoload_real.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
// autoload_real.php @generated by Composer
|
| 4 |
|
| 5 |
-
class
|
| 6 |
{
|
| 7 |
private static $loader;
|
| 8 |
|
|
@@ -24,31 +24,12 @@ class ComposerAutoloaderInite7caf2f4fab3115779a90b736801dd4b
|
|
| 24 |
|
| 25 |
require __DIR__ . '/platform_check.php';
|
| 26 |
|
| 27 |
-
spl_autoload_register(array('
|
| 28 |
-
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(
|
| 29 |
-
spl_autoload_unregister(array('
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 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) {
|
| 39 |
-
$loader->set($namespace, $path);
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
$map = require __DIR__ . '/autoload_psr4.php';
|
| 43 |
-
foreach ($map as $namespace => $path) {
|
| 44 |
-
$loader->setPsr4($namespace, $path);
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
$classMap = require __DIR__ . '/autoload_classmap.php';
|
| 48 |
-
if ($classMap) {
|
| 49 |
-
$loader->addClassMap($classMap);
|
| 50 |
-
}
|
| 51 |
-
}
|
| 52 |
|
| 53 |
$loader->register(true);
|
| 54 |
|
| 2 |
|
| 3 |
// autoload_real.php @generated by Composer
|
| 4 |
|
| 5 |
+
class ComposerAutoloaderInit0f8c28c28637f6e40856be06392fc25b
|
| 6 |
{
|
| 7 |
private static $loader;
|
| 8 |
|
| 24 |
|
| 25 |
require __DIR__ . '/platform_check.php';
|
| 26 |
|
| 27 |
+
spl_autoload_register(array('ComposerAutoloaderInit0f8c28c28637f6e40856be06392fc25b', 'loadClassLoader'), true, true);
|
| 28 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
| 29 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit0f8c28c28637f6e40856be06392fc25b', 'loadClassLoader'));
|
| 30 |
+
|
| 31 |
+
require __DIR__ . '/autoload_static.php';
|
| 32 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit0f8c28c28637f6e40856be06392fc25b::getInitializer($loader));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
$loader->register(true);
|
| 35 |
|
vendor/composer/autoload_static.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
|
| 5 |
namespace Composer\Autoload;
|
| 6 |
|
| 7 |
-
class
|
| 8 |
{
|
| 9 |
public static $prefixLengthsPsr4 = array (
|
| 10 |
'a' =>
|
|
@@ -45,10 +45,10 @@ class ComposerStaticInite7caf2f4fab3115779a90b736801dd4b
|
|
| 45 |
public static function getInitializer(ClassLoader $loader)
|
| 46 |
{
|
| 47 |
return \Closure::bind(function () use ($loader) {
|
| 48 |
-
$loader->prefixLengthsPsr4 =
|
| 49 |
-
$loader->prefixDirsPsr4 =
|
| 50 |
-
$loader->prefixesPsr0 =
|
| 51 |
-
$loader->classMap =
|
| 52 |
|
| 53 |
}, null, ClassLoader::class);
|
| 54 |
}
|
| 4 |
|
| 5 |
namespace Composer\Autoload;
|
| 6 |
|
| 7 |
+
class ComposerStaticInit0f8c28c28637f6e40856be06392fc25b
|
| 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 = ComposerStaticInit0f8c28c28637f6e40856be06392fc25b::$prefixLengthsPsr4;
|
| 49 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit0f8c28c28637f6e40856be06392fc25b::$prefixDirsPsr4;
|
| 50 |
+
$loader->prefixesPsr0 = ComposerStaticInit0f8c28c28637f6e40856be06392fc25b::$prefixesPsr0;
|
| 51 |
+
$loader->classMap = ComposerStaticInit0f8c28c28637f6e40856be06392fc25b::$classMap;
|
| 52 |
|
| 53 |
}, null, ClassLoader::class);
|
| 54 |
}
|
vendor/composer/installed.php
CHANGED
|
@@ -1,58 +1,58 @@
|
|
| 1 |
<?php return array(
|
| 2 |
'root' => array(
|
| 3 |
-
'
|
| 4 |
-
'
|
|
|
|
|
|
|
| 5 |
'type' => 'library',
|
| 6 |
'install_path' => __DIR__ . '/../../',
|
| 7 |
'aliases' => array(),
|
| 8 |
-
'reference' => '9d99889923ef103d2bdea1a828aa4845ad234d21',
|
| 9 |
-
'name' => 'woocommerce/woocommerce-square',
|
| 10 |
'dev' => false,
|
| 11 |
),
|
| 12 |
'versions' => array(
|
| 13 |
'apimatic/jsonmapper' => array(
|
| 14 |
'pretty_version' => 'v2.0.3',
|
| 15 |
'version' => '2.0.3.0',
|
|
|
|
| 16 |
'type' => 'library',
|
| 17 |
'install_path' => __DIR__ . '/../apimatic/jsonmapper',
|
| 18 |
'aliases' => array(),
|
| 19 |
-
'reference' => 'f7588f1ab692c402a9118e65cb9fd42b74e5e0db',
|
| 20 |
'dev_requirement' => false,
|
| 21 |
),
|
| 22 |
'apimatic/unirest-php' => array(
|
| 23 |
'pretty_version' => '2.0.0',
|
| 24 |
'version' => '2.0.0.0',
|
|
|
|
| 25 |
'type' => 'library',
|
| 26 |
'install_path' => __DIR__ . '/../apimatic/unirest-php',
|
| 27 |
'aliases' => array(),
|
| 28 |
-
'reference' => 'b4e399a8970c3a5c611f734282f306381f9d1eee',
|
| 29 |
'dev_requirement' => false,
|
| 30 |
),
|
| 31 |
'square/square' => array(
|
| 32 |
'pretty_version' => '15.0.0.20211020',
|
| 33 |
'version' => '15.0.0.20211020',
|
|
|
|
| 34 |
'type' => 'library',
|
| 35 |
'install_path' => __DIR__ . '/../square/square',
|
| 36 |
'aliases' => array(),
|
| 37 |
-
'reference' => 'a31e7fbb6cd458095b2f09543d799a06c35fd2a7',
|
| 38 |
'dev_requirement' => false,
|
| 39 |
),
|
| 40 |
'woocommerce/action-scheduler' => array(
|
| 41 |
'pretty_version' => '3.4.0',
|
| 42 |
'version' => '3.4.0.0',
|
|
|
|
| 43 |
'type' => 'wordpress-plugin',
|
| 44 |
'install_path' => __DIR__ . '/../woocommerce/action-scheduler',
|
| 45 |
'aliases' => array(),
|
| 46 |
-
'reference' => '3218a33ff14b968f8cb05de9656c2efa1eeb1330',
|
| 47 |
'dev_requirement' => false,
|
| 48 |
),
|
| 49 |
'woocommerce/woocommerce-square' => array(
|
| 50 |
-
'pretty_version' => 'dev-release/3.
|
| 51 |
-
'version' => 'dev-release/3.
|
|
|
|
| 52 |
'type' => 'library',
|
| 53 |
'install_path' => __DIR__ . '/../../',
|
| 54 |
'aliases' => array(),
|
| 55 |
-
'reference' => '9d99889923ef103d2bdea1a828aa4845ad234d21',
|
| 56 |
'dev_requirement' => false,
|
| 57 |
),
|
| 58 |
),
|
| 1 |
<?php return array(
|
| 2 |
'root' => array(
|
| 3 |
+
'name' => 'woocommerce/woocommerce-square',
|
| 4 |
+
'pretty_version' => 'dev-release/3.2.0',
|
| 5 |
+
'version' => 'dev-release/3.2.0',
|
| 6 |
+
'reference' => 'd315f1e6d95bba25999e90c55404d24ec009c620',
|
| 7 |
'type' => 'library',
|
| 8 |
'install_path' => __DIR__ . '/../../',
|
| 9 |
'aliases' => array(),
|
|
|
|
|
|
|
| 10 |
'dev' => false,
|
| 11 |
),
|
| 12 |
'versions' => array(
|
| 13 |
'apimatic/jsonmapper' => array(
|
| 14 |
'pretty_version' => 'v2.0.3',
|
| 15 |
'version' => '2.0.3.0',
|
| 16 |
+
'reference' => 'f7588f1ab692c402a9118e65cb9fd42b74e5e0db',
|
| 17 |
'type' => 'library',
|
| 18 |
'install_path' => __DIR__ . '/../apimatic/jsonmapper',
|
| 19 |
'aliases' => array(),
|
|
|
|
| 20 |
'dev_requirement' => false,
|
| 21 |
),
|
| 22 |
'apimatic/unirest-php' => array(
|
| 23 |
'pretty_version' => '2.0.0',
|
| 24 |
'version' => '2.0.0.0',
|
| 25 |
+
'reference' => 'b4e399a8970c3a5c611f734282f306381f9d1eee',
|
| 26 |
'type' => 'library',
|
| 27 |
'install_path' => __DIR__ . '/../apimatic/unirest-php',
|
| 28 |
'aliases' => array(),
|
|
|
|
| 29 |
'dev_requirement' => false,
|
| 30 |
),
|
| 31 |
'square/square' => array(
|
| 32 |
'pretty_version' => '15.0.0.20211020',
|
| 33 |
'version' => '15.0.0.20211020',
|
| 34 |
+
'reference' => 'a31e7fbb6cd458095b2f09543d799a06c35fd2a7',
|
| 35 |
'type' => 'library',
|
| 36 |
'install_path' => __DIR__ . '/../square/square',
|
| 37 |
'aliases' => array(),
|
|
|
|
| 38 |
'dev_requirement' => false,
|
| 39 |
),
|
| 40 |
'woocommerce/action-scheduler' => array(
|
| 41 |
'pretty_version' => '3.4.0',
|
| 42 |
'version' => '3.4.0.0',
|
| 43 |
+
'reference' => '3218a33ff14b968f8cb05de9656c2efa1eeb1330',
|
| 44 |
'type' => 'wordpress-plugin',
|
| 45 |
'install_path' => __DIR__ . '/../woocommerce/action-scheduler',
|
| 46 |
'aliases' => array(),
|
|
|
|
| 47 |
'dev_requirement' => false,
|
| 48 |
),
|
| 49 |
'woocommerce/woocommerce-square' => array(
|
| 50 |
+
'pretty_version' => 'dev-release/3.2.0',
|
| 51 |
+
'version' => 'dev-release/3.2.0',
|
| 52 |
+
'reference' => 'd315f1e6d95bba25999e90c55404d24ec009c620',
|
| 53 |
'type' => 'library',
|
| 54 |
'install_path' => __DIR__ . '/../../',
|
| 55 |
'aliases' => array(),
|
|
|
|
| 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.
|
| 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: 3.2.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
|
