Skip to content
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

feat: update Stripe Settings dashboard UI #3488

Merged
merged 19 commits into from
Nov 11, 2024
Merged

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Oct 21, 2024

All Submissions:

Changes proposed in this Pull Request:

Updates our Stripe Settings dashboard page with a new "Payment Methods" page which lays the groundwork for showing UI for all payment gateways that Newspack fully supports (currently only Stripe and WooPayments). This PR only implements UI for Stripe, for now.

The new UI removes settings fields which are duplicative of settings in the Stripe payment gateway's own settings pages, in favor of a link out to those settings pages for configuration. It shows a "Connection status" indicator showing whether the payment gateway is not connected, partially connected (with API keys but not with the new OAuth method), or fully connected.

It also reorganizes the "Transaction fees" settings fields slightly, for better visual clarity since the UI is now more hierarchical than before.

How to test the changes in this Pull Request:

  1. Disable the Stripe gateway plugin if it's already installed/activated on your site.
  2. Check out this branch/rebuild
  3. In the admin, visit Newspack > Reader Revenue
  4. Confirm that the "Stripe Settings" tab is now called "Payment Methods"
  5. Visit "Payment Methods" and confirm you see a plugin installer (since the plugin is deactivated):
Screenshot 2024-10-18 at 3 32 50 PM
  1. Click "Activate" and confirm that the plugin installer component is replaced by a "Stripe" settings component. If you previously had Stripe connected, it will show as enabled already and with Connection Status and settings in the content area, otherwise it will just show a toggle switch to enable the payment gateway.

  2. If your site was already connected to Stripe via API keys (previously the only option) but not OAuth, confirm that the Stripe component shows "Needs attention" under "Connection Status", along with our transaction fee settings:

Screenshot 2024-10-18 at 5 03 27 PM

Note: in this state (connected via API keys but not OAuth), the Stripe gateway will continue to work on the front-end for checkout, but this is not guaranteed to continue working beyond Oct. 29.

  1. Delete your Stripe keys (via WP CLI: wp option delete woocommerce_stripe_settings). Refresh the page and confirm that "Connection Status" shows "Not connected" and that the transaction fee fields are no longer shown.
Screenshot 2024-10-18 at 4 52 42 PM
  1. Click "Connect" and confirm that you're redirected to the Stripe payment gateway's settings page.
  2. On this page you should see a dialogue to authenticate or reauthenticate with Stripe (the messaging may differ depending on whether you're already connected via API keys):
Screenshot 2024-10-21 at 9 29 46 AM
  1. Complete the new authentication flow (if connecting to a test Stripe account, you should be able to click a "skip this flow" button to avoid having to enter real banking info during the flow).
  2. After you're redirected back to the Stripe gateway settings page, return to our Newspack > Reader Revenue > Payment Methods page. Confirm that the Connection Status dialogue now shows that you're connected (in test mode) and that the transaction fees fields are once again available:
Screenshot 2024-10-18 at 5 04 18 PM
  1. Smoke test the "Collect transaction fees" toggle and the related transaction fee fields to ensure they persist after saving and change the modal checkout UI for donations as expected. Note that in this PR, toggling OFF the "Collect transaction fees" toggle will hide the other settings fields.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@dkoo dkoo self-assigned this Oct 21, 2024
@dkoo dkoo changed the title Feat/stripe settings page feat: update Stripe Settings dashboard UI Oct 21, 2024
@dkoo dkoo added [Status] Needs Review The issue or pull request needs to be reviewed [Status] Needs Design Review labels Oct 21, 2024
@dkoo dkoo requested a review from thomasguillot October 21, 2024 17:01
@dkoo dkoo marked this pull request as ready for review October 21, 2024 17:01
@dkoo dkoo requested a review from a team as a code owner October 21, 2024 17:02
@dkoo
Copy link
Contributor Author

dkoo commented Oct 23, 2024

Note: #3494 expands on this PR with a minor data refactor and UI update, plus adds full support for WooPayments in addition to the Stripe gateway. I opened as a separate PR so that we can handle code review in stages.

@dkoo
Copy link
Contributor Author

dkoo commented Oct 28, 2024

Looks like we might need to retain some kind of button to at least delete any stored Stripe API keys on the site. We've found that some sites experienced issues with the reauthentication flow if they already had Stripe API keys stored, but those keys were invalid for some reason (wrong account, expired, revoked, etc.). Resaving valid keys OR clearing the invalid keys were the only ways we could clear the block for reconnecting. After further testing it appears this wasn't the case. If we run into errors after connecting via OAuth in the future, we may reconsider a feature to manually clear stored API keys.

Copy link
Contributor

@leogermani leogermani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! All works

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Nov 8, 2024
…e-gateways

feat: support for WooPayments as a payment gateway
@dkoo dkoo merged commit 7974fac into trunk Nov 11, 2024
7 checks passed
@dkoo dkoo deleted the feat/stripe-settings-page branch November 11, 2024 21:31
Copy link

Hey @dkoo, good job getting this PR merged! 🎉

Now, the needs-changelog label has been added to it.

Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label.

If it does, please add an entry to it to our shared document, with screenshots and testing instructions if applicable, then remove the label.

Thank you! ❤️

matticbot pushed a commit that referenced this pull request Nov 15, 2024
# [5.8.0-alpha.1](v5.7.0...v5.8.0-alpha.1) (2024-11-15)

### Bug Fixes

* **reader-registration-block:** fix styles of newsletter lists ([1e1d7a4](1e1d7a4))
* **salesforce:** handle woocommerce inactive ([#3521](#3521)) ([bf868a4](bf868a4))
* use user email for esp sync purposes ([#3520](#3520)) ([d6925ff](d6925ff))
* **wc-memberships:** WC for Teams join-team link; team in my-account ([#3540](#3540)) ([489ce0f](489ce0f))

### Features

* also trigger subscription change events on switch ([#3514](#3514)) ([5a84949](5a84949))
* **pwa:** enable SW file caching ([82af7d4](82af7d4))
* **starter-content:** e2e improvements; removal CLI command ([35431ac](35431ac))
* update Stripe Settings dashboard UI ([#3488](#3488)) ([7974fac](7974fac))
* **wc-memberships:** support team data in import ([63c78b2](63c78b2))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 5.8.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Nov 25, 2024
# [5.8.0](v5.7.0...v5.8.0) (2024-11-25)

### Bug Fixes

* **reader-registration-block:** fix styles of newsletter lists ([1e1d7a4](1e1d7a4))
* **salesforce:** handle woocommerce inactive ([#3521](#3521)) ([bf868a4](bf868a4))
* use user email for esp sync purposes ([#3520](#3520)) ([d6925ff](d6925ff))
* **wc-memberships:** WC for Teams join-team link; team in my-account ([#3540](#3540)) ([489ce0f](489ce0f))

### Features

* also trigger subscription change events on switch ([#3514](#3514)) ([5a84949](5a84949))
* **pwa:** enable SW file caching ([82af7d4](82af7d4))
* **starter-content:** e2e improvements; removal CLI command ([35431ac](35431ac))
* update Stripe Settings dashboard UI ([#3488](#3488)) ([7974fac](7974fac))
* **wc-memberships:** support team data in import ([63c78b2](63c78b2))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 5.8.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @alpha released [Status] Approved The pull request has been reviewed and is ready to merge [Status] Needs Design Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants