wip: submit booking to api
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\BusProNet\Model;
|
||||
|
||||
/**
|
||||
* Represents a successful API response from a booking request.
|
||||
*
|
||||
* Response structure for successful requests:
|
||||
* - <buchung>möglich</buchung> = inquiry validation successful
|
||||
* - <buchung>erfolgt</buchung> = booking creation successful
|
||||
*
|
||||
* Error responses return Notification objects instead (typ="HINWEIS").
|
||||
*/
|
||||
class BookingResponse
|
||||
{
|
||||
/**
|
||||
* @param string $status Booking status (möglich|erfolgt)
|
||||
* @param string|null $transactionNumber Transaction number (vorgang)
|
||||
* @param array<int, PriceItem> $priceItems Individual price items from response
|
||||
* @param float|null $totalPrice Total price (gesamtpreis)
|
||||
* @param PaymentTerms|null $paymentTerms Payment terms (anzahlung/restzahlung)
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly string $status,
|
||||
public readonly ?string $transactionNumber = null,
|
||||
public readonly array $priceItems = [],
|
||||
public readonly ?float $totalPrice = null,
|
||||
public readonly ?PaymentTerms $paymentTerms = null,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the inquiry validation was successful.
|
||||
*/
|
||||
public function isInquiryValid(): bool
|
||||
{
|
||||
return 'möglich' === $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the booking was successfully created.
|
||||
*/
|
||||
public function isBookingSuccessful(): bool
|
||||
{
|
||||
return 'erfolgt' === $this->status;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user