WooCommerce Square - Version 1.0.30

Version Description

  • 2018-05-23 =
  • Update - WC tested up to version 3.4
  • Update - Privacy policy notification.
  • Update - Export/erasure hooks added.

=

Download this release

Release Info

Developer royho
Plugin Icon 128x128 WooCommerce Square
Version 1.0.30
Comparing to
See all releases

Code changes from version 1.0.29 to 1.0.30

changelog.txt CHANGED
@@ -1,9 +1,15 @@
1
*** WooCommerce Square Changelog ***
2
3
= 1.0.29 - 2018-04-17 =
4
- * Fix - If more than 1000 items, next batch is ignored.
5
- * Fix - Wrong setting used when syncing product.
6
- * Fix - Japan locale does not support Diners/Discover, so do not show these brands on checkout.
7
8
2018-04-04 - version 1.0.28
9
* Fix - Double inventory sync for newly created products.
1
*** WooCommerce Square Changelog ***
2
3
+ = 1.0.30 - 2018-05-23 =
4
+ * Update - WC tested up to version 3.4
5
+ * Update - Privacy policy notification.
6
+ * Update - Export/erasure hooks added.
7
+
8
= 1.0.29 - 2018-04-17 =
9
+ * Fix - If more than 1000 items, next batch is ignored.
10
+ * Fix - Wrong setting used when syncing product.
11
+ * Fix - Japan locale does not support Diners/Discover, so do not show these brands on checkout.
12
+ * Update - WC tested up to version 3.4
13
14
2018-04-04 - version 1.0.28
15
* Fix - Double inventory sync for newly created products.
includes/admin/class-wc-square-privacy.php ADDED
@@ -0,0 +1,110 @@
1
+ <?php
2
+ if ( ! class_exists( 'WC_Abstract_Privacy' ) ) {
3
+ return;
4
+ }
5
+
6
+ class WC_Square_Privacy extends WC_Abstract_Privacy {
7
+ /**
8
+ * Constructor
9
+ *
10
+ */
11
+ public function __construct() {
12
+ parent::__construct( __( 'Square', 'woocommerce-square' ) );
13
+
14
+ $this->add_exporter( 'woocommerce-square-customer-data', __( 'WooCommerce Square Customer Data', 'woocommerce-square' ), array( $this, 'customer_data_exporter' ) );
15
+ $this->add_eraser( 'woocommerce-square-customer-data', __( 'WooCommerce Square Customer Data', 'woocommerce-square' ), array( $this, 'customer_data_eraser' ) );
16
+ }
17
+
18
+ /**
19
+ * Gets the message of the privacy to display.
20
+ *
21
+ */
22
+ public function get_message() {
23
+ return wpautop( sprintf( __( 'By using this extension, you may be storing personal data or sharing data with an external service. <a href="%s" target="_blank">Learn more about how this works, including what you may want to include in your privacy policy.</a>', 'woocommerce-square' ), 'https://docs.woocommerce.com/document/privacy-payments/#woocommerce-square' ) );
24
+ }
25
+
26
+ /**
27
+ * Handle exporting data for Orders.
28
+ *
29
+ * @param string $email_address E-mail address to export.
30
+ * @param int $page Pagination of data.
31
+ *
32
+ * @return array
33
+ */
34
+ public function order_data_exporter( $email_address, $page = 1 ) {
35
+ $done = false;
36
+ $data_to_export = array();
37
+
38
+ $done = true;
39
+
40
+ return array(
41
+ 'data' => $data_to_export,
42
+ 'done' => $done,
43
+ );
44
+ }
45
+
46
+ /**
47
+ * Finds and exports customer data by email address.
48
+ *
49
+ * @since 3.4.0
50
+ * @param string $email_address The user email address.
51
+ * @param int $page Page.
52
+ * @return array An array of personal data in name value pairs
53
+ */
54
+ public function customer_data_exporter( $email_address, $page ) {
55
+ $user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
56
+ $data_to_export = array();
57
+
58
+ if ( $user instanceof WP_User ) {
59
+ $data_to_export[] = array(
60
+ 'group_id' => 'woocommerce_customer',
61
+ 'group_label' => __( 'Customer Data', 'woocommerce-square' ),
62
+ 'item_id' => 'user',
63
+ 'data' => array(
64
+ array(
65
+ 'name' => __( 'Square customer id', 'woocommerce-square' ),
66
+ 'value' => get_user_meta( $user->ID, '_square_customer_id', true ),
67
+ ),
68
+ ),
69
+ );
70
+ }
71
+
72
+ return array(
73
+ 'data' => $data_to_export,
74
+ 'done' => true,
75
+ );
76
+ }
77
+
78
+ /**
79
+ * Finds and erases customer data by email address.
80
+ *
81
+ * @since 3.4.0
82
+ * @param string $email_address The user email address.
83
+ * @param int $page Page.
84
+ * @return array An array of personal data in name value pairs
85
+ */
86
+ public function customer_data_eraser( $email_address, $page ) {
87
+ $page = (int) $page;
88
+ $user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
89
+
90
+ $square_customer_id = get_user_meta( $user->ID, '_square_customer_id', true );
91
+
92
+ $items_removed = false;
93
+ $messages = array();
94
+
95
+ if ( ! empty( $square_customer_id ) ) {
96
+ $items_removed = true;
97
+ delete_user_meta( $user->ID, '_square_customer_id' );
98
+ $messages[] = __( 'Square User Data Erased.', 'woocommerce-square' );
99
+ }
100
+
101
+ return array(
102
+ 'items_removed' => $items_removed,
103
+ 'items_retained' => false,
104
+ 'messages' => $messages,
105
+ 'done' => true,
106
+ );
107
+ }
108
+ }
109
+
110
+ new WC_Square_Privacy();
includes/payment/class-wc-square-payments.php CHANGED
@@ -68,7 +68,12 @@ class WC_Square_Payments {
68
return $actions;
69
}
70
71
- $order = wc_get_order( $_REQUEST['post'] );
72
73
// bail if the order wasn't paid for with this gateway
74
if ( 'square' !== ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $order->payment_method : $order->get_payment_method() ) ) {
68
return $actions;
69
}
70
71
+ $order = wc_get_order( absint( $_REQUEST['post'] ) );
72
+
73
+ // Bail if order is not found.
74
+ if ( empty( $order ) ) {
75
+ return $actions;
76
+ }
77
78
// bail if the order wasn't paid for with this gateway
79
if ( 'square' !== ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $order->payment_method : $order->get_payment_method() ) ) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: credit card, square, woocommerce, inventory sync
4
Requires at least: 4.4
5
Tested up to: 4.9
6
Requires PHP: 5.6
7
- Stable tag: 1.0.29
8
License: GPLv3
9
License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
@@ -57,10 +57,10 @@ If you get stuck, you can ask for help in the Plugin Forum.
57
58
== Changelog ==
59
60
- = 1.0.29 - 2018-04-17 =
61
- * Fix - If more than 1000 items, next batch is ignored.
62
- * Fix - Wrong setting used when syncing product.
63
- * Fix - Japan locale does not support Diners/Discover, so do not show these brands on checkout.
64
65
== Upgrade Notice ==
66
4
Requires at least: 4.4
5
Tested up to: 4.9
6
Requires PHP: 5.6
7
+ Stable tag: 1.0.30
8
License: GPLv3
9
License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
57
58
== Changelog ==
59
60
+ = 1.0.30 - 2018-05-23 =
61
+ * Update - WC tested up to version 3.4
62
+ * Update - Privacy policy notification.
63
+ * Update - Export/erasure hooks added.
64
65
== Upgrade Notice ==
66
woocommerce-square.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/**
3
* Plugin Name: WooCommerce Square
4
- * Version: 1.0.29
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
@@ -9,7 +9,7 @@
9
* Requires at least: 4.5.0
10
* Tested up to: 4.9
11
* WC requires at least: 2.6
12
- * WC tested up to: 3.3
13
* Text Domain: woocommerce-square
14
* Domain Path: /languages
15
*
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
23
24
if ( ! class_exists( 'Woocommerce_Square' ) ) :
25
26
- define( 'WC_SQUARE_VERSION', '1.0.29' );
27
28
/**
29
* Main class.
@@ -230,6 +230,7 @@ if ( ! class_exists( 'Woocommerce_Square' ) ) :
230
* @return bool
231
*/
232
public function includes() {
233
require_once( dirname( __FILE__ ) . '/includes/class-wc-square-install.php' );
234
require_once( dirname( __FILE__ ) . '/includes/class-wc-square-deactivation.php' );
235
require_once( dirname( __FILE__ ) . '/includes/class-wc-square-sync-logger.php' );
1
<?php
2
/**
3
* Plugin Name: WooCommerce Square
4
+ * Version: 1.0.30
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
9
* Requires at least: 4.5.0
10
* Tested up to: 4.9
11
* WC requires at least: 2.6
12
+ * WC tested up to: 3.4
13
* Text Domain: woocommerce-square
14
* Domain Path: /languages
15
*
23
24
if ( ! class_exists( 'Woocommerce_Square' ) ) :
25
26
+ define( 'WC_SQUARE_VERSION', '1.0.30' );
27
28
/**
29
* Main class.
230
* @return bool
231
*/
232
public function includes() {
233
+ require_once( dirname( __FILE__ ) . '/includes/admin/class-wc-square-privacy.php' );
234
require_once( dirname( __FILE__ ) . '/includes/class-wc-square-install.php' );
235
require_once( dirname( __FILE__ ) . '/includes/class-wc-square-deactivation.php' );
236
require_once( dirname( __FILE__ ) . '/includes/class-wc-square-sync-logger.php' );