public static List<PaymentMode> ApplyPaymentComissions(List<PaymentMode> modes, ReservationPrice topay)
        {
            var excontrol = new GuestService.Controllers.Api.ExcursionController();

            for (int i = 0; i < modes.Count; i++)
            {
                try
                {
                    var modeId = modes[i].id.Split('.')[0];

                    decimal comissionProcent = 0;
                    var targetCurrency = modes[i].payrest.currency;
                    //если есть комиссия
                    if (ConfigurationManager.AppSettings.AllKeys.Contains("PaymentModeComission_" + modeId))
                    {
                        comissionProcent = Convert.ToDecimal(ConfigurationManager.AppSettings["PaymentModeComission_" + modeId]);
                    }

                    modes[i].comission = new ReservationOrderPrice()
                    {
                        currency = topay.currency,
                        total = Math.Round((topay.total / 100m * comissionProcent), 2)
                    };

                    modes[i].payrest = new ReservationOrderPrice()
                    {
                        currency = topay.currency,
                        total = Math.Round(modes[i].comission.total + topay.total, 2)
                    };

                    modes[i].comission = excontrol.ConvertPrice(modes[i].comission, targetCurrency);
                    modes[i].payrest = excontrol.ConvertPrice(modes[i].payrest, targetCurrency);
                }
                catch (Exception ex) {
                    Console.Write(ex.Message);
                }
            }

            return modes;
        }
        public ReservationPrice ConvertPrice(ReservationPrice inp, string targetCurrency)
        {
            //ключ для кэша курсов
            string key = inp.currency + "to" + targetCurrency;

            //если курса нет в кэше, ищем в базе
            if (!_courses.ContainsKey(key))
                _courses[key] = GetCourse(inp.currency, targetCurrency);

            //если ключ найден и он реальный, конвертируем
            if (_courses[key] > 0)
            {
                inp.total *= _courses[key];
                inp.total = Math.Round(inp.total, 2);
                inp.topay *= _courses[key];
                inp.topay = Math.Round(inp.topay, 2);
                inp.currency = targetCurrency;
            }
            return inp;
        }