public ChargeBeeWebhookController(IShipHubConfiguration configuration, IShipHubQueueClient queueClient, IShipHubMailer mailer, cb.ChargeBeeApi chargeBee)
 {
     _configuration = configuration;
     _queueClient   = queueClient;
     _mailer        = mailer;
     _chargeBee     = chargeBee;
 }
示例#2
0
 public BillingController(IShipHubConfiguration config, cb.ChargeBeeApi chargeBee, IShipHubQueueClient queueClient, IMixpanelClient mixpanelClient)
 {
     _configuration  = config;
     _queueClient    = queueClient;
     _chargeBee      = chargeBee;
     _mixpanelClient = mixpanelClient;
 }
        public static void Register(IShipHubConfiguration config)
        {
            var container = new Container();

            container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();

            // ShipHubConfiguration
            container.RegisterSingleton(config);

            // AutoMapper
            container.RegisterSingleton(() => new MapperConfiguration(cfg => {
                cfg.AddProfile <GitHubToDataModelProfile>();
                cfg.AddProfile <DataModelToApiModelProfile>();
            }).CreateMapper());

            // Service Bus
            container.RegisterSingleton <IServiceBusFactory>(() => {
                // HACK: This is gross
                var sbf = new ServiceBusFactory();
                sbf.Initialize().GetAwaiter().GetResult();
                return(sbf);
            });

            // Orleans
            container.RegisterSingleton <IAsyncGrainFactory>(new OrleansAzureClient(config.DeploymentId, config.DataConnectionString));

            // Queue Client
            container.RegisterSingleton <IShipHubQueueClient, ShipHubQueueClient>();

            // Sync Manager
            container.RegisterSingleton <ISyncManager, SyncManager>();

            // Mailer
            container.RegisterSingleton <IShipHubMailer, ShipHubMailer>();

            // ChargeBee
            if (!config.ChargeBeeHostAndKey.IsNullOrWhiteSpace())
            {
                var parts = config.ChargeBeeHostAndKey.Split(':');
                container.RegisterSingleton(() => new ChargeBeeApi(parts[0], parts[1]));
            }

            // Mixpanel (maybe not safe as a singleton?)
            container.Register <IMixpanelClient>(() => new MixpanelClient(config.MixpanelToken, new MixpanelConfig()
            {
                ErrorLogFn = (message, exception) => {
                    Log.Exception(exception, message);
                },
                IpAddressHandling = MixpanelIpAddressHandling.IgnoreRequestIp,
            }));

            // This is an extension method from the integration package.
            container.RegisterWebApiControllers(GlobalConfiguration.Configuration);

            container.Verify();

            GlobalConfiguration.Configuration.DependencyResolver =
                new SimpleInjectorWebApiDependencyResolver(container);
        }
示例#4
0
        public GitHubActor(IFactory <dm.ShipHubContext> shipContextFactory, IShipHubQueueClient queueClient, IShipHubConfiguration configuration, IShipHubRuntimeConfiguration runtimeConfiguration)
        {
            _shipContextFactory   = shipContextFactory;
            _queueClient          = queueClient;
            _configuration        = configuration;
            _runtimeConfiguration = runtimeConfiguration;

            ApiRoot = _configuration.GitHubApiRoot;
            EnsureHandlerPipelineCreated(ApiRoot);
        }
        private static string GetPaymentMethodUpdateUrl(IShipHubConfiguration configuration, string customerId)
        {
            var accountId = ChargeBeeUtilities.AccountIdFromCustomerId(customerId);

            var apiHostName = configuration.ApiHostName;

            var signature = BillingController.CreateSignature(accountId, accountId);
            var updateUrl = $"https://{apiHostName}/billing/update/{accountId}/{signature}";

            return(updateUrl);
        }
示例#6
0
 public OrganizationActor(
     IMapper mapper,
     IGrainFactory grainFactory,
     IFactory <ShipHubContext> contextFactory,
     IShipHubQueueClient queueClient,
     IShipHubConfiguration configuration)
 {
     _mapper         = mapper;
     _grainFactory   = grainFactory;
     _contextFactory = contextFactory;
     _queueClient    = queueClient;
     _apiHostName    = configuration.ApiHostName;
 }
示例#7
0
 public AdminController(IShipHubConfiguration config, IAsyncGrainFactory grainFactory)
 {
     _configuration = config;
     _grainFactory  = grainFactory;
 }
示例#8
0
 public RollTokens(IShipHubConfiguration config, IDetailedExceptionLogger logger)
     : base(logger)
 {
     _config = config;
 }
示例#9
0
 public AnalyticsController(IShipHubConfiguration config)
 {
     _configuration = config;
 }
 public AuthenticationController(IShipHubConfiguration config, IAsyncGrainFactory grainFactory, IMapper mapper)
 {
     _config       = config;
     _grainFactory = grainFactory;
     _mapper       = mapper;
 }
示例#11
0
 public ApplePayController(IShipHubConfiguration config)
 {
     _config = config;
 }
 public GitHubProxyController(IShipHubConfiguration configuration, IMapper mapper, IShipHubQueueClient queueClient)
 {
     _mapper      = mapper;
     _queueClient = queueClient;
     _apiRoot     = configuration.GitHubApiRoot;
 }