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(next): Add enabled and onError hooks to paypal component #17839

Merged

Conversation

david1alvarez
Copy link
Contributor

@david1alvarez david1alvarez commented Oct 16, 2024

Because

  • The current paypal checkout flow does not have a way to mark the cart as failed for errors on paypal's side that happen before the subscription is created.
  • The current paypal element can be interacted at times when the form should be disabled

This pull request

  • Adds bindings to the paypal disabled attribute, using their default element styling and protections when the element should be disabled
  • Adds an onError hook to finalize the cart with error, and to reroute the user to the error page.

Issue that this pull request solves

Closes: FXA-7587

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Screenshots (Optional)

Screenshot 2024-10-16 at 10 46 08 AM
Screenshot 2024-10-16 at 10 46 15 AM

Other information (Optional)

I am not able to verify the onError callback works yet, as I am waiting for access to the paypal sandbox instance, and the testing dashboard. If anyone else wants to verify this works in the meantime, that would be great!

@david1alvarez david1alvarez requested a review from a team as a code owner October 16, 2024 18:43
@@ -260,6 +262,13 @@ export function CheckoutForm({
tagline: false,
}}
className="mt-6"
onError={() => {
finalizeCartWithError(
Copy link
Contributor

Choose a reason for hiding this comment

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

@david1alvarez david1alvarez force-pushed the FXA-7587-PayPal-Implement-onError-and-onInit-hooks branch from 2dcc915 to c24345d Compare October 17, 2024 16:50
Copy link
Contributor

@StaberindeZA StaberindeZA left a comment

Choose a reason for hiding this comment

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

r+. ty for the change

@david1alvarez david1alvarez merged commit b575985 into main Oct 17, 2024
25 checks passed
@david1alvarez david1alvarez deleted the FXA-7587-PayPal-Implement-onError-and-onInit-hooks branch October 17, 2024 18:03
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.

2 participants