Exemple #1
0
 public CachedAssetsService(IAssetsService assetsService,
                            AssetPairSettings[] assetPairsSettings)
 {
     _assetsService   = assetsService;
     _assetPairs      = assetPairsSettings.Select(p => p.AssetPairId).ToArray();
     _assetPairsCache = new ConcurrentDictionary <string, AssetPair>();
 }
Exemple #2
0
        public FxPaygatePaymentUrlInputValidationModel(
            IHttpContextAccessor httpContextAccessor,
            IAssetsHelper assetHelper,
            IAssetDisclaimersClient assetDisclaimersClient,
            IPaymentSystemClient paymentSystemClient,
            IPersonalDataService personalDataService,
            IClientAccountClient clientAccountService,
            IAssetsService assetsService,
            IKycStatusService kycStatusService,
            ITierClient tierClient,
            IRateCalculatorClient rateCalculatorClient)
        {
            _assetsHelper           = assetHelper;
            _assetDisclaimersClient = assetDisclaimersClient;
            _clientAccountService   = clientAccountService;
            _assetsService          = assetsService;
            _kycStatusService       = kycStatusService;
            _tierClient             = tierClient;
            _rateCalculatorClient   = rateCalculatorClient;

            _clientId = httpContextAccessor.HttpContext.User?.Identity?.Name;
            var paymentLimitsTask = paymentSystemClient.GetPaymentLimitsAsync();
            var pdTask            = personalDataService.GetAsync(_clientId);

            Task.WhenAll(paymentLimitsTask, pdTask).GetAwaiter().GetResult();

            _paymentLimitsResponse = paymentLimitsTask.Result;
            _personalData          = pdTask.Result;
            RegisterRules();
        }
        public async Task EditAsync_WithCorrectData_ShouldEditAssetCorrectly()
        {
            string errorMessagePrefix = "AssetsService EditAsync() method does not work properly.";

            var context = OmmDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.assetsService = new AssetsService(context);

            AssetEditDto expectedResult = (await context.Assets.FirstAsync()).To <AssetEditDto>();

            expectedResult.ReferenceNumber = "New Ref Number";
            expectedResult.Make            = "New make";
            expectedResult.Model           = "New model";
            expectedResult.InventoryNumber = "190828-OLC-Changed Number";
            expectedResult.DateOfAquire    = "29-08-2019";
            expectedResult.EmployeeId      = "02";
            expectedResult.AssetTypeId     = 3;

            await this.assetsService.EditAsync(expectedResult);

            var actualResult = (await context.Assets.FirstAsync()).To <AssetEditDto>();

            Assert.True(expectedResult.InventoryNumber == actualResult.InventoryNumber, errorMessagePrefix + " " + "InventoryNumber is not changed properly.");
            Assert.True(expectedResult.Make == actualResult.Make, errorMessagePrefix + " " + "Make is not changed properly.");
            Assert.True(expectedResult.Model == actualResult.Model, errorMessagePrefix + " " + "Model is not changed properly.");
            Assert.True(expectedResult.ReferenceNumber == actualResult.ReferenceNumber, errorMessagePrefix + " " + "ReferenceNumber is not changed properly.");
            Assert.True(expectedResult.DateOfAquire == actualResult.DateOfAquire, errorMessagePrefix + " " + "DateOfAquire is not changed properly.");
            Assert.True(expectedResult.EmployeeId == actualResult.EmployeeId, errorMessagePrefix + " " + "EmployeeId is not changed properly.");
            Assert.True(expectedResult.AssetTypeId == actualResult.AssetTypeId, errorMessagePrefix + " " + "AssetTypeId is not changed properly.");
        }
        public async Task GetAssetsByEmployeeId_WithEmployeeWithAssets_ShouldReturnCorrectResult(string employeeId)
        {
            string errorMessagePrefix = "AssetsService GetAssetsByEmployeeId() method does not work properly.";

            var context = OmmDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.assetsService = new AssetsService(context);

            List <AssetEmployeeDto> actualResults = await this.assetsService.GetAssetsByEmployeeId(employeeId).ToListAsync();

            List <AssetEmployeeDto> expectedResults = GetDummyData().Where(a => a.Employee != null && a.Employee.Id == employeeId).To <AssetEmployeeDto>().ToList();

            for (int i = 0; i < expectedResults.Count; i++)
            {
                var expectedEntry = expectedResults[i];
                var actualEntry   = actualResults[i];

                Assert.True(expectedEntry.InventoryNumber == actualEntry.InventoryNumber, errorMessagePrefix + " " + "InventoryNumber is not returned properly.");
                Assert.True(expectedEntry.Make == actualEntry.Make, errorMessagePrefix + " " + "Make is not returned properly.");
                Assert.True(expectedEntry.Model == actualEntry.Model, errorMessagePrefix + " " + "Model is not returned properly.");
                Assert.True(expectedEntry.DateOfAquire == actualEntry.DateOfAquire, errorMessagePrefix + " " + "DateOfAquire is not returned properly.");
                Assert.True(expectedEntry.ReferenceNumber == actualEntry.ReferenceNumber, errorMessagePrefix + " " + "ReferenceNumber is not returned properly.");
                Assert.True(expectedEntry.AssetTypeName == actualEntry.AssetTypeName, errorMessagePrefix + " " + "AssetTypeName is not returned properly.");
            }
            Assert.True(expectedResults.Count == actualResults.Count, errorMessagePrefix + " " + "Count of returned assets is not correct");
        }
        public async Task CreateAsync_WithValidData_ShouldCreateAssetAndReturnTrue()
        {
            string errorMessagePrefix = "AssetsService CreateAsync() method does not work properly.";

            var context = OmmDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.assetsService = new AssetsService(context);

            var assetToCreate = new AssetCreateDto
            {
                InventoryNumber = "190828-OLC-Asset5",
                Make            = "Microsoft",
                Model           = "Windows 10 Professional",
                ReferenceNumber = "OLC-01-09-SC",
                DateOfAquire    = "27-08-2019",
                AssetTypeId     = 1,
                EmployeeId      = "02",
            };

            bool actualResult = await this.assetsService.CreateAsync(assetToCreate);

            Assert.True(actualResult, errorMessagePrefix);
        }
