mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 12:25:15 +08:00
Fix merge conflicts
This commit is contained in:
commit
9055c702e7
52 changed files with 4882 additions and 1004 deletions
|
@ -8,3 +8,23 @@ if (!defined('MONTH_IN_SECONDS')) {
|
|||
if (!defined('HOUR_IN_SECONDS')) {
|
||||
define('HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel the next occurrence of a scheduled action.
|
||||
*
|
||||
* While only the next instance of a recurring or cron action is unscheduled by this method, that will also prevent
|
||||
* all future instances of that recurring or cron action from being run. Recurring and cron actions are scheduled in
|
||||
* a sequence instead of all being scheduled at once. Each successive occurrence of a recurring action is scheduled
|
||||
* only after the former action is run. If the next instance is never run, because it's unscheduled by this function,
|
||||
* then the following instance will never be scheduled (or exist), which is effectively the same as being unscheduled
|
||||
* by this method also.
|
||||
*
|
||||
* @param string $hook The hook that the job will trigger.
|
||||
* @param array $args Args that would have been passed to the job.
|
||||
* @param string $group The group the job is assigned to.
|
||||
*
|
||||
* @return string|null The scheduled action ID if a scheduled action was found, or null if no matching action found.
|
||||
*/
|
||||
function as_unschedule_action($hook, $args = array(), $group = '')
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
*** Changelog ***
|
||||
|
||||
= 2.0.2 - TBD =
|
||||
* Fix - Do not call PayPal get order by ID if it does not exist #1029
|
||||
* Fix - Type check error conflict with German Market #1056
|
||||
* Enhancement - Remove plugin data after uninstalling #1075
|
||||
* Enhancement - Add FraudNet to all payments #1040
|
||||
* Enhancement - Update "Standard Payments" tab settings #1065
|
||||
* Enhancement - Update PHP 7.2 requirement in all relevant files #1084
|
||||
|
||||
= 2.0.1 - 2022-12-13 =
|
||||
* Fix - Error while syncing tracking data to PayPal -> Sync GZD Tracking #1020
|
||||
* Fix - Fix product price retrieval for variable product buttons #1000
|
||||
|
|
412
composer.lock
generated
412
composer.lock
generated
|
@ -35,6 +35,10 @@
|
|||
],
|
||||
"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"
|
||||
},
|
||||
{
|
||||
|
@ -86,6 +90,10 @@
|
|||
}
|
||||
],
|
||||
"description": "Interfaces for human readable string interoperation.",
|
||||
"support": {
|
||||
"issues": "https://github.com/Dhii/human-readable-interface/issues",
|
||||
"source": "https://github.com/Dhii/human-readable-interface/tree/v0.2.0-alpha1"
|
||||
},
|
||||
"time": "2021-03-05T00:36:01+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -134,6 +142,10 @@
|
|||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
{
|
||||
|
@ -177,6 +189,10 @@
|
|||
}
|
||||
],
|
||||
"description": "Interfaces for package-related interop",
|
||||
"support": {
|
||||
"issues": "https://github.com/Dhii/package-interface/issues",
|
||||
"source": "https://github.com/Dhii/package-interface/tree/v0.1.0-alpha4"
|
||||
},
|
||||
"time": "2021-12-08T15:57:36+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -225,6 +241,10 @@
|
|||
}
|
||||
],
|
||||
"description": "A base interface for validators",
|
||||
"support": {
|
||||
"issues": "https://github.com/Dhii/validation-interface/issues",
|
||||
"source": "https://github.com/Dhii/validation-interface/tree/v0.3.0-alpha3"
|
||||
},
|
||||
"time": "2021-01-14T16:19:20+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -268,6 +288,10 @@
|
|||
}
|
||||
],
|
||||
"description": "Implementation for dealing with SemVer-compliant versions",
|
||||
"support": {
|
||||
"issues": "https://github.com/Dhii/versions/issues",
|
||||
"source": "https://github.com/Dhii/versions/tree/v0.1.0-alpha3"
|
||||
},
|
||||
"time": "2021-12-08T16:54:50+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -312,6 +336,10 @@
|
|||
"container-interop",
|
||||
"psr"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-fig/container/issues",
|
||||
"source": "https://github.com/php-fig/container/tree/1.1.1"
|
||||
},
|
||||
"time": "2021-03-05T17:36:06+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -359,6 +387,9 @@
|
|||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/php-fig/log/tree/1.1.4"
|
||||
},
|
||||
"time": "2021-05-03T11:20:27+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -399,6 +430,10 @@
|
|||
}
|
||||
],
|
||||
"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"
|
||||
},
|
||||
{
|
||||
|
@ -465,6 +500,9 @@
|
|||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
|
@ -528,6 +566,10 @@
|
|||
}
|
||||
],
|
||||
"description": "Composer plugin to merge multiple composer.json files",
|
||||
"support": {
|
||||
"issues": "https://github.com/wikimedia/composer-merge-plugin/issues",
|
||||
"source": "https://github.com/wikimedia/composer-merge-plugin/tree/v2.0.1"
|
||||
},
|
||||
"time": "2021-02-24T05:28:06+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -576,6 +618,10 @@
|
|||
}
|
||||
],
|
||||
"description": "Interfaces for interop within WordPress",
|
||||
"support": {
|
||||
"issues": "https://github.com/wp-oop/wordpress-interface/issues",
|
||||
"source": "https://github.com/wp-oop/wordpress-interface/tree/v0.1.0-alpha2"
|
||||
},
|
||||
"time": "2021-04-30T09:37:37+00:00"
|
||||
}
|
||||
],
|
||||
|
@ -656,6 +702,11 @@
|
|||
"non-blocking",
|
||||
"promise"
|
||||
],
|
||||
"support": {
|
||||
"irc": "irc://irc.freenode.org/amphp",
|
||||
"issues": "https://github.com/amphp/amp/issues",
|
||||
"source": "https://github.com/amphp/amp/tree/v2.6.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/amphp",
|
||||
|
@ -697,12 +748,12 @@
|
|||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Amp\\ByteStream\\": "lib"
|
||||
},
|
||||
"files": [
|
||||
"lib/functions.php"
|
||||
]
|
||||
],
|
||||
"psr-4": {
|
||||
"Amp\\ByteStream\\": "lib"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
|
@ -728,6 +779,11 @@
|
|||
"non-blocking",
|
||||
"stream"
|
||||
],
|
||||
"support": {
|
||||
"irc": "irc://irc.freenode.org/amphp",
|
||||
"issues": "https://github.com/amphp/byte-stream/issues",
|
||||
"source": "https://github.com/amphp/byte-stream/tree/v1.8.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/amphp",
|
||||
|
@ -778,6 +834,10 @@
|
|||
"runkit",
|
||||
"testing"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/antecedent/patchwork/issues",
|
||||
"source": "https://github.com/antecedent/patchwork/tree/2.1.21"
|
||||
},
|
||||
"time": "2022-02-07T07:28:34+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -844,6 +904,10 @@
|
|||
"test",
|
||||
"testing"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Brain-WP/BrainMonkey/issues",
|
||||
"source": "https://github.com/Brain-WP/BrainMonkey"
|
||||
},
|
||||
"time": "2021-11-11T15:53:55+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -899,6 +963,10 @@
|
|||
}
|
||||
],
|
||||
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
|
||||
"support": {
|
||||
"issues": "https://github.com/composer/package-versions-deprecated/issues",
|
||||
"source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://packagist.com",
|
||||
|
@ -917,16 +985,16 @@
|
|||
},
|
||||
{
|
||||
"name": "composer/pcre",
|
||||
"version": "2.0.2",
|
||||
"version": "2.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/pcre.git",
|
||||
"reference": "36d3086c793f32a9a9e853a0abe8e19ec9d936fa"
|
||||
"reference": "3fdb2807b31a78a40ad89570e30ec77466c98717"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/pcre/zipball/36d3086c793f32a9a9e853a0abe8e19ec9d936fa",
|
||||
"reference": "36d3086c793f32a9a9e853a0abe8e19ec9d936fa",
|
||||
"url": "https://api.github.com/repos/composer/pcre/zipball/3fdb2807b31a78a40ad89570e30ec77466c98717",
|
||||
"reference": "3fdb2807b31a78a40ad89570e30ec77466c98717",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -966,6 +1034,10 @@
|
|||
"regex",
|
||||
"regular expression"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/composer/pcre/issues",
|
||||
"source": "https://github.com/composer/pcre/tree/2.1.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://packagist.com",
|
||||
|
@ -980,7 +1052,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-11-03T20:20:28+00:00"
|
||||
"time": "2022-11-16T18:32:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "composer/semver",
|
||||
|
@ -1042,6 +1114,11 @@
|
|||
"validation",
|
||||
"versioning"
|
||||
],
|
||||
"support": {
|
||||
"irc": "irc://irc.freenode.org/composer",
|
||||
"issues": "https://github.com/composer/semver/issues",
|
||||
"source": "https://github.com/composer/semver/tree/3.3.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://packagist.com",
|
||||
|
@ -1103,6 +1180,11 @@
|
|||
"Xdebug",
|
||||
"performance"
|
||||
],
|
||||
"support": {
|
||||
"irc": "irc://irc.freenode.org/composer",
|
||||
"issues": "https://github.com/composer/xdebug-handler/issues",
|
||||
"source": "https://github.com/composer/xdebug-handler/tree/3.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://packagist.com",
|
||||
|
@ -1188,6 +1270,10 @@
|
|||
"stylecheck",
|
||||
"tests"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
|
||||
"source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
|
||||
},
|
||||
"time": "2022-02-04T12:51:07+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -1239,6 +1325,10 @@
|
|||
}
|
||||
],
|
||||
"description": "A highly ISP-compliant collection of interfaces that represent maps and lists.",
|
||||
"support": {
|
||||
"issues": "https://github.com/Dhii/collections-interface/issues",
|
||||
"source": "https://github.com/Dhii/collections-interface/tree/v0.3.0"
|
||||
},
|
||||
"time": "2021-10-06T10:56:09+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -1295,6 +1385,10 @@
|
|||
"PSR-11",
|
||||
"container"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Dhii/containers/issues",
|
||||
"source": "https://github.com/Dhii/containers/tree/v0.1.4"
|
||||
},
|
||||
"time": "2021-10-06T11:13:51+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -1328,6 +1422,10 @@
|
|||
"MIT"
|
||||
],
|
||||
"description": "implementation of xdg base directory specification for php",
|
||||
"support": {
|
||||
"issues": "https://github.com/dnoegel/php-xdg-base-dir/issues",
|
||||
"source": "https://github.com/dnoegel/php-xdg-base-dir/tree/v0.1.1"
|
||||
},
|
||||
"time": "2019-12-04T15:06:13+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -1380,6 +1478,10 @@
|
|||
"constructor",
|
||||
"instantiate"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/doctrine/instantiator/issues",
|
||||
"source": "https://github.com/doctrine/instantiator/tree/1.4.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.doctrine-project.org/sponsorship.html",
|
||||
|
@ -1435,6 +1537,10 @@
|
|||
}
|
||||
],
|
||||
"description": "A more advanced JSONRPC implementation",
|
||||
"support": {
|
||||
"issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues",
|
||||
"source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1"
|
||||
},
|
||||
"time": "2021-06-11T22:34:44+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -1487,6 +1593,10 @@
|
|||
"php",
|
||||
"server"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/felixfbecker/php-language-server-protocol/issues",
|
||||
"source": "https://github.com/felixfbecker/php-language-server-protocol/tree/v1.5.2"
|
||||
},
|
||||
"time": "2022-03-02T22:36:06+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -1535,6 +1645,10 @@
|
|||
"Result-Type",
|
||||
"result"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/GrahamCampbell/Result-Type/issues",
|
||||
"source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/GrahamCampbell",
|
||||
|
@ -1592,6 +1706,10 @@
|
|||
"keywords": [
|
||||
"test"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/hamcrest/hamcrest-php/issues",
|
||||
"source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1"
|
||||
},
|
||||
"time": "2020-07-09T08:09:16+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -1657,6 +1775,10 @@
|
|||
"test double",
|
||||
"testing"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/mockery/mockery/issues",
|
||||
"source": "https://github.com/mockery/mockery/tree/1.3.6"
|
||||
},
|
||||
"time": "2022-09-07T15:05:49+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -1706,6 +1828,10 @@
|
|||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/myclabs/DeepCopy/issues",
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.11.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
|
||||
|
@ -1716,16 +1842,16 @@
|
|||
},
|
||||
{
|
||||
"name": "netresearch/jsonmapper",
|
||||
"version": "v4.0.0",
|
||||
"version": "v4.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cweiske/jsonmapper.git",
|
||||
"reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d"
|
||||
"reference": "cfa81ea1d35294d64adb9c68aa4cb9e92400e53f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d",
|
||||
"reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d",
|
||||
"url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/cfa81ea1d35294d64adb9c68aa4cb9e92400e53f",
|
||||
"reference": "cfa81ea1d35294d64adb9c68aa4cb9e92400e53f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1758,7 +1884,12 @@
|
|||
}
|
||||
],
|
||||
"description": "Map nested JSON structures onto PHP classes",
|
||||
"time": "2020-12-01T19:48:11+00:00"
|
||||
"support": {
|
||||
"email": "cweiske@cweiske.de",
|
||||
"issues": "https://github.com/cweiske/jsonmapper/issues",
|
||||
"source": "https://github.com/cweiske/jsonmapper/tree/v4.1.0"
|
||||
},
|
||||
"time": "2022-12-08T20:46:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
|
@ -1810,6 +1941,10 @@
|
|||
"parser",
|
||||
"php"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2"
|
||||
},
|
||||
"time": "2022-11-12T15:38:23+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -1859,6 +1994,10 @@
|
|||
"xml",
|
||||
"xml conversion"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nullivex/lib-array2xml/issues",
|
||||
"source": "https://github.com/nullivex/lib-array2xml/tree/master"
|
||||
},
|
||||
"time": "2019-03-29T20:06:56+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -1915,6 +2054,10 @@
|
|||
}
|
||||
],
|
||||
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
|
||||
"support": {
|
||||
"issues": "https://github.com/phar-io/manifest/issues",
|
||||
"source": "https://github.com/phar-io/manifest/tree/2.0.3"
|
||||
},
|
||||
"time": "2021-07-20T11:28:43+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -1962,6 +2105,10 @@
|
|||
}
|
||||
],
|
||||
"description": "Library for handling version information and constraints",
|
||||
"support": {
|
||||
"issues": "https://github.com/phar-io/version/issues",
|
||||
"source": "https://github.com/phar-io/version/tree/3.2.1"
|
||||
},
|
||||
"time": "2022-02-21T01:04:05+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -2002,6 +2149,10 @@
|
|||
"woocommerce",
|
||||
"wordpress"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-stubs/woocommerce-stubs/issues",
|
||||
"source": "https://github.com/php-stubs/woocommerce-stubs/tree/v5.9.1"
|
||||
},
|
||||
"time": "2022-04-30T06:35:48+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -2045,6 +2196,10 @@
|
|||
"static analysis",
|
||||
"wordpress"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-stubs/wordpress-stubs/issues",
|
||||
"source": "https://github.com/php-stubs/wordpress-stubs/tree/v5.9.5"
|
||||
},
|
||||
"time": "2022-11-09T05:32:14+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -2103,6 +2258,10 @@
|
|||
"phpcs",
|
||||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
|
||||
"source": "https://github.com/PHPCompatibility/PHPCompatibility"
|
||||
},
|
||||
"time": "2019-12-27T09:44:58+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -2156,6 +2315,10 @@
|
|||
"standards",
|
||||
"static analysis"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues",
|
||||
"source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie"
|
||||
},
|
||||
"time": "2022-10-25T01:46:02+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -2207,6 +2370,10 @@
|
|||
"static analysis",
|
||||
"wordpress"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
|
||||
"source": "https://github.com/PHPCompatibility/PHPCompatibilityWP"
|
||||
},
|
||||
"time": "2022-10-24T09:00:36+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -2256,6 +2423,10 @@
|
|||
"reflection",
|
||||
"static analysis"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
|
||||
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
|
||||
},
|
||||
"time": "2020-06-27T09:03:43+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -2309,6 +2480,10 @@
|
|||
}
|
||||
],
|
||||
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
|
||||
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0"
|
||||
},
|
||||
"time": "2021-10-19T17:43:47+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -2355,6 +2530,10 @@
|
|||
}
|
||||
],
|
||||
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
|
||||
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1"
|
||||
},
|
||||
"time": "2022-03-15T21:29:03+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -2416,6 +2595,10 @@
|
|||
"php",
|
||||
"type"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/schmittjoh/php-option/issues",
|
||||
"source": "https://github.com/schmittjoh/php-option/tree/1.9.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/GrahamCampbell",
|
||||
|
@ -2489,6 +2672,10 @@
|
|||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.15"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -2545,6 +2732,10 @@
|
|||
"filesystem",
|
||||
"iterator"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -2592,6 +2783,10 @@
|
|||
"keywords": [
|
||||
"template"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-text-template/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1"
|
||||
},
|
||||
"time": "2015-06-21T13:50:34+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -2641,6 +2836,16 @@
|
|||
"keywords": [
|
||||
"timer"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-timer/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-11-30T08:20:02+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -2690,6 +2895,16 @@
|
|||
"keywords": [
|
||||
"tokenizer"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-token-stream/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"abandoned": true,
|
||||
"time": "2021-07-26T12:15:06+00:00"
|
||||
},
|
||||
|
@ -2770,6 +2985,10 @@
|
|||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.31"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://phpunit.de/sponsors.html",
|
||||
|
@ -2829,6 +3048,16 @@
|
|||
],
|
||||
"description": "Looks up which function or method a line of code belongs to",
|
||||
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues",
|
||||
"source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-11-30T08:15:22+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -2893,6 +3122,10 @@
|
|||
"compare",
|
||||
"equality"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/comparator/issues",
|
||||
"source": "https://github.com/sebastianbergmann/comparator/tree/3.0.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -2955,6 +3188,16 @@
|
|||
"unidiff",
|
||||
"unified diff"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/diff/issues",
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/3.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-11-30T07:59:04+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -3008,6 +3251,16 @@
|
|||
"environment",
|
||||
"hhvm"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/environment/issues",
|
||||
"source": "https://github.com/sebastianbergmann/environment/tree/4.2.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-11-30T07:53:42+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -3075,6 +3328,10 @@
|
|||
"export",
|
||||
"exporter"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/exporter/issues",
|
||||
"source": "https://github.com/sebastianbergmann/exporter/tree/3.1.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -3135,6 +3392,10 @@
|
|||
"keywords": [
|
||||
"global state"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/global-state/issues",
|
||||
"source": "https://github.com/sebastianbergmann/global-state/tree/3.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -3188,6 +3449,16 @@
|
|||
],
|
||||
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
|
||||
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
|
||||
"source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-11-30T07:40:27+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -3233,6 +3504,16 @@
|
|||
],
|
||||
"description": "Allows reflection of object attributes, including inherited and non-public ones",
|
||||
"homepage": "https://github.com/sebastianbergmann/object-reflector/",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/object-reflector/issues",
|
||||
"source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-11-30T07:37:18+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -3286,6 +3567,16 @@
|
|||
],
|
||||
"description": "Provides functionality to recursively process PHP variables",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
|
||||
"source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-11-30T07:34:24+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -3328,6 +3619,16 @@
|
|||
],
|
||||
"description": "Provides a list of PHP built-in functions that operate on resources",
|
||||
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/resource-operations/issues",
|
||||
"source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-11-30T07:30:19+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -3374,6 +3675,10 @@
|
|||
],
|
||||
"description": "Collection of value objects that represent the types of the PHP type system",
|
||||
"homepage": "https://github.com/sebastianbergmann/type",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/type/issues",
|
||||
"source": "https://github.com/sebastianbergmann/type/tree/1.1.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
|
@ -3423,6 +3728,10 @@
|
|||
],
|
||||
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
||||
"homepage": "https://github.com/sebastianbergmann/version",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/version/issues",
|
||||
"source": "https://github.com/sebastianbergmann/version/tree/master"
|
||||
},
|
||||
"time": "2016-10-03T07:35:21+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -3474,20 +3783,25 @@
|
|||
"phpcs",
|
||||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
|
||||
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
|
||||
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
|
||||
},
|
||||
"time": "2022-06-18T07:21:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v5.4.15",
|
||||
"version": "v5.4.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669"
|
||||
"reference": "8e9b9c8dfb33af6057c94e1b44846bee700dc5ef"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/ea59bb0edfaf9f28d18d8791410ee0355f317669",
|
||||
"reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/8e9b9c8dfb33af6057c94e1b44846bee700dc5ef",
|
||||
"reference": "8e9b9c8dfb33af6057c94e1b44846bee700dc5ef",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3556,6 +3870,9 @@
|
|||
"console",
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/v5.4.16"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
|
@ -3570,7 +3887,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-10-26T21:41:52+00:00"
|
||||
"time": "2022-11-25T14:09:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/deprecation-contracts",
|
||||
|
@ -3620,6 +3937,9 @@
|
|||
],
|
||||
"description": "A generic function and convention to trigger deprecation notices",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
|
@ -3699,6 +4019,9 @@
|
|||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
|
@ -3777,6 +4100,9 @@
|
|||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
|
@ -3858,6 +4184,9 @@
|
|||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
|
@ -3938,6 +4267,9 @@
|
|||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
|
@ -4014,6 +4346,9 @@
|
|||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
|
@ -4094,6 +4429,9 @@
|
|||
"interoperability",
|
||||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/service-contracts/tree/v2.5.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
|
@ -4177,6 +4515,9 @@
|
|||
"utf-8",
|
||||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/string/tree/v5.4.15"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
|
@ -4231,6 +4572,10 @@
|
|||
}
|
||||
],
|
||||
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
|
||||
"support": {
|
||||
"issues": "https://github.com/theseer/tokenizer/issues",
|
||||
"source": "https://github.com/theseer/tokenizer/tree/1.2.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/theseer",
|
||||
|
@ -4341,6 +4686,10 @@
|
|||
"inspection",
|
||||
"php"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/vimeo/psalm/issues",
|
||||
"source": "https://github.com/vimeo/psalm/tree/4.30.0"
|
||||
},
|
||||
"time": "2022-11-06T20:37:08+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -4411,6 +4760,10 @@
|
|||
"env",
|
||||
"environment"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/vlucas/phpdotenv/issues",
|
||||
"source": "https://github.com/vlucas/phpdotenv/tree/v5.5.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/GrahamCampbell",
|
||||
|
@ -4475,6 +4828,10 @@
|
|||
"check",
|
||||
"validate"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/webmozarts/assert/issues",
|
||||
"source": "https://github.com/webmozarts/assert/tree/1.11.0"
|
||||
},
|
||||
"time": "2022-06-03T18:03:27+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -4521,6 +4878,10 @@
|
|||
}
|
||||
],
|
||||
"description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.",
|
||||
"support": {
|
||||
"issues": "https://github.com/webmozart/path-util/issues",
|
||||
"source": "https://github.com/webmozart/path-util/tree/2.3.0"
|
||||
},
|
||||
"abandoned": "symfony/filesystem",
|
||||
"time": "2015-12-17T08:42:14+00:00"
|
||||
},
|
||||
|
@ -4562,6 +4923,10 @@
|
|||
"woocommerce",
|
||||
"wordpress"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/woocommerce/woocommerce-sniffs/issues",
|
||||
"source": "https://github.com/woocommerce/woocommerce-sniffs/tree/0.1.3"
|
||||
},
|
||||
"time": "2022-02-17T15:34:51+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -4608,6 +4973,11 @@
|
|||
"standards",
|
||||
"wordpress"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues",
|
||||
"source": "https://github.com/WordPress/WordPress-Coding-Standards",
|
||||
"wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki"
|
||||
},
|
||||
"time": "2020-05-13T23:57:56+00:00"
|
||||
}
|
||||
],
|
||||
|
@ -4620,9 +4990,9 @@
|
|||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": "^7.2 | ^8.0, ^7.2 | ^8.0, ^7.2 | ^8.0, ^7.2 | ^8.0, ^7.2 | ^8.0, ^7.2 | ^8.0, ^7.2 | ^8.0, ^7.2 | ^8.0, ^7.2 | ^8.0, ^7.2 | ^8.0, ^7.2 | ^8.0, ^7.2 | ^8.0, ^7.2 | ^8.0, ^7.2 | ^8.0",
|
||||
"php": "^7.2 | ^8.0",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "1.1.0"
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ return function ( string $root_dir ): iterable {
|
|||
( require "$modules_dir/ppcp-webhooks/module.php" )(),
|
||||
( require "$modules_dir/ppcp-vaulting/module.php" )(),
|
||||
( require "$modules_dir/ppcp-order-tracking/module.php" )(),
|
||||
( require "$modules_dir/ppcp-uninstall/module.php" )(),
|
||||
);
|
||||
|
||||
return $modules;
|
||||
|
|
|
@ -194,7 +194,9 @@ return array(
|
|||
$intent,
|
||||
$logger,
|
||||
$application_context_repository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
$container->get( 'wcgateway.is-fraudnet-enabled' ),
|
||||
$container->get( 'wcgateway.fraudnet' )
|
||||
);
|
||||
},
|
||||
'api.endpoint.billing-agreements' => static function ( ContainerInterface $container ): BillingAgreementsEndpoint {
|
||||
|
|
|
@ -29,6 +29,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Repository\ApplicationContextRepository
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Repository\PayPalRequestIdRepository;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\FraudNet\FraudNet;
|
||||
use WP_Error;
|
||||
|
||||
/**
|
||||
|
@ -94,6 +95,20 @@ class OrderEndpoint {
|
|||
*/
|
||||
private $application_context_repository;
|
||||
|
||||
/**
|
||||
* True if FraudNet support is enabled in settings, otherwise false.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $is_fraudnet_enabled;
|
||||
|
||||
/**
|
||||
* The FraudNet entity.
|
||||
*
|
||||
* @var FraudNet
|
||||
*/
|
||||
protected $fraudnet;
|
||||
|
||||
/**
|
||||
* The BN Code.
|
||||
*
|
||||
|
@ -112,6 +127,8 @@ class OrderEndpoint {
|
|||
* @param LoggerInterface $logger The logger.
|
||||
* @param ApplicationContextRepository $application_context_repository The application context repository.
|
||||
* @param SubscriptionHelper $subscription_helper The subscription helper.
|
||||
* @param bool $is_fraudnet_enabled true if FraudNet support is enabled in settings, otherwise false.
|
||||
* @param FraudNet $fraudnet The FraudNet entity.
|
||||
* @param string $bn_code The BN Code.
|
||||
*/
|
||||
public function __construct(
|
||||
|
@ -123,6 +140,8 @@ class OrderEndpoint {
|
|||
LoggerInterface $logger,
|
||||
ApplicationContextRepository $application_context_repository,
|
||||
SubscriptionHelper $subscription_helper,
|
||||
bool $is_fraudnet_enabled,
|
||||
FraudNet $fraudnet,
|
||||
string $bn_code = ''
|
||||
) {
|
||||
|
||||
|
@ -134,7 +153,9 @@ class OrderEndpoint {
|
|||
$this->logger = $logger;
|
||||
$this->application_context_repository = $application_context_repository;
|
||||
$this->bn_code = $bn_code;
|
||||
$this->is_fraudnet_enabled = $is_fraudnet_enabled;
|
||||
$this->subscription_helper = $subscription_helper;
|
||||
$this->fraudnet = $fraudnet;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -210,6 +231,11 @@ class OrderEndpoint {
|
|||
if ( $this->bn_code ) {
|
||||
$args['headers']['PayPal-Partner-Attribution-Id'] = $this->bn_code;
|
||||
}
|
||||
|
||||
if ( $this->is_fraudnet_enabled ) {
|
||||
$args['headers']['PayPal-Client-Metadata-Id'] = $this->fraudnet->session_id();
|
||||
}
|
||||
|
||||
$response = $this->request( $url, $args );
|
||||
if ( is_wp_error( $response ) ) {
|
||||
$error = new RuntimeException(
|
||||
|
@ -425,14 +451,8 @@ class OrderEndpoint {
|
|||
$error = new RuntimeException(
|
||||
__( 'Could not retrieve order.', 'woocommerce-paypal-payments' )
|
||||
);
|
||||
$this->logger->log(
|
||||
'warning',
|
||||
$error->getMessage(),
|
||||
array(
|
||||
'args' => $args,
|
||||
'response' => $response,
|
||||
)
|
||||
);
|
||||
$this->logger->warning( $error->getMessage() );
|
||||
|
||||
throw $error;
|
||||
}
|
||||
$json = json_decode( $response['body'] );
|
||||
|
@ -467,8 +487,8 @@ class OrderEndpoint {
|
|||
);
|
||||
throw $error;
|
||||
}
|
||||
$order = $this->order_factory->from_paypal_response( $json );
|
||||
return $order;
|
||||
|
||||
return $this->order_factory->from_paypal_response( $json );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\OrderFactory;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice\FraudNet;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\FraudNet\FraudNet;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice\PaymentSource;
|
||||
use WP_Error;
|
||||
|
||||
|
|
|
@ -406,11 +406,9 @@ class SmartButton implements SmartButtonInterface {
|
|||
*/
|
||||
private function render_button_wrapper_registrar(): bool {
|
||||
|
||||
$not_enabled_on_product_page = $this->settings->has( 'button_single_product_enabled' ) &&
|
||||
! $this->settings->get( 'button_single_product_enabled' );
|
||||
if (
|
||||
( is_product() || wc_post_content_has_shortcode( 'product_page' ) )
|
||||
&& ! $not_enabled_on_product_page
|
||||
&& $this->settings_status->is_smart_button_enabled_for_location( 'product' )
|
||||
// TODO: it seems like there is no easy way to properly handle vaulted PayPal free trial,
|
||||
// so disable the buttons for now everywhere except checkout for free trial.
|
||||
&& ! $this->is_free_trial_product()
|
||||
|
@ -435,10 +433,8 @@ class SmartButton implements SmartButtonInterface {
|
|||
);
|
||||
}
|
||||
|
||||
$not_enabled_on_minicart = $this->settings->has( 'button_mini_cart_enabled' ) &&
|
||||
! $this->settings->get( 'button_mini_cart_enabled' );
|
||||
if (
|
||||
! $not_enabled_on_minicart
|
||||
$this->settings_status->is_smart_button_enabled_for_location( 'mini-cart' )
|
||||
&& ! $this->is_free_trial_cart()
|
||||
) {
|
||||
add_action(
|
||||
|
@ -479,12 +475,11 @@ class SmartButton implements SmartButtonInterface {
|
|||
}
|
||||
);
|
||||
|
||||
$not_enabled_on_cart = $this->settings->has( 'button_cart_enabled' ) &&
|
||||
! $this->settings->get( 'button_cart_enabled' );
|
||||
$enabled_on_cart = $this->settings_status->is_smart_button_enabled_for_location( 'cart' );
|
||||
add_action(
|
||||
$this->proceed_to_checkout_button_renderer_hook(),
|
||||
function() use ( $not_enabled_on_cart ) {
|
||||
if ( ! is_cart() || $not_enabled_on_cart || $this->is_free_trial_cart() || $this->is_cart_price_total_zero() ) {
|
||||
function() use ( $enabled_on_cart ) {
|
||||
if ( ! is_cart() || ! $enabled_on_cart || $this->is_free_trial_cart() || $this->is_cart_price_total_zero() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -868,8 +863,8 @@ class SmartButton implements SmartButtonInterface {
|
|||
'shipping_field' => _x( 'Shipping %s', 'checkout-validation', 'woocommerce' ),
|
||||
),
|
||||
'order_id' => 'pay-now' === $this->context() ? absint( $wp->query_vars['order-pay'] ) : 0,
|
||||
'single_product_buttons_enabled' => $this->settings->has( 'button_product_enabled' ) && $this->settings->get( 'button_product_enabled' ),
|
||||
'mini_cart_buttons_enabled' => $this->settings->has( 'button_mini-cart_enabled' ) && $this->settings->get( 'button_mini-cart_enabled' ),
|
||||
'single_product_buttons_enabled' => $this->settings_status->is_smart_button_enabled_for_location( 'product' ),
|
||||
'mini_cart_buttons_enabled' => $this->settings_status->is_smart_button_enabled_for_location( 'mini-cart' ),
|
||||
'basic_checkout_validation_enabled' => $this->basic_checkout_validation_enabled,
|
||||
);
|
||||
|
||||
|
@ -1050,45 +1045,21 @@ class SmartButton implements SmartButtonInterface {
|
|||
* @throws NotFoundException If a setting has not been found.
|
||||
*/
|
||||
private function load_button_component() : bool {
|
||||
$load_buttons = false;
|
||||
if (
|
||||
$this->context() === 'checkout'
|
||||
&& $this->settings->has( 'button_enabled' )
|
||||
&& $this->settings->get( 'button_enabled' )
|
||||
) {
|
||||
$load_buttons = true;
|
||||
}
|
||||
if (
|
||||
$this->context() === 'product'
|
||||
&& (
|
||||
( $this->settings->has( 'button_product_enabled' ) && $this->settings->get( 'button_product_enabled' ) ) ||
|
||||
( $this->settings_status->is_pay_later_messaging_enabled_for_location( 'product' ) )
|
||||
)
|
||||
) {
|
||||
$load_buttons = true;
|
||||
}
|
||||
if (
|
||||
$this->settings->has( 'button_mini-cart_enabled' )
|
||||
&& $this->settings->get( 'button_mini-cart_enabled' )
|
||||
) {
|
||||
$load_buttons = true;
|
||||
}
|
||||
$smart_button_enabled_for_current_location = $this->settings_status->is_smart_button_enabled_for_location( $this->context() );
|
||||
$smart_button_enabled_for_mini_cart = $this->settings_status->is_smart_button_enabled_for_location( 'mini-cart' );
|
||||
$messaging_enabled_for_current_location = $this->settings_status->is_pay_later_messaging_enabled_for_location( $this->context() );
|
||||
|
||||
if (
|
||||
$this->context() === 'cart'
|
||||
&& (
|
||||
( $this->settings->has( 'button_cart_enabled' ) && $this->settings->get( 'button_cart_enabled' ) ) ||
|
||||
( $this->settings_status->is_pay_later_messaging_enabled_for_location( 'cart' ) )
|
||||
)
|
||||
) {
|
||||
$load_buttons = true;
|
||||
switch ( $this->context() ) {
|
||||
case 'checkout':
|
||||
case 'cart':
|
||||
return $smart_button_enabled_for_current_location || $messaging_enabled_for_current_location;
|
||||
case 'product':
|
||||
return $smart_button_enabled_for_current_location || $messaging_enabled_for_current_location || $smart_button_enabled_for_mini_cart;
|
||||
case 'pay-now':
|
||||
return true;
|
||||
default:
|
||||
return $smart_button_enabled_for_mini_cart;
|
||||
}
|
||||
|
||||
if ( $this->context() === 'pay-now' ) {
|
||||
$load_buttons = true;
|
||||
}
|
||||
|
||||
return $load_buttons;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1178,6 +1149,11 @@ class SmartButton implements SmartButtonInterface {
|
|||
'tagline' => true,
|
||||
);
|
||||
|
||||
$enable_styling_per_location = $this->settings->has( 'smart_button_enable_styling_per_location' ) && $this->settings->get( 'smart_button_enable_styling_per_location' );
|
||||
if ( ! $enable_styling_per_location ) {
|
||||
$context = 'general';
|
||||
}
|
||||
|
||||
$value = isset( $defaults[ $style ] ) ?
|
||||
$defaults[ $style ] : '';
|
||||
$value = $this->settings->has( 'button_' . $style ) ?
|
||||
|
|
|
@ -56,6 +56,7 @@ class CompatModule implements ModuleInterface {
|
|||
add_action( 'admin_enqueue_scripts', array( $asset_loader, 'enqueue' ) );
|
||||
|
||||
$this->migrate_pay_later_settings( $c );
|
||||
$this->migrate_smart_button_settings( $c );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,19 +202,19 @@ class CompatModule implements ModuleInterface {
|
|||
$disable_funding = $settings->has( 'disable_funding' ) ? $settings->get( 'disable_funding' ) : array();
|
||||
|
||||
$available_messaging_locations = array_keys( $c->get( 'wcgateway.settings.pay-later.messaging-locations' ) );
|
||||
$available_button_locations = array_merge( $available_messaging_locations, array( 'mini-cart' ) );
|
||||
$available_button_locations = array_keys( $c->get( 'wcgateway.button.locations' ) );
|
||||
|
||||
if ( in_array( 'credit', $disable_funding, true ) ) {
|
||||
$settings->set( 'pay_later_button_enabled', false );
|
||||
} else {
|
||||
$settings->set( 'pay_later_button_enabled', true );
|
||||
$selected_button_locations = $this->pay_later_selected_locations( $settings, $available_button_locations, 'button' );
|
||||
$selected_button_locations = $this->selected_locations( $settings, $available_button_locations, 'button' );
|
||||
if ( ! empty( $selected_button_locations ) ) {
|
||||
$settings->set( 'pay_later_button_locations', $selected_button_locations );
|
||||
}
|
||||
}
|
||||
|
||||
$selected_messaging_locations = $this->pay_later_selected_locations( $settings, $available_messaging_locations, 'message' );
|
||||
$selected_messaging_locations = $this->selected_locations( $settings, $available_messaging_locations, 'message' );
|
||||
|
||||
if ( ! empty( $selected_messaging_locations ) ) {
|
||||
$settings->set( 'pay_later_messaging_enabled', true );
|
||||
|
@ -261,26 +262,58 @@ class CompatModule implements ModuleInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Finds from old settings the locations, which should be selected for new Pay Later tab settings.
|
||||
* Finds from old settings the selected locations for given type.
|
||||
*
|
||||
* @param Settings $settings The settings.
|
||||
* @param string[] $all_locations The list of all available locations.
|
||||
* @param string $setting The setting: 'button' or 'message'.
|
||||
* @param string $type The setting type: 'button' or 'message'.
|
||||
* @return string[] The list of locations, which should be selected.
|
||||
* @throws NotFoundException When setting was not found.
|
||||
*/
|
||||
protected function pay_later_selected_locations( Settings $settings, array $all_locations, string $setting ): array {
|
||||
$pay_later_locations = array();
|
||||
protected function selected_locations( Settings $settings, array $all_locations, string $type ): array {
|
||||
$button_locations = array();
|
||||
|
||||
foreach ( $all_locations as $location ) {
|
||||
$location_setting_name_part = $location === 'checkout' ? '' : "_{$location}";
|
||||
$setting_name = "{$setting}{$location_setting_name_part}_enabled";
|
||||
$setting_name = "{$type}{$location_setting_name_part}_enabled";
|
||||
|
||||
if ( $settings->has( $setting_name ) && $settings->get( $setting_name ) ) {
|
||||
$pay_later_locations[] = $location;
|
||||
$button_locations[] = $location;
|
||||
}
|
||||
}
|
||||
|
||||
return $pay_later_locations;
|
||||
return $button_locations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrates the old smart button settings.
|
||||
*
|
||||
* The migration will be done on plugin upgrade if it hasn't already done.
|
||||
*
|
||||
* @param ContainerInterface $c The Container.
|
||||
*/
|
||||
protected function migrate_smart_button_settings( ContainerInterface $c ): void {
|
||||
$is_smart_button_settings_migrated_option_name = 'woocommerce_ppcp-is_smart_button_settings_migrated';
|
||||
$is_smart_button_settings_migrated = get_option( $is_smart_button_settings_migrated_option_name );
|
||||
|
||||
if ( $is_smart_button_settings_migrated ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action(
|
||||
'woocommerce_paypal_payments_gateway_migrate_on_update',
|
||||
function () use ( $c, $is_smart_button_settings_migrated_option_name ) {
|
||||
$settings = $c->get( 'wcgateway.settings' );
|
||||
assert( $settings instanceof Settings );
|
||||
|
||||
$available_button_locations = array_keys( $c->get( 'wcgateway.button.locations' ) );
|
||||
$selected_button_locations = $this->selected_locations( $settings, $available_button_locations, 'button' );
|
||||
if ( ! empty( $selected_button_locations ) ) {
|
||||
$settings->set( 'smart_button_locations', $selected_button_locations );
|
||||
$settings->persist();
|
||||
}
|
||||
|
||||
update_option( $is_smart_button_settings_migrated_option_name, true );
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,10 @@ document.addEventListener(
|
|||
const payLaterMessagingLocationsSelect = payLaterMessagingLocationsSelector + ' select';
|
||||
const payLaterMessagingEnabledSelector = '#ppcp-pay_later_messaging_enabled';
|
||||
|
||||
const smartButtonLocationsSelector = '#field-smart_button_locations';
|
||||
const smartButtonLocationsSelect = smartButtonLocationsSelector + ' select';
|
||||
const smartButtonSelectableLocations = payLaterMessagingSelectableLocations.concat('mini-cart');
|
||||
|
||||
const groupToggle = (selector, group) => {
|
||||
const toggleElement = document.querySelector(selector);
|
||||
if (! toggleElement) {
|
||||
|
@ -162,41 +166,58 @@ document.addEventListener(
|
|||
replace();
|
||||
};
|
||||
|
||||
const togglePayLaterMessagingInputsBySelectedLocations = (
|
||||
stylingPerMessagingSelector,
|
||||
messagingLocationsSelector,
|
||||
const toggleInputsBySelectedLocations = (
|
||||
stylingPerSelector,
|
||||
locationsSelector,
|
||||
groupToShowOnChecked,
|
||||
groupToHideOnChecked
|
||||
groupToHideOnChecked,
|
||||
inputType
|
||||
) => {
|
||||
|
||||
const payLaterMessagingEnabled = document.querySelector(payLaterMessagingEnabledSelector);
|
||||
const stylingPerMessagingElement = document.querySelector(stylingPerMessagingSelector);
|
||||
const messagingLocationsElement = document.querySelector(messagingLocationsSelector);
|
||||
const stylingPerElement = document.querySelector(stylingPerSelector);
|
||||
const locationsElement = document.querySelector(locationsSelector);
|
||||
const stylingPerElementWrapper = stylingPerElement?.closest('tr');
|
||||
const stylingPerElementWrapperSelector = '#'+ stylingPerElementWrapper?.getAttribute('id');
|
||||
|
||||
if (! stylingPerMessagingElement) {
|
||||
if (! stylingPerElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
const toggleElementsBySelectedLocations = () => {
|
||||
if (! stylingPerMessagingElement.checked || ! payLaterMessagingEnabled.checked) {
|
||||
stylingPerElementWrapper.style.display = '';
|
||||
let selectedLocations = getSelectedLocations(locationsSelector);
|
||||
let emptySmartButtonLocationMessage = jQuery('.ppcp-empty-smart-button-location');
|
||||
|
||||
if(selectedLocations.length === 0) {
|
||||
hideElements(groupToHideOnChecked.concat(stylingPerElementWrapperSelector));
|
||||
if (emptySmartButtonLocationMessage.length === 0) {
|
||||
jQuery(PayPalCommerceSettings.empty_smart_button_location_message).insertAfter(jQuery(smartButtonLocationsSelector).find('.description'));
|
||||
}
|
||||
}
|
||||
|
||||
if (! stylingPerElement.checked) {
|
||||
return;
|
||||
}
|
||||
|
||||
let checkedLocations = document.querySelectorAll(messagingLocationsSelector + ' :checked');
|
||||
const selectedLocations = [...checkedLocations].map(option => option.value);
|
||||
if (inputType === 'messages' && ! payLaterMessagingEnabled.checked) {
|
||||
return;
|
||||
}
|
||||
|
||||
const messagingInputSelectors = payLaterMessagingInputSelectorsByLocations(selectedLocations);
|
||||
const inputSelectors = inputSelectorsByLocations(selectedLocations, inputType);
|
||||
|
||||
groupToShowOnChecked.forEach( (element) => {
|
||||
if ( messagingInputSelectors.includes(element) ) {
|
||||
if ( inputSelectors.includes(element) ) {
|
||||
document.querySelector(element).style.display = '';
|
||||
return;
|
||||
}
|
||||
document.querySelector(element).style.display = 'none';
|
||||
})
|
||||
|
||||
if (inputType === 'messages') {
|
||||
togglePayLaterMessageFields();
|
||||
}
|
||||
}
|
||||
|
||||
const hideElements = (selectroGroup) => {
|
||||
selectroGroup.forEach( (elementToHide) => {
|
||||
|
@ -210,14 +231,14 @@ document.addEventListener(
|
|||
})
|
||||
}
|
||||
|
||||
groupToggle(stylingPerMessagingSelector, groupToShowOnChecked);
|
||||
groupToggle(stylingPerSelector, groupToShowOnChecked);
|
||||
toggleElementsBySelectedLocations();
|
||||
|
||||
if (stylingPerMessagingElement.checked) {
|
||||
if (stylingPerElement.checked) {
|
||||
hideElements(groupToHideOnChecked);
|
||||
}
|
||||
|
||||
stylingPerMessagingElement.addEventListener(
|
||||
stylingPerElement.addEventListener(
|
||||
'change',
|
||||
(event) => {
|
||||
toggleElementsBySelectedLocations();
|
||||
|
@ -227,20 +248,38 @@ document.addEventListener(
|
|||
return;
|
||||
}
|
||||
|
||||
let selectedLocations = getSelectedLocations(locationsSelector);
|
||||
if(selectedLocations.length > 0) {
|
||||
showElements(groupToHideOnChecked);
|
||||
}
|
||||
|
||||
if (inputType === 'messages') {
|
||||
togglePayLaterMessageFields();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// We need to use jQuery here as the select might be a select2 element, which doesn't use native events.
|
||||
jQuery(messagingLocationsElement).on('change', toggleElementsBySelectedLocations);
|
||||
jQuery(locationsElement).on('change', function (){
|
||||
let emptySmartButtonLocationMessage = jQuery('.ppcp-empty-smart-button-location');
|
||||
emptySmartButtonLocationMessage?.remove();
|
||||
toggleElementsBySelectedLocations()
|
||||
stylingPerElement.dispatchEvent(new Event('change'))
|
||||
});
|
||||
}
|
||||
|
||||
const payLaterMessagingInputSelectorsByLocations = (locations) => {
|
||||
const getSelectedLocations = (selector) => {
|
||||
let checkedLocations = document.querySelectorAll(selector + ' :checked');
|
||||
return [...checkedLocations].map(option => option.value);
|
||||
}
|
||||
|
||||
const inputSelectorsByLocations = (locations, inputType = 'messages') => {
|
||||
let inputSelectros = [];
|
||||
|
||||
locations.forEach( (location) => {
|
||||
inputSelectros = inputSelectros.concat(payLaterMessagingInputSelectorByLocation(location))
|
||||
inputSelectros = inputType === 'messages'
|
||||
? inputSelectros.concat(payLaterMessagingInputSelectorByLocation(location))
|
||||
: inputSelectros.concat(butttonInputSelectorByLocation(location));
|
||||
})
|
||||
|
||||
return inputSelectros
|
||||
|
@ -264,8 +303,30 @@ document.addEventListener(
|
|||
return inputSelectors
|
||||
}
|
||||
|
||||
const butttonInputSelectorByLocation = (location) => {
|
||||
const locationPrefix = location === 'checkout' ? '' : '_' + location;
|
||||
const inputSelectors = [
|
||||
'#field-button' + locationPrefix + '_layout',
|
||||
'#field-button' + locationPrefix + '_tagline',
|
||||
'#field-button' + locationPrefix + '_label',
|
||||
'#field-button' + locationPrefix + '_color',
|
||||
'#field-button' + locationPrefix + '_shape',
|
||||
'#field-button' + locationPrefix + '_preview',
|
||||
]
|
||||
|
||||
if (location !== 'general') {
|
||||
inputSelectors.push('#field-button_' + location + '_heading');
|
||||
}
|
||||
|
||||
if (location === 'mini-cart') {
|
||||
inputSelectors.push('#field-button' + locationPrefix + '_height');
|
||||
}
|
||||
|
||||
return inputSelectors
|
||||
}
|
||||
|
||||
const allPayLaterMessaginginputSelectors = () => {
|
||||
let stylingInputSelectors = payLaterMessagingInputSelectorsByLocations(payLaterMessagingAllLocations);
|
||||
let stylingInputSelectors = inputSelectorsByLocations(payLaterMessagingAllLocations);
|
||||
|
||||
return stylingInputSelectors.concat(payLaterMessagingLocationsSelector, '#field-pay_later_enable_styling_per_messaging_location');
|
||||
}
|
||||
|
@ -274,15 +335,16 @@ document.addEventListener(
|
|||
const payLaterMessagingEnabled = document.querySelector(payLaterMessagingEnabledSelector);
|
||||
const stylingPerMessagingElement = document.querySelector('#ppcp-pay_later_enable_styling_per_messaging_location');
|
||||
|
||||
if (! payLaterMessagingEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
groupToggle(
|
||||
payLaterMessagingEnabledSelector,
|
||||
allPayLaterMessaginginputSelectors()
|
||||
);
|
||||
|
||||
if (! payLaterMessagingEnabled) {
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
payLaterMessagingEnabled.addEventListener(
|
||||
'change',
|
||||
(event) => {
|
||||
|
@ -296,68 +358,30 @@ document.addEventListener(
|
|||
|
||||
(() => {
|
||||
removeDisabledCardIcons('select[name="ppcp[disable_cards][]"]', 'select[name="ppcp[card_icons][]"]');
|
||||
groupToggle(
|
||||
'#ppcp-button_enabled',
|
||||
[
|
||||
'#field-button_layout',
|
||||
'#field-button_tagline',
|
||||
'#field-button_label',
|
||||
'#field-button_color',
|
||||
'#field-button_shape',
|
||||
'#field-button_preview',
|
||||
]
|
||||
);
|
||||
|
||||
groupToggle(
|
||||
'#ppcp-pay_later_button_enabled',
|
||||
['#field-pay_later_button_locations']
|
||||
);
|
||||
|
||||
toggleMessagingEnabled();
|
||||
|
||||
togglePayLaterMessagingInputsBySelectedLocations(
|
||||
toggleInputsBySelectedLocations(
|
||||
'#ppcp-pay_later_enable_styling_per_messaging_location',
|
||||
payLaterMessagingLocationsSelect,
|
||||
payLaterMessagingInputSelectorsByLocations(payLaterMessagingSelectableLocations),
|
||||
payLaterMessagingInputSelectorsByLocations(['general']),
|
||||
inputSelectorsByLocations(payLaterMessagingSelectableLocations),
|
||||
inputSelectorsByLocations(['general']),
|
||||
'messages'
|
||||
);
|
||||
|
||||
groupToggle(
|
||||
'#ppcp-button_product_enabled',
|
||||
[
|
||||
'#field-button_product_layout',
|
||||
'#field-button_product_tagline',
|
||||
'#field-button_product_label',
|
||||
'#field-button_product_color',
|
||||
'#field-button_product_shape',
|
||||
'#field-button_product_preview',
|
||||
]
|
||||
toggleInputsBySelectedLocations(
|
||||
'#ppcp-smart_button_enable_styling_per_location',
|
||||
smartButtonLocationsSelect,
|
||||
inputSelectorsByLocations(smartButtonSelectableLocations, 'buttons'),
|
||||
inputSelectorsByLocations(['general'], 'buttons'),
|
||||
'buttons'
|
||||
);
|
||||
|
||||
groupToggle(
|
||||
'#ppcp-button_mini-cart_enabled',
|
||||
[
|
||||
'#field-button_mini-cart_layout',
|
||||
'#field-button_mini-cart_tagline',
|
||||
'#field-button_mini-cart_label',
|
||||
'#field-button_mini-cart_color',
|
||||
'#field-button_mini-cart_shape',
|
||||
'#field-button_mini-cart_height',
|
||||
'#field-button_mini-cart_preview',
|
||||
]
|
||||
);
|
||||
toggleMessagingEnabled();
|
||||
|
||||
groupToggle(
|
||||
'#ppcp-button_cart_enabled',
|
||||
[
|
||||
'#field-button_cart_layout',
|
||||
'#field-button_cart_tagline',
|
||||
'#field-button_cart_label',
|
||||
'#field-button_cart_color',
|
||||
'#field-button_cart_shape',
|
||||
'#field-button_cart_preview',
|
||||
]
|
||||
);
|
||||
|
||||
groupToggle(
|
||||
'#ppcp-vault_enabled',
|
||||
|
@ -366,7 +390,6 @@ document.addEventListener(
|
|||
]
|
||||
);
|
||||
|
||||
|
||||
groupToggleSelect(
|
||||
'#ppcp-intent',
|
||||
[
|
||||
|
|
|
@ -110,6 +110,16 @@ class OnboardingAssets {
|
|||
$this->version,
|
||||
true
|
||||
);
|
||||
wp_localize_script(
|
||||
'ppcp-settings',
|
||||
'PayPalCommerceSettings',
|
||||
array(
|
||||
'empty_smart_button_location_message' => sprintf(
|
||||
'<p class="description ppcp-empty-smart-button-location">%1$s</p>',
|
||||
__( 'Note: If no button location is selected, the PayPal gateway will not be available.', 'woocommerce-paypal-payments' )
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$url = untrailingslashit( $this->module_url ) . '/assets/js/onboarding.js';
|
||||
wp_register_script(
|
||||
|
|
11
modules/ppcp-uninstall/.babelrc
Normal file
11
modules/ppcp-uninstall/.babelrc
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"useBuiltIns": "usage",
|
||||
"corejs": "3.25.0"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
2
modules/ppcp-uninstall/.gitignore
vendored
Normal file
2
modules/ppcp-uninstall/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
node_modules
|
||||
/assets
|
17
modules/ppcp-uninstall/composer.json
Normal file
17
modules/ppcp-uninstall/composer.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "woocommerce/ppcp-uninstall",
|
||||
"type": "dhii-mod",
|
||||
"description": "Uninstall module for PPCP",
|
||||
"license": "GPL-2.0",
|
||||
"require": {
|
||||
"php": "^7.2 | ^8.0",
|
||||
"dhii/module-interface": "^0.3.0-alpha1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"WooCommerce\\PayPalCommerce\\Uninstall\\": "src"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
56
modules/ppcp-uninstall/extensions.php
Normal file
56
modules/ppcp-uninstall/extensions.php
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* The uninstall module extensions.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\Uninstall
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Uninstall;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
||||
return array(
|
||||
'wcgateway.settings.fields' => static function ( ContainerInterface $container, array $fields ): array {
|
||||
$uninstall_fields = array(
|
||||
'uninstall_heading' => array(
|
||||
'heading' => __( 'Uninstall/Clear Database', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'ppcp-heading',
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
'description' => __( 'Manage plugin data and scheduled actions stored in database.', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'uninstall_clear_db_on_uninstall' => array(
|
||||
'title' => __( 'Remove PayPal Payments data from Database on uninstall', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Remove options and scheduled actions from database when uninstalling the plugin.', 'woocommerce-paypal-payments' ),
|
||||
'default' => false,
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'uninstall_clear_db_now' => array(
|
||||
'title' => __( 'Remove PayPal Payments data from Database.', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'ppcp-text',
|
||||
'text' => '<button type="button" class="button ppcp-clear_db_now">' . esc_html__( 'Clear now', 'woocommerce-paypal-payments' ) . '</button>',
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
'description' => __( 'Click to remove options and scheduled actions from database now.', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
);
|
||||
|
||||
return array_merge( $fields, $uninstall_fields );
|
||||
},
|
||||
);
|
16
modules/ppcp-uninstall/module.php
Normal file
16
modules/ppcp-uninstall/module.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
/**
|
||||
* The uninstall module.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\Uninstall
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Uninstall;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return function (): ModuleInterface {
|
||||
return new UninstallModule();
|
||||
};
|
32
modules/ppcp-uninstall/package.json
Normal file
32
modules/ppcp-uninstall/package.json
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "ppcp-uninstall",
|
||||
"version": "1.0.0",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"main": "resources/js/ppcp-clear-db.js",
|
||||
"browserslist": [
|
||||
"> 0.5%",
|
||||
"Safari >= 8",
|
||||
"Chrome >= 41",
|
||||
"Firefox >= 43",
|
||||
"Edge >= 14"
|
||||
],
|
||||
"dependencies": {
|
||||
"core-js": "^3.25.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.19",
|
||||
"@babel/preset-env": "^7.19",
|
||||
"babel-loader": "^8.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"file-loader": "^6.2.0",
|
||||
"sass": "^1.42.1",
|
||||
"sass-loader": "^12.1.0",
|
||||
"webpack": "^5.74",
|
||||
"webpack-cli": "^4.10"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "cross-env BABEL_ENV=default NODE_ENV=production webpack",
|
||||
"watch": "cross-env BABEL_ENV=default NODE_ENV=production webpack --watch",
|
||||
"dev": "cross-env BABEL_ENV=default webpack --watch"
|
||||
}
|
||||
}
|
43
modules/ppcp-uninstall/resources/js/ppcp-clear-db.js
Normal file
43
modules/ppcp-uninstall/resources/js/ppcp-clear-db.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
document.addEventListener(
|
||||
'DOMContentLoaded',
|
||||
() => {
|
||||
const config = PayPalCommerceGatewayClearDb;
|
||||
if (!typeof (config)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const clearDbConfig = config.clearDb;
|
||||
|
||||
document.querySelector(clearDbConfig.button)?.addEventListener('click', function () {
|
||||
const isConfirmed = confirm(clearDbConfig.confirmationMessage);
|
||||
if (!isConfirmed) {
|
||||
return;
|
||||
}
|
||||
|
||||
const clearButton = document.querySelector(clearDbConfig.button);
|
||||
|
||||
clearButton.setAttribute('disabled', 'disabled');
|
||||
fetch(clearDbConfig.endpoint, {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
body: JSON.stringify({
|
||||
nonce: clearDbConfig.nonce,
|
||||
})
|
||||
}).then((res)=>{
|
||||
return res.json();
|
||||
}).then((data)=>{
|
||||
if (!data.success) {
|
||||
jQuery(clearDbConfig.failureMessage).insertAfter(clearButton);
|
||||
setTimeout(()=> jQuery(clearDbConfig.messageSelector).remove(),3000);
|
||||
clearButton.removeAttribute('disabled');
|
||||
throw Error(data.data.message);
|
||||
}
|
||||
|
||||
jQuery(clearDbConfig.successMessage).insertAfter(clearButton);
|
||||
setTimeout(()=> jQuery(clearDbConfig.messageSelector).remove(),3000);
|
||||
clearButton.removeAttribute('disabled');
|
||||
window.location.replace(clearDbConfig.redirectUrl);
|
||||
});
|
||||
})
|
||||
},
|
||||
);
|
96
modules/ppcp-uninstall/services.php
Normal file
96
modules/ppcp-uninstall/services.php
Normal file
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
/**
|
||||
* The uninstall module services.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\Uninstall
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Uninstall;
|
||||
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Repository\PayPalRequestIdRepository;
|
||||
use WooCommerce\PayPalCommerce\Uninstall\Assets\ClearDatabaseAssets;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CardButtonGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice\PayUponInvoiceGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\PayPalCommerce\Webhooks\Status\WebhookSimulation;
|
||||
use WooCommerce\PayPalCommerce\Webhooks\WebhookRegistrar;
|
||||
|
||||
return array(
|
||||
'uninstall.ppcp-all-option-names' => function( ContainerInterface $container ) : array {
|
||||
return array(
|
||||
$container->get( 'webhook.last-webhook-storage.key' ),
|
||||
PayPalRequestIdRepository::KEY,
|
||||
'woocommerce_ppcp-is_pay_later_settings_migrated',
|
||||
'woocommerce_' . PayPalGateway::ID . '_settings',
|
||||
'woocommerce_' . CreditCardGateway::ID . '_settings',
|
||||
'woocommerce_' . PayUponInvoiceGateway::ID . '_settings',
|
||||
'woocommerce_' . CardButtonGateway::ID . '_settings',
|
||||
Settings::KEY,
|
||||
'woocommerce-ppcp-version',
|
||||
WebhookSimulation::OPTION_ID,
|
||||
WebhookRegistrar::KEY,
|
||||
);
|
||||
},
|
||||
|
||||
'uninstall.ppcp-all-scheduled-action-names' => function( ContainerInterface $container ) : array {
|
||||
return array(
|
||||
'woocommerce_paypal_payments_check_pui_payment_captured',
|
||||
'woocommerce_paypal_payments_check_saved_payment',
|
||||
);
|
||||
},
|
||||
|
||||
'uninstall.clear-db-endpoint' => function( ContainerInterface $container ) : string {
|
||||
return 'ppcp-clear-db';
|
||||
},
|
||||
|
||||
'uninstall.clear-database-script-data' => function( ContainerInterface $container ) : array {
|
||||
return array(
|
||||
'clearDb' => array(
|
||||
'endpoint' => \WC_AJAX::get_endpoint( $container->get( 'uninstall.clear-db-endpoint' ) ),
|
||||
'nonce' => wp_create_nonce( $container->get( 'uninstall.clear-db-endpoint' ) ),
|
||||
'button' => '.ppcp-clear_db_now',
|
||||
'messageSelector' => '.clear-db-info-message',
|
||||
'confirmationMessage' => __( 'Are you sure? the operation will remove all plugin data.', 'woocommerce-paypal-payments' ),
|
||||
'successMessage' => sprintf(
|
||||
'<div class="updated clear-db-info-message"><p><strong>%1$s</strong></p></div>',
|
||||
esc_html__( 'The plugin data is successfully cleared.', 'woocommerce-paypal-payments' )
|
||||
),
|
||||
'failureMessage' => sprintf(
|
||||
'<div class="error clear-db-info-message"><p><strong>%1$s</strong></p></div>',
|
||||
esc_html__( 'Operation failed. Check WooCommerce logs for more details.', 'woocommerce-paypal-payments' )
|
||||
),
|
||||
'redirectUrl' => admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' ),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
'uninstall.module-url' => static function ( ContainerInterface $container ): string {
|
||||
/**
|
||||
* The path cannot be false.
|
||||
*
|
||||
* @psalm-suppress PossiblyFalseArgument
|
||||
*/
|
||||
return plugins_url(
|
||||
'/modules/ppcp-uninstall/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
},
|
||||
|
||||
'uninstall.clear-db-assets' => function( ContainerInterface $container ) : ClearDatabaseAssets {
|
||||
return new ClearDatabaseAssets(
|
||||
$container->get( 'uninstall.module-url' ),
|
||||
$container->get( 'ppcp.asset-version' ),
|
||||
'ppcp-clear-db',
|
||||
$container->get( 'uninstall.clear-database-script-data' )
|
||||
);
|
||||
},
|
||||
|
||||
'uninstall.clear-db' => function( ContainerInterface $container ) : ClearDatabaseInterface {
|
||||
return new ClearDatabase();
|
||||
},
|
||||
);
|
96
modules/ppcp-uninstall/src/Assets/ClearDatabaseAssets.php
Normal file
96
modules/ppcp-uninstall/src/Assets/ClearDatabaseAssets.php
Normal file
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
/**
|
||||
* Register and configure assets for uninstall module.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\Uninstall\Assets
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Uninstall\Assets;
|
||||
|
||||
/**
|
||||
* Class ClearDatabaseAssets
|
||||
*/
|
||||
class ClearDatabaseAssets {
|
||||
|
||||
/**
|
||||
* The URL to the module.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $module_url;
|
||||
|
||||
/**
|
||||
* The assets version.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* The script name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $script_name;
|
||||
|
||||
/**
|
||||
* A map of script data.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $script_data;
|
||||
|
||||
/**
|
||||
* ClearDatabaseAssets constructor.
|
||||
*
|
||||
* @param string $module_url The URL to the module.
|
||||
* @param string $version The assets version.
|
||||
* @param string $script_name The script name.
|
||||
* @param array $script_data A map of script data.
|
||||
*/
|
||||
public function __construct(
|
||||
string $module_url,
|
||||
string $version,
|
||||
string $script_name,
|
||||
array $script_data
|
||||
) {
|
||||
$this->module_url = $module_url;
|
||||
$this->version = $version;
|
||||
$this->script_data = $script_data;
|
||||
$this->script_name = $script_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the scripts and styles.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register(): void {
|
||||
$module_url = untrailingslashit( $this->module_url );
|
||||
|
||||
wp_register_script(
|
||||
$this->script_name,
|
||||
"{$module_url}/assets/js/{$this->script_name}.js",
|
||||
array( 'jquery' ),
|
||||
$this->version,
|
||||
true
|
||||
);
|
||||
|
||||
wp_localize_script(
|
||||
$this->script_name,
|
||||
'PayPalCommerceGatewayClearDb',
|
||||
$this->script_data
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues the necessary scripts.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue(): void {
|
||||
wp_enqueue_script( $this->script_name );
|
||||
}
|
||||
}
|
34
modules/ppcp-uninstall/src/ClearDatabase.php
Normal file
34
modules/ppcp-uninstall/src/ClearDatabase.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Clears the plugin related data from DB.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\Uninstall
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Uninstall;
|
||||
|
||||
/**
|
||||
* Class ClearDatabase
|
||||
*/
|
||||
class ClearDatabase implements ClearDatabaseInterface {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function delete_options( array $option_names ):void {
|
||||
foreach ( $option_names as $option_name ) {
|
||||
delete_option( $option_name );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function clear_scheduled_actions( array $action_names ):void {
|
||||
foreach ( $action_names as $action_name ) {
|
||||
as_unschedule_action( $action_name );
|
||||
}
|
||||
}
|
||||
}
|
32
modules/ppcp-uninstall/src/ClearDatabaseInterface.php
Normal file
32
modules/ppcp-uninstall/src/ClearDatabaseInterface.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Can delete the options and clear scheduled actions from database.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\Uninstall
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Uninstall;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
interface ClearDatabaseInterface {
|
||||
|
||||
/**
|
||||
* Deletes the given options from database.
|
||||
*
|
||||
* @param string[] $option_names The list of option names.
|
||||
* @throws RuntimeException If problem deleting.
|
||||
*/
|
||||
public function delete_options( array $option_names ): void;
|
||||
|
||||
/**
|
||||
* Clears the given scheduled actions.
|
||||
*
|
||||
* @param string[] $action_names The list of scheduled action names.
|
||||
* @throws RuntimeException If problem clearing.
|
||||
*/
|
||||
public function clear_scheduled_actions( array $action_names ): void;
|
||||
|
||||
}
|
98
modules/ppcp-uninstall/src/UninstallModule.php
Normal file
98
modules/ppcp-uninstall/src/UninstallModule.php
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
/**
|
||||
* The uninstall module.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\Uninstall
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Uninstall;
|
||||
|
||||
use Exception;
|
||||
use WooCommerce\PayPalCommerce\Button\Endpoint\RequestData;
|
||||
use WooCommerce\PayPalCommerce\Uninstall\Assets\ClearDatabaseAssets;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
||||
/**
|
||||
* Class UninstallModule
|
||||
*/
|
||||
class UninstallModule implements ModuleInterface {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $container ): void {
|
||||
$page_id = $container->get( 'wcgateway.current-ppcp-settings-page-id' );
|
||||
if ( Settings::CONNECTION_TAB_ID === $page_id ) {
|
||||
$this->registerClearDatabaseAssets( $container->get( 'uninstall.clear-db-assets' ) );
|
||||
}
|
||||
|
||||
$request_data = $container->get( 'button.request-data' );
|
||||
$clear_db = $container->get( 'uninstall.clear-db' );
|
||||
$clear_db_endpoint = $container->get( 'uninstall.clear-db-endpoint' );
|
||||
$option_names = $container->get( 'uninstall.ppcp-all-option-names' );
|
||||
$scheduled_action_names = $container->get( 'uninstall.ppcp-all-scheduled-action-names' );
|
||||
|
||||
$this->handleClearDbAjaxRequest( $request_data, $clear_db, $clear_db_endpoint, $option_names, $scheduled_action_names );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the assets for clear database functionality.
|
||||
*
|
||||
* @param ClearDatabaseAssets $asset_loader The clear database functionality asset loader.
|
||||
*/
|
||||
protected function registerClearDatabaseAssets( ClearDatabaseAssets $asset_loader ): void {
|
||||
add_action( 'init', array( $asset_loader, 'register' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( $asset_loader, 'enqueue' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the AJAX request to clear the database.
|
||||
*
|
||||
* @param RequestData $request_data The request data helper.
|
||||
* @param ClearDatabaseInterface $clear_db Can delete the options and clear scheduled actions from database.
|
||||
* @param string $nonce The nonce.
|
||||
* @param string[] $option_names The list of option names.
|
||||
* @param string[] $scheduled_action_names The list of scheduled action names.
|
||||
*/
|
||||
protected function handleClearDbAjaxRequest(
|
||||
RequestData $request_data,
|
||||
ClearDatabaseInterface $clear_db,
|
||||
string $nonce,
|
||||
array $option_names,
|
||||
array $scheduled_action_names
|
||||
): void {
|
||||
add_action(
|
||||
"wc_ajax_{$nonce}",
|
||||
static function () use ( $request_data, $clear_db, $nonce, $option_names, $scheduled_action_names ) {
|
||||
try {
|
||||
// Validate nonce.
|
||||
$request_data->read_request( $nonce );
|
||||
$clear_db->delete_options( $option_names );
|
||||
$clear_db->clear_scheduled_actions( $scheduled_action_names );
|
||||
|
||||
wp_send_json_success();
|
||||
return true;
|
||||
} catch ( Exception $error ) {
|
||||
wp_send_json_error( $error->getMessage(), 403 );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
35
modules/ppcp-uninstall/webpack.config.js
Normal file
35
modules/ppcp-uninstall/webpack.config.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
const path = require('path');
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
|
||||
module.exports = {
|
||||
devtool: isProduction ? 'source-map' : 'eval-source-map',
|
||||
mode: isProduction ? 'production' : 'development',
|
||||
target: 'web',
|
||||
entry: {
|
||||
'ppcp-clear-db': path.resolve('./resources/js/ppcp-clear-db.js'),
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'assets/'),
|
||||
filename: 'js/[name].js',
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.js?$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: 'css/[name].css',
|
||||
}
|
||||
},
|
||||
{loader:'sass-loader'}
|
||||
]
|
||||
}]
|
||||
}
|
||||
};
|
2306
modules/ppcp-uninstall/yarn.lock
Normal file
2306
modules/ppcp-uninstall/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
|
@ -82,6 +82,8 @@ return array(
|
|||
$logger,
|
||||
$application_context_repository,
|
||||
$subscription_helper,
|
||||
$container->get( 'wcgateway.is-fraudnet-enabled' ),
|
||||
$container->get( 'wcgateway.fraudnet' ),
|
||||
$bn_code
|
||||
);
|
||||
},
|
||||
|
@ -98,12 +100,17 @@ return array(
|
|||
},
|
||||
|
||||
'wcgateway.settings.fields' => function ( ContainerInterface $container, array $fields ): array {
|
||||
$get_connection_tab_fields = require __DIR__ . '/connection-tab-settings.php';
|
||||
$path_to_settings_fields = __DIR__ . '/src/Settings/Fields';
|
||||
|
||||
$get_paypal_button_fields = require $path_to_settings_fields . '/paypal-smart-button-fields.php';
|
||||
$paypal_button_fields = $get_paypal_button_fields( $container, $fields ) ?? array();
|
||||
|
||||
$get_connection_tab_fields = require $path_to_settings_fields . '/connection-tab-fields.php';
|
||||
$connection_tab_fields = $get_connection_tab_fields( $container, $fields ) ?? array();
|
||||
|
||||
$get_pay_later_tab_fields = require __DIR__ . '/pay-later-tab-settings.php';
|
||||
$get_pay_later_tab_fields = require $path_to_settings_fields . '/pay-later-tab-fields.php';
|
||||
$pay_later_tab_fields = $get_pay_later_tab_fields( $container, $fields ) ?? array();
|
||||
|
||||
return array_merge( $connection_tab_fields, $pay_later_tab_fields );
|
||||
return array_merge( $paypal_button_fields, $connection_tab_fields, $pay_later_tab_fields );
|
||||
},
|
||||
);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
@media (min-width: 1200px) {
|
||||
float: right;
|
||||
margin-top: -400px;
|
||||
margin-top: -300px;
|
||||
}
|
||||
|
||||
@media (min-width: 1400px) {
|
||||
|
@ -29,12 +29,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.ppcp-message-preview {
|
||||
@media (min-width: 1200px) {
|
||||
margin-top: -300px;
|
||||
}
|
||||
}
|
||||
|
||||
.ppcp-button-preview.pay-later {
|
||||
@media (min-width: 1200px) {
|
||||
margin-top: -250px;
|
||||
|
|
|
@ -45,11 +45,13 @@ import {setVisibleByClass, isVisible} from "../../../ppcp-button/resources/js/mo
|
|||
if (separateCardButtonCheckbox) {
|
||||
separateCardButtonCheckbox.addEventListener('change', () => {
|
||||
setVisibleByClass('#field-button_layout', !separateCardButtonCheckbox.checked, 'hide');
|
||||
setVisibleByClass('#field-button_general_layout', !separateCardButtonCheckbox.checked, 'hide');
|
||||
});
|
||||
}
|
||||
|
||||
[
|
||||
{layoutSelector: '#ppcp-button_layout', taglineSelector: '#field-button_tagline', canHaveSeparateButtons: true},
|
||||
{layoutSelector: '#ppcp-button_general_layout', taglineSelector: '#field-button_general_tagline', canHaveSeparateButtons: true},
|
||||
{layoutSelector: '#ppcp-button_product_layout', taglineSelector: '#field-button_product_tagline'},
|
||||
{layoutSelector: '#ppcp-button_cart_layout', taglineSelector: '#field-button_cart_tagline'},
|
||||
{layoutSelector: '#ppcp-button_mini-cart_layout', taglineSelector: '#field-button_mini-cart_tagline'},
|
||||
|
@ -262,7 +264,7 @@ import {setVisibleByClass, isVisible} from "../../../ppcp-button/resources/js/mo
|
|||
|
||||
loadPaypalScript(oldScriptSettings, () => {
|
||||
const payLaterMessagingLocations = ['product', 'cart', 'checkout', 'general'];
|
||||
const paypalButtonLocations = ['product', 'cart', 'checkout', 'mini-cart'];
|
||||
const paypalButtonLocations = ['product', 'cart', 'checkout', 'mini-cart', 'general'];
|
||||
|
||||
paypalButtonLocations.forEach((location) => {
|
||||
const inputNamePrefix = location === 'checkout' ? '#ppcp-button' : '#ppcp-button_' + location;
|
||||
|
|
|
@ -11,6 +11,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Session\SessionHandler;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PayUponInvoiceOrderEndpoint;
|
||||
|
@ -28,6 +29,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Admin\FeesRenderer;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Admin\OrderTablePaymentStatusColumn;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Admin\PaymentStatusOrderDetail;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Admin\RenderAuthorizeAction;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Assets\FraudNetAssets;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Checkout\CheckoutPayPalAddressPreset;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Checkout\DisableGateways;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Endpoint\ReturnUrlEndpoint;
|
||||
|
@ -38,9 +40,9 @@ use WooCommerce\PayPalCommerce\WcGateway\Gateway\OXXO\OXXO;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\OXXO\OXXOEndpoint;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\OXXO\OXXOGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice\FraudNet;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice\FraudNetSessionId;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice\FraudNetSourceWebsiteId;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\FraudNet\FraudNet;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\FraudNet\FraudNetSessionId;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\FraudNet\FraudNetSourceWebsiteId;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice\PaymentSourceFactory;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice\PayUponInvoice;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice\PayUponInvoiceGateway;
|
||||
|
@ -142,7 +144,8 @@ return array(
|
|||
'wcgateway.disabler' => static function ( ContainerInterface $container ): DisableGateways {
|
||||
$session_handler = $container->get( 'session.handler' );
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
return new DisableGateways( $session_handler, $settings );
|
||||
$settings_status = $container->get( 'wcgateway.settings.status' );
|
||||
return new DisableGateways( $session_handler, $settings, $settings_status );
|
||||
},
|
||||
|
||||
'wcgateway.is-wc-payments-page' => static function ( ContainerInterface $container ): bool {
|
||||
|
@ -194,8 +197,8 @@ return array(
|
|||
},
|
||||
|
||||
'wcgateway.settings' => static function ( ContainerInterface $container ): Settings {
|
||||
$messaging_locations = $container->get( 'wcgateway.settings.pay-later.messaging-locations' );
|
||||
return new Settings( array_keys( $messaging_locations ) );
|
||||
$default_button_locations = $container->get( 'wcgateway.button.default-locations' );
|
||||
return new Settings( $default_button_locations );
|
||||
},
|
||||
'wcgateway.notice.connect' => static function ( ContainerInterface $container ): ConnectAdminNotice {
|
||||
$state = $container->get( 'onboarding.state' );
|
||||
|
@ -432,19 +435,9 @@ return array(
|
|||
$onboarding_options_renderer = $container->get( 'onboarding.render-options' );
|
||||
assert( $onboarding_options_renderer instanceof OnboardingOptionsRenderer );
|
||||
|
||||
$render_preview_element = function ( string $id ): string {
|
||||
return '
|
||||
<div class="ppcp-preview ppcp-button-preview">
|
||||
<h4>' . __( 'Preview', 'woocommerce-paypal-payments' ) . '</h4>
|
||||
<div id="' . $id . '" class="ppcp-button-preview-inner"></div>
|
||||
</div>';
|
||||
};
|
||||
|
||||
$subscription_helper = $container->get( 'subscription.helper' );
|
||||
assert( $subscription_helper instanceof SubscriptionHelper );
|
||||
|
||||
$has_enabled_separate_button_gateways = $container->get( 'wcgateway.settings.has_enabled_separate_button_gateways' );
|
||||
|
||||
$fields = array(
|
||||
'checkout_settings_heading' => array(
|
||||
'heading' => __( 'Standard Payments Settings', 'woocommerce-paypal-payments' ),
|
||||
|
@ -710,627 +703,6 @@ return array(
|
|||
'gateway' => 'paypal',
|
||||
),
|
||||
|
||||
// General button styles.
|
||||
'button_style_heading' => array(
|
||||
'heading' => __( 'Checkout Buttons', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'ppcp-heading',
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
'description' => sprintf(
|
||||
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
|
||||
__( 'Customize the appearance of the PayPal smart buttons on the %1$sCheckout page%2$s.', 'woocommerce-paypal-payments' ),
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-checkout" target="_blank">',
|
||||
'</a>'
|
||||
),
|
||||
),
|
||||
'button_enabled' => array(
|
||||
'title' => __( 'Enable buttons on Checkout', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable on Checkout', 'woocommerce-paypal-payments' ),
|
||||
'default' => true,
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_layout' => array(
|
||||
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'classes' => $has_enabled_separate_button_gateways ? array( 'hide' ) : array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'vertical',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'If additional funding sources are available to the buyer through PayPal, then multiple buttons are displayed in the space provided. Choose "vertical" for a dynamic list of alternative and local payment options, or "horizontal" when space is limited.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'vertical' => __( 'Vertical', 'woocommerce-paypal-payments' ),
|
||||
'horizontal' => __( 'Horizontal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_tagline' => array(
|
||||
'title' => __( 'Tagline', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'default' => false,
|
||||
'label' => __( 'Enable tagline', 'woocommerce-paypal-payments' ),
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Add the tagline. This line will only show up, if you select a horizontal layout.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_label' => array(
|
||||
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
/**
|
||||
* Returns default label ID of the PayPal button.
|
||||
*/
|
||||
'default' => apply_filters( 'woocommerce_paypal_payments_button_label_default', 'paypal' ),
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'This controls the label on the primary button.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'paypal' => __( 'PayPal', 'woocommerce-paypal-payments' ),
|
||||
'checkout' => __( 'Checkout', 'woocommerce-paypal-payments' ),
|
||||
'buynow' => __( 'PayPal Buy Now', 'woocommerce-paypal-payments' ),
|
||||
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_color' => array(
|
||||
'title' => __( 'Color', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'gold',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Controls the background color of the primary button. Use "Gold" to leverage PayPal\'s recognition and preference, or change it to match your site design or aesthetic.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'gold' => __( 'Gold (Recommended)', 'woocommerce-paypal-payments' ),
|
||||
'blue' => __( 'Blue', 'woocommerce-paypal-payments' ),
|
||||
'silver' => __( 'Silver', 'woocommerce-paypal-payments' ),
|
||||
'black' => __( 'Black', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_shape' => array(
|
||||
'title' => __( 'Shape', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'rect',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'The pill-shaped button\'s unique and powerful shape signifies PayPal in people\'s minds. Use the rectangular button as an alternative when pill-shaped buttons might pose design challenges.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'pill' => __( 'Pill', 'woocommerce-paypal-payments' ),
|
||||
'rect' => __( 'Rectangle', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_preview' => array(
|
||||
'type' => 'ppcp-text',
|
||||
'text' => $render_preview_element( 'ppcpCheckoutButtonPreview' ),
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
|
||||
// Single product page.
|
||||
'button_product_heading' => array(
|
||||
'heading' => __( 'Single Product Page Buttons', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'ppcp-heading',
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
'description' => sprintf(
|
||||
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
|
||||
__( 'Customize the appearance of the PayPal smart buttons on the %1$sSingle Product Page%2$s.', 'woocommerce-paypal-payments' ),
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-single-product" target="_blank">',
|
||||
'</a>'
|
||||
),
|
||||
),
|
||||
'button_product_enabled' => array(
|
||||
'title' => __( 'Enable buttons on Single Product', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable on Single Product', 'woocommerce-paypal-payments' ),
|
||||
'default' => true,
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_product_layout' => array(
|
||||
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'horizontal',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'If additional funding sources are available to the buyer through PayPal, such as Venmo, then multiple buttons are displayed in the space provided. Choose "vertical" for a dynamic list of alternative and local payment options, or "horizontal" when space is limited.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'vertical' => __( 'Vertical', 'woocommerce-paypal-payments' ),
|
||||
'horizontal' => __( 'Horizontal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_product_tagline' => array(
|
||||
'title' => __( 'Tagline', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable tagline', 'woocommerce-paypal-payments' ),
|
||||
'default' => false,
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Add the tagline. This line will only show up, if you select a horizontal layout.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_product_label' => array(
|
||||
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
/**
|
||||
* Returns default label ID of the PayPal button on product pages.
|
||||
*/
|
||||
'default' => apply_filters( 'woocommerce_paypal_payments_button_product_label_default', 'paypal' ),
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'This controls the label on the primary button.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'paypal' => __( 'PayPal', 'woocommerce-paypal-payments' ),
|
||||
'checkout' => __( 'Checkout', 'woocommerce-paypal-payments' ),
|
||||
'buynow' => __( 'PayPal Buy Now', 'woocommerce-paypal-payments' ),
|
||||
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_product_color' => array(
|
||||
'title' => __( 'Color', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'gold',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Controls the background color of the primary button. Use "Gold" to leverage PayPal\'s recognition and preference, or change it to match your site design or aesthetic.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'gold' => __( 'Gold (Recommended)', 'woocommerce-paypal-payments' ),
|
||||
'blue' => __( 'Blue', 'woocommerce-paypal-payments' ),
|
||||
'silver' => __( 'Silver', 'woocommerce-paypal-payments' ),
|
||||
'black' => __( 'Black', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_product_shape' => array(
|
||||
'title' => __( 'Shape', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'rect',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'The pill-shaped button\'s unique and powerful shape signifies PayPal in people\'s minds. Use the rectangular button as an alternative when pill-shaped buttons might pose design challenges.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'pill' => __( 'Pill', 'woocommerce-paypal-payments' ),
|
||||
'rect' => __( 'Rectangle', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_product_preview' => array(
|
||||
'type' => 'ppcp-text',
|
||||
'text' => $render_preview_element( 'ppcpProductButtonPreview' ),
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
|
||||
// Cart settings.
|
||||
'button_cart_heading' => array(
|
||||
'heading' => __( 'Cart Buttons', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'ppcp-heading',
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
'description' => sprintf(
|
||||
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
|
||||
__( 'Customize the appearance of the PayPal smart buttons %1$son the Cart page%2$s.', 'woocommerce-paypal-payments' ),
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-cart" target="_blank">',
|
||||
'</a>'
|
||||
),
|
||||
),
|
||||
'button_cart_enabled' => array(
|
||||
'title' => __( 'Enable buttons on Cart', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable on Cart', 'woocommerce-paypal-payments' ),
|
||||
'default' => true,
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_cart_layout' => array(
|
||||
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'horizontal',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'If additional funding sources are available to the buyer through PayPal, such as Venmo, then multiple buttons are displayed in the space provided. Choose "vertical" for a dynamic list of alternative and local payment options, or "horizontal" when space is limited.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'vertical' => __( 'Vertical', 'woocommerce-paypal-payments' ),
|
||||
'horizontal' => __( 'Horizontal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_cart_tagline' => array(
|
||||
'title' => __( 'Tagline', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable tagline', 'woocommerce-paypal-payments' ),
|
||||
'default' => false,
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Add the tagline. This line will only show up, if you select a horizontal layout.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_cart_label' => array(
|
||||
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
/**
|
||||
* Returns default label ID of the PayPal button in cart.
|
||||
*/
|
||||
'default' => apply_filters( 'woocommerce_paypal_payments_button_cart_label_default', 'paypal' ),
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'This controls the label on the primary button.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'paypal' => __( 'PayPal', 'woocommerce-paypal-payments' ),
|
||||
'checkout' => __( 'Checkout', 'woocommerce-paypal-payments' ),
|
||||
'buynow' => __( 'PayPal Buy Now', 'woocommerce-paypal-payments' ),
|
||||
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_cart_color' => array(
|
||||
'title' => __( 'Color', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'gold',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Controls the background color of the primary button. Use "Gold" to leverage PayPal\'s recognition and preference, or change it to match your site design or aesthetic.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'gold' => __( 'Gold (Recommended)', 'woocommerce-paypal-payments' ),
|
||||
'blue' => __( 'Blue', 'woocommerce-paypal-payments' ),
|
||||
'silver' => __( 'Silver', 'woocommerce-paypal-payments' ),
|
||||
'black' => __( 'Black', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_cart_shape' => array(
|
||||
'title' => __( 'Shape', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'rect',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'The pill-shaped button\'s unique and powerful shape signifies PayPal in people\'s minds. Use the rectangular button as an alternative when pill-shaped buttons might pose design challenges.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'pill' => __( 'Pill', 'woocommerce-paypal-payments' ),
|
||||
'rect' => __( 'Rectangle', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_cart_preview' => array(
|
||||
'type' => 'ppcp-text',
|
||||
'text' => $render_preview_element( 'ppcpCartButtonPreview' ),
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
|
||||
// Mini cart settings.
|
||||
'button_mini-cart_heading' => array(
|
||||
'heading' => __( 'Mini Cart Buttons', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'ppcp-heading',
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
'description' => sprintf(
|
||||
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
|
||||
__( 'Customize the appearance of the PayPal smart buttons %1$son the Mini Cart page%2$s.', 'woocommerce-paypal-payments' ),
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-mini-cart" target="_blank">',
|
||||
'</a>'
|
||||
),
|
||||
),
|
||||
'button_mini-cart_enabled' => array(
|
||||
'title' => __( 'Enable buttons on Mini Cart', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable on Mini Cart', 'woocommerce-paypal-payments' ),
|
||||
'default' => false,
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_layout' => array(
|
||||
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'vertical',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'If additional funding sources are available to the buyer through PayPal, such as Venmo, then multiple buttons are displayed in the space provided. Choose "vertical" for a dynamic list of alternative and local payment options, or "horizontal" when space is limited.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'vertical' => __( 'Vertical', 'woocommerce-paypal-payments' ),
|
||||
'horizontal' => __( 'Horizontal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_tagline' => array(
|
||||
'title' => __( 'Tagline', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable tagline', 'woocommerce-paypal-payments' ),
|
||||
'default' => false,
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Add the tagline. This line will only show up, if you select a horizontal layout.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_label' => array(
|
||||
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
/**
|
||||
* Returns default label ID of the PayPal button in mini cart.
|
||||
*/
|
||||
'default' => apply_filters( 'woocommerce_paypal_payments_button_mini_cart_label_default', 'paypal' ),
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'This controls the label on the primary button.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'paypal' => __( 'PayPal', 'woocommerce-paypal-payments' ),
|
||||
'checkout' => __( 'Checkout', 'woocommerce-paypal-payments' ),
|
||||
'buynow' => __( 'PayPal Buy Now', 'woocommerce-paypal-payments' ),
|
||||
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_color' => array(
|
||||
'title' => __( 'Color', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'gold',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Controls the background color of the primary button. Use "Gold" to leverage PayPal\'s recognition and preference, or change it to match your site design or aesthetic.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'gold' => __( 'Gold (Recommended)', 'woocommerce-paypal-payments' ),
|
||||
'blue' => __( 'Blue', 'woocommerce-paypal-payments' ),
|
||||
'silver' => __( 'Silver', 'woocommerce-paypal-payments' ),
|
||||
'black' => __( 'Black', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_shape' => array(
|
||||
'title' => __( 'Shape', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'rect',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'The pill-shaped button\'s unique and powerful shape signifies PayPal in people\'s minds. Use the rectangular button as an alternative when pill-shaped buttons might pose design challenges.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'pill' => __( 'Pill', 'woocommerce-paypal-payments' ),
|
||||
'rect' => __( 'Rectangle', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_height' => array(
|
||||
'title' => __( 'Button Height', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'number',
|
||||
'default' => '35',
|
||||
'custom_attributes' => array(
|
||||
'min' => 25,
|
||||
'max' => 55,
|
||||
),
|
||||
'desc_tip' => true,
|
||||
'description' => __( 'Add a value from 25 to 55.', 'woocommerce-paypal-payments' ),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_preview' => array(
|
||||
'type' => 'ppcp-text',
|
||||
'text' => $render_preview_element( 'ppcpMiniCartButtonPreview' ),
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
|
||||
'disable_cards' => array(
|
||||
'title' => __( 'Disable specific credit cards', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'ppcp-multiselect',
|
||||
|
@ -1571,7 +943,7 @@ return array(
|
|||
$container->get( 'api.host' ),
|
||||
$container->get( 'api.bearer' ),
|
||||
$container->get( 'api.factory.order' ),
|
||||
$container->get( 'wcgateway.pay-upon-invoice-fraudnet' ),
|
||||
$container->get( 'wcgateway.fraudnet' ),
|
||||
$container->get( 'woocommerce.logger.woocommerce' )
|
||||
);
|
||||
},
|
||||
|
@ -1592,15 +964,15 @@ return array(
|
|||
$container->get( 'wcgateway.processor.refunds' )
|
||||
);
|
||||
},
|
||||
'wcgateway.pay-upon-invoice-fraudnet-session-id' => static function ( ContainerInterface $container ): FraudNetSessionId {
|
||||
'wcgateway.fraudnet-session-id' => static function ( ContainerInterface $container ): FraudNetSessionId {
|
||||
return new FraudNetSessionId();
|
||||
},
|
||||
'wcgateway.pay-upon-invoice-fraudnet-source-website-id' => static function ( ContainerInterface $container ): FraudNetSourceWebsiteId {
|
||||
'wcgateway.fraudnet-source-website-id' => static function ( ContainerInterface $container ): FraudNetSourceWebsiteId {
|
||||
return new FraudNetSourceWebsiteId( $container->get( 'api.merchant_id' ) );
|
||||
},
|
||||
'wcgateway.pay-upon-invoice-fraudnet' => static function ( ContainerInterface $container ): FraudNet {
|
||||
$session_id = $container->get( 'wcgateway.pay-upon-invoice-fraudnet-session-id' );
|
||||
$source_website_id = $container->get( 'wcgateway.pay-upon-invoice-fraudnet-source-website-id' );
|
||||
'wcgateway.fraudnet' => static function ( ContainerInterface $container ): FraudNet {
|
||||
$session_id = $container->get( 'wcgateway.fraudnet-session-id' );
|
||||
$source_website_id = $container->get( 'wcgateway.fraudnet-source-website-id' );
|
||||
return new FraudNet(
|
||||
(string) $session_id(),
|
||||
(string) $source_website_id()
|
||||
|
@ -1621,21 +993,15 @@ return array(
|
|||
},
|
||||
'wcgateway.pay-upon-invoice' => static function ( ContainerInterface $container ): PayUponInvoice {
|
||||
return new PayUponInvoice(
|
||||
$container->get( 'wcgateway.url' ),
|
||||
$container->get( 'wcgateway.pay-upon-invoice-fraudnet' ),
|
||||
$container->get( 'wcgateway.pay-upon-invoice-order-endpoint' ),
|
||||
$container->get( 'woocommerce.logger.woocommerce' ),
|
||||
$container->get( 'wcgateway.settings' ),
|
||||
$container->get( 'onboarding.environment' ),
|
||||
$container->get( 'ppcp.asset-version' ),
|
||||
$container->get( 'onboarding.state' ),
|
||||
$container->get( 'wcgateway.is-ppcp-settings-page' ),
|
||||
$container->get( 'wcgateway.current-ppcp-settings-page-id' ),
|
||||
$container->get( 'wcgateway.pay-upon-invoice-product-status' ),
|
||||
$container->get( 'wcgateway.pay-upon-invoice-helper' ),
|
||||
$container->get( 'wcgateway.checkout-helper' ),
|
||||
$container->get( 'api.factory.capture' ),
|
||||
$container->get( 'session.handler' )
|
||||
$container->get( 'api.factory.capture' )
|
||||
);
|
||||
},
|
||||
'wcgateway.oxxo' => static function( ContainerInterface $container ): OXXO {
|
||||
|
@ -1893,40 +1259,118 @@ return array(
|
|||
'dcc.status-cache' => static function( ContainerInterface $container ): Cache {
|
||||
return new Cache( 'ppcp-paypal-dcc-status-cache' );
|
||||
},
|
||||
'wcgateway.settings.pay-later.messaging-locations' => static function( ContainerInterface $container ): array {
|
||||
'wcgateway.button.locations' => static function( ContainerInterface $container ): array {
|
||||
return array(
|
||||
'product' => 'Single Product',
|
||||
'cart' => 'Cart',
|
||||
'checkout' => 'Checkout',
|
||||
'mini-cart' => 'Mini Cart',
|
||||
);
|
||||
},
|
||||
'wcgateway.settings.pay-later.messaging-locations' => static function( ContainerInterface $container ): array {
|
||||
$button_locations = $container->get( 'wcgateway.button.locations' );
|
||||
unset( $button_locations['mini-cart'] );
|
||||
return $button_locations;
|
||||
},
|
||||
'wcgateway.button.default-locations' => static function( ContainerInterface $container ): array {
|
||||
return array_keys( $container->get( 'wcgateway.settings.pay-later.messaging-locations' ) );
|
||||
},
|
||||
'wcgateway.settings.pay-later.button-locations' => static function( ContainerInterface $container ): array {
|
||||
$button_locations = array();
|
||||
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
assert( $settings instanceof Settings );
|
||||
|
||||
$is_product_buttons_enabled = $settings->has( 'button_product_enabled' ) && $settings->get( 'button_product_enabled' );
|
||||
$is_mini_cart_buttons_enabled = $settings->has( 'button_mini-cart_enabled' ) && $settings->get( 'button_mini-cart_enabled' );
|
||||
$is_cart_buttons_enabled = $settings->has( 'button_cart_enabled' ) && $settings->get( 'button_cart_enabled' );
|
||||
$is_checkout_buttons_enabled = $settings->has( 'button_enabled' ) && $settings->get( 'button_enabled' );
|
||||
$button_locations = $container->get( 'wcgateway.button.locations' );
|
||||
unset( $button_locations['mini-cart'] );
|
||||
|
||||
if ( $is_product_buttons_enabled ) {
|
||||
$button_locations['product'] = 'Single Product';
|
||||
$smart_button_selected_locations = $settings->has( 'smart_button_locations' ) ? $settings->get( 'smart_button_locations' ) : array();
|
||||
$pay_later_button_locations = array();
|
||||
|
||||
if ( empty( $smart_button_selected_locations ) ) {
|
||||
return $pay_later_button_locations;
|
||||
}
|
||||
|
||||
if ( $is_mini_cart_buttons_enabled ) {
|
||||
$button_locations['mini-cart'] = 'Mini Cart';
|
||||
foreach ( $button_locations as $location_key => $location ) {
|
||||
if ( ! in_array( $location_key, $smart_button_selected_locations, true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $is_cart_buttons_enabled ) {
|
||||
$button_locations['cart'] = 'Cart';
|
||||
$pay_later_button_locations[ $location_key ] = $location;
|
||||
}
|
||||
|
||||
if ( $is_checkout_buttons_enabled ) {
|
||||
$button_locations['checkout'] = 'Checkout';
|
||||
return $pay_later_button_locations;
|
||||
},
|
||||
'wcgateway.ppcp-gateways' => static function ( ContainerInterface $container ): array {
|
||||
return array(
|
||||
PayPalGateway::ID,
|
||||
CreditCardGateway::ID,
|
||||
PayUponInvoiceGateway::ID,
|
||||
CardButtonGateway::ID,
|
||||
OXXOGateway::ID,
|
||||
);
|
||||
},
|
||||
'wcgateway.enabled-ppcp-gateways' => static function ( ContainerInterface $container ): array {
|
||||
$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
|
||||
$ppcp_gateways = $container->get( 'wcgateway.ppcp-gateways' );
|
||||
$enabled_ppcp_gateways = array();
|
||||
|
||||
foreach ( $ppcp_gateways as $gateway ) {
|
||||
if ( ! isset( $available_gateways[ $gateway ] ) ) {
|
||||
continue;
|
||||
}
|
||||
$enabled_ppcp_gateways[] = $gateway;
|
||||
}
|
||||
|
||||
return $button_locations;
|
||||
return $enabled_ppcp_gateways;
|
||||
},
|
||||
'wcgateway.is-paypal-continuation' => static function ( ContainerInterface $container ): bool {
|
||||
$session_handler = $container->get( 'session.handler' );
|
||||
assert( $session_handler instanceof SessionHandler );
|
||||
|
||||
$order = $session_handler->order();
|
||||
if ( ! $order ) {
|
||||
return false;
|
||||
}
|
||||
$source = $order->payment_source();
|
||||
if ( $source && $source->card() ) {
|
||||
return false; // Ignore for DCC.
|
||||
}
|
||||
if ( 'card' === $session_handler->funding_source() ) {
|
||||
return false; // Ignore for card buttons.
|
||||
}
|
||||
return true;
|
||||
},
|
||||
'wcgateway.current-context' => static function ( ContainerInterface $container ): string {
|
||||
$context = 'mini-cart';
|
||||
if ( is_product() || wc_post_content_has_shortcode( 'product_page' ) ) {
|
||||
$context = 'product';
|
||||
}
|
||||
if ( is_cart() ) {
|
||||
$context = 'cart';
|
||||
}
|
||||
if ( is_checkout() && ! $container->get( 'wcgateway.is-paypal-continuation' ) ) {
|
||||
$context = 'checkout';
|
||||
}
|
||||
if ( is_checkout_pay_page() ) {
|
||||
$context = 'pay-now';
|
||||
}
|
||||
return $context;
|
||||
},
|
||||
'wcgateway.is-fraudnet-enabled' => static function ( ContainerInterface $container ): bool {
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
assert( $settings instanceof Settings );
|
||||
|
||||
return $settings->has( 'fraudnet_enabled' ) && $settings->get( 'fraudnet_enabled' );
|
||||
},
|
||||
'wcgateway.fraudnet-assets' => function( ContainerInterface $container ) : FraudNetAssets {
|
||||
return new FraudNetAssets(
|
||||
$container->get( 'wcgateway.url' ),
|
||||
$container->get( 'ppcp.asset-version' ),
|
||||
$container->get( 'wcgateway.fraudnet' ),
|
||||
$container->get( 'onboarding.environment' ),
|
||||
$container->get( 'wcgateway.settings' ),
|
||||
$container->get( 'wcgateway.enabled-ppcp-gateways' ),
|
||||
$container->get( 'wcgateway.current-context' ),
|
||||
$container->get( 'wcgateway.is-fraudnet-enabled' )
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
186
modules/ppcp-wc-gateway/src/Assets/FraudNetAssets.php
Normal file
186
modules/ppcp-wc-gateway/src/Assets/FraudNetAssets.php
Normal file
|
@ -0,0 +1,186 @@
|
|||
<?php
|
||||
/**
|
||||
* Register and configure FraudNet assets
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\WcGateway\Assets
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\Assets;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\FraudNet\FraudNet;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice\PayUponInvoiceGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
||||
/**
|
||||
* Class FraudNetAssets
|
||||
*/
|
||||
class FraudNetAssets {
|
||||
|
||||
/**
|
||||
* The URL of this module.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $module_url;
|
||||
|
||||
/**
|
||||
* The assets version.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $version;
|
||||
|
||||
/**
|
||||
* The FraudNet entity.
|
||||
*
|
||||
* @var FraudNet
|
||||
*/
|
||||
protected $fraud_net;
|
||||
|
||||
/**
|
||||
* The environment.
|
||||
*
|
||||
* @var Environment
|
||||
*/
|
||||
protected $environment;
|
||||
|
||||
/**
|
||||
* The Settings.
|
||||
*
|
||||
* @var Settings
|
||||
*/
|
||||
protected $settings;
|
||||
|
||||
/**
|
||||
* The list of enabled PayPal gateways.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $enabled_ppcp_gateways;
|
||||
|
||||
/**
|
||||
* The current context.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $context;
|
||||
|
||||
/**
|
||||
* True if FraudNet support is enabled in settings, otherwise false.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $is_fraudnet_enabled;
|
||||
|
||||
/**
|
||||
* Assets constructor.
|
||||
*
|
||||
* @param string $module_url The url of this module.
|
||||
* @param string $version The assets version.
|
||||
* @param FraudNet $fraud_net The FraudNet entity.
|
||||
* @param Environment $environment The environment.
|
||||
* @param Settings $settings The Settings.
|
||||
* @param string[] $enabled_ppcp_gateways The list of enabled PayPal gateways.
|
||||
* @param string $context The current context.
|
||||
* @param bool $is_fraudnet_enabled true if FraudNet support is enabled in settings, otherwise false.
|
||||
*/
|
||||
public function __construct(
|
||||
string $module_url,
|
||||
string $version,
|
||||
FraudNet $fraud_net,
|
||||
Environment $environment,
|
||||
Settings $settings,
|
||||
array $enabled_ppcp_gateways,
|
||||
string $context,
|
||||
bool $is_fraudnet_enabled
|
||||
) {
|
||||
$this->module_url = $module_url;
|
||||
$this->version = $version;
|
||||
$this->fraud_net = $fraud_net;
|
||||
$this->environment = $environment;
|
||||
$this->settings = $settings;
|
||||
$this->enabled_ppcp_gateways = $enabled_ppcp_gateways;
|
||||
$this->context = $context;
|
||||
$this->is_fraudnet_enabled = $is_fraudnet_enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers FraudNet assets.
|
||||
*/
|
||||
public function register_assets(): void {
|
||||
add_action(
|
||||
'wp_enqueue_scripts',
|
||||
function() {
|
||||
if ( $this->should_load_fraudnet_script() ) {
|
||||
wp_enqueue_script(
|
||||
'ppcp-fraudnet',
|
||||
trailingslashit( $this->module_url ) . 'assets/js/fraudnet.js',
|
||||
array(),
|
||||
$this->version,
|
||||
true
|
||||
);
|
||||
|
||||
wp_localize_script(
|
||||
'ppcp-fraudnet',
|
||||
'FraudNetConfig',
|
||||
array(
|
||||
'f' => $this->fraud_net->session_id(),
|
||||
's' => $this->fraud_net->source_website_id(),
|
||||
'sandbox' => $this->environment->current_environment_is( Environment::SANDBOX ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if FraudNet script should be loaded.
|
||||
*
|
||||
* @return bool true if FraudNet script should be loaded, otherwise false.
|
||||
*/
|
||||
protected function should_load_fraudnet_script(): bool {
|
||||
if ( empty( $this->enabled_ppcp_gateways ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$is_pui_gateway_enabled = in_array( PayUponInvoiceGateway::ID, $this->enabled_ppcp_gateways, true );
|
||||
$is_only_standard_gateway_enabled = $this->enabled_ppcp_gateways === array( PayPalGateway::ID );
|
||||
|
||||
if ( $this->context !== 'checkout' || $is_only_standard_gateway_enabled ) {
|
||||
return $this->is_fraudnet_enabled && $this->are_buttons_enabled_for_context();
|
||||
}
|
||||
|
||||
return $is_pui_gateway_enabled ? true : $this->is_fraudnet_enabled;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if buttons are enabled for current context.
|
||||
*
|
||||
* @return bool true if enabled, otherwise false.
|
||||
*/
|
||||
protected function are_buttons_enabled_for_context() : bool {
|
||||
if ( ! in_array( PayPalGateway::ID, $this->enabled_ppcp_gateways, true ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$location_prefix = $this->context === 'checkout' ? '' : "{$this->context}_";
|
||||
$setting_name = "button_{$location_prefix}enabled";
|
||||
$buttons_enabled_for_context = $this->settings->has( $setting_name ) && $this->settings->get( $setting_name );
|
||||
|
||||
if ( $this->context === 'product' ) {
|
||||
return $buttons_enabled_for_context || $this->settings->has( 'mini-cart' ) && $this->settings->get( 'mini-cart' );
|
||||
}
|
||||
|
||||
if ( $this->context === 'pay-now' ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $buttons_enabled_for_context;
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Gateway\CardButtonGateway;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\SettingsStatus;
|
||||
|
||||
/**
|
||||
* Class DisableGateways
|
||||
|
@ -34,19 +35,29 @@ class DisableGateways {
|
|||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* The Settings status helper.
|
||||
*
|
||||
* @var SettingsStatus
|
||||
*/
|
||||
protected $settings_status;
|
||||
|
||||
/**
|
||||
* DisableGateways constructor.
|
||||
*
|
||||
* @param SessionHandler $session_handler The Session Handler.
|
||||
* @param ContainerInterface $settings The Settings.
|
||||
* @param SettingsStatus $settings_status The Settings status helper.
|
||||
*/
|
||||
public function __construct(
|
||||
SessionHandler $session_handler,
|
||||
ContainerInterface $settings
|
||||
ContainerInterface $settings,
|
||||
SettingsStatus $settings_status
|
||||
) {
|
||||
|
||||
$this->session_handler = $session_handler;
|
||||
$this->settings = $settings;
|
||||
$this->settings_status = $settings_status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,7 +82,7 @@ class DisableGateways {
|
|||
unset( $methods[ CreditCardGateway::ID ] );
|
||||
}
|
||||
|
||||
if ( $this->settings->has( 'button_enabled' ) && ! $this->settings->get( 'button_enabled' ) && ! $this->session_handler->order() && is_checkout() ) {
|
||||
if ( ! $this->settings_status->is_smart_button_enabled_for_location( 'checkout' ) && ! $this->session_handler->order() && is_checkout() ) {
|
||||
unset( $methods[ PayPalGateway::ID ] );
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice;
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\FraudNet;
|
||||
|
||||
/**
|
||||
* Class FraudNet
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice;
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\FraudNet;
|
||||
|
||||
use Exception;
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice;
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\FraudNet;
|
||||
|
||||
/**
|
||||
* Class FraudNetSourceWebsiteId.
|
|
@ -270,7 +270,7 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
|||
'type' => 'checkbox',
|
||||
'desc_tip' => true,
|
||||
'description' => __( 'In order to use PayPal or Advanced Card Processing, you need to enable the Gateway.', 'woocommerce-paypal-payments' ),
|
||||
'label' => __( 'Enable the PayPal Gateway', 'woocommerce-paypal-payments' ),
|
||||
'label' => __( 'Enable PayPal features for your store', 'woocommerce-paypal-payments' ),
|
||||
'default' => 'no',
|
||||
),
|
||||
'ppcp' => array(
|
||||
|
|
|
@ -17,6 +17,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Factory\CaptureFactory;
|
|||
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
||||
use WooCommerce\PayPalCommerce\Session\SessionHandler;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\FraudNet\FraudNet;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CheckoutHelper;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\PayUponInvoiceHelper;
|
||||
|
@ -34,20 +35,6 @@ class PayUponInvoice {
|
|||
|
||||
use TransactionIdHandlingTrait;
|
||||
|
||||
/**
|
||||
* The module URL.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $module_url;
|
||||
|
||||
/**
|
||||
* The FraudNet entity.
|
||||
*
|
||||
* @var FraudNet
|
||||
*/
|
||||
protected $fraud_net;
|
||||
|
||||
/**
|
||||
* The pui order endpoint.
|
||||
*
|
||||
|
@ -69,20 +56,6 @@ class PayUponInvoice {
|
|||
*/
|
||||
protected $settings;
|
||||
|
||||
/**
|
||||
* The environment.
|
||||
*
|
||||
* @var Environment
|
||||
*/
|
||||
protected $environment;
|
||||
|
||||
/**
|
||||
* The asset version.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $asset_version;
|
||||
|
||||
/**
|
||||
* The PUI helper.
|
||||
*
|
||||
|
@ -97,13 +70,6 @@ class PayUponInvoice {
|
|||
*/
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Whether the current page is the PPCP settings page.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $is_ppcp_settings_page;
|
||||
|
||||
/**
|
||||
* Current PayPal settings page id.
|
||||
*
|
||||
|
@ -132,64 +98,39 @@ class PayUponInvoice {
|
|||
*/
|
||||
protected $capture_factory;
|
||||
|
||||
/**
|
||||
* The session handler
|
||||
*
|
||||
* @var SessionHandler
|
||||
*/
|
||||
protected $session_handler;
|
||||
|
||||
/**
|
||||
* PayUponInvoice constructor.
|
||||
*
|
||||
* @param string $module_url The module URL.
|
||||
* @param FraudNet $fraud_net The FraudNet entity.
|
||||
* @param PayUponInvoiceOrderEndpoint $pui_order_endpoint The PUI order endpoint.
|
||||
* @param LoggerInterface $logger The logger.
|
||||
* @param Settings $settings The settings.
|
||||
* @param Environment $environment The environment.
|
||||
* @param string $asset_version The asset version.
|
||||
* @param State $state The onboarding state.
|
||||
* @param bool $is_ppcp_settings_page Whether page is PayPal settings poge.
|
||||
* @param string $current_ppcp_settings_page_id Current PayPal settings page id.
|
||||
* @param PayUponInvoiceProductStatus $pui_product_status The PUI product status.
|
||||
* @param PayUponInvoiceHelper $pui_helper The PUI helper.
|
||||
* @param CheckoutHelper $checkout_helper The checkout helper.
|
||||
* @param CaptureFactory $capture_factory The capture factory.
|
||||
* @param SessionHandler $session_handler The session handler.
|
||||
*/
|
||||
public function __construct(
|
||||
string $module_url,
|
||||
FraudNet $fraud_net,
|
||||
PayUponInvoiceOrderEndpoint $pui_order_endpoint,
|
||||
LoggerInterface $logger,
|
||||
Settings $settings,
|
||||
Environment $environment,
|
||||
string $asset_version,
|
||||
State $state,
|
||||
bool $is_ppcp_settings_page,
|
||||
string $current_ppcp_settings_page_id,
|
||||
PayUponInvoiceProductStatus $pui_product_status,
|
||||
PayUponInvoiceHelper $pui_helper,
|
||||
CheckoutHelper $checkout_helper,
|
||||
CaptureFactory $capture_factory,
|
||||
SessionHandler $session_handler
|
||||
CaptureFactory $capture_factory
|
||||
) {
|
||||
$this->module_url = $module_url;
|
||||
$this->fraud_net = $fraud_net;
|
||||
$this->pui_order_endpoint = $pui_order_endpoint;
|
||||
$this->logger = $logger;
|
||||
$this->settings = $settings;
|
||||
$this->environment = $environment;
|
||||
$this->asset_version = $asset_version;
|
||||
$this->state = $state;
|
||||
$this->is_ppcp_settings_page = $is_ppcp_settings_page;
|
||||
$this->current_ppcp_settings_page_id = $current_ppcp_settings_page_id;
|
||||
$this->pui_product_status = $pui_product_status;
|
||||
$this->pui_helper = $pui_helper;
|
||||
$this->checkout_helper = $checkout_helper;
|
||||
$this->capture_factory = $capture_factory;
|
||||
$this->session_handler = $session_handler;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -236,11 +177,6 @@ class PayUponInvoice {
|
|||
}
|
||||
);
|
||||
|
||||
add_action(
|
||||
'wp_enqueue_scripts',
|
||||
array( $this, 'register_assets' )
|
||||
);
|
||||
|
||||
add_action(
|
||||
'ppcp_payment_capture_completed_webhook_handler',
|
||||
function ( WC_Order $wc_order, string $order_id ) {
|
||||
|
@ -610,31 +546,4 @@ class PayUponInvoice {
|
|||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers PUI assets.
|
||||
*/
|
||||
public function register_assets(): void {
|
||||
$gateway_settings = get_option( 'woocommerce_ppcp-pay-upon-invoice-gateway_settings' );
|
||||
$gateway_enabled = $gateway_settings['enabled'] ?? '';
|
||||
if ( $gateway_enabled === 'yes' && ! $this->session_handler->order() && ( is_checkout() || is_checkout_pay_page() ) ) {
|
||||
wp_enqueue_script(
|
||||
'ppcp-pay-upon-invoice',
|
||||
trailingslashit( $this->module_url ) . 'assets/js/pay-upon-invoice.js',
|
||||
array(),
|
||||
$this->asset_version,
|
||||
true
|
||||
);
|
||||
|
||||
wp_localize_script(
|
||||
'ppcp-pay-upon-invoice',
|
||||
'FraudNetConfig',
|
||||
array(
|
||||
'f' => $this->fraud_net->session_id(),
|
||||
's' => $this->fraud_net->source_website_id(),
|
||||
'sandbox' => $this->environment->current_environment_is( Environment::SANDBOX ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,4 +125,20 @@ class SettingsStatus {
|
|||
|
||||
return $context === 'product' ? $enabled_for_product || $enabled_for_mini_cart : $enabled_for_current_location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether smart buttons are enabled for a given location.
|
||||
*
|
||||
* @param string $location The location.
|
||||
* @return bool true if is enabled, otherwise false.
|
||||
*/
|
||||
public function is_smart_button_enabled_for_location( string $location ): bool {
|
||||
$selected_locations = $this->settings->has( 'smart_button_locations' ) ? $this->settings->get( 'smart_button_locations' ) : array();
|
||||
|
||||
if ( empty( $selected_locations ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return in_array( $location, $selected_locations, true );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,11 @@ declare(strict_types=1);
|
|||
namespace WooCommerce\PayPalCommerce\WcGateway\Processor;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WC_Order;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\OrderFactory;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\OrderHelper;
|
||||
use WooCommerce\PayPalCommerce\Button\Helper\ThreeDSecure;
|
||||
|
@ -160,14 +162,29 @@ class OrderProcessor {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function process( \WC_Order $wc_order ): bool {
|
||||
$order_id = $wc_order->get_meta( PayPalGateway::ORDER_ID_META_KEY );
|
||||
$order = $this->session_handler->order() ?? $this->order_endpoint->order( $order_id );
|
||||
public function process( WC_Order $wc_order ): bool {
|
||||
$order = $this->session_handler->order();
|
||||
if ( ! $order ) {
|
||||
$this->last_error = __( 'No PayPal order found in the current WooCommerce session.', 'woocommerce-paypal-payments' );
|
||||
$order_id = $wc_order->get_meta( PayPalGateway::ORDER_ID_META_KEY );
|
||||
if ( ! $order_id ) {
|
||||
$this->logger->warning(
|
||||
sprintf(
|
||||
'No PayPal order ID found in order #%d meta.',
|
||||
$wc_order->get_id()
|
||||
)
|
||||
);
|
||||
$this->last_error = __( 'Could not retrieve order. This browser may not be supported. Please try again with a different browser.', 'woocommerce-paypal-payments' );
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
$order = $this->order_endpoint->order( $order_id );
|
||||
} catch ( RuntimeException $exception ) {
|
||||
$this->last_error = __( 'Could not retrieve PayPal order.', 'woocommerce-paypal-payments' );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->add_paypal_meta( $wc_order, $order, $this->environment );
|
||||
|
||||
$error_message = null;
|
||||
|
|
|
@ -9,14 +9,13 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway;
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\Settings;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingOptionsRenderer;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
||||
return function ( ContainerInterface $container, array $fields ): array {
|
||||
|
||||
|
@ -395,6 +394,24 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
'input_class' => $container->get( 'wcgateway.settings.should-disable-tracking-checkbox' ) ? array( 'ppcp-disabled-checkbox' ) : array(),
|
||||
),
|
||||
'fraudnet_enabled' => array(
|
||||
'title' => __( 'FraudNet', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'desc_tip' => true,
|
||||
'label' => sprintf(
|
||||
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
|
||||
__( 'Manage online risk with %1$sFraudNet%2$s.', 'woocommerce-paypal-payments' ),
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#FraudNet" target="_blank">',
|
||||
'</a>'
|
||||
),
|
||||
'description' => __( 'FraudNet is a JavaScript library developed by PayPal and embedded into a merchant’s web page to collect browser-based data to help reduce fraud.', 'woocommerce-paypal-payments' ),
|
||||
'default' => false,
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
|
||||
'credentials_integration_configuration_heading' => array(
|
||||
'heading' => __( 'General integration configuration', 'woocommerce-paypal-payments' ),
|
|
@ -9,11 +9,10 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway;
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\Settings;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
||||
return function ( ContainerInterface $container, array $fields ): array {
|
||||
|
||||
|
@ -32,8 +31,6 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
? __( "You have PayPal vaulting enabled, that's why Pay Later options are unavailable now. You cannot use both features at the same time.", 'woocommerce-paypal-payments' )
|
||||
: __( 'Enabled', 'woocommerce-paypal-payments' );
|
||||
|
||||
$default_locations = array_keys( $container->get( 'wcgateway.settings.pay-later.messaging-locations' ) );
|
||||
|
||||
$selected_country = $container->get( 'api.shop.country' );
|
||||
$default_messaging_flex_color = $selected_country === 'US' ? 'white-no-border' : 'white';
|
||||
|
||||
|
@ -75,7 +72,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
'type' => 'ppcp-multiselect',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => $default_locations,
|
||||
'default' => $container->get( 'wcgateway.button.default-locations' ),
|
||||
'desc_tip' => false,
|
||||
'description' => __( 'Select where the Pay Later button should be displayed.', 'woocommerce-paypal-payments' ),
|
||||
'options' => $container->get( 'wcgateway.settings.pay-later.button-locations' ),
|
||||
|
@ -121,7 +118,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
'type' => 'ppcp-multiselect',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => $default_locations,
|
||||
'default' => $container->get( 'wcgateway.button.default-locations' ),
|
||||
'desc_tip' => false,
|
||||
'description' => __( 'Select where the Pay Later messaging should be displayed.', 'woocommerce-paypal-payments' ),
|
||||
'options' => $container->get( 'wcgateway.settings.pay-later.messaging-locations' ),
|
|
@ -0,0 +1,787 @@
|
|||
<?php
|
||||
/**
|
||||
* The services of the Gateway module.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\WcGateway
|
||||
*/
|
||||
|
||||
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\Settings;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
|
||||
return function ( ContainerInterface $container, array $fields ): array {
|
||||
|
||||
$current_page_id = $container->get( 'wcgateway.current-ppcp-settings-page-id' );
|
||||
|
||||
if ( $current_page_id !== PayPalGateway::ID ) {
|
||||
return $fields;
|
||||
}
|
||||
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
assert( $settings instanceof Settings );
|
||||
|
||||
$has_enabled_separate_button_gateways = $container->get( 'wcgateway.settings.has_enabled_separate_button_gateways' );
|
||||
|
||||
$render_preview_element = function ( string $id ): string {
|
||||
return '
|
||||
<div class="ppcp-preview ppcp-button-preview">
|
||||
<h4>' . __( 'Preview', 'woocommerce-paypal-payments' ) . '</h4>
|
||||
<div id="' . $id . '" class="ppcp-button-preview-inner"></div>
|
||||
</div>';
|
||||
};
|
||||
|
||||
$smart_button_fields = array(
|
||||
'button_style_heading' => array(
|
||||
'heading' => __( 'PayPal Smart Buttons', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'ppcp-heading',
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
'description' => sprintf(
|
||||
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
|
||||
__(
|
||||
'Customize the appearance of the PayPal smart buttons on the
|
||||
%1$sCheckout page%5$s, %2$sSingle Product Page%5$s, %3$sCart page%5$s or on %4$sMini Cart%5$s.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-checkout" target="_blank">',
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-single-product" target="_blank">',
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-cart" target="_blank">',
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-mini-cart" target="_blank">',
|
||||
'</a>'
|
||||
),
|
||||
),
|
||||
'smart_button_locations' => array(
|
||||
'title' => __( 'Smart Button Locations', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'ppcp-multiselect',
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => $container->get( 'wcgateway.button.default-locations' ),
|
||||
'description' => __( 'Select where the PayPal smart buttons should be displayed.', 'woocommerce-paypal-payments' ),
|
||||
'options' => $container->get( 'wcgateway.button.locations' ),
|
||||
'screens' => array( State::STATE_START, State::STATE_ONBOARDED ),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'smart_button_enable_styling_per_location' => array(
|
||||
'title' => __( 'Customize Smart Buttons Per Location', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Customize smart button style per location', 'woocommerce-paypal-payments' ),
|
||||
'default' => true,
|
||||
'screens' => array( State::STATE_START, State::STATE_ONBOARDED ),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
// General button styles.
|
||||
'button_general_layout' => array(
|
||||
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'classes' => $has_enabled_separate_button_gateways ? array( 'hide' ) : array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'vertical',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'If additional funding sources are available to the buyer through PayPal, then multiple buttons are displayed in the space provided. Choose "vertical" for a dynamic list of alternative and local payment options, or "horizontal" when space is limited.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'vertical' => __( 'Vertical', 'woocommerce-paypal-payments' ),
|
||||
'horizontal' => __( 'Horizontal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_general_tagline' => array(
|
||||
'title' => __( 'Tagline', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'default' => false,
|
||||
'label' => __( 'Enable tagline', 'woocommerce-paypal-payments' ),
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Add the tagline. This line will only show up, if you select a horizontal layout.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_general_label' => array(
|
||||
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
/**
|
||||
* Returns default label ID of the PayPal button.
|
||||
*/
|
||||
'default' => apply_filters( 'woocommerce_paypal_payments_button_label_default', 'paypal' ),
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'This controls the label on the primary button.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'paypal' => __( 'PayPal', 'woocommerce-paypal-payments' ),
|
||||
'checkout' => __( 'Checkout', 'woocommerce-paypal-payments' ),
|
||||
'buynow' => __( 'PayPal Buy Now', 'woocommerce-paypal-payments' ),
|
||||
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_general_color' => array(
|
||||
'title' => __( 'Color', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'gold',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Controls the background color of the primary button. Use "Gold" to leverage PayPal\'s recognition and preference, or change it to match your site design or aesthetic.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'gold' => __( 'Gold (Recommended)', 'woocommerce-paypal-payments' ),
|
||||
'blue' => __( 'Blue', 'woocommerce-paypal-payments' ),
|
||||
'silver' => __( 'Silver', 'woocommerce-paypal-payments' ),
|
||||
'black' => __( 'Black', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_general_shape' => array(
|
||||
'title' => __( 'Shape', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'rect',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'The pill-shaped button\'s unique and powerful shape signifies PayPal in people\'s minds. Use the rectangular button as an alternative when pill-shaped buttons might pose design challenges.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'pill' => __( 'Pill', 'woocommerce-paypal-payments' ),
|
||||
'rect' => __( 'Rectangle', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_general_preview' => array(
|
||||
'type' => 'ppcp-text',
|
||||
'text' => $render_preview_element( 'ppcpGeneralButtonPreview' ),
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
|
||||
// Checkout page.
|
||||
'button_checkout_heading' => array(
|
||||
'heading' => __( 'Checkout Buttons', 'woocommerce-paypal-payments' ),
|
||||
'description' => sprintf(
|
||||
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
|
||||
__(
|
||||
'Customize the appearance of the PayPal smart buttons on the %1$sCheckout page%2$s.
|
||||
%3$sCheckout Buttons must be enabled to display the PayPal gateway on the Checkout page.
|
||||
',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-checkout" target="_blank">',
|
||||
'</a>',
|
||||
'</ br>'
|
||||
),
|
||||
'type' => 'ppcp-heading',
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_layout' => array(
|
||||
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'classes' => $has_enabled_separate_button_gateways ? array( 'hide' ) : array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'vertical',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'If additional funding sources are available to the buyer through PayPal, then multiple buttons are displayed in the space provided. Choose "vertical" for a dynamic list of alternative and local payment options, or "horizontal" when space is limited.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'vertical' => __( 'Vertical', 'woocommerce-paypal-payments' ),
|
||||
'horizontal' => __( 'Horizontal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_tagline' => array(
|
||||
'title' => __( 'Tagline', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'default' => false,
|
||||
'label' => __( 'Enable tagline', 'woocommerce-paypal-payments' ),
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Add the tagline. This line will only show up, if you select a horizontal layout.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_label' => array(
|
||||
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
/**
|
||||
* Returns default label ID of the PayPal button.
|
||||
*/
|
||||
'default' => apply_filters( 'woocommerce_paypal_payments_button_label_default', 'paypal' ),
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'This controls the label on the primary button.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'paypal' => __( 'PayPal', 'woocommerce-paypal-payments' ),
|
||||
'checkout' => __( 'Checkout', 'woocommerce-paypal-payments' ),
|
||||
'buynow' => __( 'PayPal Buy Now', 'woocommerce-paypal-payments' ),
|
||||
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_color' => array(
|
||||
'title' => __( 'Color', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'gold',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Controls the background color of the primary button. Use "Gold" to leverage PayPal\'s recognition and preference, or change it to match your site design or aesthetic.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'gold' => __( 'Gold (Recommended)', 'woocommerce-paypal-payments' ),
|
||||
'blue' => __( 'Blue', 'woocommerce-paypal-payments' ),
|
||||
'silver' => __( 'Silver', 'woocommerce-paypal-payments' ),
|
||||
'black' => __( 'Black', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_shape' => array(
|
||||
'title' => __( 'Shape', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'rect',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'The pill-shaped button\'s unique and powerful shape signifies PayPal in people\'s minds. Use the rectangular button as an alternative when pill-shaped buttons might pose design challenges.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'pill' => __( 'Pill', 'woocommerce-paypal-payments' ),
|
||||
'rect' => __( 'Rectangle', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_preview' => array(
|
||||
'type' => 'ppcp-text',
|
||||
'text' => $render_preview_element( 'ppcpCheckoutButtonPreview' ),
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
|
||||
// Single product page.
|
||||
'button_product_heading' => array(
|
||||
'heading' => __( 'Single Product Page Buttons', 'woocommerce-paypal-payments' ),
|
||||
'description' => sprintf(
|
||||
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
|
||||
__(
|
||||
'Customize the appearance of the PayPal smart buttons on the %1$sSingle Product Page%2$s.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-single-product" target="_blank">',
|
||||
'</a>'
|
||||
),
|
||||
'type' => 'ppcp-heading',
|
||||
'screens' => array( State::STATE_START, State::STATE_ONBOARDED ),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_product_layout' => array(
|
||||
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'horizontal',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'If additional funding sources are available to the buyer through PayPal, such as Venmo, then multiple buttons are displayed in the space provided. Choose "vertical" for a dynamic list of alternative and local payment options, or "horizontal" when space is limited.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'vertical' => __( 'Vertical', 'woocommerce-paypal-payments' ),
|
||||
'horizontal' => __( 'Horizontal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_product_tagline' => array(
|
||||
'title' => __( 'Tagline', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable tagline', 'woocommerce-paypal-payments' ),
|
||||
'default' => false,
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Add the tagline. This line will only show up, if you select a horizontal layout.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_product_label' => array(
|
||||
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
/**
|
||||
* Returns default label ID of the PayPal button on product pages.
|
||||
*/
|
||||
'default' => apply_filters( 'woocommerce_paypal_payments_button_product_label_default', 'paypal' ),
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'This controls the label on the primary button.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'paypal' => __( 'PayPal', 'woocommerce-paypal-payments' ),
|
||||
'checkout' => __( 'Checkout', 'woocommerce-paypal-payments' ),
|
||||
'buynow' => __( 'PayPal Buy Now', 'woocommerce-paypal-payments' ),
|
||||
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_product_color' => array(
|
||||
'title' => __( 'Color', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'gold',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Controls the background color of the primary button. Use "Gold" to leverage PayPal\'s recognition and preference, or change it to match your site design or aesthetic.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'gold' => __( 'Gold (Recommended)', 'woocommerce-paypal-payments' ),
|
||||
'blue' => __( 'Blue', 'woocommerce-paypal-payments' ),
|
||||
'silver' => __( 'Silver', 'woocommerce-paypal-payments' ),
|
||||
'black' => __( 'Black', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_product_shape' => array(
|
||||
'title' => __( 'Shape', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'rect',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'The pill-shaped button\'s unique and powerful shape signifies PayPal in people\'s minds. Use the rectangular button as an alternative when pill-shaped buttons might pose design challenges.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'pill' => __( 'Pill', 'woocommerce-paypal-payments' ),
|
||||
'rect' => __( 'Rectangle', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_product_preview' => array(
|
||||
'type' => 'ppcp-text',
|
||||
'text' => $render_preview_element( 'ppcpProductButtonPreview' ),
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
|
||||
// Cart settings.
|
||||
'button_cart_heading' => array(
|
||||
'heading' => __( 'Cart Buttons', 'woocommerce-paypal-payments' ),
|
||||
'description' => sprintf(
|
||||
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
|
||||
__(
|
||||
'Customize the appearance of the PayPal smart buttons on the %1$sCart page%2$s.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-cart" target="_blank">',
|
||||
'</a>'
|
||||
),
|
||||
'type' => 'ppcp-heading',
|
||||
'screens' => array( State::STATE_START, State::STATE_ONBOARDED ),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_cart_layout' => array(
|
||||
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'horizontal',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'If additional funding sources are available to the buyer through PayPal, such as Venmo, then multiple buttons are displayed in the space provided. Choose "vertical" for a dynamic list of alternative and local payment options, or "horizontal" when space is limited.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'vertical' => __( 'Vertical', 'woocommerce-paypal-payments' ),
|
||||
'horizontal' => __( 'Horizontal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_cart_tagline' => array(
|
||||
'title' => __( 'Tagline', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable tagline', 'woocommerce-paypal-payments' ),
|
||||
'default' => false,
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Add the tagline. This line will only show up, if you select a horizontal layout.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_cart_label' => array(
|
||||
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
/**
|
||||
* Returns default label ID of the PayPal button in cart.
|
||||
*/
|
||||
'default' => apply_filters( 'woocommerce_paypal_payments_button_cart_label_default', 'paypal' ),
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'This controls the label on the primary button.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'paypal' => __( 'PayPal', 'woocommerce-paypal-payments' ),
|
||||
'checkout' => __( 'Checkout', 'woocommerce-paypal-payments' ),
|
||||
'buynow' => __( 'PayPal Buy Now', 'woocommerce-paypal-payments' ),
|
||||
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_cart_color' => array(
|
||||
'title' => __( 'Color', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'gold',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Controls the background color of the primary button. Use "Gold" to leverage PayPal\'s recognition and preference, or change it to match your site design or aesthetic.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'gold' => __( 'Gold (Recommended)', 'woocommerce-paypal-payments' ),
|
||||
'blue' => __( 'Blue', 'woocommerce-paypal-payments' ),
|
||||
'silver' => __( 'Silver', 'woocommerce-paypal-payments' ),
|
||||
'black' => __( 'Black', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_cart_shape' => array(
|
||||
'title' => __( 'Shape', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'rect',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'The pill-shaped button\'s unique and powerful shape signifies PayPal in people\'s minds. Use the rectangular button as an alternative when pill-shaped buttons might pose design challenges.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'pill' => __( 'Pill', 'woocommerce-paypal-payments' ),
|
||||
'rect' => __( 'Rectangle', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_cart_preview' => array(
|
||||
'type' => 'ppcp-text',
|
||||
'text' => $render_preview_element( 'ppcpCartButtonPreview' ),
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
|
||||
// Mini cart settings.
|
||||
'button_mini-cart_heading' => array(
|
||||
'heading' => __( 'Mini Cart Buttons', 'woocommerce-paypal-payments' ),
|
||||
'description' => sprintf(
|
||||
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
|
||||
__(
|
||||
'Customize the appearance of the PayPal smart buttons on the %1$sMini Cart%2$s.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-mini-cart" target="_blank">',
|
||||
'</a>'
|
||||
),
|
||||
'type' => 'ppcp-heading',
|
||||
'screens' => array( State::STATE_START, State::STATE_ONBOARDED ),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_layout' => array(
|
||||
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'vertical',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'If additional funding sources are available to the buyer through PayPal, such as Venmo, then multiple buttons are displayed in the space provided. Choose "vertical" for a dynamic list of alternative and local payment options, or "horizontal" when space is limited.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'vertical' => __( 'Vertical', 'woocommerce-paypal-payments' ),
|
||||
'horizontal' => __( 'Horizontal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_tagline' => array(
|
||||
'title' => __( 'Tagline', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable tagline', 'woocommerce-paypal-payments' ),
|
||||
'default' => false,
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Add the tagline. This line will only show up, if you select a horizontal layout.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_label' => array(
|
||||
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
/**
|
||||
* Returns default label ID of the PayPal button in mini cart.
|
||||
*/
|
||||
'default' => apply_filters( 'woocommerce_paypal_payments_button_mini_cart_label_default', 'paypal' ),
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'This controls the label on the primary button.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'paypal' => __( 'PayPal', 'woocommerce-paypal-payments' ),
|
||||
'checkout' => __( 'Checkout', 'woocommerce-paypal-payments' ),
|
||||
'buynow' => __( 'PayPal Buy Now', 'woocommerce-paypal-payments' ),
|
||||
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_color' => array(
|
||||
'title' => __( 'Color', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'gold',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'Controls the background color of the primary button. Use "Gold" to leverage PayPal\'s recognition and preference, or change it to match your site design or aesthetic.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'gold' => __( 'Gold (Recommended)', 'woocommerce-paypal-payments' ),
|
||||
'blue' => __( 'Blue', 'woocommerce-paypal-payments' ),
|
||||
'silver' => __( 'Silver', 'woocommerce-paypal-payments' ),
|
||||
'black' => __( 'Black', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_shape' => array(
|
||||
'title' => __( 'Shape', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'rect',
|
||||
'desc_tip' => true,
|
||||
'description' => __(
|
||||
'The pill-shaped button\'s unique and powerful shape signifies PayPal in people\'s minds. Use the rectangular button as an alternative when pill-shaped buttons might pose design challenges.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'options' => array(
|
||||
'pill' => __( 'Pill', 'woocommerce-paypal-payments' ),
|
||||
'rect' => __( 'Rectangle', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_height' => array(
|
||||
'title' => __( 'Button Height', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'number',
|
||||
'default' => '35',
|
||||
'custom_attributes' => array(
|
||||
'min' => 25,
|
||||
'max' => 55,
|
||||
),
|
||||
'desc_tip' => true,
|
||||
'description' => __( 'Add a value from 25 to 55.', 'woocommerce-paypal-payments' ),
|
||||
'screens' => array(
|
||||
State::STATE_START,
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
'button_mini-cart_preview' => array(
|
||||
'type' => 'ppcp-text',
|
||||
'text' => $render_preview_element( 'ppcpMiniCartButtonPreview' ),
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
),
|
||||
);
|
||||
|
||||
return array_merge( $fields, $smart_button_fields );
|
||||
};
|
|
@ -29,19 +29,19 @@ class Settings implements ContainerInterface {
|
|||
private $settings = array();
|
||||
|
||||
/**
|
||||
* The list of pay later selected default locations.
|
||||
* The list of selected default button locations.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $pay_later_default_locations;
|
||||
protected $default_button_locations;
|
||||
|
||||
/**
|
||||
* Settings constructor.
|
||||
*
|
||||
* @param string[] $pay_later_default_locations The list of pay later selected default locations.
|
||||
* @param string[] $default_button_locations The list of selected default button locations.
|
||||
*/
|
||||
public function __construct( array $pay_later_default_locations ) {
|
||||
$this->pay_later_default_locations = $pay_later_default_locations;
|
||||
public function __construct( array $default_button_locations ) {
|
||||
$this->default_button_locations = $default_button_locations;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,14 +109,12 @@ class Settings implements ContainerInterface {
|
|||
'Pay via PayPal.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'button_product_enabled' => true,
|
||||
'button_mini-cart_enabled' => false,
|
||||
'button_cart_enabled' => true,
|
||||
'smart_button_locations' => $this->default_button_locations,
|
||||
'smart_button_enable_styling_per_location' => true,
|
||||
'pay_later_messaging_enabled' => true,
|
||||
'button_enabled' => true,
|
||||
'pay_later_button_enabled' => true,
|
||||
'pay_later_button_locations' => $this->pay_later_default_locations,
|
||||
'pay_later_messaging_locations' => $this->pay_later_default_locations,
|
||||
'pay_later_button_locations' => $this->default_button_locations,
|
||||
'pay_later_messaging_locations' => $this->default_button_locations,
|
||||
'brand_name' => get_bloginfo( 'name' ),
|
||||
'dcc_gateway_title' => __( 'Credit Cards', 'woocommerce-paypal-payments' ),
|
||||
'dcc_gateway_description' => __(
|
||||
|
|
|
@ -21,6 +21,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Admin\FeesRenderer;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Admin\OrderTablePaymentStatusColumn;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Admin\PaymentStatusOrderDetail;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Admin\RenderAuthorizeAction;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Assets\FraudNetAssets;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Assets\SettingsPageAssets;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Checkout\CheckoutPayPalAddressPreset;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Checkout\DisableGateways;
|
||||
|
@ -258,6 +259,10 @@ class WCGatewayModule implements ModuleInterface {
|
|||
}
|
||||
|
||||
( $c->get( 'wcgateway.oxxo' ) )->init();
|
||||
|
||||
$fraudnet_assets = $c->get( 'wcgateway.fraudnet-assets' );
|
||||
assert( $fraudnet_assets instanceof FraudNetAssets );
|
||||
$fraudnet_assets->register_assets();
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ module.exports = {
|
|||
target: 'web',
|
||||
entry: {
|
||||
'gateway-settings': path.resolve('./resources/js/gateway-settings.js'),
|
||||
'pay-upon-invoice': path.resolve('./resources/js/pay-upon-invoice.js'),
|
||||
'fraudnet': path.resolve('./resources/js/fraudnet.js'),
|
||||
'oxxo': path.resolve('./resources/js/oxxo.js'),
|
||||
'gateway-settings-style': path.resolve('./resources/css/gateway-settings.scss'),
|
||||
},
|
||||
|
|
|
@ -23,7 +23,7 @@ class WebhookSimulation {
|
|||
public const STATE_WAITING = 'waiting';
|
||||
public const STATE_RECEIVED = 'received';
|
||||
|
||||
private const OPTION_ID = 'ppcp-webhook-simulation';
|
||||
public const OPTION_ID = 'ppcp-webhook-simulation';
|
||||
|
||||
/**
|
||||
* The webhooks endpoint.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "woocommerce-paypal-payments",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.2",
|
||||
"description": "WooCommerce PayPal Payments",
|
||||
"repository": "https://github.com/woocommerce/woocommerce-paypal-payments",
|
||||
"license": "GPL-2.0",
|
||||
|
@ -15,6 +15,7 @@
|
|||
"install:modules:ppcp-order-tracking": "cd modules/ppcp-order-tracking && yarn install",
|
||||
"install:modules:ppcp-onboarding": "cd modules/ppcp-onboarding && yarn install",
|
||||
"install:modules:ppcp-compat": "cd modules/ppcp-compat && yarn install",
|
||||
"install:modules:ppcp-uninstall": "cd modules/ppcp-uninstall && yarn install",
|
||||
|
||||
"build:modules:ppcp-button": "cd modules/ppcp-button && yarn run build",
|
||||
"build:modules:ppcp-wc-gateway": "cd modules/ppcp-wc-gateway && yarn run build",
|
||||
|
@ -23,6 +24,7 @@
|
|||
"build:modules:ppcp-order-tracking": "cd modules/ppcp-order-tracking && yarn run build",
|
||||
"build:modules:ppcp-onboarding": "cd modules/ppcp-onboarding && yarn run build",
|
||||
"build:modules:ppcp-compat": "cd modules/ppcp-compat && yarn run build",
|
||||
"build:modules:ppcp-uninstall": "cd modules/ppcp-uninstall && yarn run build",
|
||||
"build:modules": "run-p build:modules:*",
|
||||
|
||||
"watch:modules:ppcp-button": "cd modules/ppcp-button && yarn run watch",
|
||||
|
@ -32,6 +34,7 @@
|
|||
"watch:modules:ppcp-order-tracking": "cd modules/ppcp-order-tracking && yarn run watch",
|
||||
"watch:modules:ppcp-onboarding": "cd modules/ppcp-onboarding && yarn run watch",
|
||||
"watch:modules:ppcp-compat": "cd modules/ppcp-compat && yarn run watch",
|
||||
"watch:modules:ppcp-uninstall": "cd modules/ppcp-uninstall && yarn run watch",
|
||||
"watch:modules": "run-p watch:modules:*",
|
||||
|
||||
"ddev:setup": "ddev start && ddev orchestrate",
|
||||
|
@ -58,7 +61,7 @@
|
|||
"prearchive": "rm -rf $npm_package_name.zip",
|
||||
"archive": "zip -r $npm_package_name.zip . -x **.git/\\* **node_modules/\\*",
|
||||
"postarchive": "yarn run archive:cleanup && rm -rf $npm_package_name && unzip $npm_package_name.zip -d $npm_package_name && rm $npm_package_name.zip && zip -r $npm_package_name.zip $npm_package_name && rm -rf $npm_package_name",
|
||||
"archive:cleanup": "zip -d $npm_package_name.zip .env* .ddev/\\* .editorconfig tests/\\* .github/\\* .psalm/\\* wordpress_org_assets/\\* \\*.DS_Store README.md .gitattributes .gitignore .travis.yml composer.json composer.lock package.json package-lock.json patchwork.json yarn.lock phpunit.xml.dist .phpunit.result.cache phpcs.xml.dist modules/ppcp-button/.babelrc modules/ppcp-button/package.json modules/ppcp-button/webpack.config.js modules/ppcp-button/yarn.lock vendor/\\*/.idea/\\* vendor/\\*/.gitignore vendor/\\*/.gitattributes vendor/\\*/.travis.yml"
|
||||
"archive:cleanup": "zip -d $npm_package_name.zip .env* .ddev/\\* \\*.idea/\\* .editorconfig tests/\\* .github/\\* .psalm/\\* wordpress_org_assets/\\* \\*.DS_Store \\*README.md \\*.gitattributes \\*.gitignore \\*composer.json \\*composer.lock patchwork.json phpunit.xml.dist .phpunit.result.cache phpcs.xml* psalm*.xml* \\*.babelrc \\*package.json \\*webpack.config.js \\*yarn.lock \\*.travis.yml"
|
||||
},
|
||||
"config": {
|
||||
"wp_org_slug": "woocommerce-paypal-payments"
|
||||
|
|
10
readme.txt
10
readme.txt
|
@ -4,7 +4,7 @@ Tags: woocommerce, paypal, payments, ecommerce, e-commerce, store, sales, sell,
|
|||
Requires at least: 5.3
|
||||
Tested up to: 6.1
|
||||
Requires PHP: 7.2
|
||||
Stable tag: 2.0.1
|
||||
Stable tag: 2.0.2
|
||||
License: GPLv2
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
|
@ -81,6 +81,14 @@ Follow the steps below to connect the plugin to your PayPal account:
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 2.0.2 =
|
||||
* Fix - Do not call PayPal get order by ID if it does not exist #1029
|
||||
* Fix - Type check error conflict with German Market #1056
|
||||
* Enhancement - Remove plugin data after uninstalling #1075
|
||||
* Enhancement - Add FraudNet to all payments #1040
|
||||
* Enhancement - Update "Standard Payments" tab settings #1065
|
||||
* Enhancement - Update PHP 7.2 requirement in all relevant files #1084
|
||||
|
||||
= 2.0.1 =
|
||||
* Fix - Error while syncing tracking data to PayPal -> Sync GZD Tracking #1020
|
||||
* Fix - Fix product price retrieval for variable product buttons #1000
|
||||
|
|
|
@ -28,6 +28,7 @@ use Mockery;
|
|||
use Psr\Log\LoggerInterface;
|
||||
use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
|
||||
use WooCommerce\PayPalCommerce\TestCase;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\FraudNet\FraudNet;
|
||||
use function Brain\Monkey\Functions\expect;
|
||||
use function Brain\Monkey\Functions\when;
|
||||
|
||||
|
@ -70,6 +71,8 @@ class OrderEndpointTest extends TestCase
|
|||
$headers->shouldReceive('getAll');
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = new OrderEndpoint(
|
||||
$host,
|
||||
$bearer,
|
||||
|
@ -78,7 +81,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
);
|
||||
|
||||
$rawResponse = [
|
||||
|
@ -120,13 +125,15 @@ class OrderEndpointTest extends TestCase
|
|||
$patchCollectionFactory = Mockery::mock(PatchCollectionFactory::class);
|
||||
$intent = 'CAPTURE';
|
||||
$logger = Mockery::mock(LoggerInterface::class);
|
||||
$logger->shouldReceive('log');
|
||||
$logger->shouldReceive('warning');
|
||||
$logger->shouldReceive('debug');
|
||||
$applicationContextRepository = Mockery::mock(ApplicationContextRepository::class);
|
||||
$headers = Mockery::mock(Requests_Utility_CaseInsensitiveDictionary::class);
|
||||
$headers->shouldReceive('getAll');
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = new OrderEndpoint(
|
||||
$host,
|
||||
$bearer,
|
||||
|
@ -135,7 +142,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
);
|
||||
|
||||
$rawResponse = [
|
||||
|
@ -175,6 +184,8 @@ class OrderEndpointTest extends TestCase
|
|||
$applicationContextRepository = Mockery::mock(ApplicationContextRepository::class);
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = new OrderEndpoint(
|
||||
$host,
|
||||
$bearer,
|
||||
|
@ -183,7 +194,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
);
|
||||
|
||||
expect('wp_remote_get')->andReturn($rawResponse);
|
||||
|
@ -237,6 +250,8 @@ class OrderEndpointTest extends TestCase
|
|||
$applicationContextRepository = Mockery::mock(ApplicationContextRepository::class);
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = new OrderEndpoint(
|
||||
$host,
|
||||
$bearer,
|
||||
|
@ -245,7 +260,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
);
|
||||
|
||||
expect('wp_remote_get')
|
||||
|
@ -302,6 +319,8 @@ class OrderEndpointTest extends TestCase
|
|||
$applicationContextRepository = Mockery::mock(ApplicationContextRepository::class);
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = new OrderEndpoint(
|
||||
$host,
|
||||
$bearer,
|
||||
|
@ -310,7 +329,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
);
|
||||
|
||||
$result = $testee->capture($orderToCapture);
|
||||
|
@ -343,6 +364,8 @@ class OrderEndpointTest extends TestCase
|
|||
$applicationContextRepository = Mockery::mock(ApplicationContextRepository::class);
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = new OrderEndpoint(
|
||||
$host,
|
||||
$bearer,
|
||||
|
@ -351,7 +374,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
);
|
||||
$headers = Mockery::mock(Requests_Utility_CaseInsensitiveDictionary::class);
|
||||
$headers->shouldReceive('getAll');
|
||||
|
@ -391,6 +416,8 @@ class OrderEndpointTest extends TestCase
|
|||
$applicationContextRepository = Mockery::mock(ApplicationContextRepository::class);
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = new OrderEndpoint(
|
||||
$host,
|
||||
$bearer,
|
||||
|
@ -399,7 +426,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
);
|
||||
|
||||
$headers = Mockery::mock(Requests_Utility_CaseInsensitiveDictionary::class);
|
||||
|
@ -441,6 +470,8 @@ class OrderEndpointTest extends TestCase
|
|||
$applicationContextRepository = Mockery::mock(ApplicationContextRepository::class);
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = Mockery::mock(
|
||||
OrderEndpoint::class,
|
||||
[
|
||||
|
@ -452,6 +483,8 @@ class OrderEndpointTest extends TestCase
|
|||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
]
|
||||
)->makePartial();
|
||||
$orderToExpect = Mockery::mock(Order::class);
|
||||
|
@ -517,6 +550,8 @@ class OrderEndpointTest extends TestCase
|
|||
$applicationContextRepository = Mockery::mock(ApplicationContextRepository::class);
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = Mockery::mock(
|
||||
OrderEndpoint::class,
|
||||
[
|
||||
|
@ -528,6 +563,8 @@ class OrderEndpointTest extends TestCase
|
|||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
]
|
||||
)->makePartial();
|
||||
$testee
|
||||
|
@ -615,6 +652,8 @@ class OrderEndpointTest extends TestCase
|
|||
$applicationContextRepository = Mockery::mock(ApplicationContextRepository::class);
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = new OrderEndpoint(
|
||||
$host,
|
||||
$bearer,
|
||||
|
@ -623,7 +662,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
);
|
||||
|
||||
expect('wp_remote_get')
|
||||
|
@ -707,6 +748,8 @@ class OrderEndpointTest extends TestCase
|
|||
$applicationContextRepository = Mockery::mock(ApplicationContextRepository::class);
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = Mockery::mock(
|
||||
OrderEndpoint::class,
|
||||
[
|
||||
|
@ -717,7 +760,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
]
|
||||
)->makePartial();
|
||||
|
||||
|
@ -778,6 +823,8 @@ class OrderEndpointTest extends TestCase
|
|||
$applicationContextRepository = Mockery::mock(ApplicationContextRepository::class);
|
||||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = new OrderEndpoint(
|
||||
$host,
|
||||
$bearer,
|
||||
|
@ -786,7 +833,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
);
|
||||
|
||||
$result = $testee->patch_order_with($orderToUpdate, $orderToCompare);
|
||||
|
@ -838,6 +887,8 @@ class OrderEndpointTest extends TestCase
|
|||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
$subscription_helper->shouldReceive('cart_contains_subscription')->andReturn(true);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = new OrderEndpoint(
|
||||
$host,
|
||||
$bearer,
|
||||
|
@ -846,7 +897,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
);
|
||||
|
||||
$purchaseUnit = Mockery::mock(PurchaseUnit::class, ['contains_physical_goods' => false]);
|
||||
|
@ -937,6 +990,8 @@ class OrderEndpointTest extends TestCase
|
|||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
$subscription_helper->shouldReceive('cart_contains_subscription')->andReturn(true);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = new OrderEndpoint(
|
||||
$host,
|
||||
$bearer,
|
||||
|
@ -945,7 +1000,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
);
|
||||
|
||||
$purchaseUnit = Mockery::mock(PurchaseUnit::class, ['contains_physical_goods' => true]);
|
||||
|
@ -1013,6 +1070,8 @@ class OrderEndpointTest extends TestCase
|
|||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
$subscription_helper->shouldReceive('cart_contains_subscription')->andReturn(true);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = new OrderEndpoint(
|
||||
$host,
|
||||
$bearer,
|
||||
|
@ -1021,7 +1080,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
);
|
||||
|
||||
$purchaseUnit = Mockery::mock(PurchaseUnit::class, ['contains_physical_goods' => false]);
|
||||
|
@ -1100,6 +1161,8 @@ class OrderEndpointTest extends TestCase
|
|||
$subscription_helper = Mockery::mock(SubscriptionHelper::class);
|
||||
$subscription_helper->shouldReceive('cart_contains_subscription')->andReturn(true);
|
||||
|
||||
$fraudnet = Mockery::mock(FraudNet::class);
|
||||
|
||||
$testee = new OrderEndpoint(
|
||||
$host,
|
||||
$bearer,
|
||||
|
@ -1108,7 +1171,9 @@ class OrderEndpointTest extends TestCase
|
|||
$intent,
|
||||
$logger,
|
||||
$applicationContextRepository,
|
||||
$subscription_helper
|
||||
$subscription_helper,
|
||||
false,
|
||||
$fraudnet
|
||||
);
|
||||
|
||||
$purchaseUnit = Mockery::mock(PurchaseUnit::class, ['contains_physical_goods' => true]);
|
||||
|
|
|
@ -14,7 +14,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Entity\Token;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\OrderFactory;
|
||||
use WooCommerce\PayPalCommerce\TestCase;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice\FraudNet;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\FraudNet\FraudNet;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice\PaymentSource;
|
||||
use function Brain\Monkey\Functions\expect;
|
||||
use function Brain\Monkey\Functions\when;
|
||||
|
|
75
uninstall.php
Normal file
75
uninstall.php
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
/**
|
||||
* Uninstalls the plugin.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use WooCommerce\PayPalCommerce\Uninstall\ClearDatabaseInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\CachingContainer;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
||||
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
||||
die( 'Direct access not allowed.' );
|
||||
}
|
||||
|
||||
$root_dir = __DIR__;
|
||||
$main_plugin_file = "{$root_dir}/woocommerce-paypal-payments.php";
|
||||
|
||||
if ( !file_exists( $main_plugin_file ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
require $main_plugin_file;
|
||||
|
||||
( static function (string $root_dir): void {
|
||||
|
||||
$autoload_filepath = "{$root_dir}/vendor/autoload.php";
|
||||
if ( file_exists( $autoload_filepath ) && ! class_exists( '\WooCommerce\PayPalCommerce\PluginModule' ) ) {
|
||||
require $autoload_filepath;
|
||||
}
|
||||
|
||||
try {
|
||||
$bootstrap = require "{$root_dir}/bootstrap.php";
|
||||
|
||||
$app_container = $bootstrap( $root_dir );
|
||||
assert( $app_container instanceof CachingContainer );
|
||||
|
||||
$settings = $app_container->get( 'wcgateway.settings' );
|
||||
assert( $settings instanceof Settings );
|
||||
|
||||
$should_clear_db = $settings->has( 'uninstall_clear_db_on_uninstall' ) && $settings->get( 'uninstall_clear_db_on_uninstall' );
|
||||
if ( ! $should_clear_db ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$clear_db = $app_container->get( 'uninstall.clear-db' );
|
||||
assert( $clear_db instanceof ClearDatabaseInterface );
|
||||
|
||||
$option_names = $app_container->get( 'uninstall.ppcp-all-option-names' );
|
||||
$scheduled_action_names = $app_container->get( 'uninstall.ppcp-all-scheduled-action-names' );
|
||||
|
||||
$clear_db->delete_options( $option_names );
|
||||
$clear_db->clear_scheduled_actions( $scheduled_action_names );
|
||||
} catch ( Throwable $throwable ) {
|
||||
$message = sprintf(
|
||||
'<strong>Error:</strong> %s <br><pre>%s</pre>',
|
||||
$throwable->getMessage(),
|
||||
$throwable->getTraceAsString()
|
||||
);
|
||||
|
||||
add_action(
|
||||
'all_admin_notices',
|
||||
static function () use ( $message ) {
|
||||
$class = 'notice notice-error';
|
||||
printf(
|
||||
'<div class="%1$s"><p>%2$s</p></div>',
|
||||
esc_attr( $class ),
|
||||
wp_kses_post( $message )
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
} )($root_dir);
|
|
@ -3,13 +3,13 @@
|
|||
* Plugin Name: WooCommerce PayPal Payments
|
||||
* Plugin URI: https://woocommerce.com/products/woocommerce-paypal-payments/
|
||||
* Description: PayPal's latest complete payments processing solution. Accept PayPal, Pay Later, credit/debit cards, alternative digital wallets local payment types and bank accounts. Turn on only PayPal options or process a full suite of payment methods. Enable global transaction with extensive currency and country coverage.
|
||||
* Version: 2.0.1
|
||||
* Version: 2.0.2
|
||||
* Author: WooCommerce
|
||||
* Author URI: https://woocommerce.com/
|
||||
* License: GPL-2.0
|
||||
* Requires PHP: 7.2
|
||||
* WC requires at least: 3.9
|
||||
* WC tested up to: 7.1
|
||||
* WC tested up to: 7.2
|
||||
* Text Domain: woocommerce-paypal-payments
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce
|
||||
|
@ -23,7 +23,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
|||
|
||||
define( 'PAYPAL_API_URL', 'https://api.paypal.com' );
|
||||
define( 'PAYPAL_SANDBOX_API_URL', 'https://api.sandbox.paypal.com' );
|
||||
define( 'PAYPAL_INTEGRATION_DATE', '2022-04-13' );
|
||||
define( 'PAYPAL_INTEGRATION_DATE', '2023-01-11' );
|
||||
|
||||
define( 'PPCP_FLAG_SUBSCRIPTION', true );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue