fix: give chatbot pickups per-leg surcharges including the return leg
This commit is contained in:
1 parent
ac5ca7b18b
commit
3cb1548f2f
8 files changed
+58
-7
No files matched your search
@@ -188,7 +188,8 @@ class ProductExportBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* Outbound boarding points joined against zustiege.xml, in source order.
|
||||
* Outbound boarding points joined against zustiege.xml, in source order, each with the
|
||||
* same point's return-leg entry. A point listed on the return leg only is not emitted.
|
||||
*
|
||||
* getPickups() resolves both zeit shapes and rolls a bare time past midnight onto the
|
||||
* next day. Entries with id 0 are kept: the consumer drops them itself.
|
||||
@@ -206,6 +207,7 @@ class ProductExportBuilder
|
||||
{
|
||||
$resolved = [];
|
||||
$clockDate = new \DateTimeImmutable($dateFrom->format('Y-m-d'), new \DateTimeZone('UTC'));
|
||||
$returnLegs = $this->travelParser->getPickups($this->productExportParser->children($dateNode, 'zustiege_rueck/zustieg_rueck'), null, false);
|
||||
|
||||
foreach ($this->travelParser->getPickups($this->productExportParser->children($dateNode, 'zustiege/zustieg'), $clockDate, true) as $pickup) {
|
||||
$pickupId = (int) $pickup->id;
|
||||
@@ -221,6 +223,8 @@ class ProductExportBuilder
|
||||
'city' => $details?->city,
|
||||
'street' => $details?->street,
|
||||
'price' => $pickup->price,
|
||||
'returnLeg' => isset($returnLegs[$pickupId]),
|
||||
'returnPrice' => ($returnLegs[$pickupId] ?? null)?->price,
|
||||
'datetime' => $pickup->time?->format('Y-m-d\TH:i:s'),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user