Example #1
0
 public AccountService(IRepository <Account> repository,
                       IRepository <Operation> operationRepository,
                       ICurrencyHelper currencyHelper)
 {
     Repository = repository;
     this.operationRepository = operationRepository;
     this.currencyHelper      = currencyHelper;
 }
 public WalletStateRequestHandler(ICurrentUserService currentUserService,
                                  ICurrencyHelper currencyHelper,
                                  IRepository <Account> repository)
 {
     this.currentUserService = currentUserService;
     this.currencyHelper     = currencyHelper;
     this.accountRepository  = repository;
 }
Example #3
0
        public CurrencyPair ParseData(string input, IDataWriter loger, ICurrencyHelper currencyHelper)
        {
            CurrencyPair result = null;

            var currencies = currencyHelper.GetCurencies();

            try
            {
                var words = ParseString(input);
                if (ValidateData(loger, words) && currencies != null)
                {
                    result = new CurrencyPair();
                    ISO FirstIso;
                    if (Enum.TryParse(words[1], true, out FirstIso))
                    {
                        result.FirstCurrency = currencies.Where(x => x.Iso == FirstIso).First();
                    }

                    ISO secondIso;
                    if (Enum.TryParse(words[2], true, out secondIso))
                    {
                        result.SecondCurrency = currencies.Where(x => x.Iso == secondIso).First();
                    }

                    decimal amount;
                    if (decimal.TryParse(words[3], out amount))
                    {
                        result.Amount = amount;
                    }
                }
            }
            catch (Exception ex)
            {
                loger.WriteError(ex.ToString());
            }

            return(result);
        }
Example #4
0
        public Price(
			decimal? amount = null,
			int? coefficient = null,
			int? exponent = null,
			string currency = null,
            ICurrencyHelper currencyHelper = null
		)
        {
            this.coefficient = coefficient;
            this.exponent = exponent;
            this.currency = currency;

            if (amount != null) {
                this.coefficient = (int)Math.Round ((decimal)amount * 100);
                this.exponent = -2;
            }

            if (currencyHelper == null) {
                currencyHelper = new CurrencyHelper();
            }

            this._currencyHelper = currencyHelper;
        }
Example #5
0
 public BusinessLogicHelper(CurrencyPair currencyPair, ICurrencyHelper currencyHelper)
 {
     CurrencyPair   = currencyPair;
     CurrencyHelper = currencyHelper;
 }
Example #6
0
 public CurrencyHelper(ICurrencyHelper currencyHelper)
 {
     _outputToUpperCase = currencyHelper.OutputToUpperCase;
 }
 public ValidateCurrencyName(ICurrencyHelper currencyHelper,
                             IValidator <AccountCreationRequest> validator)
 {
     this.currencyHelper = currencyHelper;
     this.validator      = validator;
 }