2.7 KiB
2.7 KiB
Contingent API Status
Summary
The contingent API is implemented on master. It serves cached availability data from HotelZimmer_*.xml files in var/xmlexportzimmer, using Flysystem and the tag-aware bpn.cache pool. XML sync now covers both travel and contingent datasets, invalidates xml-sync tagged cache entries, and logs dataset transfer errors without aborting the command.
Implemented
- OAuth-protected endpoints:
GET /api/contingents?hotelRef={hotelRef}&dateRef={dateRef}GET /api/contingents/rooms?hotelRef={hotelRef}&dateRef={dateRef}&dateFrom={Y-m-d}&dateTo={Y-m-d}GET /api/contingents/calendar?hotelRef={hotelRef}&dateFrom={Y-m-d}&dateTo={Y-m-d}
hotelRefanddateRefaccept numeric IDs or business codes; date codes are sanitized before lookup.- Parser/loader/service/controller flow is implemented via
ContingentParser,ContingentLoader,ContingentDataService, andContingentController. - Room responses include per date + room availability, pricing, status, and
bookingUrl. - BelKal control-room rows override date status and set room availability to
0for affected dates. - Room-level contingent links and one-hop root-level file links are supported.
app:bpn:xml-syncsyncs travel and contingents, invalidatesxml-synccache tags, and refreshes travel snapshots only when travel data synced.app:bpn:xml-cache-invalidatechecks both travel and contingent local XML exports.
Config
.envdefinesXML_EXPORT_CONTINGENTS_PATHandSFTP_XML_EXPORT_CONTINGENTS_*.config/packages/flysystem.yamldefines:xml_export_contingents.storagexml_source_contingents.storage
config/services.yamlwires contingent storage,bpn.cache, andAPP_BASE_URLfor booking URL generation.
Behavior Notes
- Missing contingent XML returns empty data.
- Unknown travel/date or hotel/date mismatches return
404from the API. - Invalid date ranges or formats return
400. - Dataset transfer failures are shown and logged as warnings, but
app:bpn:xml-syncstill completes with exit code0.
Remaining TODOs
- Decide whether room responses still need travel metadata fields such as
summer,servicesIncluded, andservicesOptional; these are not currently implemented. - If the XML files grow materially or cold-cache parsing becomes slow, revisit whether
ContingentParsershould move from DOM/Crawler parsing to a streaming parser. - Validate the deployed contingent SFTP environment variables before enabling scheduled sync in production.
Verification
- Covered by parser, loader, data service, controller, booking URL, XML sync, and cache invalidation tests.
- Current verification command:
php bin/phpunit.