Version Description
- 2020-09-07 =
- Fix - Only redirect to the onboarding screen if the plugin has been individually activated using the plugins page.
Download this release
Release Info
Developer | automattic |
Plugin | WooCommerce Payments – Fully Integrated Solution Built and Supported by Woo |
Version | 1.4.1 |
Comparing to | |
See all releases |
Code changes from version 1.4.0 to 1.4.1
- changelog.txt +3 -0
- dist/index.asset.php +1 -1
- includes/class-wc-payment-gateway-wcpay.php +1 -1
- includes/class-wc-payments-account.php +2 -34
- includes/compat/subscriptions/class-wc-payment-gateway-wcpay-subscriptions-compat.php +2 -2
- includes/data-types/class-payment-information.php +4 -3
- readme.txt +4 -1
- vendor/autoload.php +1 -1
- vendor/autoload_packages.php +2 -2
- vendor/composer/ClassLoader.php +1 -1
- vendor/composer/autoload_real.php +10 -7
- vendor/composer/autoload_static.php +4 -4
- woocommerce-payments.php +22 -1
changelog.txt
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
*** WooCommerce Payments Changelog ***
|
2 |
|
|
|
|
|
|
|
3 |
= 1.4.0 - 2020-09-02 =
|
4 |
* Add - Initial support for WooCommerce Subscriptions: Signing up for subscriptions, scheduled payments, and customer-initiated payment method changes.
|
5 |
* Add - Added a link to transaction details from order screens.
|
1 |
*** WooCommerce Payments Changelog ***
|
2 |
|
3 |
+
= 1.4.1 - 2020-09-07 =
|
4 |
+
* Fix - Only redirect to the onboarding screen if the plugin has been individually activated using the plugins page.
|
5 |
+
|
6 |
= 1.4.0 - 2020-09-02 =
|
7 |
* Add - Initial support for WooCommerce Subscriptions: Signing up for subscriptions, scheduled payments, and customer-initiated payment method changes.
|
8 |
* Add - Added a link to transaction details from order screens.
|
dist/index.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'wc-components', 'wc-currency', 'wc-navigation', 'wp-api-fetch', 'wp-compose', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-url'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'wc-components', 'wc-currency', 'wc-navigation', 'wp-api-fetch', 'wp-compose', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-url'), 'version' => 'fa8cce974e9d94c794b6e17310adcb5e');
|
includes/class-wc-payment-gateway-wcpay.php
CHANGED
@@ -642,7 +642,7 @@ class WC_Payment_Gateway_WCPay extends WC_Payment_Gateway_CC {
|
|
642 |
* @param WC_Order $order The order.
|
643 |
* @param WC_Payment_Token $token The token to save.
|
644 |
*/
|
645 |
-
|
646 |
$order_tokens = $order->get_payment_tokens();
|
647 |
|
648 |
// This could lead to tokens being saved twice in an order's payment tokens, but it is needed so that shoppers
|
642 |
* @param WC_Order $order The order.
|
643 |
* @param WC_Payment_Token $token The token to save.
|
644 |
*/
|
645 |
+
public function add_token_to_order( $order, $token ) {
|
646 |
$order_tokens = $order->get_payment_tokens();
|
647 |
|
648 |
// This could lead to tokens being saved twice in an order's payment tokens, but it is needed so that shoppers
|
includes/class-wc-payments-account.php
CHANGED
@@ -210,39 +210,7 @@ class WC_Payments_Account {
|
|
210 |
return true;
|
211 |
}
|
212 |
|
213 |
-
|
214 |
-
if ( get_option( 'wcpay_redirected_to_onboarding', false ) ) {
|
215 |
-
return false;
|
216 |
-
}
|
217 |
-
|
218 |
-
// If onboarding new accounts is disabled, so it's pointless to redirect users to the splash page.
|
219 |
-
if ( self::is_on_boarding_disabled() ) {
|
220 |
-
return false;
|
221 |
-
}
|
222 |
-
|
223 |
-
// Don't hijack WP-Admin if the user is bulk-activating plugins.
|
224 |
-
if ( isset( $_GET['activate-multi'] ) ) {
|
225 |
-
return false;
|
226 |
-
}
|
227 |
-
|
228 |
-
// Don't redirect if the user is in the WC setup wizard.
|
229 |
-
$current_page = isset( $_GET['page'] ) ? wp_unslash( $_GET['page'] ) : null; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
230 |
-
if ( 'wc-setup' === $current_page ) {
|
231 |
-
return false;
|
232 |
-
}
|
233 |
-
|
234 |
-
// Don't redirect if the user is on the WC-Admin setup profiler or WC-Admin dashboard with the task list.
|
235 |
-
if ( 'wc-admin' === $current_page && empty( $_GET['path'] )
|
236 |
-
&& ( Onboarding::should_show_profiler() || Onboarding::should_show_tasks() ) ) {
|
237 |
-
return false;
|
238 |
-
}
|
239 |
-
|
240 |
-
// Don't redirect if the user is on Jetpack pages.
|
241 |
-
if ( 'jetpack' === $current_page ) {
|
242 |
-
return false;
|
243 |
-
}
|
244 |
-
|
245 |
-
return true;
|
246 |
}
|
247 |
|
248 |
/**
|
@@ -264,7 +232,7 @@ class WC_Payments_Account {
|
|
264 |
|
265 |
if ( empty( $account ) ) {
|
266 |
if ( $this->should_redirect_to_onboarding() ) {
|
267 |
-
update_option( '
|
268 |
$this->redirect_to_onboarding_page();
|
269 |
}
|
270 |
return false;
|
210 |
return true;
|
211 |
}
|
212 |
|
213 |
+
return get_option( 'wcpay_should_redirect_to_onboarding', false );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
}
|
215 |
|
216 |
/**
|
232 |
|
233 |
if ( empty( $account ) ) {
|
234 |
if ( $this->should_redirect_to_onboarding() ) {
|
235 |
+
update_option( 'wcpay_should_redirect_to_onboarding', false );
|
236 |
$this->redirect_to_onboarding_page();
|
237 |
}
|
238 |
return false;
|
includes/compat/subscriptions/class-wc-payment-gateway-wcpay-subscriptions-compat.php
CHANGED
@@ -118,7 +118,7 @@ class WC_Payment_Gateway_WCPay_Subscriptions_Compat extends WC_Payment_Gateway_W
|
|
118 |
Logger::error( 'Failing subscription could not be updated: there is no saved payment token for order #' . $renewal_order->get_id() );
|
119 |
return;
|
120 |
}
|
121 |
-
$
|
122 |
}
|
123 |
|
124 |
/**
|
@@ -127,7 +127,7 @@ class WC_Payment_Gateway_WCPay_Subscriptions_Compat extends WC_Payment_Gateway_W
|
|
127 |
* @param WC_Order $order The order.
|
128 |
* @param WC_Payment_Token $token The token to save.
|
129 |
*/
|
130 |
-
|
131 |
parent::add_token_to_order( $order, $token );
|
132 |
|
133 |
// Set payment token for subscriptions, so it can be used for renewals.
|
118 |
Logger::error( 'Failing subscription could not be updated: there is no saved payment token for order #' . $renewal_order->get_id() );
|
119 |
return;
|
120 |
}
|
121 |
+
$this->add_token_to_order( $subscription, $renewal_token );
|
122 |
}
|
123 |
|
124 |
/**
|
127 |
* @param WC_Order $order The order.
|
128 |
* @param WC_Payment_Token $token The token to save.
|
129 |
*/
|
130 |
+
public function add_token_to_order( $order, $token ) {
|
131 |
parent::add_token_to_order( $order, $token );
|
132 |
|
133 |
// Set payment token for subscriptions, so it can be used for renewals.
|
includes/data-types/class-payment-information.php
CHANGED
@@ -156,15 +156,16 @@ class Payment_Information {
|
|
156 |
* @return \WC_Payment_Token|NULL
|
157 |
*/
|
158 |
public static function get_token_from_request( array $request ) {
|
|
|
159 |
if (
|
160 |
-
! isset( $request[
|
161 |
-
'new' === $request[
|
162 |
) {
|
163 |
return null;
|
164 |
}
|
165 |
|
166 |
//phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
|
167 |
-
$token = \WC_Payment_Tokens::get( wc_clean( $request[
|
168 |
|
169 |
// If the token doesn't belong to this gateway or the current user it's invalid.
|
170 |
if ( ! $token || \WC_Payment_Gateway_WCPay::GATEWAY_ID !== $token->get_gateway_id() || $token->get_user_id() !== get_current_user_id() ) {
|
156 |
* @return \WC_Payment_Token|NULL
|
157 |
*/
|
158 |
public static function get_token_from_request( array $request ) {
|
159 |
+
$token_request_key = 'wc-' . \WC_Payment_Gateway_WCPay::GATEWAY_ID . '-payment-token';
|
160 |
if (
|
161 |
+
! isset( $request[ $token_request_key ] ) ||
|
162 |
+
'new' === $request[ $token_request_key ]
|
163 |
) {
|
164 |
return null;
|
165 |
}
|
166 |
|
167 |
//phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
|
168 |
+
$token = \WC_Payment_Tokens::get( wc_clean( $request[ $token_request_key ] ) );
|
169 |
|
170 |
// If the token doesn't belong to this gateway or the current user it's invalid.
|
171 |
if ( ! $token || \WC_Payment_Gateway_WCPay::GATEWAY_ID !== $token->get_gateway_id() || $token->get_user_id() !== get_current_user_id() ) {
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: woocommerce, payment, payment request, credit card, automattic
|
|
4 |
Requires at least: 5.3
|
5 |
Tested up to: 5.4
|
6 |
Requires PHP: 7.0
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -90,6 +90,9 @@ You can read our Terms of Service [here](https://en.wordpress.com/tos).
|
|
90 |
|
91 |
== Changelog ==
|
92 |
|
|
|
|
|
|
|
93 |
= 1.4.0 - 2020-09-02 =
|
94 |
* Add - Initial support for WooCommerce Subscriptions: Signing up for subscriptions, scheduled payments, and customer-initiated payment method changes.
|
95 |
* Add - Added a link to transaction details from order screens.
|
4 |
Requires at least: 5.3
|
5 |
Tested up to: 5.4
|
6 |
Requires PHP: 7.0
|
7 |
+
Stable tag: 1.4.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
90 |
|
91 |
== Changelog ==
|
92 |
|
93 |
+
= 1.4.1 - 2020-09-07 =
|
94 |
+
* Fix - Only redirect to the onboarding screen if the plugin has been individually activated using the plugins page.
|
95 |
+
|
96 |
= 1.4.0 - 2020-09-02 =
|
97 |
* Add - Initial support for WooCommerce Subscriptions: Signing up for subscriptions, scheduled payments, and customer-initiated payment method changes.
|
98 |
* Add - Added a link to transaction details from order screens.
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInitbad42693a2a67eb4387853dae504a1bd::getLoader();
|
vendor/autoload_packages.php
CHANGED
@@ -179,7 +179,7 @@ if ( ! function_exists( __NAMESPACE__ . '\autoloader' ) ) {
|
|
179 |
/**
|
180 |
* Prepare all the classes for autoloading.
|
181 |
*/
|
182 |
-
function
|
183 |
$class_map = require_once dirname( __FILE__ ) . '/composer/autoload_classmap_package.php';
|
184 |
foreach ( $class_map as $class_name => $class_info ) {
|
185 |
enqueue_package_class( $class_name, $class_info['version'], $class_info['path'] );
|
@@ -203,4 +203,4 @@ function enqueue_packages_1c17c81d6bb0e789d15762cdc7617239() {
|
|
203 |
file_loader(); // Either WordPress is not loaded or plugin is doing it wrong. Either way we'll load the files so nothing breaks.
|
204 |
}
|
205 |
}
|
206 |
-
|
179 |
/**
|
180 |
* Prepare all the classes for autoloading.
|
181 |
*/
|
182 |
+
function enqueue_packages_a593e0db9aea4a1692f2a4e8f74be60d() {
|
183 |
$class_map = require_once dirname( __FILE__ ) . '/composer/autoload_classmap_package.php';
|
184 |
foreach ( $class_map as $class_name => $class_info ) {
|
185 |
enqueue_package_class( $class_name, $class_info['version'], $class_info['path'] );
|
203 |
file_loader(); // Either WordPress is not loaded or plugin is doing it wrong. Either way we'll load the files so nothing breaks.
|
204 |
}
|
205 |
}
|
206 |
+
enqueue_packages_a593e0db9aea4a1692f2a4e8f74be60d();
|
vendor/composer/ClassLoader.php
CHANGED
@@ -279,7 +279,7 @@ class ClassLoader
|
|
279 |
*/
|
280 |
public function setApcuPrefix($apcuPrefix)
|
281 |
{
|
282 |
-
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
|
283 |
}
|
284 |
|
285 |
/**
|
279 |
*/
|
280 |
public function setApcuPrefix($apcuPrefix)
|
281 |
{
|
282 |
+
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
283 |
}
|
284 |
|
285 |
/**
|
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 |
|
@@ -13,21 +13,24 @@ class ComposerAutoloaderInit0a651f92f6dec0685e6f92fb5fc9b1f9
|
|
13 |
}
|
14 |
}
|
15 |
|
|
|
|
|
|
|
16 |
public static function getLoader()
|
17 |
{
|
18 |
if (null !== self::$loader) {
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +51,19 @@ class ComposerAutoloaderInit0a651f92f6dec0685e6f92fb5fc9b1f9
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInitbad42693a2a67eb4387853dae504a1bd
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
13 |
}
|
14 |
}
|
15 |
|
16 |
+
/**
|
17 |
+
* @return \Composer\Autoload\ClassLoader
|
18 |
+
*/
|
19 |
public static function getLoader()
|
20 |
{
|
21 |
if (null !== self::$loader) {
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInitbad42693a2a67eb4387853dae504a1bd', 'loadClassLoader'), true, true);
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitbad42693a2a67eb4387853dae504a1bd', 'loadClassLoader'));
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
require_once __DIR__ . '/autoload_static.php';
|
32 |
|
33 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitbad42693a2a67eb4387853dae504a1bd::getInitializer($loader));
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
51 |
$loader->register(true);
|
52 |
|
53 |
if ($useStaticLoader) {
|
54 |
+
$includeFiles = Composer\Autoload\ComposerStaticInitbad42693a2a67eb4387853dae504a1bd::$files;
|
55 |
} else {
|
56 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
57 |
}
|
58 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
59 |
+
composerRequirebad42693a2a67eb4387853dae504a1bd($fileIdentifier, $file);
|
60 |
}
|
61 |
|
62 |
return $loader;
|
63 |
}
|
64 |
}
|
65 |
|
66 |
+
function composerRequirebad42693a2a67eb4387853dae504a1bd($fileIdentifier, $file)
|
67 |
{
|
68 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
69 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'bce4ecd6aabb2a2948e06d0e2c4ea9a6' => __DIR__ . '/..' . '/automattic/jetpack-connection/legacy/load-ixr.php',
|
@@ -49,9 +49,9 @@ class ComposerStaticInit0a651f92f6dec0685e6f92fb5fc9b1f9
|
|
49 |
public static function getInitializer(ClassLoader $loader)
|
50 |
{
|
51 |
return \Closure::bind(function () use ($loader) {
|
52 |
-
$loader->prefixLengthsPsr4 =
|
53 |
-
$loader->prefixDirsPsr4 =
|
54 |
-
$loader->classMap =
|
55 |
|
56 |
}, null, ClassLoader::class);
|
57 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInitbad42693a2a67eb4387853dae504a1bd
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'bce4ecd6aabb2a2948e06d0e2c4ea9a6' => __DIR__ . '/..' . '/automattic/jetpack-connection/legacy/load-ixr.php',
|
49 |
public static function getInitializer(ClassLoader $loader)
|
50 |
{
|
51 |
return \Closure::bind(function () use ($loader) {
|
52 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitbad42693a2a67eb4387853dae504a1bd::$prefixLengthsPsr4;
|
53 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitbad42693a2a67eb4387853dae504a1bd::$prefixDirsPsr4;
|
54 |
+
$loader->classMap = ComposerStaticInitbad42693a2a67eb4387853dae504a1bd::$classMap;
|
55 |
|
56 |
}, null, ClassLoader::class);
|
57 |
}
|
woocommerce-payments.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
* WC requires at least: 4.0
|
11 |
* WC tested up to: 4.4
|
12 |
* Requires WP: 5.3
|
13 |
-
* Version: 1.4.
|
14 |
*
|
15 |
* @package WooCommerce\Payments
|
16 |
*/
|
@@ -25,6 +25,27 @@ define( 'WCPAY_MIN_WC_ADMIN_VERSION', '0.23.2' );
|
|
25 |
|
26 |
require_once WCPAY_ABSPATH . 'vendor/autoload_packages.php';
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
/**
|
29 |
* Initialize the Jetpack connection functionality.
|
30 |
*/
|
10 |
* WC requires at least: 4.0
|
11 |
* WC tested up to: 4.4
|
12 |
* Requires WP: 5.3
|
13 |
+
* Version: 1.4.1
|
14 |
*
|
15 |
* @package WooCommerce\Payments
|
16 |
*/
|
25 |
|
26 |
require_once WCPAY_ABSPATH . 'vendor/autoload_packages.php';
|
27 |
|
28 |
+
/**
|
29 |
+
* Plugin activation hook.
|
30 |
+
*/
|
31 |
+
function wcpay_activate() {
|
32 |
+
// Do not take any action if activated in a REST request (via wc-admin).
|
33 |
+
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
|
34 |
+
return;
|
35 |
+
}
|
36 |
+
|
37 |
+
if (
|
38 |
+
// Only redirect to onboarding when activated on its own. Either with a link...
|
39 |
+
isset( $_GET['action'] ) && 'activate' === $_GET['action'] // phpcs:ignore WordPress.Security.NonceVerification
|
40 |
+
// ...or with a bulk action.
|
41 |
+
|| isset( $_POST['checked'] ) && is_array( $_POST['checked'] ) && 1 === count( $_POST['checked'] ) // phpcs:ignore WordPress.Security.NonceVerification
|
42 |
+
) {
|
43 |
+
update_option( 'wcpay_should_redirect_to_onboarding', true );
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
register_activation_hook( __FILE__, 'wcpay_activate' );
|
48 |
+
|
49 |
/**
|
50 |
* Initialize the Jetpack connection functionality.
|
51 |
*/
|