-
Notifications
You must be signed in to change notification settings - Fork 628
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
[subs 2] Add purchase
endpoints
#3196
Merged
rafaelbsky
merged 13 commits into
subscriptions-backend
from
bsky-bsync-subscription-endpoints
Jan 3, 2025
Merged
[subs 2] Add purchase
endpoints
#3196
rafaelbsky
merged 13 commits into
subscriptions-backend
from
bsky-bsync-subscription-endpoints
Jan 3, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
be12e9d
to
76a80ab
Compare
rafaelbsky
commented
Dec 7, 2024
6842680
to
a00a74a
Compare
dholms
reviewed
Dec 10, 2024
dholms
reviewed
Dec 10, 2024
dholms
reviewed
Dec 10, 2024
dholms
reviewed
Dec 10, 2024
devinivy
reviewed
Dec 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great, just left a handful of small comments.
3d5b943
to
67cfef3
Compare
6a39b89
to
c71ff08
Compare
devinivy
approved these changes
Dec 12, 2024
Base automatically changed from
bsync-subscription-listener
to
subscriptions-backend
January 3, 2025 15:33
8a4fc95
to
4d8784d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(supersedes #3156 and #3160)
This PR adds 4 endpoints to
bsky
and the necessary underlying calls tobsync
to implement them:app.bsky.purchase.getSubscriptions
:bsync
, which calls RevenueCat.app.bsky.purchase.getFeatures
:bsync
providing ascan...
GRPC endpoint that the indexing infrastructure will call. Thatscan...
method will serve data thatbsync
either obtained by being triggered by a webhook event, or by being called in theapp.bsky.purchase.refreshCache
flow.app.bsky.purchase.getSubscriptionGroup
:bsync
. In this case,bsync
doesn't need to call RevenueCat, it replies with in-memory data. The return data here is basically just a configuration. Still, we do it inbsync
sobsky
can remain completely agnostic regarding any purchase-related configuration.app.bsky.purchase.refreshCache
:app.bsky.purchase.getFeatures
(if that was out-of-date, this is what makes it be refreshed).bsync
, which calls RevenueCat.You can skip the
codegen
commit when reviewing.Notable points:
bsky
knows nothing about RevenueCat.bsync
knows about RevenueCat, but only in a few contained points.RevenueCatClient
.RevenueCatClient
, which was used in multiple places inbsync
. In this PR I abstractedRevenueCatClient
away into aPurchasesClient
, that does the mapping between RevenueCat formats and our formats.PurchasesClient
is now called in multiple places instead ofRevenueCatClient
. Note also thatPurchasesClient
is what does the mappings between entitlements, products, etc. Since those rely on configs for the Stripe identifiers, I preferred to put that logic inside a class than in individual functions (like it was in the POC), so I can inject the config.