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

Purchases: Reduxify Stored Cards on Secure Payment page #6710

Merged
merged 3 commits into from
Jul 14, 2016

Conversation

stephanethomas
Copy link
Contributor

@stephanethomas stephanethomas commented Jul 12, 2016

This pull request is a follow-up of #6613, #6628, and #6665 that updates the Secure Payment page in the checkout to use the global state tree to manage credit cards (stored during previous purchases or when a user added a new payment method to an existing purchase) instead of the old singleton:

screenshot

Testing instructions

  1. Run git checkout update/reduxify-checkout and start your server, or open a live branch
  2. Sandbox the store
  3. Purchase e.g. a premium theme, a plan, or a site redirect with a fake credit card
  4. Open the Billing History page
  5. Check that you can see the card with the right information in the Manage Your Credit Cards section
  6. Add another purchase to your shopping cart and head to checkout
  7. Check that you can see the previous credit card on the Secure Payment page
  8. Enter a new fake credit card and click the Pay button
  9. Repeat steps Site Picker: Always show search if user has hidden site #4 to Sites: Gap/space missing between sites for every 3rd site #5

Additional notes

This pull requests also updates the query component for stored cards to fetch data as soon as it is mounted, and only in that case. This is to avoid having to explicitly fetch stored cards when a user uses a new credit card during purchase or adds a new payment method to an existing purchase - as otherwise the Billing History page will display stale information if it was accessed by the user beforehand during a same session.

The logic here is that it indeed doesn't make sense to perform this call in these two use cases since there is little chance that the user visits the Billing History page afterwards. It seems to be more effective to fetch stored cards every time the user access this specific page, which I assume doesn't receive lots of traffic.

Reviews

  • Code
  • Product
  • Tests

@Automattic/sdev-feed

@stephanethomas stephanethomas added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Feature] Checkout The checkout screen and process for purchases made on WordPress.com. labels Jul 12, 2016
@stephanethomas stephanethomas self-assigned this Jul 12, 2016
@@ -95,7 +98,7 @@ const Checkout = React.createClass( {
props = props || this.props;

analytics.tracks.recordEvent( 'calypso_checkout_page_view', {
saved_cards: props.cards.get().length,
saved_cards: props.cards.length,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder if we shouldn't record this event only when the list of cards have loaded from the server, otherwise we might just provide stale data to Tracks. This is how it currently works though.

@fabianapsimoes
Copy link
Contributor

Product 👍

Thanks the detailed notes and comments!

@drewblaisdell
Copy link
Contributor

Code 👍 I also tested this, and updated the last commit to remove a misplaced space here (not introduced by this PR).

@drewblaisdell drewblaisdell added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jul 13, 2016
… during mounting

This is to avoid having to explicitly fetch stored cards when a user uses a new credit card during purchase or adds a new payment method to an existing purchase - as otherwise the Billing History page will display stale information if it was accessed by the user beforehand during a same session.

It indeed doesn't really make sense to perform this call in these two use cases since there is little chance that the user visits the Billing History page afterwards. It seems to be more effective to fetch stored cards every time the user access this specific page.
…story page only if no data has been fetched ever
…stored cards

This also removes the singleton that was used originally to get this data.
@stephanethomas stephanethomas merged commit 29984e5 into master Jul 14, 2016
@stephanethomas stephanethomas deleted the update/reduxify-checkout branch July 14, 2016 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Checkout The checkout screen and process for purchases made on WordPress.com.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants