# ADR-0001: DPS as a new standalone umbrella app

## Status

Accepted

## Context

The business team shared a target-state design for a "Dispute Management Automation" product (DPS — Dispute Processing System) covering the full chargeback lifecycle: dispute initiation, case creation, evidence collection, evidence submission, network processing (Visa RTSI / Mastercom), and decision/closure, plus capabilities like configurable workflows, SLA management, evidence automation, reason-code mapping, re-presentment, win-rate analytics, fraud collaboration, and custom workflows.

A working slice of this already exists: `SettlementCore.ChargebackCase` (table `chargeback_cases`), a CSV importer, a REST controller, and a LiveView dashboard for case management, representment/pre-arbitration/resolve/write-off transitions. It currently lives inside `settlement_core`, which is a financial-reconciliation app (settlement MIS, payouts, bank/scheme file parsing, merchant adjustments) — not a dispute-management app. As DPS grows to cover the full target-state feature set, keeping it inside `settlement_core` would keep coupling dispute-lifecycle concerns to reconciliation concerns indefinitely.

## Decision

Extract dispute/chargeback management into a new standalone umbrella app, `apps/dispute_core`, following the same scaffolding pattern as `apps/risk_core` (minimal core app: `mix.exs`, `application.ex` with an `:enabled` config gate, a thin facade module delegating to a `Context`). Existing chargeback code is migrated into it (see ADR-0002 for the dependency-direction resolution required to do this without a circular umbrella dependency), and new DPS capabilities are built there going forward.

## Alternatives considered

- **Expand in place inside `settlement_core`.** Rejected — wrong domain home. Would keep growing an unrelated reconciliation app with dispute-lifecycle, network-integration, and evidence-management code that has nothing to do with settlement/MIS/payouts.

## Consequences

- One-time migration cost: existing schema, context functions, CSV importer, controller, and LiveView move to the new app and get their aliases updated (Phase 1 of the DPS implementation plan).
- Cleaner ownership going forward — `dispute_core` becomes the single place all dispute/chargeback domain logic lives, matching the `*_core` app-per-domain convention already used by `tms_core`, `settlement_core`, `risk_core`, `agent_core`.
- `platform_web` gains a new umbrella dependency (`{:dispute_core, in_umbrella: true}`).