Exemple #6
0
 /// <summary>
 /// Returns all assets including nontradable.
 /// </summary>
 /// <param name='operations'>The operations group for this extension method.</param>
 /// <param name='cancellationToken'>The cancellation token.</param>
 /// <returns></returns>
 public static async Task <IList <Asset> > AssetGetAllAsync(this IAssetsService operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var result = await operations.AssetGetAllWithHttpMessagesAsync(true, null, cancellationToken).ConfigureAwait(false))
     {
         return(result.Body);
     }
 }
        public async Task EditAsync_WithInvalidAssetId_ShouldThrowNullReferenceException()
        {
            var context = OmmDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.assetsService = new AssetsService(context);

            string invalidAssetId = "InvalidId";

            AssetEditDto expectedResult = (await context.Assets.FirstAsync()).To <AssetEditDto>();

            expectedResult.ReferenceNumber = "New Ref Number";
            expectedResult.Make            = "New make";
            expectedResult.Model           = "New model";
            expectedResult.InventoryNumber = "190828-OLC-Changed Number";
            expectedResult.DateOfAquire    = "29-08-2019";
            expectedResult.EmployeeId      = "02";
            expectedResult.AssetTypeId     = 3;
            expectedResult.Id = invalidAssetId;

            var ex = await Assert.ThrowsAsync <NullReferenceException>(() => this.assetsService.EditAsync(expectedResult));

            Assert.Equal(string.Format(ErrorMessages.AssetIdNullReference, expectedResult.Id), ex.Message);
        }
 public SiriusWalletsService(
     long brokerAccountId,
     IApiClient siriusApiClient,
     IClientDialogsClient clientDialogsClient,
     IAssetsService assetsService,
     IKycStatusService kycStatusService,
     IClientAccountClient clientAccountClient,
     IBalanceService balanceService,
     ICqrsEngine cqrsEngine,
     IOperationsClient operationsClient,
     TargetClientIdFeeSettings feeSettings,
     ValidationService validationService,
     IdempotencyService idempotencyService,
     ILogFactory logFactory)
 {
     _brokerAccountId     = brokerAccountId;
     _siriusApiClient     = siriusApiClient;
     _clientDialogsClient = clientDialogsClient;
     _assetsService       = assetsService;
     _kycStatusService    = kycStatusService;
     _clientAccountClient = clientAccountClient;
     _balanceService      = balanceService;
     _cqrsEngine          = cqrsEngine;
     _operationsClient    = operationsClient;
     _feeSettings         = feeSettings;
     _validationService   = validationService;
     _idempotencyService  = idempotencyService;
     _log = logFactory.CreateLog(this);
 }
 public SituationReportsService(IAssetsService assetsService, IFactionsService factionsService, ISolarSystemsService solarSystemsService, ITickService tickService)
 {
     _assetsService       = assetsService;
     _factionsService     = factionsService;
     _solarSystemsService = solarSystemsService;
     _tickService         = tickService;
 }
Exemple #10
0
        /// <summary>
        /// 构造函数,最终得到新的服务实例
        /// </summary>
        public AutofacConfig()
        {
            if (this.containerBuilder == null)
            {
                Init();
            }
            IContainer container = this.containerBuilder.Build();
            IDbContext db        = container.Resolve <IDbContext>();

            this.AssetsService           = container.Resolve <IAssetsService>();
            this.assLocationService      = container.Resolve <IAssLocationService>();
            this.coreUserService         = container.Resolve <IcoreUserService>();
            this.ValidateCodeService     = container.Resolve <IValidateCodeService>();
            this.assTypeService          = container.Resolve <IAssTypeService>();
            this.orderCommonService      = container.Resolve <IOrderCommonService>();
            this.assRepairOrderService   = container.Resolve <IAssRepairOrderService>();
            this.assScrapOrderService    = container.Resolve <IAssScrapOrderService>();
            this.assTransferOrderService = container.Resolve <IAssTransferOrderService>();
            this.SettingService          = container.Resolve <ISettingService>();

            this.ConsumablesService  = container.Resolve <IConsumablesService>();
            this.AssInventoryService = container.Resolve <IAssInventoryService>();
            this.ConInventoryService = container.Resolve <IConInventoryService>();
            this.DepartmentService   = container.Resolve <IDepartmentService>();
        }
Exemple #11
0
        public BiometricController(IFacesService facesService,
                                   IConfigurationService configurationService,
                                   IDataAccessService externalDataAccessService,
                                   IAssetsService assetsService,
                                   ILoggerService loggerService,
                                   IInherenceServicesManager inherenceServicesManager)
        {
            if (configurationService is null)
            {
                throw new ArgumentNullException(nameof(configurationService));
            }

            if (inherenceServicesManager is null)
            {
                throw new ArgumentNullException(nameof(inherenceServicesManager));
            }

            _facesService = facesService ?? throw new ArgumentNullException(nameof(facesService));
            _facesService.Initialize();
            _dataAccessService   = externalDataAccessService;
            _assetsService       = assetsService;
            _logger              = loggerService.GetLogger(nameof(BiometricController));
            _portalConfiguration = configurationService.Get <IPortalConfiguration>();
            _inherenceService    = inherenceServicesManager.GetInstance(O10InherenceService.NAME);
        }
