Skip to content

Commit bab55cc

Browse files
authored
Add PayPal Payments package - skeleton code only (#43315)
* Generate simple-payments package * Add package to pnpm-lock.yaml * Rename package to paypal-payments * Update package name in pnpm-lock.yaml * Replace simple-payments with paypal-payments * Update last instances of simple payments * Add PHP unit test * Update Phan baseline
1 parent 8e1699e commit bab55cc

20 files changed

+300
-0
lines changed

pnpm-lock.yaml

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Files not needed to be distributed in the package.
2+
.gitattributes export-ignore
3+
.github/ export-ignore
4+
package.json export-ignore
5+
6+
# Files to include in the mirror repo, but excluded via gitignore
7+
# Remember to end all directories with `/**` to properly tag every file.
8+
# /src/js/example.min.js production-include
9+
10+
# Files to exclude from the mirror repo, but included in the monorepo.
11+
# Remember to end all directories with `/**` to properly tag every file.
12+
.gitignore production-exclude
13+
changelog/** production-exclude
14+
.phpcs.dir.xml production-exclude
15+
tests/** production-exclude
16+
.phpcsignore production-exclude
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor/
2+
node_modules/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* This is an automatically generated baseline for Phan issues.
4+
* When Phan is invoked with --load-baseline=path/to/baseline.php,
5+
* The pre-existing issues listed in this file won't be emitted.
6+
*
7+
* This file can be updated by invoking Phan with --save-baseline=path/to/baseline.php
8+
* (can be combined with --load-baseline)
9+
*/
10+
return [
11+
// This baseline has no suppressions
12+
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
13+
'file_suppressions' => [
14+
],
15+
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
16+
// (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases)
17+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
/**
3+
* This configuration will be read and overlaid on top of the
4+
* default configuration. Command-line arguments will be applied
5+
* after this file is read.
6+
*
7+
* @package automattic/jetpack-paypal-payments
8+
*/
9+
10+
// Require base config.
11+
require __DIR__ . '/../../../../.phan/config.base.php';
12+
13+
return make_phan_config( dirname( __DIR__ ) );
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
4+
<rule ref="WordPress.WP.I18n">
5+
<properties>
6+
<property name="text_domain" type="array">
7+
<element value="jetpack-paypal-payments" />
8+
</property>
9+
</properties>
10+
</rule>
11+
<rule ref="Jetpack.Functions.I18n">
12+
<properties>
13+
<property name="text_domain" value="jetpack-paypal-payments" />
14+
</properties>
15+
</rule>
16+
17+
<rule ref="WordPress.Utils.I18nTextDomainFixer">
18+
<properties>
19+
<property name="old_text_domain" type="array" />
20+
<property name="new_text_domain" value="jetpack-paypal-payments" />
21+
</properties>
22+
</rule>
23+
24+
</ruleset>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# paypal-payments
2+
3+
Add PayPal, credit, and debit card payment buttons with minimal setup. Good for collecting donations or payments for products and services.
4+
5+
## How to install paypal-payments
6+
7+
### Installation From Git Repo
8+
9+
## Contribute
10+
11+
## Get Help
12+
13+
## Using this package in your WordPress plugin
14+
15+
If you plan on using this package in your WordPress plugin, we would recommend that you use [Jetpack Autoloader](https://packagist.org/packages/automattic/jetpack-autoloader) as your autoloader. This will allow for maximum interoperability with other plugins that use this package as well.
16+
17+
## Security
18+
19+
Need to report a security vulnerability? Go to [https://automattic.com/security/](https://automattic.com/security/) or directly to our security bug bounty site [https://hackerone.com/automattic](https://hackerone.com/automattic).
20+
21+
## License
22+
23+
paypal-payments is licensed under [GNU General Public License v2 (or later)](./LICENSE.txt)
24+

projects/packages/paypal-payments/changelog/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: added
3+
4+
Initial version.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"name": "automattic/jetpack-paypal-payments",
3+
"description": "Add PayPal, credit, and debit card payment buttons with minimal setup. Good for collecting donations or payments for products and services.",
4+
"type": "jetpack-library",
5+
"license": "GPL-2.0-or-later",
6+
"require": {
7+
"php": ">=7.2"
8+
},
9+
"require-dev": {
10+
"yoast/phpunit-polyfills": "^4.0.0",
11+
"automattic/jetpack-changelogger": "@dev",
12+
"automattic/jetpack-test-environment": "@dev",
13+
"automattic/phpunit-select-config": "@dev"
14+
},
15+
"autoload": {
16+
"classmap": [
17+
"src/"
18+
]
19+
},
20+
"scripts": {
21+
"build-development": "echo 'Add your build step to composer.json, please!'",
22+
"build-production": "echo 'Add your build step to composer.json, please!'",
23+
"phpunit": [
24+
"phpunit-select-config phpunit.#.xml.dist --colors=always"
25+
],
26+
"test-coverage": [
27+
"php -dpcov.directory=. ./vendor/bin/phpunit-select-config phpunit.#.xml.dist --coverage-php \"$COVERAGE_DIR/php.cov\""
28+
],
29+
"test-php": [
30+
"@composer phpunit"
31+
]
32+
},
33+
"repositories": [
34+
{
35+
"type": "path",
36+
"url": "../../packages/*",
37+
"options": {
38+
"monorepo": true
39+
}
40+
}
41+
],
42+
"minimum-stability": "dev",
43+
"prefer-stable": true,
44+
"extra": {
45+
"autotagger": true,
46+
"branch-alias": {
47+
"dev-trunk": "0.1.x-dev"
48+
},
49+
"changelogger": {
50+
"link-template": "https://github.com/Automattic/jetpack-paypal-payments/compare/v${old}...v${new}"
51+
},
52+
"mirror-repo": "Automattic/jetpack-paypal-payments",
53+
"textdomain": "jetpack-paypal-payments",
54+
"version-constants": {
55+
"::PACKAGE_VERSION": "src/class-paypal-payments.php"
56+
}
57+
},
58+
"suggest": {
59+
"automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package."
60+
}
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"private": true,
3+
"name": "@automattic/jetpack-paypal-payments",
4+
"version": "0.1.0-alpha",
5+
"description": "Add PayPal, credit, and debit card payment buttons with minimal setup. Good for collecting donations or payments for products and services.",
6+
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/paypal-payments/#readme",
7+
"bugs": {
8+
"url": "https://github.com/Automattic/jetpack/labels/[Package] PayPal Payments"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/Automattic/jetpack.git",
13+
"directory": "projects/packages/paypal-payments"
14+
},
15+
"license": "GPL-2.0-or-later",
16+
"author": "Automattic",
17+
"scripts": {
18+
"build": "echo 'Not implemented.'",
19+
"build-js": "echo 'Not implemented.'",
20+
"build-production": "echo 'Not implemented.'",
21+
"build-production-js": "echo 'Not implemented.'",
22+
"clean": "true"
23+
},
24+
"devDependencies": {}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="tests/php/bootstrap.php"
5+
cacheDirectory=".phpunit.cache"
6+
colors="true"
7+
executionOrder="depends"
8+
beStrictAboutOutputDuringTests="true"
9+
displayDetailsOnPhpunitDeprecations="true"
10+
displayDetailsOnTestsThatTriggerDeprecations="true"
11+
displayDetailsOnTestsThatTriggerErrors="true"
12+
displayDetailsOnTestsThatTriggerNotices="true"
13+
displayDetailsOnTestsThatTriggerWarnings="true"
14+
failOnDeprecation="true"
15+
failOnEmptyTestSuite="true"
16+
failOnPhpunitDeprecation="true"
17+
failOnNotice="true"
18+
failOnRisky="true"
19+
failOnWarning="true"
20+
>
21+
<testsuites>
22+
<testsuite name="main">
23+
<directory suffix="Test.php">tests/php</directory>
24+
</testsuite>
25+
</testsuites>
26+
27+
<source>
28+
<include>
29+
<!-- Better to only include "src" than to add "." and then exclude "tests", "vendor", and so on, as PHPUnit still scans the excluded directories. -->
30+
<!-- Add additional lines for any files or directories outside of src/ that need coverage. -->
31+
<directory suffix=".php">src</directory>
32+
</include>
33+
</source>
34+
<coverage ignoreDeprecatedCodeUnits="true">
35+
</coverage>
36+
</phpunit>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
phpunit.11.xml.dist
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
phpunit.9.xml.dist
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
4+
bootstrap="tests/php/bootstrap.php"
5+
cacheResultFile=".phpunit.cache/test-results"
6+
colors="true"
7+
executionOrder="depends"
8+
beStrictAboutOutputDuringTests="true"
9+
failOnRisky="true"
10+
failOnWarning="true"
11+
>
12+
<testsuites>
13+
<testsuite name="main">
14+
<directory suffix="Test.php">tests/php</directory>
15+
</testsuite>
16+
</testsuites>
17+
</phpunit>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* PayPal Payments package.
4+
*
5+
* @package automattic/jetpack-paypal-payments
6+
*/
7+
8+
namespace Automattic\Jetpack;
9+
10+
/**
11+
* Class PayPal_Payments.
12+
*/
13+
class PayPal_Payments {
14+
15+
const PACKAGE_VERSION = '0.1.0-alpha';
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<rule ref="Jetpack-Tests" />
4+
</ruleset>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Automattic\Jetpack;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
/**
8+
* Contains a simple test case for the PayPal Payments package skeleton code.
9+
*/
10+
class Base_Test extends TestCase {
11+
public function test_version() {
12+
$this->assertEquals( PayPal_Payments::PACKAGE_VERSION, '0.1.0-alpha' );
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Bootstrap.
4+
*
5+
* @package automattic/
6+
*/
7+
8+
/**
9+
* Include the composer autoloader.
10+
*/
11+
require_once __DIR__ . '/../../vendor/autoload.php';
12+
13+
define( 'WP_DEBUG', true );
14+
15+
// Initialize WordPress test environment
16+
\Automattic\Jetpack\Test_Environment::init();

0 commit comments

Comments
 (0)