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 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 RefundController(
     IPayInternalClient payInternalClient,
     ILykkeAssetsResolver lykkeAssetsResolver,
     ILogFactory logFactory)
 {
     _payInternalClient   = payInternalClient;
     _lykkeAssetsResolver = lykkeAssetsResolver;
     _log = logFactory.CreateLog(this);
 }
 public PaymentsService(
     IPayInternalClient payInternalClient,
     IPayInvoiceClient payInvoiceClient,
     ILykkeAssetsResolver lykkeAssetsResolver
     )
 {
     _payInternalClient   = payInternalClient;
     _payInvoiceClient    = payInvoiceClient;
     _lykkeAssetsResolver = lykkeAssetsResolver;
 }
Exemplo n.º 5
0
 public AssetRatesController(
     [NotNull] IAssetRatesService assetRatesService,
     [NotNull] IAssetsLocalCache assetsLocalCache,
     [NotNull] ILykkeAssetsResolver lykkeAssetsResolver,
     [NotNull] ILogFactory logFactory)
 {
     _assetRatesService   = assetRatesService ?? throw new ArgumentNullException(nameof(assetRatesService));
     _assetsLocalCache    = assetsLocalCache ?? throw new ArgumentNullException(nameof(assetsLocalCache));
     _lykkeAssetsResolver = lykkeAssetsResolver ?? throw new ArgumentNullException(nameof(lykkeAssetsResolver));
     _log = logFactory.CreateLog(this);
 }
 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));
 }
Exemplo n.º 7
0
 public EmailService(
     IPayInvoiceClient payInvoiceClient,
     ILykkeAssetsResolver lykkeAssetsResolver,
     IEmailPartnerRouterClient emailPartnerRouterClient,
     ILogFactory logFactory,
     IPayMerchantClient payMerchantClient)
 {
     _payInvoiceClient         = payInvoiceClient;
     _lykkeAssetsResolver      = lykkeAssetsResolver;
     _emailPartnerRouterClient = emailPartnerRouterClient;
     _payMerchantClient        = payMerchantClient;
     _log = logFactory.CreateLog(this);
 }
Exemplo n.º 8
0
 public AssetsController(
     IAssetsAvailabilityService assetsAvailabilityService,
     IAssetsLocalCache assetsLocalCache,
     IMerchantService merchantService,
     ILog log,
     ILykkeAssetsResolver lykkeAssetsResolver)
 {
     _assetsAvailabilityService = assetsAvailabilityService ??
                                  throw new ArgumentNullException(nameof(assetsAvailabilityService));
     _assetsLocalCache = assetsLocalCache ?? throw new ArgumentNullException(nameof(assetsLocalCache));
     _merchantService  = merchantService ?? throw new ArgumentNullException(nameof(merchantService));
     _log = log ?? throw new ArgumentNullException(nameof(log));
     _lykkeAssetsResolver = lykkeAssetsResolver ?? throw new ArgumentNullException(nameof(lykkeAssetsResolver));
 }
 public MerchantsController(
     [NotNull] IAssetSettingsService assetSettingsService,
     [NotNull] ILogFactory logFactory,
     [NotNull] IMarkupService markupService,
     [NotNull] IAssetsLocalCache assetsLocalCache,
     [NotNull] ILykkeAssetsResolver lykkeAssetsResolver)
 {
     _assetSettingsService =
         assetSettingsService ?? throw new ArgumentNullException(nameof(assetSettingsService));
     _log                 = logFactory.CreateLog(this);
     _markupService       = markupService ?? throw new ArgumentNullException(nameof(markupService));
     _assetsLocalCache    = assetsLocalCache ?? throw new ArgumentNullException(nameof(assetsLocalCache));
     _lykkeAssetsResolver = lykkeAssetsResolver ?? throw new ArgumentNullException(nameof(lykkeAssetsResolver));
 }
Exemplo n.º 10
0
 public AssetService(
     IPayInternalClient payInternalClient,
     IPayInvoiceClient payInvoiceClient,
     ILykkeAssetsResolver lykkeAssetsResolver,
     IMemoryCache memoryCache,
     ILogFactory logFactory)
 {
     _payInternalClient        = payInternalClient;
     _payInvoiceClient         = payInvoiceClient;
     _lykkeAssetsResolver      = lykkeAssetsResolver;
     _assetsNetworkCache       = new OnDemandDataCache <Dictionary <string, BlockchainType> >(memoryCache);
     _assetBlockchainTypeCache = new OnDemandDataCache <Tuple <BlockchainType> >(memoryCache);
     _log = logFactory.CreateLog(this);
 }
Exemplo n.º 11
0
 public MerchantsController(
     IMerchantService merchantService,
     IAssetsAvailabilityService assetsAvailabilityService,
     ILog log,
     IMarkupService markupService,
     IAssetsLocalCache assetsLocalCache,
     ILykkeAssetsResolver lykkeAssetsResolver)
 {
     _merchantService           = merchantService;
     _assetsAvailabilityService = assetsAvailabilityService;
     _log                 = log;
     _markupService       = markupService;
     _assetsLocalCache    = assetsLocalCache;
     _lykkeAssetsResolver = lykkeAssetsResolver;
 }