Exemple #12
0
 public AssetsOptionService(IAquairRepository aquairRep,
                            IAquairDetailRepository aquairDetailRep,
                            IAssetsService assetsService,
                            IBorrowRepository borrowRep,
                            IBorrowDetailRepository borrowDetailRep,
                            IRepairDetailRepository repairDetailRep,
                            IRepairRepository repairRepository,
                            IInventoryRepository inventoryRep,
                            IInventoryDetailRepository inventoryDetailRep,
                            IScrapApllyRepository scrapApllyRep,
                            IScrapApplyDetailRepository scrapApplyDetailRep, IAssetsMainRepository assetsMainRepository,
                            IAssetsMainRepository assetsMainRep)
 {
     _aquairRep            = aquairRep;
     _aquairDetailRep      = aquairDetailRep;
     _assetsService        = assetsService;
     _borrowRep            = borrowRep;
     _borrowDetailRep      = borrowDetailRep;
     _repairDetailRep      = repairDetailRep;
     _repairRepository     = repairRepository;
     _inventoryRep         = inventoryRep;
     _inventoryDetailRep   = inventoryDetailRep;
     _scrapApllyRep        = scrapApllyRep;
     _scrapApplyDetailRep  = scrapApplyDetailRep;
     _assetsMainRepository = assetsMainRepository;
     _assetsMainRep        = assetsMainRep;
 }
        public EthereumIataApiClient(
            [NotNull] IEthereumCoreAPI ethereumServiceClient,
            [NotNull] EthereumBlockchainSettings ethereumSettings,
            [NotNull] IAssetsLocalCache assetsLocalCache,
            [NotNull] IAssetsService assetsService,
            [NotNull] ILykkeAssetsResolver lykkeAssetsResolver,
            [NotNull] ILogFactory logFactory,
            [NotNull] RetryPolicySettings retryPolicySettings)
        {
            _ethereumServiceClient = ethereumServiceClient ?? throw new ArgumentNullException(nameof(ethereumServiceClient));
            _ethereumSettings      = ethereumSettings ?? throw new ArgumentNullException(nameof(ethereumSettings));
            _assetsLocalCache      = assetsLocalCache ?? throw new ArgumentNullException(nameof(assetsLocalCache));
            _assetsService         = assetsService ?? throw new ArgumentNullException(nameof(assetsService));
            _lykkeAssetsResolver   = lykkeAssetsResolver ?? throw new ArgumentNullException(nameof(lykkeAssetsResolver));
            _retryPolicySettings   = retryPolicySettings ?? throw new ArgumentNullException(nameof(retryPolicySettings));
            _log         = logFactory.CreateLog(this);
            _retryPolicy = Policy
                           .HandleResult <object>(r =>
            {
                if (r is ApiException apiException)
                {
                    return(apiException.Error?.Code == ExceptionType.None);
                }

                return(false);
            })
                           .WaitAndRetryAsync(
                _retryPolicySettings.DefaultAttempts,
                attempt => TimeSpan.FromSeconds(Math.Pow(2, attempt)),
                (ex, timespan) => _log.Error(message: "Connecting ethereum core with retry", context: ex));
        }
 public AssetPairsInfoService(ISystem system, IAssetsService assetsService, IConvertService convertService)
 {
     _system         = system;
     _assetsService  = assetsService;
     _convertService = convertService;
     _assetPairs     = GetAssetPairsCache();
 }
 public PublicService(
     IAssetsService assetsService,
     IOrderbooksService orderbooksService,
     MarketDataService.MarketDataServiceClient marketDataClient,
     ITradesAdapterClient tradesAdapterClient,
     PricesStreamService priceStreamService,
     TickersStreamService tickerUpdateService,
     OrderbookStreamService orderbookUpdateService,
     PublicTradesStreamService publicTradesStreamService,
     ValidationService validationService,
     IMyNoSqlServerDataReader <TickerEntity> tickersReader,
     IMyNoSqlServerDataReader <PriceEntity> pricesReader,
     IMapper mapper
     )
 {
     _assetsService             = assetsService;
     _orderbooksService         = orderbooksService;
     _marketDataClient          = marketDataClient;
     _tradesAdapterClient       = tradesAdapterClient;
     _priceStreamService        = priceStreamService;
     _tickerUpdateService       = tickerUpdateService;
     _orderbookUpdateService    = orderbookUpdateService;
     _publicTradesStreamService = publicTradesStreamService;
     _validationService         = validationService;
     _tickersReader             = tickersReader;
     _pricesReader = pricesReader;
     _mapper       = mapper;
 }
Exemple #16
0
 public OrderBooksService(IOrderBookProviderClient orderBookProviderClient,
                          IAssetsService assetsService, ILogFactory logFactory)
 {
     _orderBookProviderClient = orderBookProviderClient;
     _assetsService           = assetsService;
     _log = logFactory.CreateLog(this);
 }
