feat: simplify xml parsing, add 'mutable' property for personal data

This commit is contained in:
Björn Fromme
2025-01-30 10:40:38 +01:00
parent c75f069ce0
commit eae9879519
8 changed files with 47 additions and 32 deletions
+4 -6
View File
@@ -32,8 +32,7 @@ class BookingParser extends AbstractParser
$booking->agencyId = $this->getIntOrNullValue($node->filterXPath('//idagentur'));
$booking->bookingNumber = $this->getIntOrNullValue($node->filterXPath('//vorgang'));
$booking->invoiceNumber = $this->getIntOrNullValue($node->filterXPath('//zahlungsdaten/rechnung'));
$booking->totalPrice = $this
->stringToFloat($this->getStringOrNullValue($node->filterXPath('//zahlungsdaten/gesamtbetrag')));
$booking->totalPrice = $this->getFloatOrNullValue($node->filterXPath('//zahlungsdaten/gesamtbetrag'));
$booking->status = $this->getStringOrNullValue($node->filterXPath('//status'));
$travelData = $node->filterXPath('//reise');
@@ -48,8 +47,7 @@ class BookingParser extends AbstractParser
$booking->applicant = $this->parsePersonalData($node->filterXPath('//anmelder'));
$participantsStatus = $this
->stringToArray($this->getStringOrNullValue($node->filterXPath('//status_teilnehmer')), '/');
$participantsStatus = $this->getArrayValue($node->filterXPath('//status_teilnehmer'), '/');
$booking->participantsStatus = array_combine(range(1, count($participantsStatus)), $participantsStatus);
$booking->participants = $this->parseParticipants($node->filterXPath('//teilnehmerliste/teilnehmer'));
@@ -109,6 +107,7 @@ class BookingParser extends AbstractParser
$personalData->addressId = $this->getIntOrNullValue($node->filterXPath('//idadresse'));
$personalData->personId = $this->getIntOrNullValue($node->filterXPath('//idadresseperson'));
$personalData->mutable = $this->getBoolValue($node->filterXPath('//aenderungmoeglich'));
$dateString = $this->getStringOrNullValue($node->filterXPath('//geburtsdatum'));
$personalData->dateOfBirth = null !== $dateString
@@ -145,8 +144,7 @@ class BookingParser extends AbstractParser
$communication->phone = $this->getStringOrNullValue($contactNode->filterXPath('//telefonprivat'));
$communication->mobile = $this->getStringOrNullValue($contactNode->filterXPath('//telefonmobil'));
$communication->email = $this->getStringOrNullValue($contactNode->filterXPath('//email'));
$communication->newsletter = $this
->stringToBool($contactNode->filterXPath('//newsletter')->text('False'));
$communication->newsletter = $this->getBoolValue($contactNode->filterXPath('//newsletter'));
$personalData->communication = $communication;
}