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

feat(organizations): update is_mmo to identify mmo subscriptions TASK-1231 #5289

Merged
merged 8 commits into from
Nov 28, 2024

Conversation

jamesrkiger
Copy link
Contributor

@jamesrkiger jamesrkiger commented Nov 21, 2024

📣 Summary

Change the logic of the is_mmo property on the Organization model to check Stripe product metadata for the 'mmo_enabled' field.

👀 Preview steps

This change is covered by a unit test.

For a manual test:

  1. Create an organization and purchase a storage addon (this is a subscription in Stripe even if we don't describe it as such in the UI).
  2. Check org's is_mmo property in shell. On main, this will be True because it is only checking to see whether or not an org has a plan. On this branch, however, it will correctly be False because storage addons shouldn't enable MMO features.
  3. Upgrade to an enterprise plan, which includes MMO support.
  4. Check is_mmo property in shell. On this branch, it should now be True.

Comment on lines +182 to +189
if self.mmo_override:
return True

if billing_details := self.active_subscription_billing_details():
if product_metadata := billing_details.get('product_metadata'):
return product_metadata.get('mmo_enabled') == 'true'

return False
Copy link
Contributor

Choose a reason for hiding this comment

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

@jamesrkiger we may change the docstring then ;-)

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 catch. I have updated the text.

kobo/apps/stripe/tests/test_organization_usage.py Outdated Show resolved Hide resolved
kobo/apps/stripe/tests/utils.py Show resolved Hide resolved
@noliveleger noliveleger removed the request for review from jnm November 27, 2024 18:59
@noliveleger noliveleger merged commit 38393e0 into main Nov 28, 2024
7 checks passed
@noliveleger noliveleger deleted the task-1231-correct-is-mmo-logic branch November 28, 2024 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants