WooCommerce Square - Version 2.3.4

Version Description

  • 2021.02.11 =
  • Fix - Handle exceptions when loading digital wallet buttons on product pages with no stock or other serviceable issues. PR#591
Download this release

Release Info

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

Code changes from version 2.3.3 to 2.3.4

i18n/languages/woocommerce-square.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Square 2.3.3\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-square\n"
8
- "POT-Creation-Date: 2021-02-09 04:04:57+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -434,7 +434,7 @@ msgid "The sync job has failed. Check sync records, or %s."
434
  msgstr ""
435
 
436
  #: includes/Gateway/API/Requests/Orders.php:88
437
- #: includes/Gateway/Digital_Wallet.php:410
438
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:555
439
  msgid "Discount"
440
  msgstr ""
@@ -467,7 +467,7 @@ msgstr ""
467
  msgid "OR"
468
  msgstr ""
469
 
470
- #: includes/Gateway/Digital_Wallet.php:204
471
  #: includes/Gateway/Payment_Form.php:240 includes/Gateway.php:245
472
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php:216
473
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:2758
@@ -475,53 +475,53 @@ msgstr ""
475
  msgid "An error occurred, please try again or try an alternate form of payment."
476
  msgstr ""
477
 
478
- #: includes/Gateway/Digital_Wallet.php:268
479
  #. translators: product ID
480
  msgid "Product with the ID (%d) cannot be found."
481
  msgstr ""
482
 
483
- #: includes/Gateway/Digital_Wallet.php:284
484
  #. translators: 1: product name 2: quantity in stock
485
  msgid ""
486
  "You cannot add that amount of \"%1$s\"; to the cart because there is not "
487
  "enough stock (%2$s remaining)."
488
  msgstr ""
489
 
490
- #: includes/Gateway/Digital_Wallet.php:306
491
- #: includes/Gateway/Digital_Wallet.php:402
492
  msgid "Tax"
493
  msgstr ""
494
 
495
- #: includes/Gateway/Digital_Wallet.php:341
496
  msgid "This payment method cannot be used for multiple shipments."
497
  msgstr ""
498
 
499
- #: includes/Gateway/Digital_Wallet.php:352
500
  #: vendor/prospress/action-scheduler/classes/ActionScheduler_Store.php:182
501
  msgid "Pending"
502
  msgstr ""
503
 
504
- #: includes/Gateway/Digital_Wallet.php:394
505
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:565
506
  msgid "Shipping"
507
  msgstr ""
508
 
509
- #: includes/Gateway/Digital_Wallet.php:418
510
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:575
511
  msgid "Fees"
512
  msgstr ""
513
 
514
- #: includes/Gateway/Digital_Wallet.php:452
515
  msgid ""
516
  "Invalid request. Could not fetch the payment request data to be use in the "
517
  "Square digital wallet."
518
  msgstr ""
519
 
520
- #: includes/Gateway/Digital_Wallet.php:646
521
  msgid "Empty cart"
522
  msgstr ""
523
 
524
- #: includes/Gateway/Digital_Wallet.php:780
525
  msgid "Unable to verify domain with Apple Pay - missing access token."
526
  msgstr ""
527
 
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Square 2.3.4\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-square\n"
8
+ "POT-Creation-Date: 2021-02-11 02:41:23+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
434
  msgstr ""
435
 
436
  #: includes/Gateway/API/Requests/Orders.php:88
437
+ #: includes/Gateway/Digital_Wallet.php:415
438
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:555
439
  msgid "Discount"
440
  msgstr ""
467
  msgid "OR"
468
  msgstr ""
469
 
470
+ #: includes/Gateway/Digital_Wallet.php:205
471
  #: includes/Gateway/Payment_Form.php:240 includes/Gateway.php:245
472
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php:216
473
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:2758
475
  msgid "An error occurred, please try again or try an alternate form of payment."
476
  msgstr ""
477
 
478
+ #: includes/Gateway/Digital_Wallet.php:273
479
  #. translators: product ID
480
  msgid "Product with the ID (%d) cannot be found."
481
  msgstr ""
482
 
483
+ #: includes/Gateway/Digital_Wallet.php:289
484
  #. translators: 1: product name 2: quantity in stock
485
  msgid ""
486
  "You cannot add that amount of \"%1$s\"; to the cart because there is not "
