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

Initial groundwork for generating test mode Stripe Connect URLs #3320

Merged

Conversation

james-allan
Copy link
Contributor

@james-allan james-allan commented Jul 29, 2024

Fixes #3291

Changes proposed in this Pull Request:

This PR updates the WC_Stripe_Connect_API class to add general support for generating test mode Stripe Connect URLs. It also updates the placeholder URL being used for the Connect a test account button on the Configure connection modal - it was previously using the live URL.

Testing instructions

  1. Checkout this branch.
  2. Run npm run build
  3. Go to WooCommerce > Settings > Payments > Stripe > Settings (tab)
  4. Click Configure connection to option the Stripe Connect modal.
  5. Click on Test tab.
  6. Click on Create or connect a test account button.
  7. You should land on a Stripe connect page with test mode labels.

Screenshot 2024-07-29 at 5 21 07 PM

  1. Clicking the Create or connect an account on the Live tab should still direct you to the live mode connect page.

  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry in both changelog.txt and readme.txt (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

: __(
'Create or connect an account',
'woocommerce-gateway-stripe'
)
Copy link
Contributor Author

@james-allan james-allan Jul 29, 2024

Choose a reason for hiding this comment

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

In the previous PR these strings weren't translated (🙈) and in this PR I've also taken the opportunity to make the button text consistent with the text on the other connect UI.

Screenshot 2024-07-29 at 5 24 41 PM
Create or connect an account button

Copy link
Member

Choose a reason for hiding this comment

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

I added a button (secondary if there is a valid live url) to connect a test account:
Screenshot 2024-07-30 at 1 04 46 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I had been working on this test button over here: #3318

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my PR I've taken into consideration the notice and the case if only 1 of the URLs is returned. I think we can probably merge this PR once it's good and then my PR can just be updated to improve on it.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, nice work on #3318, those error notices over the buttons look awesome.

@diegocurbelo diegocurbelo added the status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. label Jul 30, 2024
@diegocurbelo diegocurbelo removed the status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. label Aug 1, 2024
@diegocurbelo
Copy link
Member

The sandbox endpoints have been deployed to the connect server, we can merge this.

@diegocurbelo diegocurbelo self-requested a review August 1, 2024 20:24
Copy link
Member

@diegocurbelo diegocurbelo left a comment

Choose a reason for hiding this comment

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

The code looks good, and it tests well... 🚢

Screenshot 2024-08-01 at 6 13 10 PM
Screenshot 2024-08-01 at 6 13 16 PM

@james-allan
Copy link
Contributor Author

james-allan commented Aug 2, 2024

I'm going to merge this as there's an approving review and it's been a big PR that we've both worked on.

There is an issue we will need to fix however. I cannot onboard to a live account.

I suspect what is happening is we generate the oauth URL and store in a transient the state that is returned. Because we generate the test mode URL second, the test mode state overrides the live mode state and so when the user returns after on-boarding the state verification fails because it's comparing the live state returned with the test state stored in the transient. I'll follow up in another PR to fix that.

@james-allan james-allan merged commit 5ca67d4 into develop Aug 2, 2024
32 of 33 checks passed
@james-allan james-allan deleted the issue/3291-add-support-for-connecting-in-test-mode branch August 2, 2024 04:31
@diegocurbelo
Copy link
Member

I'm going to merge this as there's an approving review and it's been a big PR that we've both worked on.

There is an issue we will need to fix however. I cannot onboard to a live account.

I suspect what is happening is we generate the oauth URL and store in a transient the state that is returned. Because we generate the test mode URL second, the test mode state overrides the live mode state and so when the user returns after on-boarding the state verification fails because it's comparing the live state returned with the test state stored in the transient. I'll follow up in another PR to fix that.

That seems like the likely cause, I'll fix it while adding the Stripe App flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the WC_Stripe_Connect_API class to support test mode requests
2 participants