IAV-848/feat: Local CustomerCareAgentIntegration tracking + integration deletion rollback + fake credential refactor
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:
- Create fake credential
- Update n8n workflow nodes
- Delete
CustomerCareAgentIntegration - 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_AUTHcorrectly replacesINSTAGRAMin all downstream calls (n8n, orchestration) - Known bug in
countActiveUserProvidedChannels/hasAtLeastOneUserProvidedChannel(inverted logic) is not fixed in this MR -
generateFakeCredentialDataFromSchemaStrictremains dead code inAgentIntegrationServiceImpl
Related Issues
Closes IAV-848