Skip to content

Move Simple Payments to PayPal Payments package #43413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

allie500
Copy link
Contributor

@allie500 allie500 commented May 8, 2025

Fixes PAYPAL-13

Proposed changes:

  • This PR moves the Simple Payments block code to the PayPal Payments package.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • TBD

Copy link
Contributor

github-actions bot commented May 8, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the update/move-simple-payments-to-paypal-payments-pkg branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/move-simple-payments-to-paypal-payments-pkg

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Block] Pay With Paypal aka Simple Payments [Package] Paypal Payments [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests Docs labels May 8, 2025
Copy link
Contributor

github-actions bot commented May 8, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • 🔴 Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@allie500 allie500 changed the title Update/move simple payments to paypal payments pkg Move Simple Payments to PayPal Payments package May 8, 2025
@allie500
Copy link
Contributor Author

allie500 commented May 8, 2025

@jeherve, so far I've only moved and lightly modified the Simple Payments block code. I see there is also a simple-payments directory within the jetpack/projects/plugins/jetpack/modules directory:
https://github.com/Automattic/jetpack/tree/update/move-simple-payments-to-paypal-payments-pkg/projects/plugins/jetpack/modules/simple-payments

Should I make a modules directory in projects/packages/paypal-payments and move the three files there? Or would it be better to simply move the three files directly into the projects/packages/paypal-payments directory?

Thanks in advance for your feedback!

Copy link

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/extensions/shared/help-message.js 0/2 (0.00%) -100.00% 2 ❤️‍🩹

1 file is newly checked for coverage.

File Coverage
projects/packages/paypal-payments/src/simple-payments/simple-payments.php 0/36 (0.00%) 💔

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

@jeherve
Copy link
Member

jeherve commented May 9, 2025

That's going to be a multi-step process I think. Here is how I would personally go about it, but that's just my personal opinion, feel free to take a different approach :)

The main entry point for the whole functionality is projects/plugins/jetpack/modules/simple-payments/simple-payments.php. I would recommend copying this to the package first, alongside the related files in that projects/plugins/jetpack/modules/simple-payments/ directory.

Once that's ported to the package, we can start requiring the package in the Jetpack plugin's composer.json file, stop requiring the file here:

'simple-payments/simple-payments.php',

And instead create a new modules/simple-payments.php file that would instantiate the class from the package.

Once that's done, you could copy the contents of projects/plugins/jetpack/modules/widgets/simple-payments.php to the package, and then replace the contents of that widget file by a call to the same code in the package.

Then, the next step would be to copy the actual block from projects/plugins/jetpack/extensions/blocks/simple-payments/ into a new dir in the package, and create the webpack config file to build it, so you get build files that we'll be able to require in the Jetpack plugin and later on in the new standalone plugin. The Forms package has an example you could follow. Here is their webpack file for example: projects/packages/forms/tools/webpack.config.blocks.js.
Once you have that set up, you would probably create a new class in the package, that would handle registering that block. You can see the Contact_Form_Block for an example of a block that lives in a package, is registered in a package, and then registration is called from the Jetpack plugin in projects/plugins/jetpack/extensions/blocks/contact-form/contact-form.php.

Once that's all done, you'll be able to deprecate the old classes from the Jetpack plugin, and they could then be removed entirely in a few releases.

At that point, you'll have a standalone package with code that can register a block, register a widget, and you'll be able to register that block or that widget from the Jetpack plugin and also from any other standalone plugin we create in the future.

Let me know if that makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Pay With Paypal aka Simple Payments Docs [Package] Paypal Payments [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress [Tests] Includes Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants