|
|
@ -9,8 +9,10 @@ |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using Autofac; |
|
|
using Autofac; |
|
|
|
|
|
using Microsoft.AspNetCore.Identity; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.Options; |
|
|
using Microsoft.Extensions.Options; |
|
|
|
|
|
using Squidex.Chargebee; |
|
|
using Squidex.Domain.Apps.Read.Apps; |
|
|
using Squidex.Domain.Apps.Read.Apps; |
|
|
using Squidex.Domain.Apps.Read.Apps.Services; |
|
|
using Squidex.Domain.Apps.Read.Apps.Services; |
|
|
using Squidex.Domain.Apps.Read.Apps.Services.Implementations; |
|
|
using Squidex.Domain.Apps.Read.Apps.Services.Implementations; |
|
|
@ -22,8 +24,10 @@ using Squidex.Domain.Apps.Read.Schemas; |
|
|
using Squidex.Domain.Apps.Read.Schemas.Services; |
|
|
using Squidex.Domain.Apps.Read.Schemas.Services; |
|
|
using Squidex.Domain.Apps.Read.Schemas.Services.Implementations; |
|
|
using Squidex.Domain.Apps.Read.Schemas.Services.Implementations; |
|
|
using Squidex.Domain.Users; |
|
|
using Squidex.Domain.Users; |
|
|
|
|
|
using Squidex.Infrastructure; |
|
|
using Squidex.Infrastructure.CQRS.Events; |
|
|
using Squidex.Infrastructure.CQRS.Events; |
|
|
using Squidex.Pipeline; |
|
|
using Squidex.Pipeline; |
|
|
|
|
|
using Squidex.Shared.Users; |
|
|
|
|
|
|
|
|
// ReSharper disable UnusedAutoPropertyAccessor.Local
|
|
|
// ReSharper disable UnusedAutoPropertyAccessor.Local
|
|
|
|
|
|
|
|
|
@ -55,11 +59,6 @@ namespace Squidex.Config.Domain |
|
|
.AsSelf() |
|
|
.AsSelf() |
|
|
.SingleInstance(); |
|
|
.SingleInstance(); |
|
|
|
|
|
|
|
|
builder.RegisterType<NoopAppPlanBillingManager>() |
|
|
|
|
|
.As<IAppPlanBillingManager>() |
|
|
|
|
|
.AsSelf() |
|
|
|
|
|
.SingleInstance(); |
|
|
|
|
|
|
|
|
|
|
|
builder.RegisterType<CachingSchemaProvider>() |
|
|
builder.RegisterType<CachingSchemaProvider>() |
|
|
.As<ISchemaProvider>() |
|
|
.As<ISchemaProvider>() |
|
|
.AsSelf() |
|
|
.AsSelf() |
|
|
@ -98,6 +97,23 @@ namespace Squidex.Config.Domain |
|
|
.As<IGraphQLService>() |
|
|
.As<IGraphQLService>() |
|
|
.AsSelf() |
|
|
.AsSelf() |
|
|
.InstancePerDependency(); |
|
|
.InstancePerDependency(); |
|
|
|
|
|
|
|
|
|
|
|
var chargebeeSiteName = Configuration.GetValue<string>("chargebee:siteName"); |
|
|
|
|
|
var chargebeeApiKey = Configuration.GetValue<string>("chargebee:apiKey"); |
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(chargebeeSiteName)) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new ConfigurationException("Configure Chargebee SiteName type with 'chargebee:siteName'."); |
|
|
|
|
|
} |
|
|
|
|
|
if (string.IsNullOrWhiteSpace(chargebeeApiKey)) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new ConfigurationException("Configure Chargebee ApiKey with 'chargebee:apiKey'."); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
builder.Register(c => new ChargebeeAppPlanBillingManager(c.Resolve<UserManager<IUser>>(), chargebeeSiteName, chargebeeApiKey)) |
|
|
|
|
|
.As<IAppPlanBillingManager>() |
|
|
|
|
|
.AsSelf() |
|
|
|
|
|
.SingleInstance(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|