/// <summary> /// Initializes a new instance of the <see cref="CustomerLogic"/> class. /// </summary> /// <param name="redisCache">The redis cache.</param> /// <param name="localCache">The local cache.</param> /// <param name="appSettings">The application settings.</param> /// <param name="logger">The logger.</param> /// <param name="options">The options.</param> /// <param name="bpByContractAccountRepository">The bp by contract account repository.</param> /// <param name="customerRepository">The customer repository.</param> /// <param name="authenticationApi">The authentication API.</param> /// <param name="mcfClient"></param> /// <param name="addressApi"></param> /// /// <param name="requestContextAdapter"></param> public CustomerLogic( IDistributedCache redisCache, IMemoryCache localCache, IOptions <AppSettings> appSettings, ILogger <CustomerLogic> logger, ICoreOptions options, IBPByContractAccountRepository bpByContractAccountRepository, ICustomerRepository customerRepository, IAuthenticationApi authenticationApi, IMcfClient mcfClient, IAddressApi addressApi, IRequestContextAdapter requestContextAdapter) { _redisCache = redisCache ?? throw new ArgumentNullException(nameof(redisCache)); _localCache = localCache ?? throw new ArgumentNullException(nameof(localCache)); _appSettings = appSettings ?? throw new ArgumentNullException(nameof(appSettings)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _options = options ?? throw new ArgumentNullException(nameof(options)); _bpByContractAccountRepository = bpByContractAccountRepository ?? throw new ArgumentNullException(nameof(bpByContractAccountRepository)); _customerRepository = customerRepository ?? throw new ArgumentNullException(nameof(customerRepository)); _authenticationApi = authenticationApi ?? throw new ArgumentNullException(nameof(authenticationApi)); _mcfClient = mcfClient ?? throw new ArgumentNullException(nameof(mcfClient)); _addressApi = addressApi ?? throw new ArgumentNullException(nameof(addressApi)); _requestContextAdapter = requestContextAdapter ?? throw new ArgumentNullException(nameof(requestContextAdapter)); }
/// <summary> /// Initializes a new instance of the <see cref="RequestContextAdapterFormatHelper"/> class. /// </summary> /// <param name="requstContext">The requst context.</param> public RequestContextAdapterFormatHelper(IRequestContextAdapter requstContext) { RequestChannel = requstContext.RequestChannel; if (!string.IsNullOrWhiteSpace(requstContext.JWT)) { UserId = requstContext.UserId; } }
/// <summary> /// Initializes a new instance of the <see cref="SyncController" /> class. /// </summary> /// <param name="appSettings">The application settings.</param> /// <param name="logger">The logger.</param> /// <param name="customerSummaryLogic">The customer summary logic.</param> /// <param name="requestContextAdapter">The request context adapter.</param> /// <exception cref="ArgumentNullException">appSettings /// or /// logger /// or /// accountSummaryLogic</exception> public SyncController( IOptions <AppSettings> appSettings, ILogger <SyncController> logger, ICustomerLogic customerSummaryLogic, IRequestContextAdapter requestContextAdapter) { _config = (appSettings ?? throw new ArgumentNullException(nameof(appSettings))).Value; _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _customerSummaryLogic = customerSummaryLogic ?? throw new ArgumentNullException(nameof(customerSummaryLogic)); _contextAdapter = requestContextAdapter ?? throw new ArgumentNullException(nameof(requestContextAdapter)); }
/// <summary> /// Initializes a new instance of the <see cref="MoveOutLogic" /> class. /// </summary> /// <param name="logger">The logger.</param> /// <param name="mcfClient">The MCF client.</param> /// <param name="addressApi">The address API.</param> /// <param name="accountApi">The device API.</param> /// <param name="deviceApi">The device API.</param> /// <param name="requestContext">The request context.</param> /// <exception cref="ArgumentNullException">logger /// or /// mcfClient /// or /// addressApi /// or /// deviceApi /// or /// requestContext</exception> public MoveOutLogic( ILogger <MoveInLogic> logger, IMcfClient mcfClient, IAddressApi addressApi, IAccountApi accountApi, IDeviceApi deviceApi, IRequestContextAdapter requestContext) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _mcfClient = mcfClient ?? throw new ArgumentNullException(nameof(mcfClient)); _addressApi = addressApi ?? throw new ArgumentNullException(nameof(addressApi)); _accountApi = accountApi ?? throw new ArgumentNullException(nameof(accountApi)); _deviceApi = deviceApi ?? throw new ArgumentNullException(nameof(deviceApi)); _requestContext = requestContext ?? throw new ArgumentNullException(nameof(requestContext)); }
/// <summary> /// Helper method to convert object to JSON (e.g. for logging objects) /// </summary> /// <param name="requstContext">The serializable object.</param> /// <param name="formatting">The formatting style (defaults to indented)</param> /// <returns>The object formatted as a JSON string</returns> public static string ToJson(this IRequestContextAdapter requstContext, Formatting formatting = Formatting.Indented) { return(ToJson(new RequestContextAdapterFormatHelper(requstContext), formatting)); }
/// <summary> /// Constructor for DI /// </summary> /// <param name="coreOptions"></param> /// <param name="channelContext"></param> public AuthenticationApi(ICoreOptions coreOptions, IRequestContextAdapter channelContext) : base(coreOptions) { _channelContext = channelContext; }
/// <summary> /// Initializes a new instance of the <see cref="ManagePremisesLogic"/> class. /// </summary> /// <param name="requestContext">The request context.</param> /// <param name="logger">The logger.</param> /// <param name="mcfClient">The MCF client.</param> public ManagePremisesLogic(IRequestContextAdapter requestContext, ILogger <ManagePremisesLogic> logger, IMcfClient mcfClient) { _requestContext = requestContext; _logger = logger; _mcfClient = mcfClient; }
/// <summary> /// Initializes a new instance of the <see cref="AccountApi"/> class. /// </summary> /// <param name="coreOptions">The core options.</param> /// <param name="channelContext">The channel context.</param> public AccountApi(ICoreOptions coreOptions, IRequestContextAdapter channelContext) : base(coreOptions) { _channelContext = channelContext; }