Exemple #17
0
        public UserIdentitiesUpdater(ulong accountId, IUtxoClientCryptoService clientCryptoService, IAssetsService assetsService, IDataAccessService externalDataAccessService, IHubContext <IdentitiesHub> idenitiesHubContext, IRelationsProofsValidationService relationsProofsValidationService, ITrackingService trackingService)
        {
            _accountId           = accountId;
            _clientCryptoService = clientCryptoService;
            _assetsService       = assetsService;
            _dataAccessService   = externalDataAccessService;
            _idenitiesHubContext = idenitiesHubContext;
            _relationsProofsValidationService = relationsProofsValidationService;
            _trackingService = trackingService;
            PipeIn           = new ActionBlock <PacketBase>(p =>
            {
                try
                {
                    if (p is TransferAssetToUtxo packet)
                    {
                        _clientCryptoService.DecodeEcdhTuple(packet.TransferredAsset.EcdhTuple, packet.TransactionPublicKey, out byte[] blindingFactor, out byte[] assetId);
                        AttributeType attributeType = _assetsService.GetAttributeType(assetId);

                        _idenitiesHubContext.Clients.Group(_accountId.ToString(CultureInfo.InvariantCulture)).SendAsync("PushAttribute", new UserAttributeDto {
                            AttributeType = attributeType.ToString(), Source = packet.Signer.ArraySegment.Array.ToHexString(), AssetId = assetId.ToHexString(), OriginalBlindingFactor = blindingFactor.ToHexString(), OriginalCommitment = packet.TransferredAsset.AssetCommitment.ToHexString(), LastBlindingFactor = blindingFactor.ToHexString(), LastCommitment = packet.TransferredAsset.AssetCommitment.ToHexString(), LastTransactionKey = packet.TransactionPublicKey.ToHexString(), LastDestinationKey = packet.DestinationKey.ToHexString(), Validated = false, IsOverriden = false
                        });
                    }
                    else if (p is GroupsRelationsProofs relationsProofs && _clientCryptoService.CheckTarget(relationsProofs.DestinationKey2, relationsProofs.TransactionPublicKey))
                    {
                        RelationProofsValidationResults validationResults = _relationsProofsValidationService.VerifyRelationProofs(relationsProofs, _clientCryptoService);

                        _idenitiesHubContext.Clients.Group(_accountId.ToString(CultureInfo.InvariantCulture)).SendAsync("PushRelationValidation", validationResults);
                    }
                }
                catch
                {
                }
            });
        }
Exemple #18
0
 public AssetPairsManager(IAssetsService repository,
                          IAssetPairsInitializableCache assetPairsCache,
                          IAssetPairSettingsRepository assetPairSettingsRepository)
 {
     _assets                      = repository;
     _assetPairsCache             = assetPairsCache;
     _assetPairSettingsRepository = assetPairSettingsRepository;
 }
Exemple #19
0
 public BiometricController(IFacesService facesService, IConfigurationService configurationService, IDataAccessService externalDataAccessService, IAssetsService assetsService)
 {
     _facesService = facesService;
     _facesService.Initialize();
     _dataAccessService   = externalDataAccessService;
     _assetsService       = assetsService;
     _portalConfiguration = configurationService.Get <IPortalConfiguration>();
 }
 public AssetPairsController(
     IAssetsService assetsService,
     ValidationService validationService
     )
 {
     _assetsService     = assetsService;
     _validationService = validationService;
 }
 public ValidationService(
     IAssetsService assetsService,
     IBalanceService balanceService
     )
 {
     _assetsService  = assetsService;
     _balanceService = balanceService;
 }
Exemple #22
0
 public AssetsController(IAssetsService assetsService, IClientAccountSettingsClient clientAccountSettingsClient, IRequestContext requestContext,
                         ILog log)
 {
     _assetsService = assetsService;
     _clientAccountSettingsClient = clientAccountSettingsClient;
     _requestContext = requestContext;
     _log            = log;
 }
Exemple #23
0
 public AssetsController(
     IHostingEnvironment environment,
     IAssetsService assetsService,
     IShyneesService shyneesService)
 {
     _hostingEnvironment = environment;
     _assetsService      = assetsService;
     _shyneesService     = shyneesService;
 }
Exemple #24
0
 public CandlestiсksRepository(
     INoSQLTableStorage <FeedHistoryEntity> storage,
     IAssetsService assetsService,
     ILog log)
 {
     _storage       = storage;
     _assetsService = assetsService;
     _log           = log;
 }
