Skip to content

IAV-848/feat: Local CustomerCareAgentIntegration tracking + integration deletion rollback + fake credential refactor

salaheddine zidani a demandé de fusionner feature/IAV-848 vers develop

Description

Context

Agent integrations were previously tracked only on the external orchestration service side. This MR introduces a local CustomerCareAgentIntegration table as an internal source of truth, required for rollback operations on deletion and for future operations that need to avoid external calls.

Main Changes

Local integration service

CustomerCareAgentIntegration is now persisted locally when an integration is created. The service is idempotent: if the record already exists, it returns the existing result without error.

Fake credential refactor

Placeholder generation logic was duplicated between AgentFakeCredentialServiceImpl and AgentIntegrationServiceImpl. It is now centralized in AgentIntegrationHelper.generatePlaceholderData(), which also covers the new INSTAGRAM_HEADER_AUTH type.

Enriched rollback on deletion

IntegrationDeletionServiceImpl now performs 4 atomic steps:

  1. Create fake credential
  2. Update n8n workflow nodes
  3. Delete CustomerCareAgentIntegration
  4. Update ticketing system if Freshdesk

Rollback restores each step in reverse order, including CustomerCareAgentIntegration via an IntegrationSnapshot captured before the operation begins.

Explicit defaults on agent creation

Agents are now initialized with ticketingSystem = IAVIA, ecommercePlatform = WOOCOMMERCE and communicationChannels = {TELEGRAM} to guarantee a consistent state from creation.

Review Notes

  • Verify INSTAGRAM_HEADER_AUTH correctly replaces INSTAGRAM in all downstream calls (n8n, orchestration)
  • Known bug in countActiveUserProvidedChannels / hasAtLeastOneUserProvidedChannel (inverted logic) is not fixed in this MR
  • generateFakeCredentialDataFromSchemaStrict remains dead code in AgentIntegrationServiceImpl

Related Issues

Closes IAV-848

Rapports de requête de fusion