Example #1
0
        public async Task <dto.AssignSeatsResponse> UnAssignSeat(dto.AssignSeatRequest assignSeatRequest)
        {
            var sellSeatRequest = await GetSellSeatRequest(assignSeatRequest, true);

            var unAssignSeatsResponse = await _client.UnassignSeatsAsync(new UnassignSeatsRequest
            {
                ContractVersion        = _navApiContractVer,
                MessageContractVersion = _navMsgContractVer,
                Signature = await _sessionBag.Signature(),
                EnableExceptionStackTrace = false,
                SellSeatRequest           = sellSeatRequest
            });

            var error = NewskiesHelper.GetUpdateResponseError(unAssignSeatsResponse.BookingUpdateResponseData);

            if (error != null)
            {
                throw new dto.ResponseErrorException(
                          dto.Enumerations.ResponseErrorCode.SeatAssignmentFailure, error);
            }
            return(Mapper.Map <dto.AssignSeatsResponse>(unAssignSeatsResponse));
        }
Example #2
0
        private async Task <SeatSellRequest> GetSellSeatRequest(dto.AssignSeatRequest assignSeatRequest, bool isUnassign)
        {
            var booking = await _sessionBag.Booking();

            var journeyIndex          = assignSeatRequest.AssignSeatData.JourneyIndex;
            var segmentIndex          = assignSeatRequest.AssignSeatData.SegmentIndex;
            var legIndex              = assignSeatRequest.AssignSeatData.SegmentIndex;
            var paxNumber             = assignSeatRequest.AssignSeatData.PaxNumber;
            var mode                  = assignSeatRequest.AssignSeatData.SeatAssignmentMode;
            var waiveFees             = assignSeatRequest.AssignSeatData.WaiveFees;
            var compartmentDesignator = assignSeatRequest.AssignSeatData.CompartmentDesignator;
            var unitDesignator        = assignSeatRequest.AssignSeatData.UnitDesignator;
            var leg             = Mapper.Map <Leg>(booking.Journeys[journeyIndex].Segments[segmentIndex].Legs[legIndex]);
            var paxNumbers      = GetPaxNumbers(booking, leg, journeyIndex, segmentIndex, paxNumber, isUnassign);
            var seatSellRequest = new SeatSellRequest
            {
                SeatAssignmentMode    = Mapper.Map <SeatAssignmentMode>(mode),
                CollectedCurrencyCode = booking.CurrencyCode,
                WaiveFee = waiveFees,
                AllowSeatSwappingInPNR = true,
                SegmentSeatRequests    = new SegmentSeatRequest[]
                {
                    new SegmentSeatRequest
                    {
                        DepartureStation = leg.DepartureStation,
                        ArrivalStation   = leg.ArrivalStation,
                        FlightDesignator = leg.FlightDesignator,
                        STD = leg.STD,
                        PassengerNumbers      = paxNumbers,
                        CompartmentDesignator = compartmentDesignator,
                        UnitDesignator        = unitDesignator
                    }
                }
            };

            return(seatSellRequest);
        }