From cdcd309ec5c031eb7d8b17ada8927e50fb9c7853 Mon Sep 17 00:00:00 2001 From: "mojo-machine[bot]" <111131124+mojo-machine[bot]@users.noreply.github.com> Date: Tue, 7 May 2024 08:20:40 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20Sync=20from=20monorepo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/wearemojo/mojo/commit/8c444be9fd73218401b187988e03cfb46e518bb8 --- lib/revenuecat/revenuecat.go | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/lib/revenuecat/revenuecat.go b/lib/revenuecat/revenuecat.go index e034fa5..9a74188 100644 --- a/lib/revenuecat/revenuecat.go +++ b/lib/revenuecat/revenuecat.go @@ -38,7 +38,6 @@ type Subscriber struct { Entitlements map[string]Entitlement `json:"entitlements"` Subscriptions map[string]Subscription `json:"subscriptions"` NonSubscriptions map[string][]NonSubscription `json:"non_subscriptions"` - ManagementURL *string `json:"management_url"` } type Entitlement struct { @@ -72,10 +71,10 @@ const ( type StoreType string const ( - StoreTypeAppStore StoreType = "app_store" - StoreTypePlayStore StoreType = "play_store" - StoreTypeStripe StoreType = "stripe" - StoreTypePromotional StoreType = "promotional" + StoreTypeAppStore StoreType = "app_store" + StoreTypePlay StoreType = "play_store" + StoreTypeStripe StoreType = "stripe" + StoreTypePromo StoreType = "promotional" ) // https://www.revenuecat.com/reference/subscribers @@ -87,19 +86,3 @@ func (c *Client) GetOrCreateSubscriberInfo(ctx context.Context, appUserID string path := fmt.Sprintf("/subscribers/%s", escapedAppUserID) return res, c.client.Do(ctx, "GET", path, nil, nil, &res) } - -func (s *Subscriber) ActiveSubscriptionCount() int { - activeNonSubCount := len(s.NonSubscriptions) // always active - activeSubCount := 0 - now := time.Now() - - for _, e := range s.Entitlements { - if e.ExpiresDate.Before(now) { - continue - } - - activeSubCount++ - } - - return activeNonSubCount + activeSubCount -}