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

fix (ras-acc): prevent NYP, coupon submission from clearing credit card fields #1881

Merged
merged 4 commits into from
Sep 18, 2024

Conversation

laurelfulford
Copy link
Contributor

@laurelfulford laurelfulford commented Sep 13, 2024

All Submissions:

Changes proposed in this Pull Request:

This PR moves setting and updating the 'Complete Transaction' button price from PHP to JS. This is to prevent an issue where submitting a coupon or NYP after filling in the credit card fields would cause the credit card fields to be cleared.

See: 1207817176293825-as-1208255803261156.

How to test the changes in this Pull Request:

  1. Start on epic/ras-acc.
  2. Enable coupons, and set up at least one regular coupon.
  3. Set up Checkout button blocks for a simple product and a NYP product, plus a donate block.
  4. Set up Stripe Gateway and WooPayments as your payment options.
  5. As a reader, run through a transaction using the simple product.
  6. On the second screen, fill out your payment information first.
  7. Fill in your coupon, and Apply.
  8. Note that the credit card fields reset.
  9. Repeat steps 5-8 with the NYP product, and with both payment gateways.
  10. Apply this PR and run npm run build.
  11. Repeat steps 5-8 with both your simple and NYP products, and both payment processors. When you do this, confirm that the credit card values remain in place, and also confirm that the Confirm Transaction button at the bottom updates with the correct price.
  12. Try applying your coupon, then removing it, and checking the price in the Confirm Transaction button each time.
  13. Run a transaction with the Donate Button block, and confirm the button on the second screen just says "Donate Now".
  14. Smoke test a few other product options, like a subscription product or variable product, and make sure the Confirm Transaction button displays the correct initial payment amount.

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?

@laurelfulford laurelfulford changed the title fix (ras-acc): prevent NYP, coupon submission from clearing coupon fields fix (ras-acc): prevent NYP, coupon submission from clearing credit card fields Sep 13, 2024
Copy link
Contributor

@chickenn00dle chickenn00dle left a comment

Choose a reason for hiding this comment

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

Nice work @laurelfulford! Looks good for the most part. Left a small non-blocking nit.

I also ran into a very edge case issue where when a product has both coupons AND nyp enabled, submitting a new NYP value will override the coupon entirely. However, this seems to be happening on epic/ras-acc as well so will approve and create a new task for this.

/**
* Get updated cart total to update the "Place Order" button.
*/
function returnUpdatedCartTotal() {
Copy link
Contributor

Choose a reason for hiding this comment

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

non-blocking nit: might be clearer to name this something like getUpdatedCartTotal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call! This has been updated in 013161e.

@laurelfulford
Copy link
Contributor Author

I also ran into a very edge case issue where when a product has both coupons AND nyp enabled, submitting a new NYP value will override the coupon entirely.

Eeeeep good catch! 😱 I ran so many checkouts testing this and still missed it -- so glad you caught it!

@laurelfulford laurelfulford merged commit b3fd8e6 into epic/ras-acc Sep 18, 2024
8 checks passed
@laurelfulford laurelfulford deleted the fix/cc-fields branch September 18, 2024 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants