From ce7b302c1790ce69f19ea99bb444e6a2268c7523 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 6 Jul 2026 15:51:21 +0000 Subject: [PATCH] =?UTF-8?q?Log=20an=20OpenHousing=20job=20from=20a=20confi?= =?UTF-8?q?rmed=20survey=20booking's=20deal=20fields=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- orchestration/abri_log_job_orchestrator.py | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/orchestration/abri_log_job_orchestrator.py b/orchestration/abri_log_job_orchestrator.py index b31cfe1c3..b80d39bf5 100644 --- a/orchestration/abri_log_job_orchestrator.py +++ b/orchestration/abri_log_job_orchestrator.py @@ -2,7 +2,9 @@ from dataclasses import dataclass from datetime import date from typing import Optional, Protocol, Union -from domain.abri.models import AbriRequestRejected, PlaceRef +from domain.abri.descriptions import build_job_descriptions +from domain.abri.models import AbriRequestRejected, LogJobRequest, PlaceRef +from domain.abri.slots import slot_for_confirmed_time from infrastructure.abri.abri_client import AbriClient from infrastructure.hubspot.deal_properties_client import HubspotDealPropertiesClient @@ -58,7 +60,7 @@ def client_ref_for_deal(deal_id: str) -> str: re-logging after a cancellation would repeat the bare deal ID) is an open question on issue #1478. Swap the derivation here once Abri answers. """ - raise NotImplementedError + return deal_id class AbriLogJobOrchestrator: @@ -79,4 +81,21 @@ class AbriLogJobOrchestrator: self._deal_database = deal_database def run(self, booking: ConfirmedSurveyBooking) -> LogJobOrchestrationResult: - raise NotImplementedError + descriptions = build_job_descriptions(booking.deal_name) + outcome = self._abri.log_job( + LogJobRequest( + client_ref=client_ref_for_deal(booking.deal_id), + place_ref=booking.place_ref, + appointment_date=booking.confirmed_survey_date, + appointment_time=slot_for_confirmed_time( + booking.confirmed_survey_time + ), + short_description=descriptions.short_description, + long_description=descriptions.long_description, + ) + ) + + if isinstance(outcome, AbriRequestRejected): + return outcome + + return LogJobSummary(deal_id=booking.deal_id, job_no=outcome.job_no)