diff --git a/infrastructure/hubspot/deal_properties_client.py b/infrastructure/hubspot/deal_properties_client.py index eb2e132d4..24cf5fca8 100644 --- a/infrastructure/hubspot/deal_properties_client.py +++ b/infrastructure/hubspot/deal_properties_client.py @@ -1,4 +1,5 @@ from hubspot.client import Client # type: ignore[reportMissingTypeStubs] +from hubspot.crm.deals import SimplePublicObjectInput # type: ignore[reportMissingTypeStubs] class HubspotDealPropertiesClient: @@ -15,4 +16,9 @@ class HubspotDealPropertiesClient: def write_deal_property( self, deal_id: str, property_name: str, value: str ) -> None: - raise NotImplementedError + self._client.crm.deals.basic_api.update( # type: ignore[reportUnknownMemberType] + deal_id, + simple_public_object_input=SimplePublicObjectInput( + properties={property_name: value} + ), + ) diff --git a/orchestration/abri_log_job_orchestrator.py b/orchestration/abri_log_job_orchestrator.py index b80d39bf5..811d008af 100644 --- a/orchestration/abri_log_job_orchestrator.py +++ b/orchestration/abri_log_job_orchestrator.py @@ -98,4 +98,13 @@ class AbriLogJobOrchestrator: if isinstance(outcome, AbriRequestRejected): return outcome + self._hubspot.write_deal_property( + deal_id=booking.deal_id, + property_name=JOB_NO_DEAL_PROPERTY, + value=outcome.job_no, + ) + self._deal_database.record_job_no( + deal_id=booking.deal_id, job_no=outcome.job_no + ) + return LogJobSummary(deal_id=booking.deal_id, job_no=outcome.job_no)