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
createPayPalButton() only keeps a button color that is in an allow list: silver, black, white, plus per-funding-source extras. There was no paypal entry, so Blue (and Gold) were deleted for the PayPal button and it always rendered gold.
What changed
paypal/js/frontend.js: added paypal: [ 'gold', 'blue' ] to supportedColorsMap.
tests/js/paypalBootstrap.test.mjs: runs the real createPayPalButton() and checks the PayPal button keeps all five colors and that an unsupported color (Venmo + gold, PayPal + an unknown value) is still dropped.
How it was verified
Red: JS unit tests failed on the test-only commit (expected: 'gold').
Green: JS unit tests and Oxlint pass on the head commit; all other checks that ran are green.
Not tested: a real PayPal sandbox render. The issue reports PayPal's SDK rendered a blue fundingSource: "paypal" button with style.color: "blue".
After merge
The KB page (formidableforms.com/knowledgebase/formidable-paypal/) still says only Silver, White and Black change the PayPal button; the issue asks for that note to be removed.
We reviewed changes in d4bf9a3...7154905 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.
Unexpected empty method 'onApprove'
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
The reason will be displayed to describe this comment to others. Learn more.
Unexpected empty method 'onError'
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
The reason will be displayed to describe this comment to others. Learn more.
Unexpected empty method 'onCancel'
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
The reason will be displayed to describe this comment to others. Learn more.
Unexpected empty method 'createOrder'
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
The reason will be displayed to describe this comment to others. Learn more.
Unexpected empty method 'createSubscription'
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
The reason will be displayed to describe this comment to others. Learn more.
Approve. The fix is one line and correct: createPayPalButton( paypal.FUNDING.PAYPAL, … ) had no entry in supportedColorsMap, so Gold and Blue fell through to delete buttonConfig.style.color. Adding paypal: [ 'gold', 'blue' ] matches the Color dropdown in paypal/views/settings/button-settings.php and PayPal's documented colors for the PayPal button. Venmo and Pay Later behavior is unchanged.
Tests run: node --test tests/js/paypalBootstrap.test.mjs at 9af76e1 → 7/7 pass. With paypal/js/frontend.js reverted to the pre-fix commit and the same test file, the new color test fails (expected: 'gold', actual: undefined), so it covers the bug. CI's JS unit tests is also green at this head.
Not run: a real PayPal sandbox render of the blue button. I ran the real createPayPalButton() before and after, which shows the config passed to paypal.Buttons() now keeps color: 'blue'; the SDK's own rendering of that config isn't something I exercised.
The issue's KB follow-up (remove the "only Silver, White and Black" note) is already listed under "After merge".
@garretlaxton That sounds like a separate issue. I have a new PR here #3783. I believe it's a conflict between settings when you have it set to card only with recurring payments set, which doesn't support cards currently.
The branch was conflicting with master. The only conflict was tests/js/paypalBootstrap.test.mjs: #3725 and the cancelled-pop-up fix (ccb598fc0) both appended tests at the end of the file. I kept both sets. The fix commit (paypal: [ 'gold', 'blue' ]) is unchanged.
Tested: node --test tests/js/paypalBootstrap.test.mjs on the rebased head: 10/10 pass. Not run: the rest of CI, which starts on this push; a PayPal sandbox render.
The "Card only" report above is a different bug (#3783), not this PR.
The reason will be displayed to describe this comment to others. Learn more.
Unexpected empty method 'onApprove'
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
The reason will be displayed to describe this comment to others. Learn more.
Unexpected empty method 'onError'
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
The reason will be displayed to describe this comment to others. Learn more.
Unexpected empty method 'onCancel'
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
The reason will be displayed to describe this comment to others. Learn more.
Unexpected empty method 'createOrder'
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
The reason will be displayed to describe this comment to others. Learn more.
Unexpected empty method 'createSubscription'
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
The reason will be displayed to describe this comment to others. Learn more.
Approve. Re-review at 7154905 (my Approve was at 9af76e1); the head moved only because Vivi rebased onto master to resolve a conflict in tests/js/paypalBootstrap.test.mjs.
git range-diff of the old and new heads shows all three commits unchanged apart from diff context. The fix is still the single line paypal: [ 'gold', 'blue' ] in supportedColorsMap, and the whole PR diff is those two files.
Tests run: node --test tests/js/paypalBootstrap.test.mjs at 7154905 → 10/10 pass. With paypal/js/frontend.js put back to master's version, the new color test fails (expected: 'gold', actual: undefined), so it still catches the bug.
node --test tests/js/*.test.mjs (the CI command) → 96/102 in my scratch checkout; the same six files (choiceDeleteLogic, inlineSubmitAlignment, optionGroupRename, optionGroupValues, squareVerifyBuyer, style-live-preview) fail on master too, so they are not from this PR.
Not run: a real PayPal sandbox render of the blue button. The test runs the real createPayPalButton() and shows the config handed to paypal.Buttons() keeps color: 'blue'; the SDK's own rendering isn't something I exercised.
Formidable Stripe and PayPal conflict on the same form. With the Stripe add-on active, the "Payment Method" field that should be hidden appears, with two options both labelled "Payment". The Payment area also showed a Stripe card field instead of the PayPal button on some loads but not others. This looks pre-existing though and not new in this PR.
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.
What was broken
createPayPalButton()only keeps a button color that is in an allow list:silver,black,white, plus per-funding-source extras. There was nopaypalentry, so Blue (and Gold) were deleted for the PayPal button and it always rendered gold.What changed
paypal/js/frontend.js: addedpaypal: [ 'gold', 'blue' ]tosupportedColorsMap.tests/js/paypalBootstrap.test.mjs: runs the realcreatePayPalButton()and checks the PayPal button keeps all five colors and that an unsupported color (Venmo + gold, PayPal + an unknown value) is still dropped.How it was verified
JS unit testsfailed on the test-only commit (expected: 'gold').JS unit testsand Oxlint pass on the head commit; all other checks that ran are green.fundingSource: "paypal"button withstyle.color: "blue".After merge
The KB page (formidableforms.com/knowledgebase/formidable-paypal/) still says only Silver, White and Black change the PayPal button; the issue asks for that note to be removed.
Fixes Strategy11/formidable-pro#7004
🤖 Generated with Claude Code