π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Set subscription to expire 7 days after payment failure
vishnukvmda275ab774051
diff --git a/server/pkg/controller/stripe.go b/server/pkg/controller/stripe.goindex 12a64f70fb..67f02456c2 100644--- a/server/pkg/controller/stripe.go+++ b/server/pkg/controller/stripe.go@@ -8,7 +8,6 @@ import ("fmt""net/http""strconv"- "time""github.com/ente-io/museum/pkg/controller/commonbilling"@@ -21,6 +20,7 @@ import ("github.com/ente-io/museum/pkg/repo""github.com/ente-io/museum/pkg/utils/billing""github.com/ente-io/museum/pkg/utils/email"+ "github.com/ente-io/museum/pkg/utils/time""github.com/ente-io/stacktrace"log "github.com/sirupsen/logrus""github.com/spf13/viper"@@ -51,6 +51,8 @@ type StripeController struct {// account deletion.const SkipMailKey = "skip_mail"+const BufferPeriodOnPaymentFailureInDays = 7+// Return a new instance of StripeControllerfunc NewStripeController(plans ente.BillingPlansPerAccount, stripeClients ente.StripeClientPerAccount, billingRepo *repo.BillingRepository, fileRepo *repo.FileRepository, userRepo *repo.UserRepository, storageBonusRepo *storagebonus.Repository, discordController *discord.DiscordController, emailNotificationController *emailCtrl.EmailNotificationController, offerController *offer.OfferController, commonBillCtrl *commonbilling.Controller) *StripeController {return &StripeController{@@ -469,8 +471,7 @@ func (c *StripeController) handlePaymentIntentFailed(event stripe.Event, country}// If the current subscription is the same as the one in the webhook, then// we need to expire the subscription, and send an email to the user.- // TODO: Set the expiry time to 7 days from now- newExpiryTime := time.Now().UnixMicro()+ newExpiryTime := time.NDaysFromNow(BufferPeriodOnPaymentFailureInDays)err = c.BillingRepo.UpdateSubscriptionExpiryTime(currentSubscription.ID, newExpiryTime)if err != nil {