private static ReservationState ConvertToNewCurrency(ReservationState model, string currency)
        {
            var targetCurr = currency;

            if (targetCurr != model.price.currency)
            {
                var excontrol = new GuestService.Controllers.Api.ExcursionController();

                model.price = excontrol.ConvertPrice(model.price, targetCurr);

                for (int i = 0; i < model.orders.Count; i++)
                {
                    model.orders[i].price = excontrol.ConvertPrice(model.orders[i].price, targetCurr);
                }
            }

            return model;
        }
        public ActionResult Index(int? claim)
        {
            ReservationState state = null;

            if (claim.HasValue)
                state = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, claim.Value);

            #region ПРОВЕРКА ПРАВ ПОЛЬЗОВАТЕЛЯ НА ПРОСМОТР ЗАКАЗА
            //если есть в параметрах телефон, проверяем его
            if (!string.IsNullOrEmpty(Request.Params["phone"]))
            {
                try
                {
                    //проверяем правильность телефона, добавляем в список разрешенных
                    if (ClearPhoneFromGarbege(Request.Params["phone"]) == ClearPhoneFromGarbege(state.customer.phone))
                    {

                        if (System.Web.HttpContext.Current.Session["allowed_claims"] == null)
                            System.Web.HttpContext.Current.Session["allowed_claims"] = new List<int>();

                        (System.Web.HttpContext.Current.Session["allowed_claims"] as List<int>).Add(claim.Value);

                    }
                    else
                        state = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, 0);
                }
                catch (Exception)
                {
                    state = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, 0);
                }
            }
            else //если нет, проверяем есть ли в сессии разрешение на заявку
            {
                try
                {
                    if ((claim.HasValue)
                       && ((System.Web.HttpContext.Current.Session["allowed_claims"] == null)
                         || (!(System.Web.HttpContext.Current.Session["allowed_claims"] as List<int>).Contains(claim.Value))))
                        state = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, 0);
                }
                catch (NullReferenceException)
                {
                    state = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, 0);
                }
            }
            #endregion
            var paymentModes = BookingProvider.GetPaymentModes(UrlLanguage.CurrentLanguage, claim.Value);

            paymentModes = BookingController.ApplyPaymentComissions(paymentModes, state.price);

            var targetCurr = "EUR";

            if (Session["currency"] != null)
                targetCurr = Session["currency"].ToString();

            if (targetCurr != state.price.currency)
            {
                var excontrol = new GuestService.Controllers.Api.ExcursionController();

                state.price = excontrol.ConvertPrice(state.price, targetCurr);

                for (int i = 0; i < state.orders.Count; i++)
                    state.orders[i].price = excontrol.ConvertPrice(state.orders[i].price, targetCurr);
            }

            PaymentContext context = new PaymentContext();

            if (claim.HasValue)
            {
                context.Reservation = state;
                context.PaymentModes = paymentModes;
            }

            if (!string.IsNullOrEmpty( Request.Params["paymentMethod"] ))
            {
               return ProcessingPrivate(new ProcessingModel() {
                   claimId = claim.Value,
                   paymentId = Request.Params["paymentMethod"]
               });
            }

            context.PaymentModes = BookingController.FilterModes(context.PaymentModes, targetCurr);

            return base.View(context);
        }