private async Task <bool> GetDataFromMystifly(List <Domain.SelectFlightResponse> list, SelectFlightModel model) { var supplierAgencyDetails = supplierAgencyServices.GetSupplierRouteBySupplierCodeAndAgencyCode(model.CommonRequestFarePricer.Body.AirRevalidate.ARAgencyCode , model.CommonRequestFarePricer.Body.AirRevalidate.ARSupplierCode, "select/flights"); List <SupplierAgencyDetails> supplierAgencyDetailslist = new List <SupplierAgencyDetails> { supplierAgencyDetails }; model.CommonRequestFarePricer.SupplierAgencyDetails = supplierAgencyDetailslist; string cardType = bookingServices.GetPaymentCardType(model.CommonRequestFarePricer.Body.AirRevalidate.ARAgencyCode); model.CommonRequestFarePricer.Body.AirRevalidate.paymentCardType = cardType; string req = JsonConvert.SerializeObject(model); var result = await partnerClient.Getselectflight(supplierAgencyDetails.BaseUrl, supplierAgencyDetails.RequestUrl, model); string strData = JsonConvert.SerializeObject(result.Data); string requestStr = JsonConvert.SerializeObject(model); string responseStr = JsonConvert.SerializeObject(result); string agencyCode = model.CommonRequestFarePricer.Body.AirRevalidate.ARAgencyCode; await supplierAgencyServices.SaveLog("Select-Flight", agencyCode, requestStr, responseStr); Domain.SelectFlightResponse partnerResponseEntity = JsonConvert.DeserializeObject <Domain.SelectFlightResponse>(strData); if (partnerResponseEntity != null) { list.Add(partnerResponseEntity); return(true); } return(false); }
private async Task <bool> GetSupplierTripDetails(List <SupplierTripDetailsResponse> list, SupplierTripDetailsModel model) { var supplierAgencyDetails = supplierAgencyServices.GetSupplierRouteBySupplierCodeAndAgencyCode(model.AgencyCode, model.SupplierCode, "supplier-Tripdetails"); if (supplierAgencyDetails != null) { List <SupplierAgencyDetails> SupplierAgencyDetailsList = new List <SupplierAgencyDetails>() { supplierAgencyDetails }; model.supplierAgencyDetails = SupplierAgencyDetailsList; string req = JsonConvert.SerializeObject(model); var result = await partnerClient.GetSupplierTripDetails(supplierAgencyDetails.BaseUrl, supplierAgencyDetails.RequestUrl, model); string requestStr = JsonConvert.SerializeObject(model); string resposneStr = JsonConvert.SerializeObject(result); string agencyCode = model.AgencyCode; await supplierAgencyServices.SaveLog("supplier-trip-details", agencyCode, requestStr, resposneStr); if (result != null) { string strData = JsonConvert.SerializeObject(result.Data); SupplierTripDetailsResponse partnerResponseEntity = null; partnerResponseEntity = JsonConvert.DeserializeObject <SupplierTripDetailsResponse>(strData); if (partnerResponseEntity != null) { list.Add(partnerResponseEntity); return(true); } else { return(false); } } else { return(false); } } else { return(false); } }
private async Task <bool> GetDataFromMystifly(List <Domain.IssueTicketEntity> list, Models.IssueTickettModel model) { var supplierAgencyDetails = supplierAgencyServices.GetSupplierRouteBySupplierCodeAndAgencyCode(model.ticketCreateTSTFromPricing.AgencyCode , model.ticketCreateTSTFromPricing.SupplierCode, "issueticket"); //code to add supplier details in to request var allSupplierBasicDetails = await supplierAgencyServices.GetSupplierAgencyBasicDetailswithsuppliercode(model.ticketCreateTSTFromPricing.AgencyCode, "T", model.ticketCreateTSTFromPricing.SupplierCode); model.SupplierAgencyDetails = allSupplierBasicDetails; model.ticketCreateTSTFromPricing.AgencyCode = ""; model.ticketCreateTSTFromPricing.SupplierCode = ""; var result = await partnerClient.GetIssueTicketflight(supplierAgencyDetails.BaseUrl, supplierAgencyDetails.RequestUrl, model); string strData = JsonConvert.SerializeObject(result.Data); Domain.IssueTicketEntity partnerResponseEntity = JsonConvert.DeserializeObject <Domain.IssueTicketEntity>(strData); if (partnerResponseEntity != null) { if (partnerResponseEntity.TripDetailsResult.ItineraryInformation.Length > 0) { //update details here strat await supplierAgencyServices.UpdateTblBooking(partnerResponseEntity.TripDetailsResult.BookingId.ToString(), partnerResponseEntity.TripDetailsResult.ReservationItem[0].AirlinePNR); await supplierAgencyServices.InsertIntotblBookingHistory(partnerResponseEntity.TripDetailsResult.BookingId.ToString(), model.ticketCreateTSTFromPricing.UserID.ToString(), "OK"); await supplierAgencyServices.UpdateTblAirpassemgersafterIssuedTicket(partnerResponseEntity.TripDetailsResult.BookingId.ToString(), partnerResponseEntity.TripDetailsResult.ReservationItem[0].AirlinePNR, partnerResponseEntity.TripDetailsResult.ItineraryInformation); //update details here end } list.Add(partnerResponseEntity); return(true); } return(false); }
private async Task <bool> GetDataFromMystifly(List <Domain.SelectFlightResponse> list, SelectFlightModel model) { var supplierAgencyDetails = supplierAgencyServices.GetSupplierRouteBySupplierCodeAndAgencyCode(model.CommonRequestFarePricer.Body.AirRevalidate.ARAgencyCode , model.CommonRequestFarePricer.Body.AirRevalidate.ARSupplierCode, "select/flights"); //code to add supplier details in to request var allSupplierBasicDetails = await supplierAgencyServices.GetSupplierAgencyBasicDetailswithsuppliercode(model.CommonRequestFarePricer.Body.AirRevalidate.ARAgencyCode, "T", model.CommonRequestFarePricer.Body.AirRevalidate.ARSupplierCode); model.SupplierAgencyDetails = allSupplierBasicDetails; var result = await partnerClient.Getselectflight(supplierAgencyDetails.BaseUrl, supplierAgencyDetails.RequestUrl, model); string strData = JsonConvert.SerializeObject(result.Data); Domain.SelectFlightResponse partnerResponseEntity = JsonConvert.DeserializeObject <Domain.SelectFlightResponse>(strData); if (partnerResponseEntity != null) { list.Add(partnerResponseEntity); return(true); } return(false); }
private async Task <GetTripDetailsModelRS> GetTraveldetails(List <Domain.GetTripDetailsModelRS> list, Models.GetTripDetailsModel model) { GetTripDetailsModelRS _GetTripDetailsModelRS = new GetTripDetailsModelRS(); SupplierTripDetailsModel supplierTripDetailsModel = new SupplierTripDetailsModel(); if (model.ConnectiontoDBreq.Issupplier == true) { var bookedSupplierInfo = bookingServices.GetBookedSupplierInfo(long.Parse(model.ConnectiontoDBreq.BookingRefID)); if (bookedSupplierInfo != null) { model.ConnectiontoDBreq.SupplierCodeDb = bookedSupplierInfo.SupplierCodeDb; model.ConnectiontoDBreq.SupplierPnr = bookedSupplierInfo.SupplierPnr; model.ConnectiontoDBreq.SupplierUniqueId = bookedSupplierInfo.SupplierUniqueId; } if (bookedSupplierInfo.BookingStatusCode == "HK" || bookedSupplierInfo.BookingStatusCode == "TP") { var supplierAgencyDetails = supplierAgencyServices.GetSupplierRouteBySupplierCodeAndAgencyCode(model.ConnectiontoDBreq.AgencyCodeDb, model.ConnectiontoDBreq.SupplierCodeDb, "getDBtripdetails"); if (supplierAgencyDetails != null) { List <SupplierAgencyDetails> SupplierAgencyDetailsList = new List <SupplierAgencyDetails>() { supplierAgencyDetails }; supplierTripDetailsModel = new SupplierTripDetailsModel() { AgencyCode = model.ConnectiontoDBreq.AgencyCodeDb, SupplierCode = model.ConnectiontoDBreq.SupplierCodeDb, Target = model.ConnectiontoDBreq.Target, UniqueID = model.ConnectiontoDBreq.SupplierUniqueId, supplierAgencyDetails = SupplierAgencyDetailsList }; string req = JsonConvert.SerializeObject(supplierTripDetailsModel); var result = await partnerClient.GetSupplierTripDetails(supplierAgencyDetails.BaseUrl, supplierAgencyDetails.RequestUrl, supplierTripDetailsModel); string requestStr = JsonConvert.SerializeObject(model); string resposneStr = JsonConvert.SerializeObject(result); string agencyCode = model.ConnectiontoDBreq.AgencyCodeDb; await supplierAgencyServices.SaveLog("supplier-trip-details", agencyCode, requestStr, resposneStr); if (result != null) { string strData = JsonConvert.SerializeObject(result); Domain.SupplierTripDetailsResponse supplierTripDetailsResponse = new Domain.SupplierTripDetailsResponse(); try { supplierTripDetailsResponse = JsonConvert.DeserializeObject <Domain.SupplierTripDetailsResponse>(strData); if (supplierTripDetailsResponse.data.success == true) { bookingServices.UpdateBookingInformatiomFromTripDetails(supplierTripDetailsResponse, long.Parse(model.ConnectiontoDBreq.BookingRefID)); } } catch (Exception ex) { throw ex; } } } } } _GetTripDetailsModelRS = await supplierAgencyServices.GetTravellerDetailsfromDB(model.ConnectiontoDBreq.BookingRefID.ToString()); return(_GetTripDetailsModelRS); }
private async Task <bool> GetDataFromMystifly(List <Domain.IssueTicketEntity> list, Models.IssueTickettModel model) { var supplierAgencyDetails = supplierAgencyServices.GetSupplierRouteBySupplierCodeAndAgencyCode(model.ticketCreateTSTFromPricing.AgencyCode , model.ticketCreateTSTFromPricing.SupplierCode, "issueticket"); List <SupplierAgencyDetails> SupplierAgencyDetailslist = new List <SupplierAgencyDetails>() { supplierAgencyDetails }; model.SupplierAgencyDetails = SupplierAgencyDetailslist; //code to add supplier details in to request //var allSupplierBasicDetails = await supplierAgencyServices.GetSupplierAgencyBasicDetailswithsuppliercode(model.ticketCreateTSTFromPricing.AgencyCode, "T", model.ticketCreateTSTFromPricing.SupplierCode); // model.SupplierAgencyDetails = allSupplierBasicDetails; string req = JsonConvert.SerializeObject(model); var result = await partnerClient.GetIssueTicketflight(supplierAgencyDetails.BaseUrl, supplierAgencyDetails.RequestUrl, model); string strData = JsonConvert.SerializeObject(result.Data); string requestStr = JsonConvert.SerializeObject(model); string resposneStr = JsonConvert.SerializeObject(result); string agencyCode = model.ticketCreateTSTFromPricing.AgencyCode; await supplierAgencyServices.SaveLog("issue-Flight", agencyCode, requestStr, resposneStr); if (strData != "null") { Domain.IssueTicketEntity partnerResponseEntity = null; partnerResponseEntity = JsonConvert.DeserializeObject <Domain.IssueTicketEntity>(strData); if (partnerResponseEntity != null) { if (partnerResponseEntity.TripDetailsResult.ItineraryInformation.Length > 0) { string bookingStatus = partnerResponseEntity.TripDetailsResult.BookingStatus; //update details here strat await bookingServices.UpdateAirBookingAfterIssuedTicket(partnerResponseEntity.TripDetailsResult.ItineraryInformation, long.Parse(model.ticketCreateTSTFromPricing.BookingRefID), long.Parse(model.ticketCreateTSTFromPricing.UserID), partnerResponseEntity.TripDetailsResult.ReservationItem[0].AirlinePNR, bookingStatus); //update details here end partnerResponseEntity.TripDetailsResult.BookingId = model.ticketCreateTSTFromPricing.BookingRefID; list.Add(partnerResponseEntity); } else { list.Add(partnerResponseEntity); } return(true); } } else { Tkerror error = new Tkerror() { Code = "0000", Meassage = "Supplier not responding" }; Tkerror[] errors = new Tkerror[] { error }; Domain.IssueTicketEntity partnerResponseEntity = new IssueTicketEntity(); Itineraryinformation[] Itineraryinformations = new Itineraryinformation[0]; Triptotalfare triptotalfare = new Triptotalfare() { Currency = "", EquiFare = "", Tax = "", TotalFare = "" }; Domain.Reservationitem[] reservationitems = new Domain.Reservationitem[0]; Tripdetailsresult tripdetailsresult = new Tripdetailsresult() { BookingId = model.ticketCreateTSTFromPricing.BookingRefID, Success = "false", Target = model.ticketCreateTSTFromPricing.Target, UniqueID = model.ticketCreateTSTFromPricing.UniqueID, ItineraryInformation = Itineraryinformations, ReservationItem = reservationitems, TripTotalFare = triptotalfare, BookingStatus = "", TicketStatus = "", TKErrors = errors }; partnerResponseEntity.TripDetailsResult = tripdetailsresult; partnerResponseEntity.TripDetailsResult.TKErrors = errors; list.Add(partnerResponseEntity); return(true); } return(false); }
private async Task <bool> CancelbookingfromSupplier(List <CancelPNRResponse> list, Models.CancelBookingModel model) { var supplierAgencyDetails = supplierAgencyServices.GetSupplierRouteBySupplierCodeAndAgencyCode(model.AgencyCode, model.SupplierCode, "cancel-pnr"); if (supplierAgencyDetails != null) { List <SupplierAgencyDetails> SupplierAgencyDetailsList = new List <SupplierAgencyDetails>() { supplierAgencyDetails }; model.supplierAgencyDetails = SupplierAgencyDetailsList; string req = JsonConvert.SerializeObject(model); var result = await partnerClient.GetCancelPNRStatus(supplierAgencyDetails.BaseUrl, supplierAgencyDetails.RequestUrl, model); string requestStr = JsonConvert.SerializeObject(model); string resposneStr = JsonConvert.SerializeObject(result); string agencyCode = model.AgencyCode; await supplierAgencyServices.SaveLog("cancel-Flight", agencyCode, requestStr, resposneStr); if (result != null) { string strData = JsonConvert.SerializeObject(result.Data); Domain.CancelPNRResponse partnerResponseEntity = null; partnerResponseEntity = JsonConvert.DeserializeObject <Domain.CancelPNRResponse>(strData); partnerResponseEntity.BookingRefID = model.BookingRefID; partnerResponseEntity.UserID = model.UserID; if (partnerResponseEntity != null) { list.Add(partnerResponseEntity); if (partnerResponseEntity.success == true) { await bookingServices.UpdateBookingStatusafterIssueTicket("XX", model.BookingRefID, model.UserID); } else { } return(true); } else { list.Add(partnerResponseEntity); return(true); } } else { Error[] errors = new Error[1]; Error error = new Error() { Code = "", Message = "Supplier not responding" }; errors[0] = error; CancelPNRResponse cancelPNRResponse = new CancelPNRResponse() { BookingRefID = model.BookingRefID, success = false, uniqueID = model.UniqueId, UserID = model.UserID, errors = errors }; list.Add(cancelPNRResponse); return(true); } } else { return(false); } }
private async Task <bool> GetDataFromMystifly(List <Domain.BookFlightResponse> list, Models.BookFlightModel model) { try { var supplierAgencyDetails = supplierAgencyServices.GetSupplierRouteBySupplierCodeAndAgencyCode(model.BookFlightEntity.BookFlight.AgencyCode , model.BookFlightEntity.BookFlight.SupplierCode, "book/flights"); List <SupplierAgencyDetails> _supplierAgencyDetailslist = new List <SupplierAgencyDetails> { supplierAgencyDetails }; model.BookFlightEntity.BookFlight.SupplierAgencyDetails = _supplierAgencyDetailslist; Paymentinfo paymentinfo = bookingServices.GetPaymentCardDetails(model.BookFlightEntity.BookFlight.AgencyCode); model.BookFlightEntity.BookFlight.PaymentInfo = paymentinfo; BookingData _BookingData = new BookingData(); BusinessEntitties.BookFlightModel bookFlightModel = new BusinessEntitties.BookFlightModel(); bookFlightModel.AirBagDetails = model.AirBagDetails; bookFlightModel.CostBreakuppax = model.CostBreakuppax; bookFlightModel.Fareruleseg = model.Fareruleseg; bookFlightModel.Totalfaregroup = model.Totalfaregroup; bookFlightModel.BookFlightEntity.BookFlight = model.BookFlightEntity.BookFlight; bookFlightModel.costAirMarkUp = model.costAirMarkUp; //Check RefID Exist in Database bool Exist = false; if (model.BookFlightEntity.BookFlight.BookingId != "") { Exist = bookingServices.CheckBookingRefIDExist(long.Parse(model.BookFlightEntity.BookFlight.BookingId)); } if (Exist) { //Update DataBase With New Price Details and Change Password await bookingServices.UpdateAllDetailsWithRefID(bookFlightModel); } else { // Add New Record in Database _BookingData = await bookingServices.SavingAirBookingFlight(bookFlightModel, supplierAgencyDetails.AgencyID, supplierAgencyDetails.SupplierId); } //Send Booking Request To Supplier string modelStr = JsonConvert.SerializeObject(model.BookFlightEntity); var result = await partnerClient.GetBookflight(supplierAgencyDetails.BaseUrl, supplierAgencyDetails.RequestUrl, model.BookFlightEntity); string responseStr = JsonConvert.SerializeObject(result.Data); string jsonData = JsonConvert.SerializeObject(result.Data); string requestStr = JsonConvert.SerializeObject(model); string agencyCode = model.BookFlightEntity.BookFlight.AgencyCode; await supplierAgencyServices.SaveLog("book-Flight", agencyCode, requestStr, jsonData); if (jsonData != "null") { Domain.BookFlightResponse partnerResponseEntity = JsonConvert.DeserializeObject <Domain.BookFlightResponse>(responseStr); string bookStatus = partnerResponseEntity.BookFlightResult.Status; if (bookStatus == "PRICECHANGED") { //Send Status to website with new bookingRefID partnerResponseEntity.BookFlightResult.BookingId = _BookingData.BookingRefID.ToString(); list.Add(partnerResponseEntity); return(true); } else { //Check PNR is Successfully Generated bool pnrstatus = CheckPNRorUniqIDexistornot(partnerResponseEntity); if (pnrstatus) { //Update PNR,BookingStatus and UniqID //Add Errors To Database bookingServices.UpdatePNRandStatus(partnerResponseEntity, _BookingData, bookFlightModel, supplierAgencyDetails.SupplierCode); partnerResponseEntity.BookFlightResult.BookingId = _BookingData.BookingRefID.ToString(); list.Add(partnerResponseEntity); } else { list.Add(partnerResponseEntity); } } } else { //Send Error Message to website // Error message = Supplier Note Responding Domain.BookFlightResponse bookFlightResponse = GetErrorTag("0000", "Supplier not responding"); list.Add(bookFlightResponse); } return(true); } catch (Exception ex) { throw ex; } }
private async Task <bool> GetDataFromMystifly(List <Domain.BookFlightResponse> list, BookFlightModel model) { var supplierAgencyDetails = supplierAgencyServices.GetSupplierRouteBySupplierCodeAndAgencyCode(model.BookFlightEntity.BookFlight.AgencyCode , model.BookFlightEntity.BookFlight.SupplierCode, "book/flights"); //codt to add booking details in DB BookingData _BookingData = new BookingData(); _BookingData = await supplierAgencyServices.BookFlights(model.BookFlightEntity.BookFlight.Email, supplierAgencyDetails.AgencyID, model.BookFlightEntity.BookFlight.PhoneNumber, model.BookFlightEntity.BookFlight.Faresourcecode, supplierAgencyDetails.SupplierId); //code to add air passengetdetails in to DB await supplierAgencyServices.AddAirPassengers(model.BookFlightEntity.BookFlight.TravelerInfo, _BookingData.BookingRefID.ToString(), model.BookFlightEntity.BookFlight.CustomerInfo.Email, model.BookFlightEntity.BookFlight.CustomerInfo.PhoneNumber, model.BookFlightEntity.BookFlight.CustomerInfo.PhoneCountry, _BookingData.userID.ToString()); // await supplierAgencyServices.AddAirbookingCost(model.BookFlight.TravelerInfo, bookingID); //Add data to tblairbookingcost start var BookingCostID = await supplierAgencyServices.InsertIntotblairbookingcost(_BookingData.BookingRefID.ToString(), Convert.ToDouble(model.Totalfaregroup.TotalBaseNet), Convert.ToDouble(model.Totalfaregroup.TotalTaxNet), Convert.ToDouble(model.Totalfaregroup.PaidAmount), model.Totalfaregroup.NetCurrency, Convert.ToInt16(model.Totalfaregroup.MarkupTypeID), Convert.ToDouble(model.Totalfaregroup.MarkupValue), model.Totalfaregroup.MarkupCurrency, Convert.ToDouble(model.Totalfaregroup.SellAmount), model.Totalfaregroup.SellCurrency, Convert.ToDouble(model.Totalfaregroup.AdditionalServiceFee), Convert.ToDouble(model.Totalfaregroup.CancellationAmount), model.Totalfaregroup.CancellationCurrency); //Add data to tblairbookingcost end //Add to AirBookingCostBreakup start await supplierAgencyServices.InsertIntotblAirBookingCostBreakup(BookingCostID.ToString(), model.CostBreakuppax); //Add to AirBookingCostBreakup end //Add to PaymentDetails start await supplierAgencyServices.InsertIntotblPayment(_BookingData.BookingRefID.ToString(), Convert.ToDouble(model.Totalfaregroup.PaidAmount), model.Totalfaregroup.SellCurrency, model.Totalfaregroup.PaidDate, Convert.ToInt16(model.Totalfaregroup.PaymentTypeID)); //Add to PaymentDetails End //Add to AirOrigingDestination start await supplierAgencyServices.InsertIntotblAirOriginDestinationOptions(_BookingData.BookingRefID.ToString(), model.BookFlightEntity.BookFlight.FLLegGroup); //Add to AirOrigingDestination End //Add to AirbaggageDetails start await supplierAgencyServices.InsertIntotblAirbaggageDetails(_BookingData.BookingRefID.ToString(), model.AirBagDetails); //Add to AirbaggageDetails End //Add to farerules start await supplierAgencyServices.InsertIntotblAirFarerules(_BookingData.BookingRefID.ToString(), model.Fareruleseg); //Add to farerules End //code to add supplier details in to request var allSupplierBasicDetails = await supplierAgencyServices.GetSupplierAgencyBasicDetailswithsuppliercode(model.BookFlightEntity.BookFlight.AgencyCode, "T", model.BookFlightEntity.BookFlight.SupplierCode); model.BookFlightEntity.BookFlight.SupplierAgencyDetails = allSupplierBasicDetails; model.BookFlightEntity.BookFlight.SupplierCode = ""; model.BookFlightEntity.BookFlight.BookingId = _BookingData.BookingRefID.ToString(); string modelStr = JsonConvert.SerializeObject(model.BookFlightEntity); var result = await partnerClient.GetBookflight(supplierAgencyDetails.BaseUrl, supplierAgencyDetails.RequestUrl, model.BookFlightEntity); string strData = JsonConvert.SerializeObject(result.Data); Domain.BookFlightResponse partnerResponseEntity = JsonConvert.DeserializeObject <Domain.BookFlightResponse>(strData); if (partnerResponseEntity != null) { string airlinePNR = partnerResponseEntity.BookFlightResult.Airlinepnr; string uniqueID = partnerResponseEntity.BookFlightResult.UniqueID; if ((airlinePNR != "NIL" || uniqueID != "NIL") && (airlinePNR != "NA" || uniqueID != "NA")) { //Update tblbooking (UniqId,Pnr no) await supplierAgencyServices.InsertIntotblBookingData(_BookingData.BookingRefID.ToString(), airlinePNR, uniqueID); await supplierAgencyServices.UpdateTblBooking(_BookingData.BookingRefID.ToString(), partnerResponseEntity.BookFlightResult.Airlinepnr); await supplierAgencyServices.UpdateTblAirpassemgers(_BookingData.BookingRefID.ToString(), partnerResponseEntity.BookFlightResult.Airlinepnr); await supplierAgencyServices.InsertIntotblBookingHistory(_BookingData.BookingRefID.ToString(), _BookingData.userID.ToString(), "HK"); //Update tblairpassengerdetails (Pnr no) } list.Add(partnerResponseEntity); return(true); } return(false); }