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

Billing: Remove unused code not behind new payment methods flag #48494

Merged

Conversation

nbloomf
Copy link
Contributor

@nbloomf nbloomf commented Dec 18, 2020

Changes proposed in this Pull Request

  • Once we're confident we won't need to turn off the purchases/new-payment-methods flag, we can clean up this code that's only active when the flag is not set.

Testing instructions

This PR should only be removing code that is inactive due to the purchases/new-payment-methods flag being permanently set in all deployment environments.

We should also make sure the old urls redirect correctly.

  • /me/purchases/:site/:purchaseId/payment/add to /me/purchases/:site/:purchaseId/payment-method/add
  • /me/purchases/add-credit-card to /me/purchases/add-payment-method
  • /me/purchases/:site/:purchaseId/payment/change/:cardId to /me/purchases/:site/:purchaseId/payment-method/change/:cardId

Legacy URLs (not sure if these are used anywhere; it might be worth figuring that out so these can be removed):

  • /purchases/:siteName/:purchaseId/payment/add to /purchases/subscriptions/:siteName/:purchaseId/payment-method/add
  • /purchases/:siteName/:purchaseId/payment/edit/:cardId to /purchases/subscriptions/:siteName/:purchaseId/payment-method/change/:cardId
  • /purchases/subscriptions/:site/:purchaseId/payment/add to /purchases/subscriptions/:site/:purchaseId/payment-method/add
  • /purchases/subscriptions/:site/:purchaseId/payment/edit/:cardId to /purchases/subscriptions/:site/:purchaseId/payment-method/change/:cardId
  • /purchases/add-credit-card/:site to /purchases/add-payment-method/:site

@nbloomf nbloomf added the [Feature Group] WPCOM Store & Purchases All things billing on WordPress.com. This includes the backend store, plans, and billing management. label Dec 18, 2020
@nbloomf nbloomf requested a review from a team December 18, 2020 16:02
@nbloomf nbloomf self-assigned this Dec 18, 2020
@matticbot
Copy link
Contributor

@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 18, 2020
@matticbot
Copy link
Contributor

matticbot commented Dec 18, 2020

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

Sections (~443 bytes removed 📉 [gzipped])

name               parsed_size           gzip_size
purchases              -1231 B  (-0.1%)     -179 B  (-0.0%)
site-purchases         -1152 B  (-0.1%)     -180 B  (-0.1%)
email                   -531 B  (-0.1%)     -100 B  (-0.1%)
plans                   -315 B  (-0.0%)      -49 B  (-0.0%)
incoming-redirect       -315 B  (-4.0%)      -65 B  (-2.1%)
domains                 -285 B  (-0.0%)      -66 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 (~49 bytes removed 📉 [gzipped])

name                                        parsed_size           gzip_size
async-load-signup-steps-plans-atomic-store       -315 B  (-0.2%)      -49 B  (-0.1%)
async-load-signup-steps-plans                    -315 B  (-0.1%)      -49 B  (-0.1%)

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 removed the request for review from a team December 18, 2020 16:22
@sirbrillig sirbrillig removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 18, 2020
@nbloomf nbloomf force-pushed the try/remove-unused-code-not-behind-new-payment-methods-flag branch from b398036 to 2ac998b Compare January 13, 2021 21:00
@nbloomf nbloomf requested a review from a team January 13, 2021 21:10
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 13, 2021
@nbloomf nbloomf marked this pull request as ready for review January 13, 2021 21:22
Copy link
Member

@sirbrillig sirbrillig left a comment

Choose a reason for hiding this comment

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

Everything appears to work correctly. I have some questions about the code but overall I think this is great!


// redirect legacy urls
router( '/me/billing', () => page.redirect( paths.billingHistory ) );
router( '/me/billing/:receiptId', ( { params: { receiptId } } ) =>
page.redirect( paths.billingHistoryReceipt( receiptId ) )
);
router( paths.addCardDetails( ':site', ':purchaseId' ), ( { params: { site, purchaseId } } ) =>
Copy link
Member

Choose a reason for hiding this comment

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

🤔 Since it appears these routes were effectively removed by the flag until now, maybe they're not necessary and/or are covered by something else? Let's check.

Copy link
Member

Choose a reason for hiding this comment

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

It's also possible that they are necessary, but were disabled accidentally as a result of our flag and we need to make sure that the legacy routes remain as you've done here; I just wanted to be sure that was the case.

@@ -46,6 +46,7 @@ export function confirmCancelDomain( siteName, purchaseId ) {
return managePurchase( siteName, purchaseId ) + '/confirm-cancel-domain';
}

// legacy path
Copy link
Member

Choose a reason for hiding this comment

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

Are these still necessary? Can we replace their remaining uses with the new paths?

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 need to make sure I understand the suggestion. If we remove these completely, any old links to (for instance) /payment/add will break, right?

`/purchases/subscriptions/${ siteName }/${ purchaseId }/payment-method/change/${ cardId }`
)
);
router(
Copy link
Member

Choose a reason for hiding this comment

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

Similar to my above comment: I'm surprised that we had legacy routes here that have been disabled since the flag was introduced... are we sure they aren't covered elsewhere?

@sirbrillig
Copy link
Member

I removed some of these in #49897 as a side-effect of the clean-up there.

@nbloomf nbloomf force-pushed the try/remove-unused-code-not-behind-new-payment-methods-flag branch from 2ac998b to 172d6b6 Compare February 15, 2021 21:18
@sirbrillig sirbrillig removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 10, 2021
@nbloomf nbloomf force-pushed the try/remove-unused-code-not-behind-new-payment-methods-flag branch from 36e6565 to 92d9eb0 Compare April 21, 2021 18:57
@nbloomf
Copy link
Contributor Author

nbloomf commented Apr 21, 2021

Rebased again

@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Apr 21, 2021
Copy link
Member

@sirbrillig sirbrillig left a comment

Choose a reason for hiding this comment

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

This looks fine to me. If there's any more clean-up or further discussion to be had, we can do it in another PR.

@sirbrillig sirbrillig 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 Apr 21, 2021
@nbloomf nbloomf merged commit 3aa1cf4 into trunk Apr 22, 2021
@nbloomf nbloomf deleted the try/remove-unused-code-not-behind-new-payment-methods-flag branch April 22, 2021 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Estimate] 2 [Feature Group] WPCOM Store & Purchases All things billing on WordPress.com. This includes the backend store, plans, and billing management.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants