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(code_push_protocol): add subscription object to user #339

Merged
merged 9 commits into from
Apr 24, 2023

Conversation

bryanoltman
Copy link
Contributor

Description

Adds the Subscription object to our API contract and adds a Subscription? subscription to User.

The info provided by this object will allow us to provide richer information to the user about their subscription (price, when/if it expires, when they will be charged, etc.)

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@bryanoltman bryanoltman requested a review from felangel April 20, 2023 20:37
/// Converts a [Subscription] to a JSON object.
Json toJson() => _$SubscriptionToJson(this);

/// Billing rate, in cents.
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh man. US Cents I assume. :) Someone is going to write an amazing typed "money" object someday. 🤣

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Assuming usd for now.

Stripe specifies currency on the individual price objects (https://stripe.com/docs/api/prices/object#price_object-currency), so we can get fancier if/when we need to.


/// When the subscription will be renewed or expire.
@TimestampConverter()
final DateTime paidThroughDate;
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this is midnight UTC on that date?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not specified, but looking at some of the live subscriptions, it seems to be purchase_time + Duration(days: 30)

@bryanoltman bryanoltman requested review from felangel and eseidel April 24, 2023 15:17
@bryanoltman bryanoltman merged commit 679c592 into main Apr 24, 2023
@bryanoltman bryanoltman deleted the bo/subscription-api branch April 24, 2023 15:42
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