private BrestBTRequest CreateApiRequest(UserBookingOptions bookingOptions) { return(new BrestBTRequest { BookingTime = bookingOptions.UserBookingTime }); }
public async Task <BrestBTResponse> GetTicketBooking(UserBookingOptions bookingOptions, IBrestGatewayConfiguration brestGatewayConfiguration) { var request = CreateApiRequest(bookingOptions); var restSharpClient = _clientFactory.Create(brestGatewayConfiguration.ApiEndpoint); var response = await restSharpClient.GetResponse <BrestBTRequest>(request); if (!IsResponseSuccessful(response)) { throw new BrestBTApiException(brestGatewayConfiguration.Username, response.ErrorStatus.Error); } return(response); }
public override async Task <TicketBooking> BookTicket(UserBookingOptions userBookingOptions) { var userConfiguration = _configurationProvider.GetApiConfiguration <IBrestGatewayConfiguration>(userBookingOptions.UserId); var ticketBooking = await _brestBTClient.GetTicketBooking(userBookingOptions, userConfiguration); return(new TicketBooking { TicketNumber = ticketBooking.TicketNumber, Seat = ticketBooking.SeatNumber, BusNumber = ticketBooking.BusNumber }); }