fix: apply correct return type and response handling

This commit is contained in:
Björn Fromme
2026-01-06 14:05:51 +01:00
parent 96205c14db
commit 1c1766bbd4
4 changed files with 9 additions and 8 deletions
+3 -3
View File
@@ -9,7 +9,7 @@ use App\BusProNet\Model\BaseData;
use App\BusProNet\Model\Booking;
use App\BusProNet\Model\BookingResponse;
use App\BusProNet\Model\BookingUpdate;
use App\BusProNet\Model\ContactFormResponse;
use App\BusProNet\Model\RegistrationResponse;
use App\BusProNet\Model\CrmAttributes;
use App\BusProNet\Model\Notification;
use App\BusProNet\Model\PersonalData;
@@ -79,7 +79,7 @@ class ApiClient
/**
* @throws ApiClientException
*/
public function register(RegistrationDto $registrationData): Notification
public function register(RegistrationDto $registrationData): Notification|RegistrationResponse
{
$data = [
'user' => $this->config['bpn_username'],
@@ -144,7 +144,7 @@ class ApiClient
public function createAddress(
PersonalData $personalData,
bool $debug = false,
): ContactFormResponse|Notification {
): RegistrationResponse|Notification {
$data = [
'user' => $this->config['bpn_username'],
'key' => $this->createKey($this->config['bpn_username'], $this->config['bpn_password'], static::TYPE_CUSTOMER_DATA),
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\BusProNet\Model;
class ContactFormResponse
class RegistrationResponse
{
public function __construct(
public readonly int $addressId,
@@ -4,18 +4,18 @@ declare(strict_types=1);
namespace App\BusProNet\XmlParser;
use App\BusProNet\Model\ContactFormResponse;
use App\BusProNet\Model\RegistrationResponse;
use Symfony\Component\DomCrawler\Crawler;
class ContactFormResponseParser extends AbstractParser
{
public function parse(Crawler $node): ContactFormResponse
public function parse(Crawler $node): RegistrationResponse
{
$addressId = (int) $node->filterXPath('//idadresse')->text();
$personId = (int) $node->filterXPath('//idperson')->text();
$isNewRecord = $this->getBoolValue($node->filterXPath('//neuanlage'));
return new ContactFormResponse(
return new RegistrationResponse(
addressId: $addressId,
personId: $personId,
isNewRecord: $isNewRecord,