public static function createDummySeatRequest() { $tomorrow = new \DateTime('tomorrow'); $seatRequest = new SeatRequest(); $seatRequest->setEmpresaSolicita("CBUS"); $seatRequest->setClaveCorrida(176); $seatRequest->setFechaCorrida($tomorrow); $seatRequest->setEmpresaCorrida("TLU"); $seatRequest->setClaveOrigen("GDLJ"); $seatRequest->setClaveDestino("MEXN"); return $seatRequest; }
/** * @param SeatRequest $seatRequest * @return array * @throws \Etn\Exceptions\ResponseException; */ public function getAvailableSeats(SeatRequest $seatRequest) { $serviceType = 'ConsultaOcupacion'; $departureDate = $seatRequest->getFechaCorrida(); $formattedDepartureDate = $departureDate->format('dmY'); $soapParams = array('p_cve_origen_1' => $seatRequest->getClaveOrigen(), 'p_cve_destino_2' => $seatRequest->getClaveDestino(), 'p_fecha_3' => $formattedDepartureDate, 'p_cve_corrida_4' => $seatRequest->getClaveCorrida(), 'p_cve_empresa_5' => $seatRequest->getEmpresaSolicita(), 'p_cve_empresa_corrida_6' => $seatRequest->getEmpresaCorrida()); $soapResponse = $this->soapClient->__soapCall($serviceType, $soapParams); $availableSeatsResponse = $this->seatHelper->normalizeAvailableSeats($soapResponse); if ($availableSeatsResponse['errorMessage'] !== 'Sin Error.') { throw new ResponseException('There was a communication error with the Bus Line'); } return $availableSeatsResponse; }