Exemple #25
0
 public CandlesHistoryController(
     ICandlesHistoryServiceProvider candlesServiceProvider,
     IAssetsService assetsService,
     CachedDataDictionary <string, AssetPair> assetPairs)
 {
     _candlesServiceProvider = candlesServiceProvider;
     _assetsService          = assetsService;
     _assetPairs             = assetPairs;
 }
 public AssetsHelper(
     IAssetsService assetsService,
     CachedDataDictionary <string, Asset> assetsCache,
     CachedDataDictionary <string, AssetPair> assetPairsCache)
 {
     _assetsService   = assetsService;
     _assetsCache     = assetsCache;
     _assetPairsCache = assetPairsCache;
 }
Exemple #27
0
        public ServiceProviderUpdater(ulong accountId, IStateClientCryptoService clientCryptoService, IAssetsService assetsService, IDataAccessService dataAccessService, IIdentityAttributesService identityAttributesService, IBlockParsersRepositoriesRepository blockParsersRepositoriesRepository, IGatewayService gatewayService, IStateTransactionsService transactionsService, IHubContext <IdentitiesHub> idenitiesHubContext, IAppConfig appConfig, ILoggerService loggerService)
        {
            _accountId                          = accountId;
            _clientCryptoService                = clientCryptoService;
            _assetsService                      = assetsService;
            _dataAccessService                  = dataAccessService;
            _identityAttributesService          = identityAttributesService;
            _blockParsersRepositoriesRepository = blockParsersRepositoriesRepository;
            _gatewayService                     = gatewayService;
            _transactionsService                = transactionsService;
            _idenitiesHubContext                = idenitiesHubContext;
            _appConfig                          = appConfig;
            _logger = loggerService.GetLogger(nameof(ServiceProviderUpdater));

            PipeIn = new ActionBlock <PacketBase>(p =>
            {
                if (p is DocumentSignRecord documentSignRecord)
                {
                    ProcessDocumentSignRecord(documentSignRecord);
                }

                if (p is DocumentRecord documentRecord)
                {
                    ProcessDocumentRecord(documentRecord);
                }

                if (p is DocumentSignRequest documentSignRequest)
                {
                    ProcessDocumentSignRequest(documentSignRequest);
                }

                if (p is EmployeeRegistrationRequest employeeRegistrationRequest)
                {
                    ProcessEmployeeRegistrationRequest(employeeRegistrationRequest);
                }

                if (p is OnboardingRequest packet)
                {
                    ProcessOnboarding(packet);
                }

                if (p is TransitionAuthenticationProofs transitionAuthentication)
                {
                    ProcessAuthentication(transitionAuthentication);
                }

                if (p is TransitionCompromisedProofs compromisedProofs)
                {
                    ProcessCompromisedProofs(compromisedProofs);
                }

                if (p is TransferAsset transferAsset)
                {
                    ProcessTransferAsset(transferAsset);
                }
            });
        }
 public EthereumTransferHandler(
     [NotNull] ILogFactory logFactory,
     [NotNull] IPayInternalClient payInternalClient,
     [NotNull] IAssetsService assetsService)
 {
     _payInternalClient = payInternalClient ?? throw new ArgumentNullException(nameof(payInternalClient));
     _assetsService     = assetsService;
     _log = logFactory.CreateLog(this);
 }
Exemple #29
0
 public AssetsHelper(
     IAssetsService assetsService,
     IAssetsServiceWithCache assetsServiceWithCache,
     ICacheManager memoryCache
     )
 {
     _assetsService          = assetsService;
     _assetsServiceWithCache = assetsServiceWithCache;
     _memoryCache            = memoryCache;
 }
 public TransferCommandHandler(
     IAssetsService assetsService,
     ILog logger,
     IPendingOperationService pendingOperationService)
 {
     _assetsService           = assetsService;
     _logger                  = logger;
     _pendingOperationService = pendingOperationService;
     _addressUtil             = new AddressUtil();
 }
 public TileService(IAssetsService assetsService)
 {
     _assetsService = assetsService;
 }