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

EditCardDetails: Switch to Stripe Elements #35262

Merged
merged 2 commits into from
Aug 12, 2019

Conversation

sirbrillig
Copy link
Member

@sirbrillig sirbrillig commented Aug 8, 2019

Changes proposed in this Pull Request

This updates the EditCardDetails component to use Stripe Elements and Payment Intents (see previous work in #34848).

Depends on:

Testing instructions

  1. Sandbox the API and the store.
  2. Make sure you have purchased something, then visit http://calypso.localhost:3000/me/purchases, click on a purchase, and then click on "Change Payment Method"
  3. Verify that the placeholder for the card number field is numbers and not dots (this verifies that you are seeing the Stripe field).
  4. Fill out all the fields with a unique cardholder name (something different than the subscription's current cardholder name) and with a Stripe test card (eg: 4242 4242 4242 4242) and submit the form.
  5. Verify that you get a success message and are redirected to the purchase page again.
  6. Reload the resulting page (to force calypso to fetch the updated card data), then click the "Payment method" text/icon.
  7. Be sure that the cardholder name shown is the same as the one you updated above.

@matticbot
Copy link
Contributor

@matticbot
Copy link
Contributor

matticbot commented Aug 8, 2019

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~239 bytes removed 📉 [gzipped])

name         parsed_size           gzip_size
themes            -552 B  (-0.1%)     -148 B  (-0.1%)
theme             -552 B  (-0.2%)     -148 B  (-0.2%)
purchases         +132 B  (+0.0%)      +32 B  (+0.0%)
woocommerce        +88 B  (+0.0%)      +25 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~21 bytes added 📈 [gzipped])

name                      parsed_size           gzip_size
async-load-design-blocks        +88 B  (+0.0%)      +21 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@sirbrillig sirbrillig force-pushed the update/edit-card-details-stripe-elements branch from 8a22a0d to 42016e3 Compare August 9, 2019 15:21
@sirbrillig sirbrillig requested a review from a team August 9, 2019 15:26
@sirbrillig sirbrillig marked this pull request as ready for review August 9, 2019 15:28
@sirbrillig sirbrillig requested a review from yoavf August 9, 2019 15:28
Copy link
Contributor

@yoavf yoavf left a comment

Choose a reason for hiding this comment

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

👍Works as expected, together with the two dependencies.

@yoavf
Copy link
Contributor

yoavf commented Aug 11, 2019

@sirbrillig I've noticed an unrelated issue in this flow and in the generic add-card one, which we should fix seperately:

Screen Shot 2019-08-11 at 10 45 01

I guess we don't do a pre-submission validation like we do when submitting a card with payment, so we should figure out how to display a proper error message here (or maybe better, just prevent submission if stripe elements have errors, since those are already displayed).

@sirbrillig
Copy link
Member Author

@yoavf thanks for noticing that. We should be preventing the submission with invalid data but apparently that is sometimes not working? Anyway, #35315 should improve the error message we receive (and the error flow in general).

@sirbrillig sirbrillig force-pushed the update/edit-card-details-stripe-elements branch from 42016e3 to 6e85d10 Compare August 12, 2019 20:00
@sirbrillig sirbrillig merged commit 109a479 into master Aug 12, 2019
@sirbrillig sirbrillig deleted the update/edit-card-details-stripe-elements branch August 12, 2019 20:19
getdave pushed a commit that referenced this pull request Aug 13, 2019
* EditCardDetails: Update to use Stripe Payment Intents

* CreditCardForm: Pass payment_partner through updateCreditCard
sirbrillig added a commit that referenced this pull request Aug 13, 2019
This updates the `AddCardDetails` component to use Stripe Elements and
Payment Intents (see previous work in #34848 and #35262).
sirbrillig added a commit that referenced this pull request Aug 14, 2019
This updates the `AddCardDetails` component to use Stripe Elements and
Payment Intents (see previous work in #34848 and #35262).
sirbrillig added a commit that referenced this pull request Aug 14, 2019
This updates the `AddCardDetails` component to use Stripe Elements and
Payment Intents (see previous work in #34848 and #35262).
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.

3 participants