Exemple #1
0
        public async Task <dto.GetBarCodedBoardingPassesResponse> GetBarCodedBoardingPasses(dto.GetBarCodedBoardingPassesRequest getBarCodedBoardingPassesRequest)
        {
            var booking = await _sessionBag.Booking();

            var boardingPassRequest = getBarCodedBoardingPassesRequest.BoardingPassRequest;
            var leg     = booking.Journeys[boardingPassRequest.JourneyIndex].Segments[boardingPassRequest.SegmentIndex].Legs[boardingPassRequest.LegIndex];
            var pax     = booking.Passengers[boardingPassRequest.PaxNumber];
            var request = new nskop.BoardingPassRequest
            {
                RecordLocator   = booking.RecordLocator,
                InventoryLegKey = new Navitaire.WebServices.DataContracts.Common.InventoryLegKey
                {
                    ArrivalStation   = leg.ArrivalStation,
                    DepartureStation = leg.DepartureStation,
                    CarrierCode      = leg.FlightDesignator.CarrierCode,
                    FlightNumber     = leg.FlightDesignator.FlightNumber,
                    OpSuffix         = leg.FlightDesignator.OpSuffix,
                    DepartureDate    = leg.STD
                },
                Name = new Navitaire.WebServices.DataContracts.Common.Name
                {
                    FirstName = pax.Names[0].FirstName,
                    LastName  = pax.Names[0].LastName,
                    Title     = pax.Names[0].Title
                },
                BarCodeType = Mapper.Map <BarCodeType>(getBarCodedBoardingPassesRequest.BoardingPassRequest.BarCodeType)
            };
            var response = await _client.GetBarCodedBoardingPassesAsync(new GetBarCodedBoardingPassesRequest
            {
                ContractVersion           = _navApiContractVer,
                EnableExceptionStackTrace = false,
                MessageContractVersion    = _navMsgContractVer,
                Signature           = await _sessionBag.Signature(),
                BoardingPassRequest = request
            });

            var mappedResponse = Mapper.Map <dto.GetBarCodedBoardingPassesResponse>(response);

            mappedResponse.BarcodeHeight = boardingPassRequest.BarcodeHeight;
            mappedResponse.BarcodeWidth  = boardingPassRequest.BarcodeWidth;
            return(mappedResponse);
        }
 public async Task <IActionResult> GetBarCodedBoardingPasses([FromBody] dto.GetBarCodedBoardingPassesRequest getBarCodedBoardingPassesRequest)
 {
     return(new OkObjectResult(await _checkinService.GetBarCodedBoardingPasses(getBarCodedBoardingPassesRequest)));
 }