Exemplo n.º 12
0
 public EthereumApiClient(
     [NotNull] IEthereumCoreAPI ethereumServiceClient,
     [NotNull] EthereumBlockchainSettings ethereumSettings,
     [NotNull] ILog log,
     [NotNull] IAssetsLocalCache assetsLocalCache,
     [NotNull] ILykkeAssetsResolver lykkeAssetsResolver,
     [NotNull] IAssetsService assetsService)
 {
     _ethereumServiceClient = ethereumServiceClient ?? throw new ArgumentNullException(nameof(ethereumServiceClient));
     _ethereumSettings      = ethereumSettings ?? throw new ArgumentNullException(nameof(ethereumSettings));
     _assetsLocalCache      = assetsLocalCache ?? throw new ArgumentNullException(nameof(assetsLocalCache));
     _lykkeAssetsResolver   = lykkeAssetsResolver ?? throw new ArgumentNullException(nameof(lykkeAssetsResolver));
     _assetsService         = assetsService ?? throw new ArgumentNullException(nameof(assetsLocalCache));
     _log = log.CreateComponentScope(nameof(EthereumApiClient)) ?? throw new ArgumentNullException(nameof(log));
 }
Exemplo n.º 13
0
 public OrderService(
     [NotNull] IOrderRepository orderRepository,
     [NotNull] ICalculationService calculationService,
     [NotNull] ILogFactory logFactory,
     [NotNull] OrderExpirationPeriodsSettings orderExpirationPeriods,
     [NotNull] IMarkupService markupService,
     [NotNull] ILykkeAssetsResolver lykkeAssetsResolver)
 {
     _orderRepository    = orderRepository;
     _calculationService = calculationService;
     _log = logFactory.CreateLog(this);
     _orderExpirationPeriods = orderExpirationPeriods;
     _markupService          = markupService;
     _lykkeAssetsResolver    = lykkeAssetsResolver;
 }
Exemplo n.º 14
0
 public SettingsController(
     IAssetService assetService,
     ILykkeAssetsResolver lykkeAssetsResolver,
     IMerchantService merchantService,
     IPayMerchantClient payMerchantClient,
     IPayAuthClient payAuthClient,
     IPayInvoiceClient payInvoiceClient,
     ILogFactory logFactory)
 {
     _assetService        = assetService;
     _lykkeAssetsResolver = lykkeAssetsResolver;
     _merchantService     = merchantService;
     _payMerchantClient   = payMerchantClient;
     _payAuthClient       = payAuthClient;
     _payInvoiceClient    = payInvoiceClient;
     _log = logFactory.CreateLog(this);
 }
Exemplo n.º 15
0
 public OrderService(
     IOrderRepository orderRepository,
     IMerchantRepository merchantRepository,
     ICalculationService calculationService,
     ILog log,
     OrderExpirationPeriodsSettings orderExpirationPeriods,
     IMarkupService markupService,
     ILykkeAssetsResolver lykkeAssetsResolver)
 {
     _orderRepository    = orderRepository;
     _merchantRepository = merchantRepository;
     _calculationService = calculationService;
     _log = log;
     _orderExpirationPeriods = orderExpirationPeriods;
     _markupService          = markupService;
     _lykkeAssetsResolver    = lykkeAssetsResolver;
 }
 public InvoiceService(
     IMerchantService merchantService,
     IAssetService assetService,
     IPayInvoiceClient payInvoiceClient,
     IPayInternalClient payInternalClient,
     IRateCalculatorClient rateCalculatorClient,
     ILykkeAssetsResolver lykkeAssetsResolver,
     IMemoryCache memoryCache,
     CacheExpirationPeriodsSettings cacheExpirationPeriods,
     ILogFactory logFactory,
     IPayMerchantClient payMerchantClient)
 {
     _merchantService        = merchantService;
     _assetService           = assetService;
     _payInvoiceClient       = payInvoiceClient;
     _payInternalClient      = payInternalClient;
     _rateCalculatorClient   = rateCalculatorClient;
     _lykkeAssetsResolver    = lykkeAssetsResolver;
     _cacheExpirationPeriods = cacheExpirationPeriods;
     _payMerchantClient      = payMerchantClient;
     _ratesCache             = new OnDemandDataCache <Tuple <double> >(memoryCache);
     _employeeFullNameCache  = new OnDemandDataCache <string>(memoryCache);
     _log = logFactory.CreateLog(this);
 }
 public AssetIdValueResolver(
     [NotNull] ILykkeAssetsResolver lykkeAssetsResolver)
 {
     _lykkeAssetsResolver = lykkeAssetsResolver ?? throw new ArgumentNullException(nameof(lykkeAssetsResolver));
 }