diff --git a/.gitignore b/.gitignore
index 9b188c6da..ae438ab55 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,7 +5,8 @@ node_modules
.phpunit.result.cache
yarn-error.log
modules/ppcp-button/assets/*
-modules/ppcp-wc-gateway/assets/*
+modules/ppcp-wc-gateway/assets/js
+modules/ppcp-wc-gateway/assets/css
*.zip
.env
auth.json
diff --git a/changelog.txt b/changelog.txt
index d6448106d..ed6ee457e 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,5 +1,20 @@
*** Changelog ***
+= 1.7.0 - TBD =
+* Fix - DCC orders randomly failing #503
+* Fix - Multi-currency broke #481
+* Fix - Address information from PayPal shortcut flow not loaded #451
+* Enhancement - Improve onboarding flow, allow no card processing #443
+* Enhancement - Add Germany to supported ACDC countries #459
+* Enhancement - Add filters to allow ACDC for countries #437
+* Enhancement - Update 3D Secure #464
+* Enhancement - Extend event, error logging & order notes #456
+* Enhancement - Display API response errors in checkout page with user-friendly error message #457
+* Enhancement - Pass address details to credit card fields #479
+* Enhancement - Improve onboarding notice #465
+* Enhancement - Add transaction ID to WC order and order note when refund is received #473
+* Enhancement - Asset caching may cause bugs on upgrades #501
+
= 1.6.5 - 2022-01-31 =
* Fix - Allow guest users to purchase subscription products from checkout page #422
* Fix - Transaction ID missing for renewal order #424
diff --git a/composer.json b/composer.json
index f92d4dbff..ed3c2d4a3 100644
--- a/composer.json
+++ b/composer.json
@@ -12,7 +12,10 @@
"dhii/containers": "^0.1.0-alpha1",
"psr/log": "^1.1",
"ralouphie/getallheaders": "^3.0",
- "wikimedia/composer-merge-plugin": "^1.4"
+ "wikimedia/composer-merge-plugin": "^1.4",
+ "wp-oop/wordpress-interface": "^0.1.0-alpha1",
+ "dhii/versions": "^0.1.0-alpha1",
+ "symfony/polyfill-php80": "^1.19"
},
"require-dev": {
"woocommerce/woocommerce-sniffs": "^0.1.0",
diff --git a/composer.lock b/composer.lock
index 1c8ca84eb..1ff2571e2 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "5ec79a51fc5a2f5576f38dd6e4e87b2d",
+ "content-hash": "b3ddb500dfb804b3800901e2ac30108a",
"packages": [
{
"name": "container-interop/service-provider",
@@ -35,10 +35,6 @@
],
"description": "Promoting container interoperability through standard service providers",
"homepage": "https://github.com/container-interop/service-provider",
- "support": {
- "issues": "https://github.com/container-interop/service-provider/issues",
- "source": "https://github.com/container-interop/service-provider/tree/master"
- },
"time": "2017-09-20T14:13:36+00:00"
},
{
@@ -148,6 +144,57 @@
],
"time": "2021-10-06T11:13:51+00:00"
},
+ {
+ "name": "dhii/human-readable-interface",
+ "version": "v0.2.0-alpha1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Dhii/human-readable-interface.git",
+ "reference": "2b49d664f117faf72fb7af402ad21c0c27c62b6b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Dhii/human-readable-interface/zipball/2b49d664f117faf72fb7af402ad21c0c27c62b6b",
+ "reference": "2b49d664f117faf72fb7af402ad21c0c27c62b6b",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 | ^8.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^6.0 | ^7.0 | ^8.0 | ^9.0",
+ "slevomat/coding-standard": "^6.0",
+ "symfony/polyfill-php80": "^1.19",
+ "vimeo/psalm": "^3.11.7 | ^4.0"
+ },
+ "suggest": {
+ "dhii/i18n-interface": "For internationalizing and translating human readable strings.",
+ "symfony/polyfill-php80": "To add Stringable interface"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-develop": "0.1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Dhii\\Util\\String\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Dhii Team",
+ "email": "development@dhii.co"
+ }
+ ],
+ "description": "Interfaces for human readable string interoperation.",
+ "time": "2021-03-05T00:36:01+00:00"
+ },
{
"name": "dhii/module-interface",
"version": "v0.3.0-alpha2",
@@ -194,12 +241,142 @@
}
],
"description": "Interfaces for modules",
- "support": {
- "issues": "https://github.com/Dhii/module-interface/issues",
- "source": "https://github.com/Dhii/module-interface/tree/v0.3.0-alpha2"
- },
"time": "2021-08-23T08:23:01+00:00"
},
+ {
+ "name": "dhii/package-interface",
+ "version": "v0.1.0-alpha4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Dhii/package-interface.git",
+ "reference": "bcc73f4285eead9b482dbb89662b723abf49298b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Dhii/package-interface/zipball/bcc73f4285eead9b482dbb89662b723abf49298b",
+ "reference": "bcc73f4285eead9b482dbb89662b723abf49298b",
+ "shasum": ""
+ },
+ "require": {
+ "dhii/validation-interface": "^0.3-alpha1",
+ "php": "^7.1 | ^8.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0",
+ "slevomat/coding-standard": "^6.0",
+ "symfony/polyfill-php80": "^1.19",
+ "vimeo/psalm": "^4.4.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Dhii\\Package\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Anton Ukhanev",
+ "email": "xedin.unknown@gmail.com"
+ }
+ ],
+ "description": "Interfaces for package-related interop",
+ "time": "2021-12-08T15:57:36+00:00"
+ },
+ {
+ "name": "dhii/validation-interface",
+ "version": "v0.3.0-alpha3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Dhii/validation-interface.git",
+ "reference": "0e73c7bf3d2421ceb79331c60a9bc1b1d5eb65a6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Dhii/validation-interface/zipball/0e73c7bf3d2421ceb79331c60a9bc1b1d5eb65a6",
+ "reference": "0e73c7bf3d2421ceb79331c60a9bc1b1d5eb65a6",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 | ^8.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0",
+ "slevomat/coding-standard": "^6.0",
+ "symfony/polyfill-mbstring": "1.20",
+ "symfony/polyfill-php80": "^1.19",
+ "vimeo/psalm": "^3.11.7 | ^4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-develop": "0.3.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Dhii\\Validation\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Anton Ukhanev",
+ "email": "xedin.unknown@gmail.com"
+ }
+ ],
+ "description": "A base interface for validators",
+ "time": "2021-01-14T16:19:20+00:00"
+ },
+ {
+ "name": "dhii/versions",
+ "version": "v0.1.0-alpha3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Dhii/versions.git",
+ "reference": "120b22b248d0b46e41bac93bf3394516c9d55730"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Dhii/versions/zipball/120b22b248d0b46e41bac93bf3394516c9d55730",
+ "reference": "120b22b248d0b46e41bac93bf3394516c9d55730",
+ "shasum": ""
+ },
+ "require": {
+ "dhii/package-interface": "^0.1.0-alpha3",
+ "php": "^7.1 | ^8.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0",
+ "slevomat/coding-standard": "^6.0",
+ "symfony/polyfill-php80": "^1.19",
+ "vimeo/psalm": "^4.4.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Dhii\\Versions\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Anton Ukhanev",
+ "email": "xedin.unknown@gmail.com"
+ }
+ ],
+ "description": "Implementation for dealing with SemVer-compliant versions",
+ "time": "2021-12-08T16:54:50+00:00"
+ },
{
"name": "psr/container",
"version": "1.0.0",
@@ -247,10 +424,6 @@
"container-interop",
"psr"
],
- "support": {
- "issues": "https://github.com/php-fig/container/issues",
- "source": "https://github.com/php-fig/container/tree/master"
- },
"time": "2017-02-14T16:28:37+00:00"
},
{
@@ -298,9 +471,6 @@
"psr",
"psr-3"
],
- "support": {
- "source": "https://github.com/php-fig/log/tree/1.1.4"
- },
"time": "2021-05-03T11:20:27+00:00"
},
{
@@ -341,12 +511,88 @@
}
],
"description": "A polyfill for getallheaders.",
- "support": {
- "issues": "https://github.com/ralouphie/getallheaders/issues",
- "source": "https://github.com/ralouphie/getallheaders/tree/develop"
- },
"time": "2019-03-08T08:55:37+00:00"
},
+ {
+ "name": "symfony/polyfill-php80",
+ "version": "v1.24.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-php80.git",
+ "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9",
+ "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.23-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "files": [
+ "bootstrap.php"
+ ],
+ "psr-4": {
+ "Symfony\\Polyfill\\Php80\\": ""
+ },
+ "classmap": [
+ "Resources/stubs"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Ion Bazan",
+ "email": "ion.bazan@gmail.com"
+ },
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-09-13T13:58:33+00:00"
+ },
{
"name": "wikimedia/composer-merge-plugin",
"version": "v1.4.1",
@@ -395,21 +641,69 @@
],
"description": "Composer plugin to merge multiple composer.json files",
"time": "2017-04-25T02:31:25+00:00"
+ },
+ {
+ "name": "wp-oop/wordpress-interface",
+ "version": "v0.1.0-alpha2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/wp-oop/wordpress-interface.git",
+ "reference": "5e40acb49b76702f409bb5bcd2ea5459c9b946f5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/wp-oop/wordpress-interface/zipball/5e40acb49b76702f409bb5bcd2ea5459c9b946f5",
+ "reference": "5e40acb49b76702f409bb5bcd2ea5459c9b946f5",
+ "shasum": ""
+ },
+ "require": {
+ "dhii/human-readable-interface": "^0.2.0-alpha1",
+ "dhii/package-interface": "^0.1-alpha3",
+ "php": "^7.1 | ^8.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0",
+ "slevomat/coding-standard": "^6.0",
+ "vimeo/psalm": "^4.4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-task/initial-interfaces": "0.1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "WpOop\\WordPress\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Anton Ukhanev",
+ "email": "xedin.unknown@gmail.com"
+ }
+ ],
+ "description": "Interfaces for interop within WordPress",
+ "time": "2021-04-30T09:37:37+00:00"
}
],
"packages-dev": [
{
"name": "amphp/amp",
- "version": "v2.6.1",
+ "version": "v2.6.2",
"source": {
"type": "git",
"url": "https://github.com/amphp/amp.git",
- "reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae"
+ "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/amphp/amp/zipball/c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae",
- "reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae",
+ "url": "https://api.github.com/repos/amphp/amp/zipball/9d5100cebffa729aaffecd3ad25dc5aeea4f13bb",
+ "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb",
"shasum": ""
},
"require": {
@@ -431,13 +725,13 @@
}
},
"autoload": {
- "psr-4": {
- "Amp\\": "lib"
- },
"files": [
"lib/functions.php",
"lib/Internal/functions.php"
- ]
+ ],
+ "psr-4": {
+ "Amp\\": "lib"
+ }
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -462,7 +756,7 @@
}
],
"description": "A non-blocking concurrency framework for PHP applications.",
- "homepage": "http://amphp.org/amp",
+ "homepage": "https://amphp.org/amp",
"keywords": [
"async",
"asynchronous",
@@ -480,7 +774,7 @@
"type": "github"
}
],
- "time": "2021-09-23T18:43:08+00:00"
+ "time": "2022-02-20T17:52:18+00:00"
},
{
"name": "amphp/byte-stream",
@@ -556,16 +850,16 @@
},
{
"name": "antecedent/patchwork",
- "version": "2.1.17",
+ "version": "2.1.21",
"source": {
"type": "git",
"url": "https://github.com/antecedent/patchwork.git",
- "reference": "df5aba175a44c2996ced4edf8ec9f9081b5348c0"
+ "reference": "25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/antecedent/patchwork/zipball/df5aba175a44c2996ced4edf8ec9f9081b5348c0",
- "reference": "df5aba175a44c2996ced4edf8ec9f9081b5348c0",
+ "url": "https://api.github.com/repos/antecedent/patchwork/zipball/25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d",
+ "reference": "25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d",
"shasum": ""
},
"require": {
@@ -596,31 +890,31 @@
"runkit",
"testing"
],
- "time": "2021-10-21T14:22:43+00:00"
+ "time": "2022-02-07T07:28:34+00:00"
},
{
"name": "brain/monkey",
- "version": "2.6.0",
+ "version": "2.6.1",
"source": {
"type": "git",
"url": "https://github.com/Brain-WP/BrainMonkey.git",
- "reference": "7042140000b4b18034c0c0010d86274a00f25442"
+ "reference": "a31c84515bb0d49be9310f52ef1733980ea8ffbb"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/7042140000b4b18034c0c0010d86274a00f25442",
- "reference": "7042140000b4b18034c0c0010d86274a00f25442",
+ "url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/a31c84515bb0d49be9310f52ef1733980ea8ffbb",
+ "reference": "a31c84515bb0d49be9310f52ef1733980ea8ffbb",
"shasum": ""
},
"require": {
- "antecedent/patchwork": "^2.0",
- "mockery/mockery": ">=0.9 <2",
+ "antecedent/patchwork": "^2.1.17",
+ "mockery/mockery": "^1.3.5 || ^1.4.4",
"php": ">=5.6.0"
},
"require-dev": {
- "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || ^0.7",
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"phpcompatibility/php-compatibility": "^9.3.0",
- "phpunit/phpunit": "^5.7.9 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
+ "phpunit/phpunit": "^5.7.26 || ^6.0 || ^7.0 || >=8.0 <8.5.12 || ^8.5.14 || ^9.0"
},
"type": "library",
"extra": {
@@ -630,12 +924,12 @@
}
},
"autoload": {
- "psr-4": {
- "Brain\\Monkey\\": "src/"
- },
"files": [
"inc/api.php"
- ]
+ ],
+ "psr-4": {
+ "Brain\\Monkey\\": "src/"
+ }
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -662,20 +956,20 @@
"test",
"testing"
],
- "time": "2020-10-13T17:56:14+00:00"
+ "time": "2021-11-11T15:53:55+00:00"
},
{
"name": "composer/package-versions-deprecated",
- "version": "1.11.99.4",
+ "version": "1.11.99.5",
"source": {
"type": "git",
"url": "https://github.com/composer/package-versions-deprecated.git",
- "reference": "b174585d1fe49ceed21928a945138948cb394600"
+ "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600",
- "reference": "b174585d1fe49ceed21928a945138948cb394600",
+ "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d",
+ "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d",
"shasum": ""
},
"require": {
@@ -731,27 +1025,94 @@
"type": "tidelift"
}
],
- "time": "2021-09-13T08:41:34+00:00"
+ "time": "2022-01-17T14:14:24+00:00"
},
{
- "name": "composer/semver",
- "version": "3.2.6",
+ "name": "composer/pcre",
+ "version": "1.0.1",
"source": {
"type": "git",
- "url": "https://github.com/composer/semver.git",
- "reference": "83e511e247de329283478496f7a1e114c9517506"
+ "url": "https://github.com/composer/pcre.git",
+ "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/semver/zipball/83e511e247de329283478496f7a1e114c9517506",
- "reference": "83e511e247de329283478496f7a1e114c9517506",
+ "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560",
+ "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560",
"shasum": ""
},
"require": {
"php": "^5.3.2 || ^7.0 || ^8.0"
},
"require-dev": {
- "phpstan/phpstan": "^0.12.54",
+ "phpstan/phpstan": "^1.3",
+ "phpstan/phpstan-strict-rules": "^1.1",
+ "symfony/phpunit-bridge": "^4.2 || ^5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Composer\\Pcre\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be",
+ "homepage": "http://seld.be"
+ }
+ ],
+ "description": "PCRE wrapping library that offers type-safe preg_* replacements.",
+ "keywords": [
+ "PCRE",
+ "preg",
+ "regex",
+ "regular expression"
+ ],
+ "funding": [
+ {
+ "url": "https://packagist.com",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/composer",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/composer/composer",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2022-01-21T20:24:37+00:00"
+ },
+ {
+ "name": "composer/semver",
+ "version": "3.2.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/composer/semver.git",
+ "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/composer/semver/zipball/a951f614bd64dcd26137bc9b7b2637ddcfc57649",
+ "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.3.2 || ^7.0 || ^8.0"
+ },
+ "require-dev": {
+ "phpstan/phpstan": "^1.4",
"symfony/phpunit-bridge": "^4.2 || ^5"
},
"type": "library",
@@ -807,29 +1168,31 @@
"type": "tidelift"
}
],
- "time": "2021-10-25T11:34:17+00:00"
+ "time": "2022-02-04T13:58:43+00:00"
},
{
"name": "composer/xdebug-handler",
- "version": "2.0.2",
+ "version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/composer/xdebug-handler.git",
- "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339"
+ "reference": "0c1a3925ec58a4ec98e992b9c7d171e9e184be0a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/84674dd3a7575ba617f5a76d7e9e29a7d3891339",
- "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339",
+ "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/0c1a3925ec58a4ec98e992b9c7d171e9e184be0a",
+ "reference": "0c1a3925ec58a4ec98e992b9c7d171e9e184be0a",
"shasum": ""
},
"require": {
+ "composer/pcre": "^1",
"php": "^5.3.2 || ^7.0 || ^8.0",
"psr/log": "^1 || ^2 || ^3"
},
"require-dev": {
- "phpstan/phpstan": "^0.12.55",
- "symfony/phpunit-bridge": "^4.2 || ^5"
+ "phpstan/phpstan": "^1.0",
+ "phpstan/phpstan-strict-rules": "^1.1",
+ "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0"
},
"type": "library",
"autoload": {
@@ -866,31 +1229,31 @@
"type": "tidelift"
}
],
- "time": "2021-07-31T17:03:58+00:00"
+ "time": "2022-01-04T17:06:45+00:00"
},
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
- "version": "v0.7.1",
+ "version": "v0.7.2",
"source": {
"type": "git",
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
- "reference": "fe390591e0241955f22eb9ba327d137e501c771c"
+ "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c",
- "reference": "fe390591e0241955f22eb9ba327d137e501c771c",
+ "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db",
+ "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0",
"php": ">=5.3",
- "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0"
+ "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0"
},
"require-dev": {
"composer/composer": "*",
- "phpcompatibility/php-compatibility": "^9.0",
- "sensiolabs/security-checker": "^4.1.0"
+ "php-parallel-lint/php-parallel-lint": "^1.3.1",
+ "phpcompatibility/php-compatibility": "^9.0"
},
"type": "composer-plugin",
"extra": {
@@ -911,6 +1274,10 @@
"email": "franck.nijhof@dealerdirect.com",
"homepage": "http://www.frenck.nl",
"role": "Developer / IT Manager"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors"
}
],
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
@@ -922,6 +1289,7 @@
"codesniffer",
"composer",
"installer",
+ "phpcbf",
"phpcs",
"plugin",
"qa",
@@ -932,7 +1300,7 @@
"stylecheck",
"tests"
],
- "time": "2020-12-07T18:04:37+00:00"
+ "time": "2022-02-04T12:51:07+00:00"
},
{
"name": "dnoegel/php-xdg-base-dir",
@@ -1016,20 +1384,6 @@
"constructor",
"instantiate"
],
- "funding": [
- {
- "url": "https://www.doctrine-project.org/sponsorship.html",
- "type": "custom"
- },
- {
- "url": "https://www.patreon.com/phpdoctrine",
- "type": "patreon"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator",
- "type": "tidelift"
- }
- ],
"time": "2020-11-10T18:47:58+00:00"
},
{
@@ -1283,12 +1637,6 @@
"object",
"object graph"
],
- "funding": [
- {
- "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
- "type": "tidelift"
- }
- ],
"time": "2020-11-13T09:40:50+00:00"
},
{
@@ -1339,16 +1687,16 @@
},
{
"name": "nikic/php-parser",
- "version": "v4.13.0",
+ "version": "v4.13.2",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
- "reference": "50953a2691a922aa1769461637869a0a2faa3f53"
+ "reference": "210577fe3cf7badcc5814d99455df46564f3c077"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53",
- "reference": "50953a2691a922aa1769461637869a0a2faa3f53",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077",
+ "reference": "210577fe3cf7badcc5814d99455df46564f3c077",
"shasum": ""
},
"require": {
@@ -1387,7 +1735,7 @@
"parser",
"php"
],
- "time": "2021-09-20T12:20:58+00:00"
+ "time": "2021-11-30T19:35:32+00:00"
},
{
"name": "openlss/lib-array2xml",
@@ -1542,16 +1890,16 @@
},
{
"name": "php-stubs/woocommerce-stubs",
- "version": "v5.8.0",
+ "version": "v5.9.0",
"source": {
"type": "git",
"url": "https://github.com/php-stubs/woocommerce-stubs.git",
- "reference": "e3978c519fb1e51585e8c86b489b802aa0c64cee"
+ "reference": "a7204cfbb5fa90720773122cb68530087de5bc78"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-stubs/woocommerce-stubs/zipball/e3978c519fb1e51585e8c86b489b802aa0c64cee",
- "reference": "e3978c519fb1e51585e8c86b489b802aa0c64cee",
+ "url": "https://api.github.com/repos/php-stubs/woocommerce-stubs/zipball/a7204cfbb5fa90720773122cb68530087de5bc78",
+ "reference": "a7204cfbb5fa90720773122cb68530087de5bc78",
"shasum": ""
},
"require": {
@@ -1578,28 +1926,31 @@
"woocommerce",
"wordpress"
],
- "time": "2021-10-15T14:13:09+00:00"
+ "time": "2021-11-05T10:02:27+00:00"
},
{
"name": "php-stubs/wordpress-stubs",
- "version": "v5.8.1",
+ "version": "v5.9.0",
"source": {
"type": "git",
"url": "https://github.com/php-stubs/wordpress-stubs.git",
- "reference": "8b333464d3183bccde2fdbb814e3cae592434943"
+ "reference": "0fa8dd9a1bd2a1b60e85afc6c798fca1f599cc1b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/8b333464d3183bccde2fdbb814e3cae592434943",
- "reference": "8b333464d3183bccde2fdbb814e3cae592434943",
+ "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/0fa8dd9a1bd2a1b60e85afc6c798fca1f599cc1b",
+ "reference": "0fa8dd9a1bd2a1b60e85afc6c798fca1f599cc1b",
"shasum": ""
},
"replace": {
"giacocorsiglia/wordpress-stubs": "*"
},
"require-dev": {
- "giacocorsiglia/stubs-generator": "^0.5.0",
- "php": "~7.1"
+ "nikic/php-parser": "< 4.12.0",
+ "php": "~7.3 || ~8.0",
+ "php-stubs/generator": "^0.8.0",
+ "phpdocumentor/reflection-docblock": "^5.3",
+ "phpstan/phpstan": "^1.2"
},
"suggest": {
"paragonie/sodium_compat": "Pure PHP implementation of libsodium",
@@ -1618,7 +1969,7 @@
"static analysis",
"wordpress"
],
- "time": "2021-09-09T22:10:19+00:00"
+ "time": "2022-01-26T00:27:45+00:00"
},
{
"name": "phpcompatibility/php-compatibility",
@@ -1732,16 +2083,16 @@
},
{
"name": "phpcompatibility/phpcompatibility-wp",
- "version": "2.1.2",
+ "version": "2.1.3",
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
- "reference": "a792ab623069f0ce971b2417edef8d9632e32f75"
+ "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/a792ab623069f0ce971b2417edef8d9632e32f75",
- "reference": "a792ab623069f0ce971b2417edef8d9632e32f75",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/d55de55f88697b9cdb94bccf04f14eb3b11cf308",
+ "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308",
"shasum": ""
},
"require": {
@@ -1778,7 +2129,7 @@
"standards",
"wordpress"
],
- "time": "2021-07-21T11:09:57+00:00"
+ "time": "2021-12-30T16:37:40+00:00"
},
{
"name": "phpdocumentor/reflection-common",
@@ -2056,16 +2407,16 @@
},
{
"name": "phpunit/php-file-iterator",
- "version": "2.0.4",
+ "version": "2.0.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
- "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05"
+ "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/28af674ff175d0768a5a978e6de83f697d4a7f05",
- "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5",
+ "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5",
"shasum": ""
},
"require": {
@@ -2108,7 +2459,7 @@
"type": "github"
}
],
- "time": "2021-07-19T06:46:01+00:00"
+ "time": "2021-12-02T12:42:26+00:00"
},
{
"name": "phpunit/php-text-template",
@@ -2198,12 +2549,6 @@
"keywords": [
"timer"
],
- "funding": [
- {
- "url": "https://github.com/sebastianbergmann",
- "type": "github"
- }
- ],
"time": "2020-11-30T08:20:02+00:00"
},
{
@@ -2253,12 +2598,6 @@
"keywords": [
"tokenizer"
],
- "funding": [
- {
- "url": "https://github.com/sebastianbergmann",
- "type": "github"
- }
- ],
"abandoned": true,
"time": "2021-07-26T12:15:06+00:00"
},
@@ -2389,12 +2728,6 @@
],
"description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
- "funding": [
- {
- "url": "https://github.com/sebastianbergmann",
- "type": "github"
- }
- ],
"time": "2020-11-30T08:15:22+00:00"
},
{
@@ -2459,12 +2792,6 @@
"compare",
"equality"
],
- "funding": [
- {
- "url": "https://github.com/sebastianbergmann",
- "type": "github"
- }
- ],
"time": "2020-11-30T08:04:30+00:00"
},
{
@@ -2521,12 +2848,6 @@
"unidiff",
"unified diff"
],
- "funding": [
- {
- "url": "https://github.com/sebastianbergmann",
- "type": "github"
- }
- ],
"time": "2020-11-30T07:59:04+00:00"
},
{
@@ -2580,26 +2901,20 @@
"environment",
"hhvm"
],
- "funding": [
- {
- "url": "https://github.com/sebastianbergmann",
- "type": "github"
- }
- ],
"time": "2020-11-30T07:53:42+00:00"
},
{
"name": "sebastian/exporter",
- "version": "3.1.3",
+ "version": "3.1.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
- "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e"
+ "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/6b853149eab67d4da22291d36f5b0631c0fd856e",
- "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db",
+ "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db",
"shasum": ""
},
"require": {
@@ -2608,7 +2923,7 @@
},
"require-dev": {
"ext-mbstring": "*",
- "phpunit/phpunit": "^6.0"
+ "phpunit/phpunit": "^8.5"
},
"type": "library",
"extra": {
@@ -2659,7 +2974,7 @@
"type": "github"
}
],
- "time": "2020-11-30T07:47:53+00:00"
+ "time": "2021-11-11T13:51:24+00:00"
},
{
"name": "sebastian/global-state",
@@ -2757,12 +3072,6 @@
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
- "funding": [
- {
- "url": "https://github.com/sebastianbergmann",
- "type": "github"
- }
- ],
"time": "2020-11-30T07:40:27+00:00"
},
{
@@ -2808,12 +3117,6 @@
],
"description": "Allows reflection of object attributes, including inherited and non-public ones",
"homepage": "https://github.com/sebastianbergmann/object-reflector/",
- "funding": [
- {
- "url": "https://github.com/sebastianbergmann",
- "type": "github"
- }
- ],
"time": "2020-11-30T07:37:18+00:00"
},
{
@@ -2867,12 +3170,6 @@
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
- "funding": [
- {
- "url": "https://github.com/sebastianbergmann",
- "type": "github"
- }
- ],
"time": "2020-11-30T07:34:24+00:00"
},
{
@@ -2915,12 +3212,6 @@
],
"description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
- "funding": [
- {
- "url": "https://github.com/sebastianbergmann",
- "type": "github"
- }
- ],
"time": "2020-11-30T07:30:19+00:00"
},
{
@@ -2968,16 +3259,16 @@
},
{
"name": "squizlabs/php_codesniffer",
- "version": "3.6.1",
+ "version": "3.6.2",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
- "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e"
+ "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f268ca40d54617c6e06757f83f699775c9b3ff2e",
- "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a",
+ "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a",
"shasum": ""
},
"require": {
@@ -3015,20 +3306,20 @@
"phpcs",
"standards"
],
- "time": "2021-10-11T04:00:11+00:00"
+ "time": "2021-12-12T21:44:58+00:00"
},
{
"name": "symfony/console",
- "version": "v4.4.30",
+ "version": "v4.4.37",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "a3f7189a0665ee33b50e9e228c46f50f5acbed22"
+ "reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/a3f7189a0665ee33b50e9e228c46f50f5acbed22",
- "reference": "a3f7189a0665ee33b50e9e228c46f50f5acbed22",
+ "url": "https://api.github.com/repos/symfony/console/zipball/0259f01dbf9d77badddbbf4c2abb681f24c9cac6",
+ "reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6",
"shasum": ""
},
"require": {
@@ -3102,25 +3393,28 @@
"type": "tidelift"
}
],
- "time": "2021-08-25T19:27:26+00:00"
+ "time": "2022-01-26T16:15:26+00:00"
},
{
"name": "symfony/polyfill-ctype",
- "version": "v1.23.0",
+ "version": "v1.24.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
- "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce"
+ "reference": "30885182c981ab175d4d034db0f6f469898070ab"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce",
- "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce",
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab",
+ "reference": "30885182c981ab175d4d034db0f6f469898070ab",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
+ "provide": {
+ "ext-ctype": "*"
+ },
"suggest": {
"ext-ctype": "For best performance"
},
@@ -3178,25 +3472,28 @@
"type": "tidelift"
}
],
- "time": "2021-02-19T12:13:01+00:00"
+ "time": "2021-10-20T20:35:02+00:00"
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.23.1",
+ "version": "v1.24.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6"
+ "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6",
- "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825",
+ "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
+ "provide": {
+ "ext-mbstring": "*"
+ },
"suggest": {
"ext-mbstring": "For best performance"
},
@@ -3211,12 +3508,12 @@
}
},
"autoload": {
- "psr-4": {
- "Symfony\\Polyfill\\Mbstring\\": ""
- },
"files": [
"bootstrap.php"
- ]
+ ],
+ "psr-4": {
+ "Symfony\\Polyfill\\Mbstring\\": ""
+ }
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -3255,20 +3552,20 @@
"type": "tidelift"
}
],
- "time": "2021-05-27T12:26:48+00:00"
+ "time": "2021-11-30T18:21:41+00:00"
},
{
"name": "symfony/polyfill-php73",
- "version": "v1.23.0",
+ "version": "v1.24.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php73.git",
- "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010"
+ "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010",
- "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010",
+ "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5",
+ "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5",
"shasum": ""
},
"require": {
@@ -3285,12 +3582,12 @@
}
},
"autoload": {
- "psr-4": {
- "Symfony\\Polyfill\\Php73\\": ""
- },
"files": [
"bootstrap.php"
],
+ "psr-4": {
+ "Symfony\\Polyfill\\Php73\\": ""
+ },
"classmap": [
"Resources/stubs"
]
@@ -3331,100 +3628,20 @@
"type": "tidelift"
}
],
- "time": "2021-02-19T12:13:01+00:00"
- },
- {
- "name": "symfony/polyfill-php80",
- "version": "v1.23.1",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/polyfill-php80.git",
- "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be",
- "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be",
- "shasum": ""
- },
- "require": {
- "php": ">=7.1"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-main": "1.23-dev"
- },
- "thanks": {
- "name": "symfony/polyfill",
- "url": "https://github.com/symfony/polyfill"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Polyfill\\Php80\\": ""
- },
- "files": [
- "bootstrap.php"
- ],
- "classmap": [
- "Resources/stubs"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Ion Bazan",
- "email": "ion.bazan@gmail.com"
- },
- {
- "name": "Nicolas Grekas",
- "email": "p@tchwork.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
- "homepage": "https://symfony.com",
- "keywords": [
- "compatibility",
- "polyfill",
- "portable",
- "shim"
- ],
- "funding": [
- {
- "url": "https://symfony.com/sponsor",
- "type": "custom"
- },
- {
- "url": "https://github.com/fabpot",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
- "type": "tidelift"
- }
- ],
- "time": "2021-07-28T13:41:28+00:00"
+ "time": "2021-06-05T21:20:04+00:00"
},
{
"name": "symfony/service-contracts",
- "version": "v1.1.9",
+ "version": "v1.1.11",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
- "reference": "b776d18b303a39f56c63747bcb977ad4b27aca26"
+ "reference": "633df678bec3452e04a7b0337c9bcfe7354124b3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/service-contracts/zipball/b776d18b303a39f56c63747bcb977ad4b27aca26",
- "reference": "b776d18b303a39f56c63747bcb977ad4b27aca26",
+ "url": "https://api.github.com/repos/symfony/service-contracts/zipball/633df678bec3452e04a7b0337c9bcfe7354124b3",
+ "reference": "633df678bec3452e04a7b0337c9bcfe7354124b3",
"shasum": ""
},
"require": {
@@ -3437,7 +3654,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.1-dev"
+ "dev-main": "1.1-dev"
},
"thanks": {
"name": "symfony/contracts",
@@ -3487,7 +3704,7 @@
"type": "tidelift"
}
],
- "time": "2020-07-06T13:19:58+00:00"
+ "time": "2021-11-04T13:32:43+00:00"
},
{
"name": "theseer/tokenizer",
@@ -3531,16 +3748,16 @@
},
{
"name": "vimeo/psalm",
- "version": "4.11.2",
+ "version": "4.21.0",
"source": {
"type": "git",
"url": "https://github.com/vimeo/psalm.git",
- "reference": "6fba5eb554f9507b72932f9c75533d8af593688d"
+ "reference": "d8bec4c7aaee111a532daec32fb09de5687053d1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/vimeo/psalm/zipball/6fba5eb554f9507b72932f9c75533d8af593688d",
- "reference": "6fba5eb554f9507b72932f9c75533d8af593688d",
+ "url": "https://api.github.com/repos/vimeo/psalm/zipball/d8bec4c7aaee111a532daec32fb09de5687053d1",
+ "reference": "d8bec4c7aaee111a532daec32fb09de5687053d1",
"shasum": ""
},
"require": {
@@ -3548,7 +3765,7 @@
"amphp/byte-stream": "^1.5",
"composer/package-versions-deprecated": "^1.8.0",
"composer/semver": "^1.4 || ^2.0 || ^3.0",
- "composer/xdebug-handler": "^1.1 || ^2.0",
+ "composer/xdebug-handler": "^1.1 || ^2.0 || ^3.0",
"dnoegel/php-xdg-base-dir": "^0.1.1",
"ext-ctype": "*",
"ext-dom": "*",
@@ -3564,7 +3781,7 @@
"openlss/lib-array2xml": "^1.0",
"php": "^7.1|^8",
"sebastian/diff": "^3.0 || ^4.0",
- "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0",
+ "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0 || ^6.0",
"webmozart/path-util": "^2.3"
},
"provide": {
@@ -3582,11 +3799,12 @@
"psalm/plugin-phpunit": "^0.16",
"slevomat/coding-standard": "^7.0",
"squizlabs/php_codesniffer": "^3.5",
- "symfony/process": "^4.3 || ^5.0",
+ "symfony/process": "^4.3 || ^5.0 || ^6.0",
"weirdan/prophecy-shim": "^1.0 || ^2.0"
},
"suggest": {
- "ext-igbinary": "^2.0.5"
+ "ext-curl": "In order to send data to shepherd",
+ "ext-igbinary": "^2.0.5 is required, used to serialize caching data"
},
"bin": [
"psalm",
@@ -3605,13 +3823,13 @@
}
},
"autoload": {
- "psr-4": {
- "Psalm\\": "src/Psalm/"
- },
"files": [
"src/functions.php",
"src/spl_object_id.php"
- ]
+ ],
+ "psr-4": {
+ "Psalm\\": "src/Psalm/"
+ }
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -3628,7 +3846,7 @@
"inspection",
"php"
],
- "time": "2021-10-26T17:28:17+00:00"
+ "time": "2022-02-18T04:34:15+00:00"
},
{
"name": "webmozart/assert",
@@ -3723,20 +3941,21 @@
}
],
"description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.",
+ "abandoned": "symfony/filesystem",
"time": "2015-12-17T08:42:14+00:00"
},
{
"name": "woocommerce/woocommerce-sniffs",
- "version": "0.1.1",
+ "version": "0.1.2",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-sniffs.git",
- "reference": "eb604d751b61c42f31ff1aa24113c7c0de438553"
+ "reference": "5566270d280a300bc24bd0cb055a8b9325afdd6b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/eb604d751b61c42f31ff1aa24113c7c0de438553",
- "reference": "eb604d751b61c42f31ff1aa24113c7c0de438553",
+ "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/5566270d280a300bc24bd0cb055a8b9325afdd6b",
+ "reference": "5566270d280a300bc24bd0cb055a8b9325afdd6b",
"shasum": ""
},
"require": {
@@ -3763,7 +3982,7 @@
"woocommerce",
"wordpress"
],
- "time": "2021-07-29T17:25:16+00:00"
+ "time": "2022-01-21T20:13:23+00:00"
},
{
"name": "wp-coding-standards/wpcs",
diff --git a/modules/ppcp-admin-notices/src/Repository/Repository.php b/modules/ppcp-admin-notices/src/Repository/Repository.php
index 066ed0ea8..e13a5dd6c 100644
--- a/modules/ppcp-admin-notices/src/Repository/Repository.php
+++ b/modules/ppcp-admin-notices/src/Repository/Repository.php
@@ -25,6 +25,9 @@ class Repository implements RepositoryInterface {
*/
public function current_message(): array {
return array_filter(
+ /**
+ * Returns the list of admin messages.
+ */
(array) apply_filters(
self::NOTICES_FILTER,
array()
diff --git a/modules/ppcp-api-client/services.php b/modules/ppcp-api-client/services.php
index 32184c6a3..e4ce7ebb3 100644
--- a/modules/ppcp-api-client/services.php
+++ b/modules/ppcp-api-client/services.php
@@ -127,7 +127,6 @@ return array(
return new PartnerReferrals(
$container->get( 'api.host' ),
$container->get( 'api.bearer' ),
- $container->get( 'api.repository.partner-referrals-data' ),
$container->get( 'woocommerce.logger.woocommerce' )
);
},
@@ -209,9 +208,8 @@ return array(
},
'api.repository.partner-referrals-data' => static function ( ContainerInterface $container ) : PartnerReferralsData {
- $merchant_email = $container->get( 'api.merchant_email' );
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
- return new PartnerReferralsData( $merchant_email, $dcc_applies );
+ return new PartnerReferralsData( $dcc_applies );
},
'api.repository.cart' => static function ( ContainerInterface $container ): CartRepository {
$factory = $container->get( 'api.factory.purchase-unit' );
@@ -327,12 +325,16 @@ return array(
},
'api.shop.currency' => static function ( ContainerInterface $container ) : string {
- // We use option instead of get_woocommerce_currency
- // because it will not be overridden by currency switching plugins.
+ $currency = get_woocommerce_currency();
+ if ( $currency ) {
+ return $currency;
+ }
+
$currency = get_option( 'woocommerce_currency' );
if ( ! $currency ) {
return 'NO_CURRENCY'; // Unlikely to happen.
}
+
return $currency;
},
'api.shop.country' => static function ( ContainerInterface $container ) : string {
@@ -393,141 +395,147 @@ return array(
* The matrix which countries and currency combinations can be used for DCC.
*/
'api.dcc-supported-country-currency-matrix' => static function ( ContainerInterface $container ) : array {
- return array(
- 'AU' => array(
- 'AUD',
- 'CAD',
- 'CHF',
- 'CZK',
- 'DKK',
- 'EUR',
- 'GBP',
- 'HKD',
- 'HUF',
- 'JPY',
- 'NOK',
- 'NZD',
- 'PLN',
- 'SEK',
- 'SGD',
- 'USD',
- ),
- 'DE' => array(
- 'AUD',
- 'CAD',
- 'CHF',
- 'CZK',
- 'DKK',
- 'EUR',
- 'GBP',
- 'HKD',
- 'HUF',
- 'JPY',
- 'NOK',
- 'NZD',
- 'PLN',
- 'SEK',
- 'SGD',
- 'USD',
- ),
- 'ES' => array(
- 'AUD',
- 'CAD',
- 'CHF',
- 'CZK',
- 'DKK',
- 'EUR',
- 'GBP',
- 'HKD',
- 'HUF',
- 'JPY',
- 'NOK',
- 'NZD',
- 'PLN',
- 'SEK',
- 'SGD',
- 'USD',
- ),
- 'FR' => array(
- 'AUD',
- 'CAD',
- 'CHF',
- 'CZK',
- 'DKK',
- 'EUR',
- 'GBP',
- 'HKD',
- 'HUF',
- 'JPY',
- 'NOK',
- 'NZD',
- 'PLN',
- 'SEK',
- 'SGD',
- 'USD',
- ),
- 'GB' => array(
- 'AUD',
- 'CAD',
- 'CHF',
- 'CZK',
- 'DKK',
- 'EUR',
- 'GBP',
- 'HKD',
- 'HUF',
- 'JPY',
- 'NOK',
- 'NZD',
- 'PLN',
- 'SEK',
- 'SGD',
- 'USD',
- ),
- 'IT' => array(
- 'AUD',
- 'CAD',
- 'CHF',
- 'CZK',
- 'DKK',
- 'EUR',
- 'GBP',
- 'HKD',
- 'HUF',
- 'JPY',
- 'NOK',
- 'NZD',
- 'PLN',
- 'SEK',
- 'SGD',
- 'USD',
- ),
- 'US' => array(
- 'AUD',
- 'CAD',
- 'EUR',
- 'GBP',
- 'JPY',
- 'USD',
- ),
- 'CA' => array(
- 'AUD',
- 'CAD',
- 'CHF',
- 'CZK',
- 'DKK',
- 'EUR',
- 'GBP',
- 'HKD',
- 'HUF',
- 'JPY',
- 'NOK',
- 'NZD',
- 'PLN',
- 'SEK',
- 'SGD',
- 'USD',
- ),
+ /**
+ * Returns which countries and currency combinations can be used for DCC.
+ */
+ return apply_filters(
+ 'woocommerce_paypal_payments_supported_country_currency_matrix',
+ array(
+ 'AU' => array(
+ 'AUD',
+ 'CAD',
+ 'CHF',
+ 'CZK',
+ 'DKK',
+ 'EUR',
+ 'GBP',
+ 'HKD',
+ 'HUF',
+ 'JPY',
+ 'NOK',
+ 'NZD',
+ 'PLN',
+ 'SEK',
+ 'SGD',
+ 'USD',
+ ),
+ 'DE' => array(
+ 'AUD',
+ 'CAD',
+ 'CHF',
+ 'CZK',
+ 'DKK',
+ 'EUR',
+ 'GBP',
+ 'HKD',
+ 'HUF',
+ 'JPY',
+ 'NOK',
+ 'NZD',
+ 'PLN',
+ 'SEK',
+ 'SGD',
+ 'USD',
+ ),
+ 'ES' => array(
+ 'AUD',
+ 'CAD',
+ 'CHF',
+ 'CZK',
+ 'DKK',
+ 'EUR',
+ 'GBP',
+ 'HKD',
+ 'HUF',
+ 'JPY',
+ 'NOK',
+ 'NZD',
+ 'PLN',
+ 'SEK',
+ 'SGD',
+ 'USD',
+ ),
+ 'FR' => array(
+ 'AUD',
+ 'CAD',
+ 'CHF',
+ 'CZK',
+ 'DKK',
+ 'EUR',
+ 'GBP',
+ 'HKD',
+ 'HUF',
+ 'JPY',
+ 'NOK',
+ 'NZD',
+ 'PLN',
+ 'SEK',
+ 'SGD',
+ 'USD',
+ ),
+ 'GB' => array(
+ 'AUD',
+ 'CAD',
+ 'CHF',
+ 'CZK',
+ 'DKK',
+ 'EUR',
+ 'GBP',
+ 'HKD',
+ 'HUF',
+ 'JPY',
+ 'NOK',
+ 'NZD',
+ 'PLN',
+ 'SEK',
+ 'SGD',
+ 'USD',
+ ),
+ 'IT' => array(
+ 'AUD',
+ 'CAD',
+ 'CHF',
+ 'CZK',
+ 'DKK',
+ 'EUR',
+ 'GBP',
+ 'HKD',
+ 'HUF',
+ 'JPY',
+ 'NOK',
+ 'NZD',
+ 'PLN',
+ 'SEK',
+ 'SGD',
+ 'USD',
+ ),
+ 'US' => array(
+ 'AUD',
+ 'CAD',
+ 'EUR',
+ 'GBP',
+ 'JPY',
+ 'USD',
+ ),
+ 'CA' => array(
+ 'AUD',
+ 'CAD',
+ 'CHF',
+ 'CZK',
+ 'DKK',
+ 'EUR',
+ 'GBP',
+ 'HKD',
+ 'HUF',
+ 'JPY',
+ 'NOK',
+ 'NZD',
+ 'PLN',
+ 'SEK',
+ 'SGD',
+ 'USD',
+ ),
+ )
);
},
@@ -535,49 +543,55 @@ return array(
* Which countries support which credit cards. Empty credit card arrays mean no restriction on currency.
*/
'api.dcc-supported-country-card-matrix' => static function ( ContainerInterface $container ) : array {
- return array(
- 'AU' => array(
- 'mastercard' => array(),
- 'visa' => array(),
- 'amex' => array( 'AUD' ),
- ),
- 'DE' => array(
- 'mastercard' => array(),
- 'visa' => array(),
- 'amex' => array( 'EUR' ),
- ),
- 'ES' => array(
- 'mastercard' => array(),
- 'visa' => array(),
- 'amex' => array( 'EUR' ),
- ),
- 'FR' => array(
- 'mastercard' => array(),
- 'visa' => array(),
- 'amex' => array( 'EUR' ),
- ),
- 'GB' => array(
- 'mastercard' => array(),
- 'visa' => array(),
- 'amex' => array( 'GBP', 'USD' ),
- ),
- 'IT' => array(
- 'mastercard' => array(),
- 'visa' => array(),
- 'amex' => array( 'EUR' ),
- ),
- 'US' => array(
- 'mastercard' => array(),
- 'visa' => array(),
- 'amex' => array( 'USD' ),
- 'discover' => array( 'USD' ),
- ),
- 'CA' => array(
- 'mastercard' => array(),
- 'visa' => array(),
- 'amex' => array( 'CAD' ),
- 'jcb' => array( 'CAD' ),
- ),
+ /**
+ * Returns which countries support which credit cards. Empty credit card arrays mean no restriction on currency.
+ */
+ return apply_filters(
+ 'woocommerce_paypal_payments_supported_country_card_matrix',
+ array(
+ 'AU' => array(
+ 'mastercard' => array(),
+ 'visa' => array(),
+ 'amex' => array( 'AUD' ),
+ ),
+ 'DE' => array(
+ 'mastercard' => array(),
+ 'visa' => array(),
+ 'amex' => array( 'EUR' ),
+ ),
+ 'ES' => array(
+ 'mastercard' => array(),
+ 'visa' => array(),
+ 'amex' => array( 'EUR' ),
+ ),
+ 'FR' => array(
+ 'mastercard' => array(),
+ 'visa' => array(),
+ 'amex' => array( 'EUR' ),
+ ),
+ 'GB' => array(
+ 'mastercard' => array(),
+ 'visa' => array(),
+ 'amex' => array( 'GBP', 'USD' ),
+ ),
+ 'IT' => array(
+ 'mastercard' => array(),
+ 'visa' => array(),
+ 'amex' => array( 'EUR' ),
+ ),
+ 'US' => array(
+ 'mastercard' => array(),
+ 'visa' => array(),
+ 'amex' => array( 'USD' ),
+ 'discover' => array( 'USD' ),
+ ),
+ 'CA' => array(
+ 'mastercard' => array(),
+ 'visa' => array(),
+ 'amex' => array( 'CAD' ),
+ 'jcb' => array( 'CAD' ),
+ ),
+ )
);
},
diff --git a/modules/ppcp-api-client/src/Endpoint/PartnerReferrals.php b/modules/ppcp-api-client/src/Endpoint/PartnerReferrals.php
index 38526927f..0f188f025 100644
--- a/modules/ppcp-api-client/src/Endpoint/PartnerReferrals.php
+++ b/modules/ppcp-api-client/src/Endpoint/PartnerReferrals.php
@@ -12,7 +12,6 @@ namespace WooCommerce\PayPalCommerce\ApiClient\Endpoint;
use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
-use WooCommerce\PayPalCommerce\ApiClient\Repository\PartnerReferralsData;
use Psr\Log\LoggerInterface;
/**
@@ -36,13 +35,6 @@ class PartnerReferrals {
*/
private $bearer;
- /**
- * The PartnerReferralsData.
- *
- * @var PartnerReferralsData
- */
- private $data;
-
/**
* The logger.
*
@@ -53,32 +45,29 @@ class PartnerReferrals {
/**
* PartnerReferrals constructor.
*
- * @param string $host The host.
- * @param Bearer $bearer The bearer.
- * @param PartnerReferralsData $data The partner referrals data.
- * @param LoggerInterface $logger The logger.
+ * @param string $host The host.
+ * @param Bearer $bearer The bearer.
+ * @param LoggerInterface $logger The logger.
*/
public function __construct(
string $host,
Bearer $bearer,
- PartnerReferralsData $data,
LoggerInterface $logger
) {
$this->host = $host;
$this->bearer = $bearer;
- $this->data = $data;
$this->logger = $logger;
}
/**
* Fetch the signup link.
*
+ * @param array $data The partner referrals data.
* @return string
* @throws RuntimeException If the request fails.
*/
- public function signup_link(): string {
- $data = $this->data->data();
+ public function signup_link( array $data ): string {
$bearer = $this->bearer->bearer();
$args = array(
'method' => 'POST',
diff --git a/modules/ppcp-api-client/src/Entity/PaymentToken.php b/modules/ppcp-api-client/src/Entity/PaymentToken.php
index ca919dc2f..686813817 100644
--- a/modules/ppcp-api-client/src/Entity/PaymentToken.php
+++ b/modules/ppcp-api-client/src/Entity/PaymentToken.php
@@ -105,6 +105,9 @@ class PaymentToken {
* @return array
*/
public static function get_valid_types() {
+ /**
+ * Returns a list of valid payment token types.
+ */
return apply_filters(
'woocommerce_paypal_payments_valid_payment_token_types',
array(
diff --git a/modules/ppcp-api-client/src/Factory/PayerFactory.php b/modules/ppcp-api-client/src/Factory/PayerFactory.php
index 70d33dee3..6bec8fe80 100644
--- a/modules/ppcp-api-client/src/Factory/PayerFactory.php
+++ b/modules/ppcp-api-client/src/Factory/PayerFactory.php
@@ -55,10 +55,12 @@ class PayerFactory {
$national_number = preg_replace( '/[^0-9]/', '', $national_number );
$national_number = substr( $national_number, 0, 14 );
- $phone = new PhoneWithType(
- 'HOME',
- new Phone( $national_number )
- );
+ if ( $national_number ) {
+ $phone = new PhoneWithType(
+ 'HOME',
+ new Phone( $national_number )
+ );
+ }
}
return new Payer(
new PayerName(
@@ -91,10 +93,12 @@ class PayerFactory {
$national_number = preg_replace( '/[^0-9]/', '', $national_number );
$national_number = substr( $national_number, 0, 14 );
- $phone = new PhoneWithType(
- 'HOME',
- new Phone( $national_number )
- );
+ if ( $national_number ) {
+ $phone = new PhoneWithType(
+ 'HOME',
+ new Phone( $national_number )
+ );
+ }
}
return new Payer(
new PayerName(
@@ -176,10 +180,12 @@ class PayerFactory {
if ( null !== $national_number ) {
$national_number = substr( $national_number, 0, 14 );
- $phone = new PhoneWithType(
- 'HOME',
- new Phone( $national_number )
- );
+ if ( $national_number ) {
+ $phone = new PhoneWithType(
+ 'HOME',
+ new Phone( $national_number )
+ );
+ }
}
}
diff --git a/modules/ppcp-api-client/src/Factory/PurchaseUnitFactory.php b/modules/ppcp-api-client/src/Factory/PurchaseUnitFactory.php
index c018d9917..37c371fb0 100644
--- a/modules/ppcp-api-client/src/Factory/PurchaseUnitFactory.php
+++ b/modules/ppcp-api-client/src/Factory/PurchaseUnitFactory.php
@@ -134,6 +134,9 @@ class PurchaseUnitFactory {
$invoice_id,
$soft_descriptor
);
+ /**
+ * Returns PurchaseUnit for the WC order.
+ */
return apply_filters(
'woocommerce_paypal_payments_purchase_unit_from_wc_order',
$purchase_unit,
diff --git a/modules/ppcp-api-client/src/Repository/ApplicationContextRepository.php b/modules/ppcp-api-client/src/Repository/ApplicationContextRepository.php
index bfc28b25a..f6c87c804 100644
--- a/modules/ppcp-api-client/src/Repository/ApplicationContextRepository.php
+++ b/modules/ppcp-api-client/src/Repository/ApplicationContextRepository.php
@@ -74,7 +74,10 @@ class ApplicationContextRepository {
$parts = explode( '-', $locale );
if ( count( $parts ) === 3 ) {
- return substr( $locale, 0, strrpos( $locale, '-' ) );
+ $ret = substr( $locale, 0, strrpos( $locale, '-' ) );
+ if ( false !== $ret ) {
+ return $ret;
+ }
}
return 'en';
diff --git a/modules/ppcp-api-client/src/Repository/CustomerRepository.php b/modules/ppcp-api-client/src/Repository/CustomerRepository.php
index 93134624e..99063b7e3 100644
--- a/modules/ppcp-api-client/src/Repository/CustomerRepository.php
+++ b/modules/ppcp-api-client/src/Repository/CustomerRepository.php
@@ -45,6 +45,8 @@ class CustomerRepository {
}
$unique_id = substr( $this->prefix . strrev( uniqid() ), 0, self::CLIENT_ID_MAX_LENGTH );
+ assert( is_string( $unique_id ) );
+
WC()->session->set( 'ppcp_guest_customer_id', $unique_id );
return $unique_id;
diff --git a/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php b/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php
index d893e9c91..e2a13c949 100644
--- a/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php
+++ b/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php
@@ -15,14 +15,6 @@ use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
* Class PartnerReferralsData
*/
class PartnerReferralsData {
-
- /**
- * The merchant email.
- *
- * @var string
- */
- private $merchant_email;
-
/**
* The DCC Applies Helper object.
*
@@ -30,19 +22,39 @@ class PartnerReferralsData {
*/
private $dcc_applies;
+ /**
+ * The list of products ('PPCP', 'EXPRESS_CHECKOUT').
+ *
+ * @var string[]
+ */
+ private $products;
+
/**
* PartnerReferralsData constructor.
*
- * @param string $merchant_email The email of the merchant.
* @param DccApplies $dcc_applies The DCC Applies helper.
*/
public function __construct(
- string $merchant_email,
DccApplies $dcc_applies
) {
+ $this->dcc_applies = $dcc_applies;
+ $this->products = array(
+ $this->dcc_applies->for_country_currency() ? 'PPCP' : 'EXPRESS_CHECKOUT',
+ );
+ }
- $this->merchant_email = $merchant_email;
- $this->dcc_applies = $dcc_applies;
+ /**
+ * Returns a new copy of this object with the given value set.
+ *
+ * @param string[] $products The list of products ('PPCP', 'EXPRESS_CHECKOUT').
+ * @return static
+ */
+ public function with_products( array $products ): self {
+ $obj = clone $this;
+
+ $obj->products = $products;
+
+ return $obj;
}
/**
@@ -60,33 +72,26 @@ class PartnerReferralsData {
* @return array
*/
public function data(): array {
- $data = $this->default_data();
- return $data;
- }
-
- /**
- * Returns the default data.
- *
- * @return array
- */
- private function default_data(): array {
-
return array(
'partner_config_override' => array(
'partner_logo_url' => 'https://connect.woocommerce.com/images/woocommerce_logo.png',
+ /**
+ * Returns the URL which will be opened at the end of onboarding.
+ */
'return_url' => apply_filters(
'woocommerce_paypal_payments_partner_config_override_return_url',
admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' )
),
+ /**
+ * Returns the description of the URL which will be opened at the end of onboarding.
+ */
'return_url_description' => apply_filters(
'woocommerce_paypal_payments_partner_config_override_return_url_description',
__( 'Return to your shop.', 'woocommerce-paypal-payments' )
),
'show_add_credit_card' => true,
),
- 'products' => array(
- $this->dcc_applies->for_country_currency() ? 'PPCP' : 'EXPRESS_CHECKOUT',
- ),
+ 'products' => $this->products,
'legal_consents' => array(
array(
'type' => 'SHARE_DATA_CONSENT',
diff --git a/modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js b/modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js
index 559803b3c..a4eb8f146 100644
--- a/modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js
+++ b/modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js
@@ -9,7 +9,6 @@ class CreditCardRenderer {
this.cardValid = false;
this.formValid = false;
this.currentHostedFieldsInstance = null;
- this.formSubmissionSubscribed = false;
}
render(wrapper, contextConfig) {
@@ -122,7 +121,7 @@ class CreditCardRenderer {
});
- if (!this.formSubmissionSubscribed) {
+ if (document.querySelector(wrapper).getAttribute('data-ppcp-subscribed') !== true) {
document.querySelector(wrapper + ' button').addEventListener(
'click',
event => {
@@ -130,7 +129,8 @@ class CreditCardRenderer {
this._submit(contextConfig);
}
);
- this.formSubmissionSubscribed = true;
+
+ document.querySelector(wrapper).setAttribute('data-ppcp-subscribed', true);
}
});
@@ -143,7 +143,7 @@ class CreditCardRenderer {
}
disableFields() {
- if( this.currentHostedFieldsInstance) {
+ if (this.currentHostedFieldsInstance) {
this.currentHostedFieldsInstance.setAttribute({
field: 'number',
attribute: 'disabled'
@@ -160,7 +160,7 @@ class CreditCardRenderer {
}
enableFields() {
- if( this.currentHostedFieldsInstance) {
+ if (this.currentHostedFieldsInstance) {
this.currentHostedFieldsInstance.removeAttribute({
field: 'number',
attribute: 'disabled'
diff --git a/modules/ppcp-button/services.php b/modules/ppcp-button/services.php
index fba90a1c8..9cec5b302 100644
--- a/modules/ppcp-button/services.php
+++ b/modules/ppcp-button/services.php
@@ -52,7 +52,7 @@ return array(
*
* @var State $state
*/
- if ( $state->current_state() <= State::STATE_PROGRESSIVE ) {
+ if ( $state->current_state() !== State::STATE_ONBOARDED ) {
return new DisabledSmartButton();
}
$settings = $container->get( 'wcgateway.settings' );
@@ -73,6 +73,7 @@ return array(
$currency = $container->get( 'api.shop.currency' );
return new SmartButton(
$container->get( 'button.url' ),
+ $container->get( 'ppcp.asset-version' ),
$container->get( 'session.handler' ),
$settings,
$payer_factory,
diff --git a/modules/ppcp-button/src/Assets/SmartButton.php b/modules/ppcp-button/src/Assets/SmartButton.php
index 667560dbc..08e22815b 100644
--- a/modules/ppcp-button/src/Assets/SmartButton.php
+++ b/modules/ppcp-button/src/Assets/SmartButton.php
@@ -44,6 +44,13 @@ class SmartButton implements SmartButtonInterface {
*/
private $module_url;
+ /**
+ * The assets version.
+ *
+ * @var string
+ */
+ private $version;
+
/**
* The Session Handler.
*
@@ -125,6 +132,7 @@ class SmartButton implements SmartButtonInterface {
* SmartButton constructor.
*
* @param string $module_url The URL to the module.
+ * @param string $version The assets version.
* @param SessionHandler $session_handler The Session Handler.
* @param Settings $settings The Settings.
* @param PayerFactory $payer_factory The Payer factory.
@@ -140,6 +148,7 @@ class SmartButton implements SmartButtonInterface {
*/
public function __construct(
string $module_url,
+ string $version,
SessionHandler $session_handler,
Settings $settings,
PayerFactory $payer_factory,
@@ -155,6 +164,7 @@ class SmartButton implements SmartButtonInterface {
) {
$this->module_url = $module_url;
+ $this->version = $version;
$this->session_handler = $session_handler;
$this->settings = $settings;
$this->payer_factory = $payer_factory;
@@ -406,7 +416,7 @@ class SmartButton implements SmartButtonInterface {
'ppcp-hosted-fields',
untrailingslashit( $this->module_url ) . '/assets/css/hosted-fields.css',
array(),
- 1
+ $this->version
);
}
if ( $load_script ) {
@@ -414,7 +424,7 @@ class SmartButton implements SmartButtonInterface {
'ppcp-smart-button',
untrailingslashit( $this->module_url ) . '/assets/js/button.js',
array( 'jquery' ),
- '1.3.2',
+ $this->version,
true
);
@@ -1012,38 +1022,50 @@ class SmartButton implements SmartButtonInterface {
}
/**
- * Return action name PayPal buttons will be rendered at on checkout page.
+ * Returns the action name that PayPal button will use for rendering on the checkout page.
*
* @return string Action name.
*/
private function checkout_button_renderer_hook(): string {
+ /**
+ * The filter returning the action name that PayPal button will use for rendering on the checkout page.
+ */
return (string) apply_filters( 'woocommerce_paypal_payments_checkout_button_renderer_hook', 'woocommerce_review_order_after_payment' );
}
/**
- * Return action name PayPal DCC button will be rendered at on checkout page.
+ * Returns the action name that PayPal DCC button will use for rendering on the checkout page.
*
* @return string
*/
private function checkout_dcc_button_renderer_hook(): string {
+ /**
+ * The filter returning the action name that PayPal DCC button will use for rendering on the checkout page.
+ */
return (string) apply_filters( 'woocommerce_paypal_payments_checkout_dcc_renderer_hook', 'woocommerce_review_order_after_submit' );
}
/**
- * Return action name PayPal button and Pay Later message will be rendered at on pay-order page.
+ * Returns the action name that PayPal button and Pay Later message will use for rendering on the pay-order page.
*
* @return string
*/
private function pay_order_renderer_hook(): string {
+ /**
+ * The filter returning the action name that PayPal button and Pay Later message will use for rendering on the pay-order page.
+ */
return (string) apply_filters( 'woocommerce_paypal_payments_pay_order_dcc_renderer_hook', 'woocommerce_pay_order_after_submit' );
}
/**
- * Return action name PayPal button will be rendered next to Proceed to checkout button (normally displayed in cart).
+ * Returns action name that PayPal button will use for rendering next to Proceed to checkout button (normally displayed in cart).
*
* @return string
*/
private function proceed_to_checkout_button_renderer_hook(): string {
+ /**
+ * The filter returning the action name that PayPal button will use for rendering next to Proceed to checkout button (normally displayed in cart).
+ */
return (string) apply_filters(
'woocommerce_paypal_payments_proceed_to_checkout_button_renderer_hook',
'woocommerce_proceed_to_checkout'
@@ -1051,11 +1073,14 @@ class SmartButton implements SmartButtonInterface {
}
/**
- * Return action name PayPal button will be rendered in the WC mini cart.
+ * Returns the action name that PayPal button will use for rendering in the WC mini cart.
*
* @return string
*/
private function mini_cart_button_renderer_hook(): string {
+ /**
+ * The filter returning the action name that PayPal button will use for rendering in the WC mini cart.
+ */
return (string) apply_filters(
'woocommerce_paypal_payments_mini_cart_button_renderer_hook',
'woocommerce_widget_shopping_cart_after_buttons'
@@ -1063,11 +1088,14 @@ class SmartButton implements SmartButtonInterface {
}
/**
- * Return action name PayPal button and Pay Later message will be rendered at on the single product page.
+ * Returns the action name that PayPal button and Pay Later message will use for rendering on the single product page.
*
* @return string
*/
private function single_product_renderer_hook(): string {
+ /**
+ * The filter returning the action name that PayPal button and Pay Later message will use for rendering on the single product page.
+ */
return (string) apply_filters( 'woocommerce_paypal_payments_single_product_renderer_hook', 'woocommerce_single_product_summary' );
}
}
diff --git a/modules/ppcp-compat/src/PPEC/PPECHelper.php b/modules/ppcp-compat/src/PPEC/PPECHelper.php
index 09fca3c19..71e16e544 100644
--- a/modules/ppcp-compat/src/PPEC/PPECHelper.php
+++ b/modules/ppcp-compat/src/PPEC/PPECHelper.php
@@ -89,6 +89,9 @@ class PPECHelper {
* @return bool
*/
public static function use_ppec_compat_layer_for_subscriptions() {
+ /**
+ * The filter returning whether the compatibility layer for PPEC Subscriptions should be initialized.
+ */
return ( ! self::is_gateway_available() ) && self::site_has_ppec_subscriptions() && apply_filters( 'woocommerce_paypal_payments_process_legacy_subscriptions', true );
}
diff --git a/modules/ppcp-onboarding/assets/css/onboarding.css b/modules/ppcp-onboarding/assets/css/onboarding.css
index affc68415..084b96a22 100644
--- a/modules/ppcp-onboarding/assets/css/onboarding.css
+++ b/modules/ppcp-onboarding/assets/css/onboarding.css
@@ -2,41 +2,28 @@
display: none;
}
-#field-merchant_email_production,
-#field-ppcp_disconnect_sandbox,
-#field-ppcp_disconnect_production,
-#field-merchant_id_production,
-#field-client_id_production,
-#field-client_secret_production,
-#field-merchant_email_sandbox,
-#field-merchant_id_sandbox,
-#field-client_id_sandbox,
-#field-client_secret_sandbox{
+.ppcp-onboarded .ppcp-onboarding-element:not(.ppcp-always-shown-element) {
display: none;
}
-#field-merchant_email_production.show,
-#field-ppcp_disconnect_sandbox.show,
-#field-ppcp_disconnect_production.show,
-#field-merchant_id_production.show,
-#field-client_id_production.show,
-#field-client_secret_production.show,
-#field-merchant_email_sandbox.show,
-#field-merchant_id_sandbox.show,
-#field-client_id_sandbox.show,
-#field-client_secret_sandbox.show {
+
+.ppcp-onboarding .ppcp-settings-field:not(.ppcp-onboarding-element):not(.ppcp-always-shown-element) {
+ display: none;
+}
+
+.ppcp-settings-field.hide {
+ display: none;
+}
+
+.ppcp-settings-field.show {
display: table-row;
}
-#field-toggle_manual_input span.hide,
-#field-toggle_manual_input.show span.show{
- display: none;
-}
-#field-toggle_manual_input.show span.hide {
- display: unset;
+label.error {
+ color: red;
+ font-weight: bold;
}
-#field-production_toggle_manual_input button,
-#field-sandbox_toggle_manual_input button {
+#field-toggle_manual_input button {
color: #0073aa;
transition-property: border, background, color;
transition-duration: .05s;
@@ -49,39 +36,8 @@
padding: 0;
}
-#field-sandbox_toggle_manual_input.onboarded,
-#field-production_toggle_manual_input.onboarded {
- display: none;
-}
-
-
-#field-ppcp_disconnect_sandbox.onboarded,
-#field-ppcp_disconnect_production.onboarded,
-#field-merchant_email_sandbox.onboarded,
-#field-merchant_id_sandbox.onboarded,
-#field-client_id_sandbox.onboarded,
-#field-client_secret_sandbox.onboarded,
-#field-merchant_email_production.onboarded,
-#field-merchant_id_production.onboarded,
-#field-client_id_production.onboarded,
-#field-client_secret_production.onboarded {
- display:table-row;
-}
-#field-ppcp_disconnect_sandbox.onboarded.hide,
-#field-ppcp_disconnect_production.onboarded.hide,
-#field-merchant_email_sandbox.onboarded.hide,
-#field-merchant_id_sandbox.onboarded.hide,
-#field-client_id_sandbox.onboarded.hide,
-#field-client_secret_sandbox.onboarded.hide,
-#field-merchant_email_production.onboarded.hide,
-#field-merchant_id_production.onboarded.hide,
-#field-client_id_production.onboarded.hide,
-#field-client_secret_production.onboarded.hide {
- display:none;
-}
-
/* Probably not the best location for this but will do until there's a general purpose settings CSS file. */
-.ppcp-settings-field-heading td, .ppcp-settings-field-heading th {
+.ppcp-settings-field-heading td, .ppcp-settings-field-heading th, .ppcp-settings-no-title-col td {
padding-left: 0;
}
@@ -92,3 +48,83 @@
.input-text[pattern]:invalid {
border: red solid 2px;
}
+
+ul.ppcp-onboarding-options, ul.ppcp-onboarding-options-sublist {
+ list-style: none;
+}
+
+ul.ppcp-onboarding-options-sublist {
+ margin-left: 15px;
+}
+
+.ppcp-muted-text {
+ opacity: 0.6;
+ font-size: 85%;
+}
+
+#field-ppcp_onboarading_header > td, #field-ppcp_onboarading_options > td {
+ padding: 0;
+}
+
+.ppcp-onboarding-header, .ppcp-onboarding-cards-options {
+ display: flex;
+ width: 1200px;
+}
+
+.ppcp-onboarding-header-left, .ppcp-onboarding-header-right {
+ flex: 50%;
+}
+
+.ppcp-onboarding-header-right {
+ text-align: right;
+}
+
+.ppcp-onboarding-header h2 {
+ margin-top: 0;
+}
+
+.ppcp-onboarding-header-left img {
+ height: 60px;
+}
+
+.ppcp-onboarding-header-cards img, .ppcp-onboarding-header-paypal-logos img {
+ margin: 5px;
+}
+
+.ppcp-onboarding-header-cards img {
+ height: 37px;
+}
+
+.ppcp-onboarding-header-paypal-logos img {
+ height: 32px;
+}
+
+.ppcp-onboarding-cards-options table {
+ margin-left: 35px;
+ margin-right: 15px;
+}
+
+.ppcp-onboarding-cards-options table td {
+ padding-top: 2px;
+}
+
+.ppcp-onboarding-cards-options table td:first-child {
+ vertical-align: top;
+}
+
+.ppcp-onboarding-cards-options table tr:not(:last-child) td {
+ padding-bottom: 0;
+}
+
+.ppcp-onboarding-cards-options table tr td:first-child {
+ width: 350px;
+}
+
+.ppcp-onboarding-cards-screen {
+ flex: 1;
+ align-self: center;
+}
+
+.ppcp-onboarding-cards-screen img {
+ width: 100%;
+}
diff --git a/modules/ppcp-onboarding/assets/images/cards-screen-acdc.png b/modules/ppcp-onboarding/assets/images/cards-screen-acdc.png
new file mode 100644
index 000000000..028012bb1
Binary files /dev/null and b/modules/ppcp-onboarding/assets/images/cards-screen-acdc.png differ
diff --git a/modules/ppcp-onboarding/assets/images/cards-screen-basic.png b/modules/ppcp-onboarding/assets/images/cards-screen-basic.png
new file mode 100644
index 000000000..106902102
Binary files /dev/null and b/modules/ppcp-onboarding/assets/images/cards-screen-basic.png differ
diff --git a/modules/ppcp-onboarding/assets/js/onboarding.js b/modules/ppcp-onboarding/assets/js/onboarding.js
index fd63915ff..0753ad943 100644
--- a/modules/ppcp-onboarding/assets/js/onboarding.js
+++ b/modules/ppcp-onboarding/assets/js/onboarding.js
@@ -1,9 +1,11 @@
-// Onboarding.
const ppcp_onboarding = {
BUTTON_SELECTOR: '[data-paypal-onboard-button]',
PAYPAL_JS_ID: 'ppcp-onboarding-paypal-js',
_timeout: false,
+ STATE_START: 'start',
+ STATE_ONBOARDED: 'onboarded',
+
init: function() {
document.addEventListener('DOMContentLoaded', this.reload);
},
@@ -15,7 +17,7 @@ const ppcp_onboarding = {
return;
}
- // Add event listeners to buttons.
+ // Add event listeners to buttons preventing link clicking if PayPal init failed.
buttons.forEach(
(element) => {
if (element.hasAttribute('data-ppcp-button-initialized')) {
@@ -83,14 +85,13 @@ const ppcp_onboarding = {
authCode: authCode,
sharedId: sharedId,
nonce: PayPalCommerceGatewayOnboarding.nonce,
- env: env
+ env: env,
+ acceptCards: document.querySelector('#ppcp-onboarding-accept-cards').checked,
}
)
}
);
},
-
-
};
function ppcp_onboarding_sandboxCallback(...args) {
@@ -101,150 +102,151 @@ function ppcp_onboarding_productionCallback(...args) {
return ppcp_onboarding.loginSeller('production', ...args);
}
-/**
- * Since the PayPal modal will redirect the user a dirty form
- * provokes an alert if the user wants to leave the page. Since the user
- * needs to toggle the sandbox switch, we disable this dirty state with the
- * following workaround for checkboxes.
- *
- * @param event
- */
-const checkBoxOnClick = (event) => {
- const value = event.target.checked;
- if (event.target.getAttribute('id') === 'ppcp-sandbox_on') {
- toggleSandboxProduction(! value);
- }
- event.preventDefault();
- event.stopPropagation();
- setTimeout( () => {
- event.target.checked = value;
- },1
- );
-};
-
-/**
- * Toggles the credential input fields.
- *
- * @param forProduction
- */
-const credentialToggle = (forProduction) => {
-
- const sandboxClassSelectors = [
- '#field-ppcp_disconnect_sandbox',
- '#field-merchant_email_sandbox',
- '#field-merchant_id_sandbox',
- '#field-client_id_sandbox',
- '#field-client_secret_sandbox',
- ];
- const productionClassSelectors = [
- '#field-ppcp_disconnect_production',
- '#field-merchant_email_production',
- '#field-merchant_id_production',
- '#field-client_id_production',
- '#field-client_secret_production',
- ];
-
- const selectors = forProduction ? productionClassSelectors : sandboxClassSelectors;
- document.querySelectorAll(selectors.join()).forEach(
- (element) => {element.classList.toggle('show')}
- )
-};
-
-/**
- * Toggles the visibility of the sandbox/production input fields.
- *
- * @param showProduction
- */
-const toggleSandboxProduction = (showProduction) => {
- const productionDisplaySelectors = [
- '#field-credentials_production_heading',
- '#field-production_toggle_manual_input',
- '#field-ppcp_onboarding_production',
- ];
- const productionClassSelectors = [
-
- '#field-ppcp_disconnect_production',
- '#field-merchant_email_production',
- '#field-merchant_id_production',
- '#field-client_id_production',
- '#field-client_secret_production',
- ];
- const sandboxDisplaySelectors = [
- '#field-credentials_sandbox_heading',
- '#field-sandbox_toggle_manual_input',
- '#field-ppcp_onboarding_sandbox',
- ];
- const sandboxClassSelectors = [
- '#field-ppcp_disconnect_sandbox',
- '#field-merchant_email_sandbox',
- '#field-merchant_id_sandbox',
- '#field-client_id_sandbox',
- '#field-client_secret_sandbox',
- ];
-
- if (showProduction) {
- document.querySelectorAll(productionDisplaySelectors.join()).forEach(
- (element) => {element.style.display = ''}
- );
- document.querySelectorAll(sandboxDisplaySelectors.join()).forEach(
- (element) => {element.style.display = 'none'}
- );
- document.querySelectorAll(productionClassSelectors.join()).forEach(
- (element) => {element.classList.remove('hide')}
- );
- document.querySelectorAll(sandboxClassSelectors.join()).forEach(
- (element) => {
- element.classList.remove('show');
- element.classList.add('hide');
- }
- );
- return;
- }
- document.querySelectorAll(productionDisplaySelectors.join()).forEach(
- (element) => {element.style.display = 'none'}
- );
- document.querySelectorAll(sandboxDisplaySelectors.join()).forEach(
- (element) => {element.style.display = ''}
- );
-
- document.querySelectorAll(sandboxClassSelectors.join()).forEach(
- (element) => {element.classList.remove('hide')}
- );
- document.querySelectorAll(productionClassSelectors.join()).forEach(
- (element) => {
- element.classList.remove('show');
- element.classList.add('hide');
- }
- )
-};
-
-const disconnect = (event) => {
- event.preventDefault();
- const fields = event.target.classList.contains('production') ? [
- '#field-merchant_email_production input',
- '#field-merchant_id_production input',
- '#field-client_id_production input',
- '#field-client_secret_production input',
- ] : [
- '#field-merchant_email_sandbox input',
- '#field-merchant_id_sandbox input',
- '#field-client_id_sandbox input',
- '#field-client_secret_sandbox input',
- ];
-
- document.querySelectorAll(fields.join()).forEach(
- (element) => {
- element.value = '';
- }
- );
- document.querySelector('.woocommerce-save-button').click();
-};
-
(() => {
- const sandboxSwitchElement = document.querySelector('#ppcp-sandbox_on');
- if (sandboxSwitchElement) {
- toggleSandboxProduction(! sandboxSwitchElement.checked);
- }
+ const productionCredentialElementsSelectors = [
+ '#field-merchant_email_production',
+ '#field-merchant_id_production',
+ '#field-client_id_production',
+ '#field-client_secret_production',
+ ];
+ const sandboxCredentialElementsSelectors = [
+ '#field-merchant_email_sandbox',
+ '#field-merchant_id_sandbox',
+ '#field-client_id_sandbox',
+ '#field-client_secret_sandbox',
+ ];
+
+ const updateOptionsState = () => {
+ const cardsChk = document.querySelector('#ppcp-onboarding-accept-cards');
+ if (!cardsChk) {
+ return;
+ }
+
+ document.querySelectorAll('#ppcp-onboarding-dcc-options input').forEach(input => {
+ input.disabled = !cardsChk.checked;
+ });
+
+ const basicRb = document.querySelector('#ppcp-onboarding-dcc-basic');
+
+ const isExpress = !cardsChk.checked || basicRb.checked;
+
+ const expressButtonSelectors = [
+ '#field-ppcp_onboarding_production_express',
+ '#field-ppcp_onboarding_sandbox_express',
+ ];
+ const ppcpButtonSelectors = [
+ '#field-ppcp_onboarding_production_ppcp',
+ '#field-ppcp_onboarding_sandbox_ppcp',
+ ];
+
+ document.querySelectorAll(expressButtonSelectors.join()).forEach(
+ element => element.style.display = isExpress ? '' : 'none'
+ );
+ document.querySelectorAll(ppcpButtonSelectors.join()).forEach(
+ element => element.style.display = !isExpress ? '' : 'none'
+ );
+
+ const screemImg = document.querySelector('#ppcp-onboarding-cards-screen-img');
+ if (screemImg) {
+ const currentRb = Array.from(document.querySelectorAll('#ppcp-onboarding-dcc-options input[type="radio"]'))
+ .filter(rb => rb.checked)[0] ?? null;
+
+ const imgUrl = currentRb.getAttribute('data-screen-url');
+ screemImg.src = imgUrl;
+ }
+ };
+
+ const updateManualInputControls = (shown, isSandbox, isAnyEnvOnboarded) => {
+ const productionElementsSelectors = productionCredentialElementsSelectors;
+ const sandboxElementsSelectors = sandboxCredentialElementsSelectors;
+ const otherElementsSelectors = [
+ '.woocommerce-save-button',
+ ];
+ if (!isAnyEnvOnboarded) {
+ otherElementsSelectors.push('#field-sandbox_on');
+ }
+
+ document.querySelectorAll(productionElementsSelectors.join()).forEach(
+ element => {
+ element.classList.remove('hide', 'show');
+ element.classList.add((shown && !isSandbox) ? 'show' : 'hide');
+ }
+ );
+ document.querySelectorAll(sandboxElementsSelectors.join()).forEach(
+ element => {
+ element.classList.remove('hide', 'show');
+ element.classList.add((shown && isSandbox) ? 'show' : 'hide');
+ }
+ );
+ document.querySelectorAll(otherElementsSelectors.join()).forEach(
+ element => element.style.display = shown ? '' : 'none'
+ );
+ };
+
+ const updateEnvironmentControls = (isSandbox) => {
+ const productionElementsSelectors = [
+ '#field-ppcp_disconnect_production',
+ '#field-credentials_production_heading',
+ ];
+ const sandboxElementsSelectors = [
+ '#field-ppcp_disconnect_sandbox',
+ '#field-credentials_sandbox_heading',
+ ];
+
+ document.querySelectorAll(productionElementsSelectors.join()).forEach(
+ element => element.style.display = !isSandbox ? '' : 'none'
+ );
+ document.querySelectorAll(sandboxElementsSelectors.join()).forEach(
+ element => element.style.display = isSandbox ? '' : 'none'
+ );
+ };
+
+ let isDisconnecting = false;
+
+ const disconnect = (event) => {
+ event.preventDefault();
+ const fields = event.target.classList.contains('production') ? productionCredentialElementsSelectors : sandboxCredentialElementsSelectors;
+
+ document.querySelectorAll(fields.map(f => f + ' input').join()).forEach(
+ (element) => {
+ element.value = '';
+ }
+ );
+
+ isDisconnecting = true;
+
+ document.querySelector('.woocommerce-save-button').click();
+ };
+
+ // Prevent the message about unsaved checkbox/radiobutton when reloading the page.
+ // (WC listens for changes on all inputs and sets dirty flag until form submission)
+ const preventDirtyCheckboxPropagation = event => {
+ event.preventDefault();
+ event.stopPropagation();
+
+ const value = event.target.checked;
+ setTimeout( () => {
+ event.target.checked = value;
+ }, 1
+ );
+ };
+
+ const sandboxSwitchElement = document.querySelector('#ppcp-sandbox_on');
+
+ const validate = () => {
+ const selectors = sandboxSwitchElement.checked ? sandboxCredentialElementsSelectors : productionCredentialElementsSelectors;
+ const values = selectors.map(s => document.querySelector(s + ' input')).map(el => el.value);
+
+ const errors = [];
+ if (values.some(v => !v)) {
+ errors.push(PayPalCommerceGatewayOnboarding.error_messages.no_credentials);
+ }
+
+ return errors;
+ };
+
+ const isAnyEnvOnboarded = PayPalCommerceGatewayOnboarding.sandbox_state === ppcp_onboarding.STATE_ONBOARDED ||
+ PayPalCommerceGatewayOnboarding.production_state === ppcp_onboarding.STATE_ONBOARDED;
document.querySelectorAll('.ppcp-disconnect').forEach(
(button) => {
@@ -255,43 +257,89 @@ const disconnect = (event) => {
}
);
- // Prevent a possibly dirty form arising from this particular checkbox.
- if (sandboxSwitchElement) {
- sandboxSwitchElement.addEventListener(
- 'click',
- (event) => {
- const value = event.target.checked;
+ document.querySelectorAll('.ppcp-onboarding-options input').forEach(
+ (element) => {
+ element.addEventListener('click', event => {
+ updateOptionsState();
- toggleSandboxProduction( ! value );
+ preventDirtyCheckboxPropagation(event);
+ });
+ }
+ );
- event.preventDefault();
- event.stopPropagation();
- setTimeout( () => {
- event.target.checked = value;
- }, 1
- );
- }
- );
- }
+ const isSandboxInBackend = PayPalCommerceGatewayOnboarding.current_env === 'sandbox';
+ if (sandboxSwitchElement.checked !== isSandboxInBackend) {
+ sandboxSwitchElement.checked = isSandboxInBackend;
+ }
- // document.querySelectorAll('#mainform input[type="checkbox"]').forEach(
- // (checkbox) => {
- // checkbox.addEventListener('click', checkBoxOnClick);
- // }
- // );
+ updateOptionsState();
- document.querySelectorAll('#field-sandbox_toggle_manual_input button, #field-production_toggle_manual_input button').forEach(
- (button) => {
- button.addEventListener(
- 'click',
- (event) => {
- event.preventDefault();
- const isProduction = event.target.classList.contains('production-toggle');
- credentialToggle(isProduction);
- }
- )
- }
- );
+ const settingsContainer = document.querySelector('#mainform .form-table');
+
+ const markCurrentOnboardingState = (isOnboarded) => {
+ settingsContainer.classList.remove('ppcp-onboarded', 'ppcp-onboarding');
+ settingsContainer.classList.add(isOnboarded ? 'ppcp-onboarded' : 'ppcp-onboarding');
+ }
+
+ markCurrentOnboardingState(PayPalCommerceGatewayOnboarding.current_state === ppcp_onboarding.STATE_ONBOARDED);
+
+ const manualInputToggleButton = document.querySelector('#field-toggle_manual_input button');
+ let isManualInputShown = PayPalCommerceGatewayOnboarding.current_state === ppcp_onboarding.STATE_ONBOARDED;
+
+ manualInputToggleButton.addEventListener(
+ 'click',
+ (event) => {
+ event.preventDefault();
+
+ isManualInputShown = !isManualInputShown;
+
+ updateManualInputControls(isManualInputShown, sandboxSwitchElement.checked, isAnyEnvOnboarded);
+ }
+ );
+
+ sandboxSwitchElement.addEventListener(
+ 'click',
+ (event) => {
+ const isSandbox = sandboxSwitchElement.checked;
+
+ if (isAnyEnvOnboarded) {
+ const onboardingState = isSandbox ? PayPalCommerceGatewayOnboarding.sandbox_state : PayPalCommerceGatewayOnboarding.production_state;
+ const isOnboarded = onboardingState === ppcp_onboarding.STATE_ONBOARDED;
+
+ markCurrentOnboardingState(isOnboarded);
+ isManualInputShown = isOnboarded;
+ }
+
+ updateManualInputControls(isManualInputShown, isSandbox, isAnyEnvOnboarded);
+
+ updateEnvironmentControls(isSandbox);
+
+ preventDirtyCheckboxPropagation(event);
+ }
+ );
+
+ updateManualInputControls(isManualInputShown, sandboxSwitchElement.checked, isAnyEnvOnboarded);
+
+ updateEnvironmentControls(sandboxSwitchElement.checked);
+
+ document.querySelector('#mainform').addEventListener('submit', e => {
+ if (isDisconnecting) {
+ return;
+ }
+
+ const errors = validate();
+ if (errors.length) {
+ e.preventDefault();
+
+ const errorLabel = document.querySelector('#ppcp-form-errors-label');
+ errorLabel.parentElement.parentElement.classList.remove('hide');
+
+ errorLabel.innerHTML = errors.join('
');
+
+ errorLabel.scrollIntoView();
+ window.scrollBy(0, -120); // WP + WC floating header
+ }
+ });
// Onboarding buttons.
ppcp_onboarding.init();
diff --git a/modules/ppcp-onboarding/assets/js/settings.js b/modules/ppcp-onboarding/assets/js/settings.js
index e30b45856..9af409f07 100644
--- a/modules/ppcp-onboarding/assets/js/settings.js
+++ b/modules/ppcp-onboarding/assets/js/settings.js
@@ -23,7 +23,7 @@ document.addEventListener(
}
group.forEach( (elementToShow) => {
- document.querySelector(elementToShow).style.display = 'table-row';
+ document.querySelector(elementToShow).style.display = '';
})
if('ppcp-message_enabled' === event.target.getAttribute('id')){
@@ -56,7 +56,7 @@ document.addEventListener(
return;
}
if (value === elementToToggle.value && domElement.style.display !== 'none') {
- domElement.style.display = 'table-row';
+ domElement.style.display = '';
return;
}
domElement.style.display = 'none';
@@ -69,7 +69,7 @@ document.addEventListener(
const value = event.target.value;
group.forEach( (elementToToggle) => {
if (value === elementToToggle.value) {
- document.querySelector(elementToToggle.selector).style.display = 'table-row';
+ document.querySelector(elementToToggle.selector).style.display = '';
return;
}
document.querySelector(elementToToggle.selector).style.display = 'none';
diff --git a/modules/ppcp-onboarding/services.php b/modules/ppcp-onboarding/services.php
index cb0e17590..a3a2fec58 100644
--- a/modules/ppcp-onboarding/services.php
+++ b/modules/ppcp-onboarding/services.php
@@ -18,6 +18,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PartnerReferrals;
use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
use WooCommerce\PayPalCommerce\Onboarding\Assets\OnboardingAssets;
use WooCommerce\PayPalCommerce\Onboarding\Endpoint\LoginSellerEndpoint;
+use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingOptionsRenderer;
use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingRenderer;
use WooCommerce\PayPalCommerce\Onboarding\OnboardingRESTController;
@@ -117,9 +118,8 @@ return array(
);
},
'onboarding.state' => function( ContainerInterface $container ) : State {
- $environment = $container->get( 'onboarding.environment' );
$settings = $container->get( 'wcgateway.settings' );
- return new State( $environment, $settings );
+ return new State( $settings );
},
'onboarding.environment' => function( ContainerInterface $container ) : Environment {
$settings = $container->get( 'wcgateway.settings' );
@@ -131,8 +131,11 @@ return array(
$login_seller_endpoint = $container->get( 'onboarding.endpoint.login-seller' );
return new OnboardingAssets(
$container->get( 'onboarding.url' ),
+ $container->get( 'ppcp.asset-version' ),
$state,
- $login_seller_endpoint
+ $container->get( 'onboarding.environment' ),
+ $login_seller_endpoint,
+ $container->get( 'wcgateway.current-ppcp-settings-page-id' )
);
},
@@ -188,7 +191,6 @@ return array(
return new PartnerReferrals(
CONNECT_WOO_SANDBOX_URL,
new ConnectBearer(),
- $container->get( 'api.repository.partner-referrals-data' ),
$container->get( 'woocommerce.logger.woocommerce' )
);
},
@@ -197,7 +199,6 @@ return array(
return new PartnerReferrals(
CONNECT_WOO_URL,
new ConnectBearer(),
- $container->get( 'api.repository.partner-referrals-data' ),
$container->get( 'woocommerce.logger.woocommerce' )
);
},
@@ -205,11 +206,18 @@ return array(
$partner_referrals = $container->get( 'api.endpoint.partner-referrals-production' );
$partner_referrals_sandbox = $container->get( 'api.endpoint.partner-referrals-sandbox' );
+ $partner_referrals_data = $container->get( 'api.repository.partner-referrals-data' );
$settings = $container->get( 'wcgateway.settings' );
return new OnboardingRenderer(
$settings,
$partner_referrals,
- $partner_referrals_sandbox
+ $partner_referrals_sandbox,
+ $partner_referrals_data
+ );
+ },
+ 'onboarding.render-options' => static function ( ContainerInterface $container ) : OnboardingOptionsRenderer {
+ return new OnboardingOptionsRenderer(
+ $container->get( 'onboarding.url' )
);
},
'onboarding.rest' => static function( $container ) : OnboardingRESTController {
diff --git a/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php b/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php
index 57a632860..55e99c0d1 100644
--- a/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php
+++ b/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php
@@ -10,7 +10,9 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\Onboarding\Assets;
use WooCommerce\PayPalCommerce\Onboarding\Endpoint\LoginSellerEndpoint;
+use WooCommerce\PayPalCommerce\Onboarding\Environment;
use WooCommerce\PayPalCommerce\Onboarding\State;
+use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
/**
* Class OnboardingAssets
@@ -24,6 +26,13 @@ class OnboardingAssets {
*/
private $module_url;
+ /**
+ * The assets version.
+ *
+ * @var string
+ */
+ private $version;
+
/**
* The State.
*
@@ -31,6 +40,13 @@ class OnboardingAssets {
*/
private $state;
+ /**
+ * The Environment.
+ *
+ * @var Environment
+ */
+ private $environment;
+
/**
* The LoginSeller Endpoint.
*
@@ -38,22 +54,38 @@ class OnboardingAssets {
*/
private $login_seller_endpoint;
+ /**
+ * ID of the current PPCP gateway settings page, or empty if it is not such page.
+ *
+ * @var string
+ */
+ protected $page_id;
+
/**
* OnboardingAssets constructor.
*
* @param string $module_url The URL to the module.
+ * @param string $version The assets version.
* @param State $state The State object.
+ * @param Environment $environment The Environment.
* @param LoginSellerEndpoint $login_seller_endpoint The LoginSeller endpoint.
+ * @param string $page_id ID of the current PPCP gateway settings page, or empty if it is not such page.
*/
public function __construct(
string $module_url,
+ string $version,
State $state,
- LoginSellerEndpoint $login_seller_endpoint
+ Environment $environment,
+ LoginSellerEndpoint $login_seller_endpoint,
+ string $page_id
) {
$this->module_url = untrailingslashit( $module_url );
+ $this->version = $version;
$this->state = $state;
+ $this->environment = $environment;
$this->login_seller_endpoint = $login_seller_endpoint;
+ $this->page_id = $page_id;
}
/**
@@ -68,14 +100,14 @@ class OnboardingAssets {
'ppcp-onboarding',
$url,
array(),
- 1
+ $this->version
);
$url = untrailingslashit( $this->module_url ) . '/assets/js/settings.js';
wp_register_script(
'ppcp-settings',
$url,
array(),
- 1,
+ $this->version,
true
);
@@ -84,7 +116,7 @@ class OnboardingAssets {
'ppcp-onboarding',
$url,
array( 'jquery' ),
- 1,
+ $this->version,
true
);
wp_localize_script(
@@ -103,9 +135,16 @@ class OnboardingAssets {
*/
public function get_script_data() {
return array(
- 'endpoint' => home_url( \WC_AJAX::get_endpoint( LoginSellerEndpoint::ENDPOINT ) ),
- 'nonce' => wp_create_nonce( $this->login_seller_endpoint::nonce() ),
- 'paypal_js_url' => 'https://www.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js',
+ 'endpoint' => home_url( \WC_AJAX::get_endpoint( LoginSellerEndpoint::ENDPOINT ) ),
+ 'nonce' => wp_create_nonce( $this->login_seller_endpoint::nonce() ),
+ 'paypal_js_url' => 'https://www.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js',
+ 'sandbox_state' => State::get_state_name( $this->state->sandbox_state() ),
+ 'production_state' => State::get_state_name( $this->state->production_state() ),
+ 'current_state' => State::get_state_name( $this->state->current_state() ),
+ 'current_env' => $this->environment->current_environment(),
+ 'error_messages' => array(
+ 'no_credentials' => __( 'API credentials must be entered to save the settings.', 'woocommerce-paypal-payments' ),
+ ),
);
}
@@ -131,7 +170,6 @@ class OnboardingAssets {
* @return bool
*/
private function should_render_onboarding_script(): bool {
- global $current_section;
- return 'ppcp-gateway' === $current_section;
+ return PayPalGateway::ID === $this->page_id;
}
}
diff --git a/modules/ppcp-onboarding/src/Endpoint/LoginSellerEndpoint.php b/modules/ppcp-onboarding/src/Endpoint/LoginSellerEndpoint.php
index 38b54331b..b8a458609 100644
--- a/modules/ppcp-onboarding/src/Endpoint/LoginSellerEndpoint.php
+++ b/modules/ppcp-onboarding/src/Endpoint/LoginSellerEndpoint.php
@@ -128,6 +128,7 @@ class LoginSellerEndpoint implements EndpointInterface {
$this->settings->set( 'sandbox_on', $is_sandbox );
$this->settings->set( 'products_dcc_enabled', null );
$this->settings->persist();
+
$endpoint = $is_sandbox ? $this->login_seller_sandbox : $this->login_seller_production;
$credentials = $endpoint->credentials_for(
$data['sharedId'],
@@ -143,10 +144,30 @@ class LoginSellerEndpoint implements EndpointInterface {
}
$this->settings->set( 'client_secret', $credentials->client_secret );
$this->settings->set( 'client_id', $credentials->client_id );
+
+ $accept_cards = (bool) ( $data['acceptCards'] ?? true );
+ $funding_sources = array();
+ if ( $this->settings->get( 'disable_funding' ) ) {
+ $funding_sources = $this->settings->get( 'disable_funding' );
+ if ( ! is_array( $funding_sources ) ) {
+ $funding_sources = array();
+ }
+ }
+ if ( $accept_cards ) {
+ $funding_sources = array_diff( $funding_sources, array( 'card' ) );
+ } else {
+ if ( ! in_array( 'card', $funding_sources, true ) ) {
+ $funding_sources[] = 'card';
+ }
+ }
+ $this->settings->set( 'disable_funding', $funding_sources );
+
$this->settings->persist();
+
if ( $this->cache->has( PayPalBearer::CACHE_KEY ) ) {
$this->cache->delete( PayPalBearer::CACHE_KEY );
}
+
wp_schedule_single_event(
time() + 5,
WebhookRegistrar::EVENT_HOOK
diff --git a/modules/ppcp-onboarding/src/OnboardingModule.php b/modules/ppcp-onboarding/src/OnboardingModule.php
index d05b9509f..0960c7b6c 100644
--- a/modules/ppcp-onboarding/src/OnboardingModule.php
+++ b/modules/ppcp-onboarding/src/OnboardingModule.php
@@ -65,16 +65,15 @@ class OnboardingModule implements ModuleInterface {
if ( 'ppcp_onboarding' !== $config['type'] ) {
return $field;
}
- $renderer = $c->get( 'onboarding.render' );
- $is_production = 'production' === $config['env'];
- /**
- * The OnboardingRenderer.
- *
- * @var OnboardingRenderer $renderer
- */
+ $renderer = $c->get( 'onboarding.render' );
+ assert( $renderer instanceof OnboardingRenderer );
+
+ $is_production = 'production' === $config['env'];
+ $products = $config['products'];
+
ob_start();
- $renderer->render( $is_production );
+ $renderer->render( $is_production, $products );
$content = ob_get_contents();
ob_end_clean();
return $content;
diff --git a/modules/ppcp-onboarding/src/OnboardingRESTController.php b/modules/ppcp-onboarding/src/OnboardingRESTController.php
index 9a5fae43a..209534564 100644
--- a/modules/ppcp-onboarding/src/OnboardingRESTController.php
+++ b/modules/ppcp-onboarding/src/OnboardingRESTController.php
@@ -10,7 +10,6 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\Onboarding;
use Psr\Container\ContainerInterface;
-use WooCommerce\PayPalCommerce\Onboarding\State;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
/**
@@ -138,13 +137,13 @@ class OnboardingRESTController {
return array(
'environment' => $environment->current_environment(),
'onboarded' => ( $state->current_state() >= State::STATE_ONBOARDED ),
- 'state' => $this->get_onboarding_state_name( $state->current_state() ),
+ 'state' => State::get_state_name( $state->current_state() ),
'sandbox' => array(
- 'state' => $this->get_onboarding_state_name( $state->sandbox_state() ),
+ 'state' => State::get_state_name( $state->sandbox_state() ),
'onboarded' => ( $state->sandbox_state() >= State::STATE_ONBOARDED ),
),
'production' => array(
- 'state' => $this->get_onboarding_state_name( $state->production_state() ),
+ 'state' => State::get_state_name( $state->production_state() ),
'onboarded' => ( $state->production_state() >= State::STATE_ONBOARDED ),
),
);
@@ -265,34 +264,6 @@ class OnboardingRESTController {
return add_query_arg( $this->return_url_args, $url );
}
- /**
- * Translates an onboarding state to a string.
- *
- * @param int $state An onboarding state to translate as returned by {@link State} methods.
- * @return string A string representing the state: "start", "progressive" or "onboarded".
- * @see State::current_state(), State::sandbox_state(), State::production_state().
- */
- public function get_onboarding_state_name( $state ) {
- $name = 'unknown';
-
- switch ( absint( $state ) ) {
- case State::STATE_START:
- $name = 'start';
- break;
- case State::STATE_PROGRESSIVE:
- $name = 'progressive';
- break;
- case State::STATE_ONBOARDED:
- $name = 'onboarded';
- break;
- default:
- break;
-
- }
-
- return $name;
- }
-
/**
* Generates a signup link for onboarding for a given environment and optionally adding certain URL arguments
* to the URL users are redirected after completing the onboarding flow.
diff --git a/modules/ppcp-onboarding/src/Render/OnboardingOptionsRenderer.php b/modules/ppcp-onboarding/src/Render/OnboardingOptionsRenderer.php
new file mode 100644
index 000000000..be69cf4ce
--- /dev/null
+++ b/modules/ppcp-onboarding/src/Render/OnboardingOptionsRenderer.php
@@ -0,0 +1,199 @@
+module_url = $module_url;
+ }
+
+ /**
+ * Renders the onboarding options.
+ *
+ * @param bool $is_shop_supports_dcc Whether the shop can use DCC (country, currency).
+ */
+ public function render( bool $is_shop_supports_dcc ): string {
+ return '
+