You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add conversion from legacy PayPal actions to Commerce - #3686
Offer conversion of legacy PayPal actions to PayPal Commerce from the action settings. Map payment amounts, subscriptions and conditions, disclose settings that cannot be copied exactly, and disable the legacy action after creating its replacement.
After Payment settings
Legacy "After Payment" rows (change a field when a payment completes or fails) now carry over to the new payment action in the same change_field format. Pro runs them for the Lite payment action since https://github.com/Strategy11/formidable-pro/pull/6978, and the Stripe add-on runs them while it is active. Incomplete rows are dropped.
When an action has these rows and neither can run them, the conversion is blocked. The notice asks to activate Formidable Pro, or to update it when the installed version is too old.
Notice design
The migration notice uses the existing Lite notice styles, with separate blocked (amber warning), error and success (green, with the list of settings to review) states.
Testing
Conversion regression tests: 7 tests and 23 assertions passed, including After Payment rows and the Pro requirement.
A conversion on the dev site carried both After Payment rows (Completed and Failed) to the new action and set the legacy action to draft.
The default, blocked, error and success states were checked in the browser with no console errors.
Scoped PHP syntax, PHPCS, Rector, PHP CS Fixer, Mago lint, ESLint, Oxlint and Stylelint passed. PHPStan is blocked by the duplicate wp_register_ability stub also present on unchanged master. Scoped Psalm only reports classes outside the scanned files.
Remaining draft validation
Run the migration against a connected sandbox account, including email triggers, subscription settings and a live After Payment field update. No live payment was attempted.
We reviewed changes in ab4ee48...3e1ae7c on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
The reason will be displayed to describe this comment to others. Learn more.
Variable $form_action might not be defined
A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.
The reason will be displayed to describe this comment to others. Learn more.
Variable $blocker might not be defined
A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.
Legacy PayPal actions can change a field when a payment completes or
fails. These rows now carry over to the PayPal Commerce payment action,
which saves them in the same format. Pro runs them for the Lite payment
action, or the Stripe add-on runs them while it is active.
When an action has these rows and nothing can run them, the conversion
is blocked and the notice asks to activate or update Formidable Pro.
The migration notice now uses the Lite notice styles, with clear
blocked, error and success states.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Approve (draft, code-level). One non-blocking note on test coverage; the sandbox-account validation you listed as remaining is still open and I did not exercise it.
What I ran at 56c8c91
Tests run: phpunit --filter test_FrmPayPalLiteLegacyMigration (wordpress-develop harness, PHP 8.4, PR tree swapped in) at 56c8c91 → OK, 7 tests / 23 assertions. CI skipped PHPUnit on this PR, so this run is the only one.
Real conversion through migrate() in a throwaway PHPUnit probe (not committed): a legacy subscription action with trial, paypal_stop_email, business email and return URL became a payment action with gateway paypal, type recurring, interval month, product name Gold, currency usd, amount 9.99, conditions kept. The legacy action went to draft, a second migrate() on it returned frm_paypal_migration_blocked (already has a payment action), and every email action with a create event moved to payment-success.
Live in the preview env (Lite at the PR head, Formidable PayPal add-on active, Pro from 2026-11-06): the notice renders inside the legacy action, the button is disabled with the amber blocker when After Payment rows exist and this Pro cannot run them, and enabled otherwise. Clicking Convert on an action without those rows showed the green success state with the four settings to review, focus landed on "Reload the page", and no console errors from the new code. After the reload the new payment action was there, the legacy one stayed draft in the DB, and saving the form with Update left it draft (the legacy action does not come back to life on save).
Blocked state (After Payment rows, Pro too old):
Success state:
Non-blocking
Coverage: the new tests cover convert_settings(), the blocker and the invalid-id path, but not migrate() end to end, move_emails_to_payment_success(), or migrate_action() (the AJAX handler's permission and nonce checks). Those are where a regression would do damage (the new action not being created, emails moved wrongly, an unauthenticated call). My probe above would make a good starting test.
test_after_payment_rows_need_a_supporting_pro_version starts with assertFalse( is_callable( 'FrmProTransLiteController::change_fields_after_payment' ) ), so it fails the day a Pro with that method is loaded in the same run. It is fine in Lite's own CI, but it is an environment-dependent assertion.
Not run: the "Pro supports After Payment" branch (the Pro in the env predates formidable-pro#6978, so the unblocked-with-rows path was only covered by the unit test), a connected sandbox account, a real subscription, email triggers, PHPCS/PHPStan, and the review skills. DeepSource PHP is red; I did not open its findings.
The reason will be displayed to describe this comment to others. Learn more.
Access to an undefined property test_FrmPayPalLiteLegacyMigrationAjax::$_last_response
This issue is raised when an attempt is made to access an undefined property.
This may not have been intended, and it is advisable to give the code another look to make sure the property is defined in the scope it is used in.
The reason will be displayed to describe this comment to others. Learn more.
Access to an undefined property test_FrmPayPalLiteLegacyMigrationAjax::$_last_response
This issue is raised when an attempt is made to access an undefined property.
This may not have been intended, and it is advisable to give the code another look to make sure the property is defined in the scope it is used in.
$this->assertStringContainsString( 'legacy PayPal action could not be found', $response['data']['message'], 'A valid nonce should reach the migration helper.' );
The reason will be displayed to describe this comment to others. Learn more.
Approve (draft, code-level) at 78d7572. The only change since my Approve at 56c8c91 is the new tests, which answer my coverage note. One small non-blocking note below.
Whole PR re-read at the new head. git diff 56c8c91 78d7572 touches two test files only; every source, view and JS file is byte-identical to what I reviewed at 56c8c91. The UI is unchanged, so the browser was not exercised at this head (see Not run).
migrate() now has a real end-to-end test: subscription settings land as payment / recurring / month / 9.99, the legacy action goes to draft, only the email with a create event moves (without duplicating payment-success), and a second migrate() returns frm_paypal_migration_blocked.
The AJAX handler now has its own test class: no permission and a subscriber stop before any lookup, a missing or wrong nonce returns -1, and a valid request reaches the helper.
The environment-dependent assertion I flagged is gone: the Pro test now branches on whether After Payment support is loaded.
Tests run: phpunit -c phpunit9.xml --filter test_FrmPayPalLiteLegacyMigration at 78d7572 (wordpress-develop harness, PHP 8.4, PR tree checked out in the plugin) -> OK, 10 tests / 41 assertions; --group ajax on the new class -> OK, 2 tests / 8 assertions. CI skipped PHPUnit on this PR, so these runs are the only ones.
I checked that the new tests fail when the code is broken, one change at a time:
Removing FrmAppHelper::permission_check( 'frm_edit_forms' ) from migrate_action() fails the capability test.
Removing check_ajax_referer() fails the nonce test.
Leaving create in the email events fails the migrate test.
Not saving the moved email action fails the migrate test.
php -l and php-cs-fixer (dry run, repo config) are clean on both test files.
Non-blocking
test_after_payment_rows_need_a_supporting_pro_version computes $supported with the same expression as the private after_payment_is_supported() in the helper. On a Pro that supports After Payment, the test then asserts '' from a copy of the logic it is checking. In this environment (no supporting Pro) it takes the blocker branch and passes for real. Calling the helper's own predicate through run_private_method would drop the duplicate expression.
DeepSource PHP is still red. I opened the findings this time. They are the apply_filters calls with extra arguments in migrate() (valid WordPress usage), undefined assert* methods on the test class (inherited from FrmUnitTest/PHPUnit) and view variables ($form_action, $blocker) defined by the including controller. They look like static-analysis false positives, but I did not trace each one to the include site.
Not run / not exercised: the browser at this head (the screenshots in my earlier review are for 56c8c91, same UI code), the "Pro supports After Payment" branch (the harness Pro predates formidable-pro#6978), a connected sandbox account, a real subscription, email triggers, PHPCS (the custom Formidable sniffs are not installed here), and the review skills (the delta is tests only).
The After Payment blocker test duplicated the expression from
after_payment_is_supported(). Call the private helper method instead so
the test cannot drift from the code it checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Approve (draft, code-level) at 412d884. The only change since my Approve at 78d7572 is one line in a test, which answers my last non-blocking note.
Whole PR re-read at the new head. git diff 78d7572 412d884 touches tests/phpunit/paypal/test_FrmPayPalLiteLegacyMigration.php only (1 line). Every source, view, JS and CSS file is byte-identical to what I reviewed at 78d7572, and the PR's file list is unchanged.
test_after_payment_rows_need_a_supporting_pro_version now gets $supported from the helper's own private after_payment_is_supported() through run_private_method, instead of a copy of its expression. A change to the predicate can no longer leave the test checking a stale duplicate.
Tests run: phpunit -c phpunit9.xml --filter test_FrmPayPalLiteLegacyMigration at 412d884 (wordpress-develop harness, PHP 8.4, PR tree checked out in the plugin) → OK, 10 tests / 41 assertions. --group ajax on the migration classes → OK, 2 tests / 8 assertions. CI skipped PHPUnit on this PR, so these runs are the only ones.
I also forced the predicate both ways in a throwaway edit of the helper (reverted, harness restored): forced supported, the test takes its '' branch and passes (3 assertions); forced unsupported, it takes the blocker branch and passes (4 assertions). Both branches of the test now execute, including the one the harness Pro could not reach before. php -l is clean on the test file.
DeepSource PHP is still red. Same findings I opened last round (apply_filters extra args, inherited assert* methods, view variables from the including controller); nothing new in the one-line delta.
Not run / not exercised: UI not exercised at this head (no screenshot; the screenshots in my first review are for 56c8c91, and the UI code is unchanged), a connected sandbox account, a real subscription, email triggers, PHPCS/PHPStan, and the review skills (the delta is one test line).
The reason will be displayed to describe this comment to others. Learn more.
Approve (draft, code-level) at d74e5a5. The only change since my Approve at 412d884 is a merge of master (#3713, #3664, #3647, #3708, #3709 and others).
Whole PR re-read at this head. The PR's own diff against master is the same 9 files, 881 additions, 1 deletion, and every line of it is byte-identical to what I reviewed at 412d884 (git diff origin/master...412d884 and ...d74e5a5 are the same 955 lines). 0 behind master.
Nothing from the merged master PRs touches the PayPal legacy-migration files, hooks or views.
Tests run: phpunit -c phpunit9.xml --filter test_FrmPayPalLiteLegacyMigration at d74e5a5 (wordpress-develop harness, PHP 8.4, PR tree swapped in as the Lite plugin, restored after) → OK, 10 tests / 41 assertions. --group ajax on the migration classes → OK, 2 tests / 8 assertions. --filter FrmPayPalLite (all PayPal Lite tests, including master's FrmPayPalLiteActionsController additions from #3708) → OK, 27 tests / 76 assertions. CI skipped PHPUnit on this PR, so these runs are the only ones.
DeepSource PHP is still red. Same findings I opened on 2026-11-16 (apply_filters extra args, inherited assert* methods, view variables from the including controller); no new source in this delta.
Not run / not exercised: the browser at this head (UI code, views and CSS are byte-identical to 56c8c91, where I took the screenshots), a connected sandbox account, a real subscription, email triggers, PHPCS/PHPStan, and the review skills (no code delta to review).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Offer conversion of legacy PayPal actions to PayPal Commerce from the action settings. Map payment amounts, subscriptions and conditions, disclose settings that cannot be copied exactly, and disable the legacy action after creating its replacement.
After Payment settings
Legacy "After Payment" rows (change a field when a payment completes or fails) now carry over to the new payment action in the same
change_fieldformat. Pro runs them for the Lite payment action since https://github.com/Strategy11/formidable-pro/pull/6978, and the Stripe add-on runs them while it is active. Incomplete rows are dropped.When an action has these rows and neither can run them, the conversion is blocked. The notice asks to activate Formidable Pro, or to update it when the installed version is too old.
Notice design
The migration notice uses the existing Lite notice styles, with separate blocked (amber warning), error and success (green, with the list of settings to review) states.
Testing
Remaining draft validation
Run the migration against a connected sandbox account, including email triggers, subscription settings and a live After Payment field update. No live payment was attempted.
🤖 Generated with Claude Code