487
  "enough stock (%2$s remaining)."
488
  msgstr ""
489
 
490
+ #: includes/Gateway/Digital_Wallet.php:311
491
+ #: includes/Gateway/Digital_Wallet.php:407
492
  msgid "Tax"
493
  msgstr ""
494
 
495
+ #: includes/Gateway/Digital_Wallet.php:346
496
  msgid "This payment method cannot be used for multiple shipments."
497
  msgstr ""
498
 
499
+ #: includes/Gateway/Digital_Wallet.php:357
500
  #: vendor/prospress/action-scheduler/classes/ActionScheduler_Store.php:182
501
  msgid "Pending"
502
  msgstr ""
503
 
504
+ #: includes/Gateway/Digital_Wallet.php:399
505
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:565
506
  msgid "Shipping"
507
  msgstr ""
508
 
509
+ #: includes/Gateway/Digital_Wallet.php:423
510
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:575
511
  msgid "Fees"
512
  msgstr ""
513
 
514
+ #: includes/Gateway/Digital_Wallet.php:457
515
  msgid ""
516
  "Invalid request. Could not fetch the payment request data to be use in the "
517
  "Square digital wallet."
518
  msgstr ""
519
 
520
+ #: includes/Gateway/Digital_Wallet.php:651
521
  msgid "Empty cart"
522
  msgstr ""
523
 
524
+ #: includes/Gateway/Digital_Wallet.php:785
525
  msgid "Unable to verify domain with Apple Pay - missing access token."
526
  msgstr ""
527
 
includes/Gateway/Digital_Wallet.php CHANGED
@@ -192,27 +192,32 @@ class Digital_Wallet {
192
  wp_enqueue_style( 'wc-square-digital-wallet', $this->gateway->get_plugin()->get_plugin_url() . '/assets/css/frontend/wc-square-digital-wallet.min.css', array(), Plugin::VERSION );
193
  wp_enqueue_script( 'wc-square-digital-wallet', $this->gateway->get_plugin()->get_plugin_url() . '/assets/js/frontend/wc-square-digital-wallet.min.js', array( 'jquery' ), Plugin::VERSION, true );
194
 
195
- $args = apply_filters(
196
- 'wc_square_digital_wallet_js_args',
197
- array(
198
- 'application_id' => $this->gateway->get_application_id(),
199
- 'location_id' => wc_square()->get_settings_handler()->get_location_id(),
200
- 'gateway_id' => $this->gateway->get_id(),
201
- 'gateway_id_dasherized' => $this->gateway->get_id_dasherized(),
202
- 'payment_request' => $this->get_payment_request_for_context( $page ),
203
- 'context' => $page,
204
- 'general_error' => __( 'An error occurred, please try again or try an alternate form of payment.', 'woocommerce-square' ),
205
- 'ajax_url' => \WC_AJAX::get_endpoint( '%%endpoint%%' ),
206
- 'payment_request_nonce' => wp_create_nonce( 'wc-square-get-payment-request' ),
207
- 'add_to_cart_nonce' => wp_create_nonce( 'wc-square-add-to-cart' ),
208
- 'recalculate_totals_nonce' => wp_create_nonce( 'wc-square-recalculate-totals' ),
209
- 'process_checkout_nonce' => wp_create_nonce( 'woocommerce-process_checkout' ),
210
- 'logging_enabled' => $this->gateway->debug_log(),
211
- 'hide_button_options' => $this->get_hidden_button_options(),
212
- )
213
- );
 
214
 
215
- wc_enqueue_js( sprintf( 'window.wc_square_digital_wallet_handler = new WC_Square_Digital_Wallet_Handler( %s );', wp_json_encode( $args ) ) );
 
 
 
 
216
  }
217
 
