@@ -11784,7 +11784,7 @@ func HandleCreateSubOrg(resp http.ResponseWriter, request *http.Request) {
1178411784 parentOrg.SyncUsage.MultiTenant.Counter = int64(len(childOrgs))
1178511785 }
1178611786
11787- isLicensed := checkNoInternet()
11787+ isLicensed, _ := checkNoInternet()
1178811788 if !parentOrg.CloudSync && !isLicensed && len(childOrgs) >= 3 {
1178911789 log.Printf("[WARNING] Organization %s has exceeded the free plan limit of 3 sub-organizations. An enterprise license is required to create additional sub-organizations.", parentOrg.Id)
1179011790 resp.WriteHeader(400)
@@ -30843,7 +30843,7 @@ func HandleCheckLicense(ctx context.Context, org Org) Org {
3084330843
3084430844 } else if len(shuffleLicenseKey) > 0 {
3084530845
30846- license := checkNoInternet()
30846+ license, timeout := checkNoInternet()
3084730847 if license == true {
3084830848 org.SyncFeatures.MultiEnv.Limit = 100
3084930849 org.SyncFeatures.MultiEnv.Active = true
@@ -30870,6 +30870,64 @@ func HandleCheckLicense(ctx context.Context, org Org) Org {
3087030870 org.SyncFeatures.ShuffleGPT.Active = true
3087130871 }
3087230872
30873+ parsedEula := GetOnpremPaidEula()
30874+
30875+ log.Printf("[DEBUG] Org has the Enterprise License Key")
30876+
30877+ var endDate int64
30878+ var cancellationDate int64
30879+ active := false
30880+
30881+ features := []string{
30882+ "∞ Days Workflow Run History",
30883+ "∞ Days Workflow Backup",
30884+ "∞ Users",
30885+ "Air Gap Environment",
30886+ "Critical Response",
30887+ "On-Call Support",
30888+ "Setup and Maintenance",
30889+ "Key Management System",
30890+ "Custom Integrations",
30891+ "Custom Scaling Options",
30892+ "Billing and Invoice Included",
30893+ "Custom Contract",
30894+ }
30895+
30896+ if license {
30897+ parsedTimeout, err := time.Parse("02-01-2006", timeout)
30898+ if err != nil {
30899+ log.Printf("[ERROR] Failed parsing license timeout: %s", err)
30900+ parsedTimeout = time.Now()
30901+ }
30902+ endDate = parsedTimeout.Unix()
30903+ cancellationDate = 0
30904+ active = true
30905+ } else {
30906+ endDate = time.Now().Unix()
30907+ cancellationDate = time.Now().Unix()
30908+ active = false
30909+ }
30910+
30911+ subscription := PaymentSubscription{
30912+ Name: "Enterprise License",
30913+ Active: active,
30914+ CancellationDate: cancellationDate,
30915+ SupportLevel: "Enterprise Support",
30916+ Startdate: time.Now().Unix(),
30917+ Enddate: endDate,
30918+ Recurrence: string("monthly"),
30919+ Amount: "0",
30920+ Currency: string("USD"),
30921+ Level: "1",
30922+ Reference: "",
30923+ Limit: 1,
30924+ Features: features,
30925+ EulaSigned: true,
30926+ Eula: parsedEula,
30927+ }
30928+
30929+ org.Subscriptions = []PaymentSubscription{subscription}
30930+
3087330931 } else {
3087430932 log.Printf("[WARNING] Org %v does not have an enterprise license. Please purchase an enterprise license to unlock production-ready features. Contact support@shuffler.io for more information.", org.Id)
3087530933 org.SyncFeatures.MultiEnv.Limit = 1
0 commit comments