fix: treat api response properly
This commit is contained in:
@@ -5,7 +5,6 @@ namespace App\BusProNet\Model;
|
|||||||
class BookingUpdate
|
class BookingUpdate
|
||||||
{
|
{
|
||||||
public bool $valid = false;
|
public bool $valid = false;
|
||||||
|
public bool $success = false;
|
||||||
public ?string $status = null;
|
public ?string $status = null;
|
||||||
public array $prices = [];
|
|
||||||
public ?float $totalPrice = null;
|
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,8 @@ class BookingUpdateParser extends AbstractParser
|
|||||||
{
|
{
|
||||||
$bookingUpdate = new BookingUpdate();
|
$bookingUpdate = new BookingUpdate();
|
||||||
$bookingUpdate->valid = 'möglich' === $node->filterXPath('//aenderung')->text();
|
$bookingUpdate->valid = 'möglich' === $node->filterXPath('//aenderung')->text();
|
||||||
$bookingUpdate->totalPrice = $this->getFloatOrNullValue($node->filterXPath('//gesamtpreis'));
|
$bookingUpdate->success = 'erfolgt' === $node->filterXPath('//aenderung')->text();
|
||||||
|
$bookingUpdate->status = $node->filterXPath('//status')->text();
|
||||||
|
|
||||||
return $bookingUpdate;
|
return $bookingUpdate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Controller\Booking;
|
namespace App\Controller\Booking;
|
||||||
|
|
||||||
use App\BusProNet\ApiClient;
|
use App\BusProNet\ApiClient;
|
||||||
|
use App\BusProNet\Model\Notification;
|
||||||
use App\BusProNet\XmlLoader\PickupLoader;
|
use App\BusProNet\XmlLoader\PickupLoader;
|
||||||
use App\BusProNet\XmlLoader\TravelLoader;
|
use App\BusProNet\XmlLoader\TravelLoader;
|
||||||
use App\Form\BookingType;
|
use App\Form\BookingType;
|
||||||
@@ -93,7 +94,7 @@ class EditController extends AbstractController
|
|||||||
'email' => $bpnUser->getEmail(),
|
'email' => $bpnUser->getEmail(),
|
||||||
'booking_id' => $id,
|
'booking_id' => $id,
|
||||||
]);
|
]);
|
||||||
if (false === $response->isSuccessful()) {
|
if ($response instanceof Notification && false === $response->isSuccessful()) {
|
||||||
$this->addFlash('error', $response->message);
|
$this->addFlash('error', $response->message);
|
||||||
$this->logger->error('Error initiating booking update', [
|
$this->logger->error('Error initiating booking update', [
|
||||||
'email' => $bpnUser->getEmail(),
|
'email' => $bpnUser->getEmail(),
|
||||||
|
|||||||
Reference in New Issue
Block a user