218
  /**
192
  wp_enqueue_style( 'wc-square-digital-wallet', $this->gateway->get_plugin()->get_plugin_url() . '/assets/css/frontend/wc-square-digital-wallet.min.css', array(), Plugin::VERSION );
193
  wp_enqueue_script( 'wc-square-digital-wallet', $this->gateway->get_plugin()->get_plugin_url() . '/assets/js/frontend/wc-square-digital-wallet.min.js', array( 'jquery' ), Plugin::VERSION, true );
194
 
195
+ try {
196
+ $args = apply_filters(
197
+ 'wc_square_digital_wallet_js_args',
198
+ array(
199
+ 'application_id' => $this->gateway->get_application_id(),
200
+ 'location_id' => wc_square()->get_settings_handler()->get_location_id(),
201
+ 'gateway_id' => $this->gateway->get_id(),
202
+ 'gateway_id_dasherized' => $this->gateway->get_id_dasherized(),
203
+ 'payment_request' => $this->get_payment_request_for_context( $page ),
204
+ 'context' => $page,
205
+ 'general_error' => __( 'An error occurred, please try again or try an alternate form of payment.', 'woocommerce-square' ),
206
+ 'ajax_url' => \WC_AJAX::get_endpoint( '%%endpoint%%' ),
207
+ 'payment_request_nonce' => wp_create_nonce( 'wc-square-get-payment-request' ),
208
+ 'add_to_cart_nonce' => wp_create_nonce( 'wc-square-add-to-cart' ),
209
+ 'recalculate_totals_nonce' => wp_create_nonce( 'wc-square-recalculate-totals' ),
210
+ 'process_checkout_nonce' => wp_create_nonce( 'woocommerce-process_checkout' ),
211
+ 'logging_enabled' => $this->gateway->debug_log(),
212
+ 'hide_button_options' => $this->get_hidden_button_options(),
213
+ )
214
+ );
215
 
216
+ wc_enqueue_js( sprintf( 'window.wc_square_digital_wallet_handler = new WC_Square_Digital_Wallet_Handler( %s );', wp_json_encode( $args ) ) );
217
+ } catch ( \Exception $e ) {
218
+ wp_dequeue_style( 'wc-square-digital-wallet' );
219
+ wp_dequeue_script( 'wc-square-digital-wallet' );
220
+ }
221
  }
222
 
223
  /**
includes/Plugin.php CHANGED
@@ -42,7 +42,7 @@ class Plugin extends Framework\SV_WC_Payment_Gateway_Plugin {
42
 
43
 
44
  /** plugin version number */
45
- const VERSION = '2.3.3';
46
 
47
  /** plugin ID */
48
  const PLUGIN_ID = 'square';
42
 
43
 
44
  /** plugin version number */
45
+ const VERSION = '2.3.4';
46
 
47
  /** plugin ID */
48
  const PLUGIN_ID = 'square';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: credit card, square, woocommerce, inventory sync
4
  Requires at least: 4.6
5
  Tested up to: 5.6
6
  Requires PHP: 5.6
7
- Stable tag: 2.3.3
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -72,6 +72,9 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
72
 
73
  == Changelog ==
74
 
 
 
 
75
  = 2.3.3 - 2021.02.09 =
76
  * Fix - Uncaught PHP error when attempting to setup Apple Pay and Square is not properly connected (i.e. no valid access token found). PR#587
77
  * Fix - Improve error logging when the request to verify the store's domain with Square/Apple Pay fails. PR#587
4
  Requires at least: 4.6
5
  Tested up to: 5.6
6
  Requires PHP: 5.6
7
+ Stable tag: 2.3.4
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
72
 
73
  == Changelog ==
74
 
75
+ = 2.3.4 - 2021.02.11 =
76
+ * Fix - Handle exceptions when loading digital wallet buttons on product pages with no stock or other serviceable issues. PR#591
77
+
78
  = 2.3.3 - 2021.02.09 =
79
  * Fix - Uncaught PHP error when attempting to setup Apple Pay and Square is not properly connected (i.e. no valid access token found). PR#587
80
  * Fix - Improve error logging when the request to verify the store's domain with Square/Apple Pay fails. PR#587
woocommerce-square.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
- * Version: 2.3.3
5
  * Plugin URI: https://woocommerce.com/products/square/
6
  * Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
7
  * Author: WooCommerce
@@ -19,7 +19,7 @@
19
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
20
  *
21
  * WC requires at least: 3.0
22
- * WC tested up to: 4.9
23
  */
24
 
25
  defined( 'ABSPATH' ) || exit;
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
+ * Version: 2.3.4
5
  * Plugin URI: https://woocommerce.com/products/square/
6
  * Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
7
  * Author: WooCommerce
19
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
20
  *
21
  * WC requires at least: 3.0
22
+ * WC tested up to: 5.0
23
  */
24
 
25
  defined( 'ABSPATH' ) || exit;