Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Mark upgrades

vishnukvmdfeb6a827554a
diff --git a/server/pkg/controller/billing.go b/server/pkg/controller/billing.go
index 8b9b3f75f5..ff57c94775 100644
--- a/server/pkg/controller/billing.go
+++ b/server/pkg/controller/billing.go
@@ -285,6 +285,9 @@ func (c *BillingController) VerifySubscription(
}
}
}
+ if isUpgradingFromFreePlan {
+ newSubscription.UpgradedAt = time.Microseconds()
+ }
err = c.BillingRepo.ReplaceSubscription(
currentSubscription.ID,
newSubscription,
diff --git a/server/pkg/controller/stripe.go b/server/pkg/controller/stripe.go
index a8ad9cfdcf..7e8b6ca837 100644
--- a/server/pkg/controller/stripe.go
+++ b/server/pkg/controller/stripe.go
@@ -17,6 +17,7 @@ import (
"github.com/ente-io/museum/ente"
emailCtrl "github.com/ente-io/museum/pkg/controller/email"
+ timeUtil "github.com/ente-io/museum/pkg/utils/time"
"github.com/ente-io/museum/pkg/repo"
"github.com/ente-io/museum/pkg/utils/billing"
"github.com/ente-io/museum/pkg/utils/email"
@@ -233,11 +234,14 @@ func (c *StripeController) handleCheckoutSessionCompleted(event stripe.Event, co
log.Warn("Webhook is reporting an outdated purchase that was already verified stripeSubscription:", stripeSubscription.ID)
return ente.StripeEventLog{UserID: userID, StripeSubscription: stripeSubscription, Event: event}, nil
}
+ isUpgradingFromFreePlan := currentSubscription.ProductID == ente.FreePlanProductID
+ if isUpgradingFromFreePlan {
+ newSubscription.UpgradedAt = timeUtil.Microseconds()
+ }
err = c.BillingRepo.ReplaceSubscription(
currentSubscription.ID,
newSubscription,
)
- isUpgradingFromFreePlan := currentSubscription.ProductID == ente.FreePlanProductID
if isUpgradingFromFreePlan {
go func() {
cur := currency.MustParseISO(string(session.Currency))