public CashoutService( [NotNull] IAssetSettingsService assetSettingsService, [NotNull] IBcnSettingsResolver bcnSettingsResolver, [NotNull] ITransferService transferService, [NotNull] ITransactionsService transactionsService, [NotNull] IMerchantWalletService merchantWalletService, [NotNull] IWalletBalanceValidator walletBalanceValidator, [NotNull] IWalletHistoryService walletHistoryService, [NotNull] RetryPolicySettings retryPolicySettings, [NotNull] ILogFactory logFactory) { _assetSettingsService = assetSettingsService ?? throw new ArgumentNullException(nameof(assetSettingsService)); _bcnSettingsResolver = bcnSettingsResolver ?? throw new ArgumentNullException(nameof(bcnSettingsResolver)); _transferService = transferService ?? throw new ArgumentNullException(nameof(transferService)); _transactionsService = transactionsService ?? throw new ArgumentNullException(nameof(transactionsService)); _merchantWalletService = merchantWalletService ?? throw new ArgumentNullException(nameof(merchantWalletService)); _walletBalanceValidator = walletBalanceValidator ?? throw new ArgumentNullException(nameof(walletBalanceValidator)); _walletHistoryService = walletHistoryService ?? throw new ArgumentNullException(nameof(walletHistoryService)); _log = logFactory.CreateLog(this); _retryPolicy = Policy .Handle <InsufficientFundsException>() .Or <CashoutOperationFailedException>() .Or <CashoutOperationPartiallyFailedException>() .WaitAndRetryAsync( retryPolicySettings.DefaultAttempts, attempt => TimeSpan.FromSeconds(Math.Pow(2, attempt)), (ex, timespan) => _log.Error(ex, "Cashout with retry")); }
public WalletBalanceValidator( [NotNull] IAssetSettingsService assetSettingsService, [NotNull] IBlockchainClientProvider blockchainClientProvider, [NotNull] ILykkeAssetsResolver lykkeAssetsResolver) { _assetSettingsService = assetSettingsService ?? throw new ArgumentNullException(nameof(assetSettingsService)); _blockchainClientProvider = blockchainClientProvider ?? throw new ArgumentNullException(nameof(blockchainClientProvider)); _lykkeAssetsResolver = lykkeAssetsResolver ?? throw new ArgumentNullException(nameof(lykkeAssetsResolver)); }
public BalanceIndicatorsReportService( IAssetSettingsService assetSettingsService, IQuoteService quoteService, IBalanceService balanceService) { _assetSettingsService = assetSettingsService; _quoteService = quoteService; _balanceService = balanceService; }
public TransferService( [NotNull] ITransferRepository transferRepository, [NotNull] IBlockchainClientProvider blockchainClientProvider, [NotNull] IAssetSettingsService assetSettingsService, [NotNull] ILykkeAssetsResolver lykkeAssetsResolver) { _transferRepository = transferRepository ?? throw new ArgumentNullException(nameof(transferRepository)); _blockchainClientProvider = blockchainClientProvider ?? throw new ArgumentNullException(nameof(blockchainClientProvider)); _assetSettingsService = assetSettingsService ?? throw new ArgumentNullException(nameof(assetSettingsService)); _lykkeAssetsResolver = lykkeAssetsResolver ?? throw new ArgumentNullException(nameof(lykkeAssetsResolver)); }
public BalanceReportService( ICreditService creditService, IBalanceService balanceService, IAssetSettingsService assetSettingsService, IQuoteService quoteService) { _creditService = creditService; _balanceService = balanceService; _assetSettingsService = assetSettingsService; _quoteService = quoteService; }
public PaymentRequestService( [NotNull] IPaymentRequestRepository paymentRequestRepository, [NotNull] IOrderService orderService, [NotNull] IPaymentRequestPublisher paymentRequestPublisher, [NotNull] ITransferService transferService, [NotNull] IPaymentRequestStatusResolver paymentRequestStatusResolver, [NotNull] ILogFactory logFactory, [NotNull] IWalletManager walletsManager, [NotNull] ITransactionsService transactionsService, [NotNull] ExpirationPeriodsSettings expirationPeriods, [NotNull] IMerchantWalletService merchantWalletService, [NotNull] IDistributedLocksService paymentLocksService, [NotNull] ITransactionPublisher transactionPublisher, [NotNull] IDistributedLocksService checkoutLocksService, [NotNull] IWalletBalanceValidator walletBalanceValidator, [NotNull] RetryPolicySettings retryPolicySettings, [NotNull] IAutoSettleSettingsResolver autoSettleSettingsResolver, [NotNull] IAssetSettingsService assetSettingsService) { _paymentRequestRepository = paymentRequestRepository ?? throw new ArgumentNullException(nameof(paymentRequestRepository)); _orderService = orderService ?? throw new ArgumentNullException(nameof(orderService)); _paymentRequestPublisher = paymentRequestPublisher ?? throw new ArgumentNullException(nameof(paymentRequestPublisher)); _transferService = transferService ?? throw new ArgumentNullException(nameof(transferService)); _paymentRequestStatusResolver = paymentRequestStatusResolver ?? throw new ArgumentNullException(nameof(paymentRequestStatusResolver)); _log = logFactory.CreateLog(this); _walletsManager = walletsManager ?? throw new ArgumentNullException(nameof(walletsManager)); _transactionsService = transactionsService ?? throw new ArgumentNullException(nameof(transactionsService)); _expirationPeriods = expirationPeriods ?? throw new ArgumentNullException(nameof(expirationPeriods)); _merchantWalletService = merchantWalletService ?? throw new ArgumentNullException(nameof(merchantWalletService)); _paymentLocksService = paymentLocksService ?? throw new ArgumentNullException(nameof(paymentLocksService)); _transactionPublisher = transactionPublisher ?? throw new ArgumentNullException(nameof(transactionPublisher)); _checkoutLocksService = checkoutLocksService ?? throw new ArgumentNullException(nameof(checkoutLocksService)); _walletBalanceValidator = walletBalanceValidator ?? throw new ArgumentNullException(nameof(walletBalanceValidator)); _autoSettleSettingsResolver = autoSettleSettingsResolver ?? throw new ArgumentNullException(nameof(autoSettleSettingsResolver)); _assetSettingsService = assetSettingsService ?? throw new ArgumentNullException(nameof(assetSettingsService)); _settlementRetryPolicy = Policy .Handle <InsufficientFundsException>() .Or <SettlementOperationFailedException>() .Or <SettlementOperationPartiallyFailedException>() .WaitAndRetryAsync( retryPolicySettings.SettlementAttempts, attempt => TimeSpan.FromSeconds(Math.Pow(2, attempt)), (ex, timespan) => _log.Error(ex, "Settlement with retry")); _paymentRetryPolicy = Policy .Handle <InsufficientFundsException>() .Or <PaymentOperationFailedException>() .Or <PaymentOperationPartiallyFailedException>() .WaitAndRetryAsync( retryPolicySettings.DefaultAttempts, attempt => TimeSpan.FromSeconds(Math.Pow(2, attempt)), (ex, timespan) => _log.Error(ex, "Payment with retry")); }
public AssetsController( [NotNull] IAssetSettingsService assetSettingsService, [NotNull] IAssetsLocalCache assetsLocalCache, [NotNull] ILogFactory logFactory, [NotNull] ILykkeAssetsResolver lykkeAssetsResolver) { _assetSettingsService = assetSettingsService ?? throw new ArgumentNullException(nameof(assetSettingsService)); _assetsLocalCache = assetsLocalCache ?? throw new ArgumentNullException(nameof(assetsLocalCache)); _log = logFactory.CreateLog(this); _lykkeAssetsResolver = lykkeAssetsResolver ?? throw new ArgumentNullException(nameof(lykkeAssetsResolver)); }
public PaymentRequestsController( [NotNull] IPaymentRequestService paymentRequestService, [NotNull] IRefundService refundService, [NotNull] IAssetSettingsService assetSettingsService, [NotNull] ILogFactory logFactory, [NotNull] IPaymentRequestDetailsBuilder paymentRequestDetailsBuilder) { _paymentRequestService = paymentRequestService ?? throw new ArgumentNullException(nameof(paymentRequestService)); _refundService = refundService ?? throw new ArgumentNullException(nameof(refundService)); _assetSettingsService = assetSettingsService ?? throw new ArgumentNullException(nameof(assetSettingsService)); _paymentRequestDetailsBuilder = paymentRequestDetailsBuilder ?? throw new ArgumentNullException(nameof(paymentRequestDetailsBuilder)); _log = logFactory.CreateLog(this); }
public FiatEquityStopLossService( IBalanceIndicatorsReportService balanceIndicatorsReportService, IAssetSettingsService assetSettingsService, IMarketMakerSettingsService marketMakerSettingsService, IAssetsServiceWithCache assetsServiceWithCache, IInstrumentService instrumentService, ILogFactory logFactory) { _balanceIndicatorsReportService = balanceIndicatorsReportService; _assetSettingsService = assetSettingsService; _marketMakerSettingsService = marketMakerSettingsService; _assetsServiceWithCache = assetsServiceWithCache; _instrumentService = instrumentService; _log = logFactory.CreateLog(this); }
public MerchantWalletService( [NotNull] IMerchantWalletRespository merchantWalletRespository, [NotNull] IAssetSettingsService assetSettingsService, [NotNull] IBlockchainClientProvider blockchainClientProvider, [NotNull] ILogFactory logFactory, [NotNull] IAssetsLocalCache assetsLocalCache) { _merchantWalletRespository = merchantWalletRespository ?? throw new ArgumentNullException(nameof(merchantWalletRespository)); _assetSettingsService = assetSettingsService ?? throw new ArgumentNullException(nameof(assetSettingsService)); _blockchainClientProvider = blockchainClientProvider ?? throw new ArgumentNullException(nameof(blockchainClientProvider)); _assetsLocalCache = assetsLocalCache ?? throw new ArgumentNullException(nameof(assetsLocalCache)); _log = logFactory.CreateLog(this); }
public SettlementService( ISettlementTradeService settlementTradeService, IBalanceOperationService balanceOperationService, ILykkeExchangeService lykkeExchangeService, ISettingsService settingsService, IAssetSettingsService assetSettingsService, IAssetsServiceWithCache assetsServiceWithCache, ILogFactory logFactory) { _settlementTradeService = settlementTradeService; _balanceOperationService = balanceOperationService; _lykkeExchangeService = lykkeExchangeService; _settingsService = settingsService; _assetSettingsService = assetSettingsService; _assetsServiceWithCache = assetsServiceWithCache; _log = logFactory.CreateLog(this); }
public WalletManager( [NotNull] IVirtualWalletService virtualWalletService, [NotNull] IList <BlockchainWalletAllocationPolicy> walletAllocationSettings, [NotNull] IBcnWalletUsageService bcnWalletUsageService, [NotNull] IWalletEventsPublisher walletEventsPublisher, [NotNull] IBlockchainClientProvider blockchainClientProvider, [NotNull] ITransactionsService transactionsService, [NotNull] IAssetSettingsService assetSettingsService, [NotNull] ILogFactory logFactory) { _virtualWalletService = virtualWalletService ?? throw new ArgumentNullException(nameof(virtualWalletService)); _walletAllocationSettings = walletAllocationSettings ?? throw new ArgumentNullException(nameof(walletAllocationSettings)); _bcnWalletUsageService = bcnWalletUsageService ?? throw new ArgumentNullException(nameof(bcnWalletUsageService)); _walletEventsPublisher = walletEventsPublisher ?? throw new ArgumentNullException(nameof(walletEventsPublisher)); _blockchainClientProvider = blockchainClientProvider ?? throw new ArgumentNullException(nameof(blockchainClientProvider)); _transactionsService = transactionsService ?? throw new ArgumentNullException(nameof(transactionsService)); _assetSettingsService = assetSettingsService ?? throw new ArgumentNullException(nameof(assetSettingsService)); _log = logFactory.CreateLog(this); }
/// <summary> /// /// </summary> /// <param name="assetSettingsService"></param> /// <param name="loggingService"></param> public AssetMileageSettingsController(IAssetSettingsService <AssetSettingsRequestBase, AssetSettingsResponse> assetSettingsService, ILoggingService loggingService) { this._assetSettingsService = assetSettingsService; this._loggingService = loggingService; this._loggingService.CreateLogger(this.GetType()); }
public AssetSettingsServiceTests() { this._customerUid = Guid.NewGuid(); this._userUid = Guid.NewGuid(); this._assetUIDs = new List <Guid>(); this._assetSettingsDtos = new List <AssetSettingsDto>(); for (int i = 0; i < 10; i++) { this._assetUIDs.Add(Guid.NewGuid()); } for (int i = 0; i < 10; i++) { this._assetSettingsDtos.Add(new AssetSettingsDto { AssetConfigUID = Guid.NewGuid(), AssetUID = this._assetUIDs[i], InsertUTC = DateTime.UtcNow, UpdateUTC = DateTime.UtcNow, StartDate = DateTime.Now.Date, TargetType = AssetTargetType.BucketVolumeinCuMeter.ToString(), TargetValue = 5500.00 }); } this._assetConfigTypeDtos = new List <AssetConfigTypeDto>(); this._assetConfigTypeDtos.AddRange( new List <AssetConfigTypeDto> { new AssetConfigTypeDto { AssetConfigTypeID = 0, ConfigTypeName = "IdletimeHours" }, new AssetConfigTypeDto { AssetConfigTypeID = 1, ConfigTypeName = "RuntimeHours" }, new AssetConfigTypeDto { AssetConfigTypeID = 2, ConfigTypeName = "Runtime" }, new AssetConfigTypeDto { AssetConfigTypeID = 3, ConfigTypeName = "OdometerinKmsPerWeek" }, new AssetConfigTypeDto { AssetConfigTypeID = 4, ConfigTypeName = "BucketVolumeinCuMeter" }, new AssetConfigTypeDto { AssetConfigTypeID = 5, ConfigTypeName = "PayloadinTonnes" }, new AssetConfigTypeDto { AssetConfigTypeID = 6, ConfigTypeName = "CycleCount" }, new AssetConfigTypeDto { AssetConfigTypeID = 7, ConfigTypeName = "VolumeinCuMeter" }, new AssetConfigTypeDto { AssetConfigTypeID = 8, ConfigTypeName = "IdlingBurnRateinLiPerHour" }, new AssetConfigTypeDto { AssetConfigTypeID = 9, ConfigTypeName = "WorkingBurnRateinLiPerHour" }, new AssetConfigTypeDto { AssetConfigTypeID = 10, ConfigTypeName = "PayloadPerCycleInTonnes" } }); this._stubTransactions = Substitute.For <ITransactions>(); this._stubAssetSettingsListRepository = Substitute.For <IAssetSettingsListRepository>(); this._stubAssetSettingsListRepository.FetchValidAssetUIds(Arg.Any <List <string> >(), Arg.Any <AssetSettingsListRequestDto>()).Returns( x => { var request = (AssetSettingsListRequestDto)x[1]; if (request.CustomerUid == _customerUid.ToString("N") && request.UserUid == _userUid.ToString("N")) { return(_assetUIDs.Where(y => ((List <string>)x[0]).Contains(y.ToString())).Select(z => z.ToString())); } else { return(new List <string>()); } }); this._stubAssetConfigTypeRepository = Substitute.For <IAssetConfigTypeRepository>(); this._stubAssetSettingsRepository = Substitute.For <IAssetConfigRepository>(); this._stubKafkaPublisher = Substitute.For <IPublisher>(); this._stubInjectConfig = Substitute.For <IInjectConfig>(); this._stubInjectConfig.ResolveKeyed <IPublisher>(Arg.Any <string>()).Returns(this._stubKafkaPublisher); this._stubAssetSettingsRepository.FetchAssetConfig(Arg.Any <List <string> >(), Arg.Any <AssetSettingsDto>()).Returns(x => Task.FromResult(_assetSettingsDtos.Where(y => ((List <string>)x[0]).Contains(y.AssetUID.ToString())))); this._stubAssetConfigTypeRepository.FetchByConfigTypeNames(Arg.Any <AssetConfigTypeDto>()).Returns(callInfo => Task.FromResult(_assetConfigTypeDtos.Where(x => ((AssetConfigTypeDto)callInfo[0]).ConfigTypeNames.Contains(x.ConfigTypeName)))); this._stubLoggingService = Substitute.For <ILoggingService>(); this._stubLoggingService.CreateLogger(this.GetType()); this._stubCustomerRepository = Substitute.For <ICustomerRepository>(); this._serviceRequestParametersValidators = new List <IRequestValidator <IServiceRequest> > { new CustomerUidValidator(this._stubCustomerRepository, this._stubLoggingService), new UserUidValidator(this._stubLoggingService) }; this._assetSettingsValidators = new List <IRequestValidator <AssetSettingsRequestBase> > { new AssetUIDsValidator(this._stubAssetSettingsListRepository, this._stubLoggingService) }; this._stubConfigurations = Options.Create <Configurations>(new Configurations { KafkaSettings = new KafkaSettings { PublisherTopics = new PublisherTopics { AssetWeeklySettingsTopicName = "VSS.VISIONLINK.INTERFACES.ASSETWEEKLYTARGETS", UserAssetSettingsTopicName = "VSS.VISIONLINK.INTERFACES.USERASSETTARGETS", AssetSettingsTopicName = "VSS.VISIONLINK.INTERFACES.ASSETTARGETS", UserAssetWeeklySettingsTopicName = "VSS.VISIONLINK.INTERFACES.USERASSETWEEKLYTARGETS" } } }); this._assetSettingsPublisher = new AssetSettingsPublisher(_stubConfigurations, _stubTransactions, _stubLoggingService); var mapperConfig = new MapperConfiguration(config => { config.CreateMap <AssetSettingsListDto, AssetSettingsDetails>(); config.CreateMap <AssetSettingsDto, AssetSettingsResponse>(); }); //var databaseManager = new DatabaseManager(""); this._mapper = mapperConfig.CreateMapper(); this._assetSettingsService = new AssetSettingsService(_stubAssetSettingsRepository, _stubAssetConfigTypeRepository, _assetSettingsPublisher, _assetSettingsValidators, _serviceRequestParametersValidators, _mapper, _stubTransactions, _stubLoggingService); }
public AssetsController([NotNull] IAssetSettingsService assetSettingsService) { _assetSettingsService = assetSettingsService ?? throw new ArgumentNullException(nameof(assetSettingsService)); }
/// <summary> /// /// </summary> /// <param name="injectConfig"></param> /// <param name="loggingService"></param> public AssetFuelBurnRateSettingsController(IAssetSettingsService <AssetFuelBurnRateSettingRequest, AssetFuelBurnRateSettingsDetails> assetSettingsService, ILoggingService loggingService) { this._assetSettingsService = assetSettingsService; this._loggingService = loggingService; this._loggingService.CreateLogger(typeof(AssetFuelBurnRateSettingsController)); }
/// <summary> /// /// </summary> /// <param name="assetSettingsService"></param> /// <param name="loggingService"></param> public AssetVolumePerCycleSettingsController(IAssetSettingsService <AssetSettingsRequestBase, AssetSettingsResponse> assetSettingsService, ILoggingService loggingService) { this._assetSettingsService = assetSettingsService; this._loggingService = loggingService; this._loggingService.CreateLogger(typeof(AssetVolumePerCycleSettingsController)); }
public AssetSettingsController(IAssetSettingsService assetSettingsService) { _assetSettingsService = assetSettingsService; }
/// <summary> /// Injecting required params in class. /// </summary> /// <param name="assetSettingsService"></param> /// <param name="loggingService"></param> public AssetEstimatedPayloadPerCycleSettingsController(IAssetSettingsService <AssetSettingsRequestBase, AssetSettingsResponse> assetSettingsService, ILoggingService loggingService) { this._assetSettingsService = assetSettingsService; this._loggingService = loggingService; this._loggingService.CreateLogger <AssetEstimatedPayloadPerCycleSettingsController>(); }