mattermost-webapp icon indicating copy to clipboard operation
mattermost-webapp copied to clipboard

Mm 46827

Open neallred opened this issue 1 year ago • 3 comments

Summary

Hide invoice in subscription object if it is $0.00 total. I opted to do this from the frontend instead of the backend, because sending the purchase confirmation email checks for nil invoice, so I didn't want to do it in the stripe layer, and doing it in the api layer is tricky because more than one endpoint returns a subscription, and if we add more endpoints that return subscription(s), we'll need to remember to alter those, too. Also, CWS frontend makes use of the invoice users count for the subscription and billing history cards to show the number of users, and for whether to show the subscription at all .

If we're sure we shouldn't be sending the purchase confirmation email for $0.00 invoices in the first place, I could ignore the invoice in the Stripe layer, but then if for some reason we start needing it, we'll need to change it back and make the front end ignore it. Since our model of a subscription so closely models Stripe's model, I'm hesitant to ignore the subscription invoice if Stripe is sending it.

Ticket Link

https://mattermost.atlassian.net/browse/MM-46827

Related Pull Requests

None

Screenshots

before: before

after: after

Release Note

On cloud instances, do not show $0 invoices.

neallred avatar Sep 07 '22 14:09 neallred

That is true, that it will show no last_invoice a month after they downgrade. We could do the lookup, but it means all subscriptions that return a $0 invoice incur an extra lookup of invoices in Stripe.

neallred avatar Sep 07 '22 14:09 neallred

It would also get messy from the CWS frontend side, because it's using last invoice to infer number of users, and if the last invoice is no longer the most recent informationn, that info will be misleading.

neallred avatar Sep 07 '22 14:09 neallred

Bundle Stats

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Type Total bundle size % Changed
0 bundled 0 B 0%
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

No assets were unchanged

github-actions[bot] avatar Sep 07 '22 14:09 github-actions[bot]

Opted to do it like Nick said, server-side, in https://github.com/mattermost/customer-web-server/pull/1056

neallred avatar Jan 17 '23 19:01 neallred