Version Description
- 2018-05-23 =
- Update - WC 3.4 compatibility
- Update - Privacy policy notification.
- Update - Export/erasure hooks added.
Download this release
Release Info
Developer | bor0 |
Plugin | WooCommerce PayPal Express Checkout Payment Gateway |
Version | 1.5.5 |
Comparing to | |
See all releases |
Code changes from version 1.5.4 to 1.5.5
changelog.txt
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
*** Changelog ***
|
2 |
|
|
|
|
|
|
|
|
|
|
|
3 |
= 1.5.4 - 2018-05-08 =
|
4 |
* Add - Hook to make billing address not required `woocommerce_paypal_express_checkout_address_not_required` (bool).
|
5 |
* Fix - Duplicate checkout settings when PP Credit option is enabled.
|
1 |
*** Changelog ***
|
2 |
|
3 |
+
= 1.5.5 - 2018-05-23 =
|
4 |
+
* Update - WC 3.4 compatibility
|
5 |
+
* Update - Privacy policy notification.
|
6 |
+
* Update - Export/erasure hooks added.
|
7 |
+
|
8 |
= 1.5.4 - 2018-05-08 =
|
9 |
* Add - Hook to make billing address not required `woocommerce_paypal_express_checkout_address_not_required` (bool).
|
10 |
* Fix - Duplicate checkout settings when PP Credit option is enabled.
|
includes/class-wc-gateway-ppec-plugin.php
CHANGED
@@ -328,6 +328,7 @@ class WC_Gateway_PPEC_Plugin {
|
|
328 |
$this->_load_client();
|
329 |
|
330 |
// Load handlers.
|
|
|
331 |
require_once( $this->includes_path . 'class-wc-gateway-ppec-settings.php' );
|
332 |
require_once( $this->includes_path . 'class-wc-gateway-ppec-gateway-loader.php' );
|
333 |
require_once( $this->includes_path . 'class-wc-gateway-ppec-admin-handler.php' );
|
328 |
$this->_load_client();
|
329 |
|
330 |
// Load handlers.
|
331 |
+
require_once( $this->includes_path . 'class-wc-gateway-ppec-privacy.php' );
|
332 |
require_once( $this->includes_path . 'class-wc-gateway-ppec-settings.php' );
|
333 |
require_once( $this->includes_path . 'class-wc-gateway-ppec-gateway-loader.php' );
|
334 |
require_once( $this->includes_path . 'class-wc-gateway-ppec-admin-handler.php' );
|
includes/class-wc-gateway-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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! class_exists( 'WC_Abstract_Privacy' ) ) {
|
3 |
+
return;
|
4 |
+
}
|
5 |
+
|
6 |
+
class WC_Gateway_PPEC_Privacy extends WC_Abstract_Privacy {
|
7 |
+
/**
|
8 |
+
* Constructor
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
public function __construct() {
|
12 |
+
parent::__construct( __( 'PayPal Express Checkout', 'woocommerce-gateway-paypal-express-checkout' ) );
|
13 |
+
|
14 |
+
$this->add_exporter( 'woocommerce-gateway-paypal-express-checkout-order-data', __( 'WooCommerce PPEC Order Data', 'woocommerce-gateway-paypal-express-checkout' ), array( $this, 'order_data_exporter' ) );
|
15 |
+
if ( class_exists( 'WC_Subscriptions' ) ) {
|
16 |
+
$this->add_exporter( 'woocommerce-gateway-paypal-express-checkout-subscriptions-data', __( 'WooCommerce PPEC Subscriptions Data', 'woocommerce-gateway-paypal-express-checkout' ), array( $this, 'subscriptions_data_exporter' ) );
|
17 |
+
}
|
18 |
+
|
19 |
+
$this->add_eraser( 'woocommerce-gateway-paypal-express-checkout-order-data', __( 'WooCommerce PPEC Data', 'woocommerce-gateway-paypal-express-checkout' ), array( $this, 'order_data_eraser' ) );
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Returns a list of orders that are using one of PPEC's payment methods.
|
24 |
+
*
|
25 |
+
* @param string $email_address
|
26 |
+
* @param int $page
|
27 |
+
*
|
28 |
+
* @return array WP_Post
|
29 |
+
*/
|
30 |
+
protected function get_ppec_orders( $email_address, $page ) {
|
31 |
+
$user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
|
32 |
+
|
33 |
+
$order_query = array(
|
34 |
+
'payment_method' => array( 'ppec_paypal' ),
|
35 |
+
'limit' => 10,
|
36 |
+
'page' => $page,
|
37 |
+
);
|
38 |
+
|
39 |
+
if ( $user instanceof WP_User ) {
|
40 |
+
$order_query['customer_id'] = (int) $user->ID;
|
41 |
+
} else {
|
42 |
+
$order_query['billing_email'] = $email_address;
|
43 |
+
}
|
44 |
+
|
45 |
+
return wc_get_orders( $order_query );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Gets the message of the privacy to display.
|
50 |
+
*
|
51 |
+
*/
|
52 |
+
public function get_privacy_message() {
|
53 |
+
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-gateway-paypal-express-checkout' ), 'https://docs.woocommerce.com/document/privacy-payments/#woocommerce-gateway-paypal-express-checkout' ) );
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Handle exporting data for Orders.
|
58 |
+
*
|
59 |
+
* @param string $email_address E-mail address to export.
|
60 |
+
* @param int $page Pagination of data.
|
61 |
+
*
|
62 |
+
* @return array
|
63 |
+
*/
|
64 |
+
public function order_data_exporter( $email_address, $page = 1 ) {
|
65 |
+
$done = false;
|
66 |
+
$data_to_export = array();
|
67 |
+
|
68 |
+
$orders = $this->get_ppec_orders( $email_address, (int) $page );
|
69 |
+
|
70 |
+
$done = true;
|
71 |
+
|
72 |
+
if ( 0 < count( $orders ) ) {
|
73 |
+
foreach ( $orders as $order ) {
|
74 |
+
$data_to_export[] = array(
|
75 |
+
'group_id' => 'woocommerce_orders',
|
76 |
+
'group_label' => __( 'Orders', 'woocommerce-gateway-paypal-express-checkout' ),
|
77 |
+
'item_id' => 'order-' . $order->get_id(),
|
78 |
+
'data' => array(
|
79 |
+
array(
|
80 |
+
'name' => __( 'PPEC Refundable transaction data', 'woocommerce-gateway-paypal-express-checkout' ),
|
81 |
+
'value' => json_encode( get_post_meta( $order->get_id(), '_woo_pp_txnData', true ) ),
|
82 |
+
),
|
83 |
+
array(
|
84 |
+
'name' => __( 'PPEC Billing agreement id', 'woocommerce-gateway-paypal-express-checkout' ),
|
85 |
+
'value' => get_post_meta( $order->get_id(), '_ppec_billing_agreement_id', true ),
|
86 |
+
),
|
87 |
+
),
|
88 |
+
);
|
89 |
+
}
|
90 |
+
|
91 |
+
$done = 10 > count( $orders );
|
92 |
+
}
|
93 |
+
|
94 |
+
return array(
|
95 |
+
'data' => $data_to_export,
|
96 |
+
'done' => $done,
|
97 |
+
);
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Handle exporting data for Subscriptions.
|
102 |
+
*
|
103 |
+
* @param string $email_address E-mail address to export.
|
104 |
+
* @param int $page Pagination of data.
|
105 |
+
*
|
106 |
+
* @return array
|
107 |
+
*/
|
108 |
+
public function subscriptions_data_exporter( $email_address, $page = 1 ) {
|
109 |
+
$done = false;
|
110 |
+
$page = (int) $page;
|
111 |
+
$data_to_export = array();
|
112 |
+
|
113 |
+
$meta_query = array(
|
114 |
+
'relation' => 'AND',
|
115 |
+
array(
|
116 |
+
'key' => '_payment_method',
|
117 |
+
'value' => array( 'ppec_paypal' ),
|
118 |
+
'compare' => 'IN',
|
119 |
+
),
|
120 |
+
array(
|
121 |
+
'key' => '_billing_email',
|
122 |
+
'value' => $email_address,
|
123 |
+
'compare' => '=',
|
124 |
+
),
|
125 |
+
);
|
126 |
+
|
127 |
+
$subscription_query = array(
|
128 |
+
'posts_per_page' => 10,
|
129 |
+
'page' => $page,
|
130 |
+
'meta_query' => $meta_query,
|
131 |
+
);
|
132 |
+
|
133 |
+
$subscriptions = wcs_get_subscriptions( $subscription_query );
|
134 |
+
|
135 |
+
$done = true;
|
136 |
+
|
137 |
+
if ( 0 < count( $subscriptions ) ) {
|
138 |
+
foreach ( $subscriptions as $subscription ) {
|
139 |
+
$data_to_export[] = array(
|
140 |
+
'group_id' => 'woocommerce_subscriptions',
|
141 |
+
'group_label' => __( 'Subscriptions', 'woocommerce-gateway-paypal-express-checkout' ),
|
142 |
+
'item_id' => 'subscription-' . $subscription->get_id(),
|
143 |
+
'data' => array(
|
144 |
+
array(
|
145 |
+
'name' => __( 'PPEC Refundable transaction data', 'woocommerce-gateway-paypal-express-checkout' ),
|
146 |
+
'value' => json_encode( get_post_meta( $order->get_id(), '_woo_pp_txnData', true ) ),
|
147 |
+
),
|
148 |
+
array(
|
149 |
+
'name' => __( 'PPEC Billing agreement id', 'woocommerce-gateway-paypal-express-checkout' ),
|
150 |
+
'value' => get_post_meta( $order->get_id(), '_ppec_billing_agreement_id', true ),
|
151 |
+
),
|
152 |
+
),
|
153 |
+
);
|
154 |
+
}
|
155 |
+
|
156 |
+
$done = 10 > count( $subscriptions );
|
157 |
+
}
|
158 |
+
|
159 |
+
return array(
|
160 |
+
'data' => $data_to_export,
|
161 |
+
'done' => $done,
|
162 |
+
);
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Finds and erases order data by email address.
|
167 |
+
*
|
168 |
+
* @since 3.4.0
|
169 |
+
* @param string $email_address The user email address.
|
170 |
+
* @param int $page Page.
|
171 |
+
* @return array An array of personal data in name value pairs
|
172 |
+
*/
|
173 |
+
public function order_data_eraser( $email_address, $page ) {
|
174 |
+
$orders = $this->get_ppec_orders( $email_address, (int) $page );
|
175 |
+
|
176 |
+
$items_removed = false;
|
177 |
+
$items_retained = false;
|
178 |
+
$messages = array();
|
179 |
+
|
180 |
+
foreach ( (array) $orders as $order ) {
|
181 |
+
$order = wc_get_order( $order->get_id() );
|
182 |
+
|
183 |
+
list( $removed, $retained, $msgs ) = $this->maybe_handle_order( $order );
|
184 |
+
$items_removed |= $removed;
|
185 |
+
$items_retained |= $retained;
|
186 |
+
$messages = array_merge( $messages, $msgs );
|
187 |
+
|
188 |
+
list( $removed, $retained, $msgs ) = $this->maybe_handle_subscription( $order );
|
189 |
+
$items_removed |= $removed;
|
190 |
+
$items_retained |= $retained;
|
191 |
+
$messages = array_merge( $messages, $msgs );
|
192 |
+
}
|
193 |
+
|
194 |
+
// Tell core if we have more orders to work on still
|
195 |
+
$done = count( $orders ) < 10;
|
196 |
+
|
197 |
+
return array(
|
198 |
+
'items_removed' => $items_removed,
|
199 |
+
'items_retained' => $items_retained,
|
200 |
+
'messages' => $messages,
|
201 |
+
'done' => $done,
|
202 |
+
);
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Handle eraser of data tied to Subscriptions
|
207 |
+
*
|
208 |
+
* @param WC_Order $order
|
209 |
+
* @return array
|
210 |
+
*/
|
211 |
+
protected function maybe_handle_subscription( $order ) {
|
212 |
+
if ( ! class_exists( 'WC_Subscriptions' ) ) {
|
213 |
+
return array( false, false, array() );
|
214 |
+
}
|
215 |
+
|
216 |
+
if ( ! wcs_order_contains_subscription( $order ) ) {
|
217 |
+
return array( false, false, array() );
|
218 |
+
}
|
219 |
+
|
220 |
+
$subscription = current( wcs_get_subscriptions_for_order( $order->get_id() ) );
|
221 |
+
$subscription_id = $subscription->get_id();
|
222 |
+
|
223 |
+
$ppec_billing = get_post_meta( $subscription_id, '_ppec_billing_agreement_id', true );
|
224 |
+
|
225 |
+
if ( empty( $ppec_billing ) ) {
|
226 |
+
return array( false, false, array() );
|
227 |
+
}
|
228 |
+
|
229 |
+
if ( $subscription->has_status( apply_filters( 'woocommerce_paypal_express_checkout_privacy_eraser_subs_statuses', array( 'on-hold', 'active' ) ) ) ) {
|
230 |
+
return array( false, true, array( sprintf( __( 'Order ID %d contains an active Subscription' ), $order->get_id() ) ) );
|
231 |
+
}
|
232 |
+
|
233 |
+
$renewal_orders = WC_Subscriptions_Renewal_Order::get_renewal_orders( $order->get_id() );
|
234 |
+
|
235 |
+
foreach ( $renewal_orders as $renewal_order_id ) {
|
236 |
+
delete_post_meta( $renewal_order_id, '_woo_pp_txnData' );
|
237 |
+
delete_post_meta( $renewal_order_id, '_ppec_billing_agreement_id' );
|
238 |
+
delete_post_meta( $renewal_order_id, '_paypal_status' );
|
239 |
+
}
|
240 |
+
|
241 |
+
delete_post_meta( $subscription_id, '_woo_pp_txnData' );
|
242 |
+
delete_post_meta( $subscription_id, '_ppec_billing_agreement_id' );
|
243 |
+
delete_post_meta( $subscription_id, '_paypal_status' );
|
244 |
+
|
245 |
+
return array( true, false, array( __( 'PayPal Express Checkout Subscriptions Data Erased.', 'woocommerce-gateway-paypal-express-checkout' ) ) );
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Handle eraser of data tied to Orders
|
250 |
+
*
|
251 |
+
* @param WC_Order $order
|
252 |
+
* @return array
|
253 |
+
*/
|
254 |
+
protected function maybe_handle_order( $order ) {
|
255 |
+
$order_id = $order->get_id();
|
256 |
+
$ppec_txn_data = get_post_meta( $order_id, '_woo_pp_txnData', true );
|
257 |
+
$ppec_billing = get_post_meta( $order_id, '_ppec_billing_agreement_id', true );
|
258 |
+
$ppec_status = get_post_meta( $order_id, '_paypal_status', true );
|
259 |
+
|
260 |
+
if ( empty( $ppec_txn_data ) && empty( $ppec_billing ) && empty( $ppec_status ) ) {
|
261 |
+
return array( false, false, array() );
|
262 |
+
}
|
263 |
+
|
264 |
+
delete_post_meta( $order_id, '_woo_pp_txnData' );
|
265 |
+
delete_post_meta( $order_id, '_ppec_billing_agreement_id' );
|
266 |
+
delete_post_meta( $order_id, '_paypal_status' );
|
267 |
+
|
268 |
+
return array( true, false, array( __( 'PayPal Express Checkout Order Data Erased.', 'woocommerce-gateway-paypal-express-checkout' ) ) );
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
new WC_Gateway_PPEC_Privacy();
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: automattic, woothemes, akeda, dwainm, royho, allendav, slash1andy,
|
|
3 |
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.9.0
|
6 |
-
Stable tag: 1.5.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -93,6 +93,11 @@ Please use this to inform us about bugs, or make contributions via PRs.
|
|
93 |
|
94 |
== Changelog ==
|
95 |
|
|
|
|
|
|
|
|
|
|
|
96 |
= 1.5.4 - 2018-05-08 =
|
97 |
* Add - Hook to make billing address not required `woocommerce_paypal_express_checkout_address_not_required` (bool).
|
98 |
* Fix - Duplicate checkout settings when PP Credit option is enabled.
|
3 |
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.9.0
|
6 |
+
Stable tag: 1.5.5
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
93 |
|
94 |
== Changelog ==
|
95 |
|
96 |
+
= 1.5.5 - 2018-05-23 =
|
97 |
+
* Update - WC 3.4 compatibility
|
98 |
+
* Update - Privacy policy notification.
|
99 |
+
* Update - Export/erasure hooks added.
|
100 |
+
|
101 |
= 1.5.4 - 2018-05-08 =
|
102 |
* Add - Hook to make billing address not required `woocommerce_paypal_express_checkout_address_not_required` (bool).
|
103 |
* Fix - Duplicate checkout settings when PP Credit option is enabled.
|
woocommerce-gateway-paypal-express-checkout.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WooCommerce PayPal Express Checkout Gateway
|
4 |
* Plugin URI: https://woocommerce.com/products/woocommerce-gateway-paypal-express-checkout/
|
5 |
* Description: A payment gateway for PayPal Express Checkout (https://www.paypal.com/us/webapps/mpp/express-checkout).
|
6 |
-
* Version: 1.5.
|
7 |
* Author: WooCommerce
|
8 |
* Author URI: https://woocommerce.com
|
9 |
* Copyright: © 2018 WooCommerce / PayPal.
|
@@ -11,7 +11,7 @@
|
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
12 |
* Text Domain: woocommerce-gateway-paypal-express-checkout
|
13 |
* Domain Path: /languages
|
14 |
-
* WC tested up to: 3.
|
15 |
* WC requires at least: 2.6
|
16 |
*/
|
17 |
/**
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
exit; // Exit if accessed directly
|
28 |
}
|
29 |
|
30 |
-
define( 'WC_GATEWAY_PPEC_VERSION', '1.5.
|
31 |
|
32 |
/**
|
33 |
* Return instance of WC_Gateway_PPEC_Plugin.
|
3 |
* Plugin Name: WooCommerce PayPal Express Checkout Gateway
|
4 |
* Plugin URI: https://woocommerce.com/products/woocommerce-gateway-paypal-express-checkout/
|
5 |
* Description: A payment gateway for PayPal Express Checkout (https://www.paypal.com/us/webapps/mpp/express-checkout).
|
6 |
+
* Version: 1.5.5
|
7 |
* Author: WooCommerce
|
8 |
* Author URI: https://woocommerce.com
|
9 |
* Copyright: © 2018 WooCommerce / PayPal.
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
12 |
* Text Domain: woocommerce-gateway-paypal-express-checkout
|
13 |
* Domain Path: /languages
|
14 |
+
* WC tested up to: 3.4
|
15 |
* WC requires at least: 2.6
|
16 |
*/
|
17 |
/**
|
27 |
exit; // Exit if accessed directly
|
28 |
}
|
29 |
|
30 |
+
define( 'WC_GATEWAY_PPEC_VERSION', '1.5.5' );
|
31 |
|
32 |
/**
|
33 |
* Return instance of WC_Gateway_PPEC_Plugin.
|