Exemplo n.º 1
0
        public async Task <IActionResult> Get(string culture = null)
        {
            var stationListResponse = await _resourcesService.GetStationList(culture);

            var marketListResponse = await _resourcesService.GetMarketList();

            var cultureListResponse = await _resourcesService.GetCultureList();

            var currencyListResponse = await _resourcesService.GetCurrencyList();

            var paxTypeListResponse = await _resourcesService.GetPaxTypeList();

            var travelDocTypeListResponse = await _resourcesService.GetDocTypeList(culture);

            var feeListResponse = await _resourcesService.GetFeeList(culture);

            var ssrList = await _resourcesService.GetSSRList(culture);

            var titleList = await _resourcesService.GetTitleList(culture);

            var countryList = await _resourcesService.GetCountryList(culture);

            var paymentMethods = await _resourcesService.GetPaymentMethodsList(culture);

            var resources = new AllResourcesResponse
            {
                StationList       = stationListResponse.StationList,
                MarketList        = marketListResponse.MarketList,
                CultureList       = cultureListResponse.CultureList,
                CurrencyList      = currencyListResponse.CurrencyList,
                PaxTypeList       = paxTypeListResponse.PaxTypeList,
                FeeList           = feeListResponse.FeeList,
                DocTypeList       = travelDocTypeListResponse.DocTypeList,
                SSRList           = ssrList.SSRList,
                TitleList         = titleList.TitleList,
                CountryList       = countryList.CountryList,
                PaymentMethodList = paymentMethods.PaymentMethodList,
            };

            return(new OkObjectResult(resources));
        }
Exemplo n.º 2
0
        public async Task <dto.SellResponse> SellFee(dto.SellFeeRequestData sellFeeRequestData)
        {
            var feeList = await _resourceService.GetFeeList(await _sessionBagService.CultureCode());

            var fee = feeList.FeeList.ToList().Find(f => f.FeeCode == sellFeeRequestData.FeeCode);

            if (fee == null)
            {
                throw new ResponseErrorException(dto.Enumerations.ResponseErrorCode.InvalidFee, new string[] { "Fee not found. " });
            }
            var booking = await _sessionBagService.Booking();

            sellFeeRequestData.SellFeeType = fee.FeeType == dto.Enumerations.FeeType.ServiceFee ? dto.Enumerations.SellFeeType.ServiceFee
                : fee.FeeType == dto.Enumerations.FeeType.PenaltyFee ? dto.Enumerations.SellFeeType.PenaltyFee
                : dto.Enumerations.SellFeeType.Unmapped;
            sellFeeRequestData.CollectedCurrencyCode = booking.CurrencyCode;
            sellFeeRequestData.PassengerNumber       = sellFeeRequestData.PassengerNumber;

            var response = await _client.SellAsync(new SellRequest
            {
                ContractVersion           = _navApiContractVer,
                EnableExceptionStackTrace = false,
                MessageContractVersion    = _navMsgContractVer,
                Signature = await _sessionBagService.Signature(),

                SellRequestData = new SellRequestData
                {
                    SellBy  = SellBy.Fee,
                    SellFee = new SellFee
                    {
                        SellFeeRequestData = Mapper.Map <Navitaire.WebServices.DataContracts.Booking.SellFeeRequestData>(sellFeeRequestData)
                    }
                }
            });

            return(Mapper.Map <dto.SellResponse>(response));
        }