[server] Increase duration of free trial

This commit is contained in:
Neeraj Gupta
2024-09-04 12:18:06 +05:30
parent 86d3067713
commit c416819f0a
3 changed files with 7 additions and 3 deletions

View File

@@ -16,8 +16,8 @@ const (
FreePlanProductID = "free"
// FreePlanTransactionID is the dummy transaction ID for the free plan
FreePlanTransactionID = "none"
// TrialPeriodDuration is the duration of the free trial
TrialPeriodDuration = 365
// TrialPeriodDuration is the duration (in years) of the free trial
TrialPeriodDuration = 100
// TrialPeriod is the unit for the duration of the free trial
TrialPeriod = "days"

View File

@@ -108,7 +108,7 @@ func GetFreeSubscription(userID int64) ente.Subscription {
ProductID: ente.FreePlanProductID,
OriginalTransactionID: ente.FreePlanTransactionID,
Storage: ente.FreePlanStorage,
ExpiryTime: time.NDaysFromNow(ente.TrialPeriodDuration),
ExpiryTime: time.NYearsFromNow(ente.TrialPeriodDuration),
}
}

View File

@@ -48,6 +48,10 @@ func NDaysFromNow(n int) int64 {
return time.Now().AddDate(0, 0, n).UnixNano() / 1000
}
func NYearsFromNow(n int) int64 {
return time.Now().AddDate(n, 0, 0).UnixNano() / 1000
}
// NMinFromNow returns the time n min from now in micro seconds
func NMinFromNow(n int64) int64 {
return time.Now().Add(time.Minute*time.Duration(n)).UnixNano() / 1000