# anurag171/payment-platform architecture

> Architecture diagram of the GitHub repository anurag171/payment-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anurag171/payment-platform
- Repository: https://github.com/anurag171/payment-platform

## Overview

This is a Temporal-based payment orchestration platform split into workflow and activity worker services, with a gateway for REST/MQ/Kafka ingress and asynchronous response delivery. The principal journey is inbound payment normalization and translation, qualification/enrichment, value-date warehousing, MOP and clearing-rail derivation, partner and clearing processing, and audit/state persistence; repair and reversal are additional branches. The README documents the task-queue model and service responsibilities; sampled source also confirms gateway status/repair behavior and Redis correlation. Unsampled workflow wiring is shown only where the README supports it.

Main entry points: [`services/payment-gateway-service/src/main/java/com/bank/payment/orchestration`](https://github.com/anurag171/payment-platform/tree/main/services/payment-gateway-service/src/main/java/com/bank/payment/orchestration) (Payment gateway), [`services/payment-processing-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/PaymentProcessingWorkflowImpl.java`](https://github.com/anurag171/payment-platform/blob/main/services/payment-processing-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/PaymentProcessingWorkflowImpl.java) (Processing workflow), [`services/payment-gateway-service/src/main/java/com/bank/payment/orchestration/messaging`](https://github.com/anurag171/payment-platform/tree/main/services/payment-gateway-service/src/main/java/com/bank/payment/orchestration/messaging) (Response listeners), [`services/inbound-normalization-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/InboundNormalizationWorkflowImpl.java`](https://github.com/anurag171/payment-platform/blob/main/services/inbound-normalization-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/InboundNormalizationWorkflowImpl.java) (Normalize workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["Gateway and simulation"]
  node_gateway["Payment gateway"]
  node_inbound["Inbound listener"]
  node_response["Response listeners"]
  node_simulator["Payment simulator"]
end

subgraph group_workflows["Payment workflows"]
  node_normalize["Normalize workflow"]
  node_qualify["Qualification workflow"]
  node_warehouse["Warehouse workflow"]
  node_mop["MOP workflow"]
  node_processing["Processing workflow"]
  node_repair["Repair workflow"]
end

subgraph group_activities["Activity workers"]
  node_translation["Translation worker"]
  node_enrichment["Enrichment worker"]
  node_value_date["Value-date worker"]
  node_mop_worker["MOP worker"]
  node_partner["Partner worker"]
  node_clearing["Clearing worker"]
  node_audit["Audit worker"]
  node_repair_worker["Repair worker"]
  node_reversal["Reversal worker"]
end

subgraph group_state["State and correlation"]
  node_payment_store[("Payment repository")]
  node_audit_store[("Audit repository")]
  node_correlation["Correlation registry"]
end

subgraph group_infra["External systems"]
  node_temporal{{"Temporal service"}}
  node_mq["Inbound MQ"]
  node_kafka["Kafka topics"]
  node_redis[("Redis")]
  node_mongodb[("MongoDB")]
  node_customer["Customer/account services"]
end

node_payer(("Payment source"))
node_operator(("Repair operator"))

node_payer -->|"sends payment"| node_mq
node_mq -->|"delivers message"| node_inbound
node_inbound -->|"starts workflow"| node_temporal
node_gateway -->|"starts workflows"| node_temporal
node_operator -->|"submits correction"| node_gateway
node_gateway -->|"signals repair"| node_temporal
node_temporal -->|"dispatches task"| node_normalize
node_normalize -->|"schedules qualification"| node_temporal
node_temporal -->|"dispatches task"| node_qualify
node_qualify -->|"schedules activities"| node_temporal
node_temporal -->|"dispatches task"| node_enrichment
node_qualify -->|"schedules warehouse"| node_temporal
node_temporal -->|"dispatches task"| node_warehouse
node_warehouse -->|"schedules value date"| node_temporal
node_temporal -->|"dispatches task"| node_value_date
node_temporal -->|"dispatches task"| node_translation
node_normalize -->|"schedules translation"| node_temporal
node_temporal -->|"dispatches task"| node_mop
node_mop -->|"schedules MOP activity"| node_temporal
node_temporal -->|"dispatches task"| node_mop_worker
node_mop -->|"schedules processing"| node_temporal
node_temporal -->|"dispatches task"| node_processing
node_processing -->|"schedules partner work"| node_temporal
node_temporal -->|"dispatches task"| node_partner
node_processing -->|"schedules clearing work"| node_temporal
node_temporal -->|"dispatches task"| node_clearing
node_temporal -->|"dispatches task"| node_repair
node_repair -->|"schedules repair activity"| node_temporal
node_temporal -->|"dispatches task"| node_repair_worker
node_repair -->|"schedules requalification"| node_temporal
node_processing -->|"schedules reversal"| node_temporal
node_temporal -->|"dispatches task"| node_reversal
node_partner -->|"publishes requests"| node_kafka
node_clearing -->|"submits clearing"| node_kafka
node_kafka -->|"delivers responses"| node_response
node_response -->|"signals workflows"| node_temporal
node_partner -->|"registers pending"| node_correlation
node_response -->|"checks delivery"| node_correlation
node_correlation -->|"reads/writes keys"| node_redis
node_audit -->|"writes payment"| node_payment_store
node_audit -->|"writes audit trail"| node_audit_store
node_payment_store -->|"persists state"| node_mongodb
node_audit_store -->|"persists records"| node_mongodb
node_gateway -->|"reads status"| node_payment_store
node_gateway -->|"reads audit trail"| node_audit_store
node_enrichment -.->|"enriches data"| node_customer
node_simulator -.->|"publishes simulated replies"| node_kafka
node_simulator -.->|"publishes synthetic input"| node_mq

click node_gateway "https://github.com/anurag171/payment-platform/tree/main/services/payment-gateway-service/src/main/java/com/bank/payment/orchestration"
click node_inbound "https://github.com/anurag171/payment-platform/blob/main/services/payment-gateway-service/src/main/java/com/bank/payment/orchestration/messaging/InboundMqListener.java"
click node_response "https://github.com/anurag171/payment-platform/tree/main/services/payment-gateway-service/src/main/java/com/bank/payment/orchestration/messaging"
click node_simulator "https://github.com/anurag171/payment-platform/tree/main/services/payment-simulator-service/src/main/java/com/bank/payment/orchestration"
click node_normalize "https://github.com/anurag171/payment-platform/blob/main/services/inbound-normalization-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/InboundNormalizationWorkflowImpl.java"
click node_qualify "https://github.com/anurag171/payment-platform/blob/main/services/qualification-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/QualificationWorkflowImpl.java"
click node_warehouse "https://github.com/anurag171/payment-platform/blob/main/services/warehouse-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/WarehouseWorkflowImpl.java"
click node_mop "https://github.com/anurag171/payment-platform/blob/main/services/mop-derivation-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/MopDerivationWorkflowImpl.java"
click node_processing "https://github.com/anurag171/payment-platform/blob/main/services/payment-processing-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/PaymentProcessingWorkflowImpl.java"
click node_repair "https://github.com/anurag171/payment-platform/blob/main/services/repair-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/RepairWorkflowImpl.java"
click node_translation "https://github.com/anurag171/payment-platform/blob/main/services/translation-activity-service/src/main/java/com/bank/payment/orchestration/activities/TranslationActivitiesImpl.java"
click node_enrichment "https://github.com/anurag171/payment-platform/blob/main/services/enrichment-activity-service/src/main/java/com/bank/payment/orchestration/activities/EnrichmentActivitiesImpl.java"
click node_value_date "https://github.com/anurag171/payment-platform/blob/main/services/value-date-activity-service/src/main/java/com/bank/payment/orchestration/activities/ValueDateActivitiesImpl.java"
click node_mop_worker "https://github.com/anurag171/payment-platform/blob/main/services/mop-activity-service/src/main/java/com/bank/payment/orchestration/activities/MopActivitiesImpl.java"
click node_partner "https://github.com/anurag171/payment-platform/blob/main/services/partner-activity-service/src/main/java/com/bank/payment/orchestration/activities/PartnerActivitiesImpl.java"
click node_clearing "https://github.com/anurag171/payment-platform/blob/main/services/clearing-activity-service/src/main/java/com/bank/payment/orchestration/activities/ClearingActivitiesImpl.java"
click node_audit "https://github.com/anurag171/payment-platform/blob/main/services/audit-activity-service/src/main/java/com/bank/payment/orchestration/activities/AuditActivitiesImpl.java"
click node_repair_worker "https://github.com/anurag171/payment-platform/blob/main/services/repair-activity-service/src/main/java/com/bank/payment/orchestration/activities/RepairActivitiesImpl.java"
click node_reversal "https://github.com/anurag171/payment-platform/blob/main/services/reversal-activity-service/src/main/java/com/bank/payment/orchestration/activities/ReversalActivitiesImpl.java"
click node_payment_store "https://github.com/anurag171/payment-platform/blob/main/payment-common/src/main/java/com/bank/payment/orchestration/repository/PaymentRepository.java"
click node_audit_store "https://github.com/anurag171/payment-platform/blob/main/payment-common/src/main/java/com/bank/payment/orchestration/repository/WorkflowAuditRepository.java"
click node_correlation "https://github.com/anurag171/payment-platform/blob/main/payment-common/src/main/java/com/bank/payment/orchestration/correlation/PartnerCorrelationService.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gateway,node_inbound,node_response,node_simulator toneBlue
class node_normalize,node_qualify,node_warehouse,node_mop,node_processing,node_repair toneAmber
class node_translation,node_enrichment,node_value_date,node_mop_worker,node_partner,node_clearing,node_audit,node_repair_worker,node_reversal toneMint
class node_payment_store,node_audit_store,node_correlation toneRose
class node_temporal,node_mq,node_kafka,node_redis,node_mongodb,node_customer,node_payer,node_operator toneIndigo
```

## Components

### Gateway and simulation

- [Payment gateway](https://github.com/anurag171/payment-platform/tree/main/services/payment-gateway-service/src/main/java/com/bank/payment/orchestration): `services/payment-gateway-service/src/main/java/com/bank/payment/orchestration`
- [Inbound listener](https://github.com/anurag171/payment-platform/blob/main/services/payment-gateway-service/src/main/java/com/bank/payment/orchestration/messaging/InboundMqListener.java): `services/payment-gateway-service/src/main/java/com/bank/payment/orchestration/messaging/InboundMqListener.java`
- [Response listeners](https://github.com/anurag171/payment-platform/tree/main/services/payment-gateway-service/src/main/java/com/bank/payment/orchestration/messaging): `services/payment-gateway-service/src/main/java/com/bank/payment/orchestration/messaging`
- [Payment simulator](https://github.com/anurag171/payment-platform/tree/main/services/payment-simulator-service/src/main/java/com/bank/payment/orchestration): `services/payment-simulator-service/src/main/java/com/bank/payment/orchestration`

### Payment workflows

- [Normalize workflow](https://github.com/anurag171/payment-platform/blob/main/services/inbound-normalization-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/InboundNormalizationWorkflowImpl.java): `services/inbound-normalization-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/InboundNormalizationWorkflowImpl.java`
- [Qualification workflow](https://github.com/anurag171/payment-platform/blob/main/services/qualification-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/QualificationWorkflowImpl.java): `services/qualification-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/QualificationWorkflowImpl.java`
- [Warehouse workflow](https://github.com/anurag171/payment-platform/blob/main/services/warehouse-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/WarehouseWorkflowImpl.java): `services/warehouse-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/WarehouseWorkflowImpl.java`
- [MOP workflow](https://github.com/anurag171/payment-platform/blob/main/services/mop-derivation-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/MopDerivationWorkflowImpl.java): `services/mop-derivation-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/MopDerivationWorkflowImpl.java`
- [Processing workflow](https://github.com/anurag171/payment-platform/blob/main/services/payment-processing-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/PaymentProcessingWorkflowImpl.java): `services/payment-processing-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/PaymentProcessingWorkflowImpl.java`
- [Repair workflow](https://github.com/anurag171/payment-platform/blob/main/services/repair-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/RepairWorkflowImpl.java): `services/repair-workflow-service/src/main/java/com/bank/payment/orchestration/workflow/impl/RepairWorkflowImpl.java`

### Activity workers

- [Translation worker](https://github.com/anurag171/payment-platform/blob/main/services/translation-activity-service/src/main/java/com/bank/payment/orchestration/activities/TranslationActivitiesImpl.java): `services/translation-activity-service/src/main/java/com/bank/payment/orchestration/activities/TranslationActivitiesImpl.java`
- [Enrichment worker](https://github.com/anurag171/payment-platform/blob/main/services/enrichment-activity-service/src/main/java/com/bank/payment/orchestration/activities/EnrichmentActivitiesImpl.java): `services/enrichment-activity-service/src/main/java/com/bank/payment/orchestration/activities/EnrichmentActivitiesImpl.java`
- [Value-date worker](https://github.com/anurag171/payment-platform/blob/main/services/value-date-activity-service/src/main/java/com/bank/payment/orchestration/activities/ValueDateActivitiesImpl.java): `services/value-date-activity-service/src/main/java/com/bank/payment/orchestration/activities/ValueDateActivitiesImpl.java`
- [MOP worker](https://github.com/anurag171/payment-platform/blob/main/services/mop-activity-service/src/main/java/com/bank/payment/orchestration/activities/MopActivitiesImpl.java): `services/mop-activity-service/src/main/java/com/bank/payment/orchestration/activities/MopActivitiesImpl.java`
- [Partner worker](https://github.com/anurag171/payment-platform/blob/main/services/partner-activity-service/src/main/java/com/bank/payment/orchestration/activities/PartnerActivitiesImpl.java): `services/partner-activity-service/src/main/java/com/bank/payment/orchestration/activities/PartnerActivitiesImpl.java`
- [Clearing worker](https://github.com/anurag171/payment-platform/blob/main/services/clearing-activity-service/src/main/java/com/bank/payment/orchestration/activities/ClearingActivitiesImpl.java): `services/clearing-activity-service/src/main/java/com/bank/payment/orchestration/activities/ClearingActivitiesImpl.java`
- [Audit worker](https://github.com/anurag171/payment-platform/blob/main/services/audit-activity-service/src/main/java/com/bank/payment/orchestration/activities/AuditActivitiesImpl.java): `services/audit-activity-service/src/main/java/com/bank/payment/orchestration/activities/AuditActivitiesImpl.java`
- [Repair worker](https://github.com/anurag171/payment-platform/blob/main/services/repair-activity-service/src/main/java/com/bank/payment/orchestration/activities/RepairActivitiesImpl.java): `services/repair-activity-service/src/main/java/com/bank/payment/orchestration/activities/RepairActivitiesImpl.java`
- [Reversal worker](https://github.com/anurag171/payment-platform/blob/main/services/reversal-activity-service/src/main/java/com/bank/payment/orchestration/activities/ReversalActivitiesImpl.java): `services/reversal-activity-service/src/main/java/com/bank/payment/orchestration/activities/ReversalActivitiesImpl.java`

### State and correlation

- [Payment repository](https://github.com/anurag171/payment-platform/blob/main/payment-common/src/main/java/com/bank/payment/orchestration/repository/PaymentRepository.java): `payment-common/src/main/java/com/bank/payment/orchestration/repository/PaymentRepository.java`
- [Audit repository](https://github.com/anurag171/payment-platform/blob/main/payment-common/src/main/java/com/bank/payment/orchestration/repository/WorkflowAuditRepository.java): `payment-common/src/main/java/com/bank/payment/orchestration/repository/WorkflowAuditRepository.java`
- [Correlation registry](https://github.com/anurag171/payment-platform/blob/main/payment-common/src/main/java/com/bank/payment/orchestration/correlation/PartnerCorrelationService.java): `payment-common/src/main/java/com/bank/payment/orchestration/correlation/PartnerCorrelationService.java`

### External systems

- **Temporal service**
- **Inbound MQ**
- **Kafka topics**
- **Redis**
- **MongoDB**
- **Customer/account services**

### Other components

- **Payment source**
- **Repair operator**

## Connections

- Payment source → Inbound MQ: sends payment
- Inbound MQ → Inbound listener: delivers message
- Inbound listener → Temporal service: starts workflow
- Payment gateway → Temporal service: starts workflows
- Repair operator → Payment gateway: submits correction
- Payment gateway → Temporal service: signals repair
- Temporal service → Normalize workflow: dispatches task
- Normalize workflow → Temporal service: schedules qualification
- Temporal service → Qualification workflow: dispatches task
- Qualification workflow → Temporal service: schedules activities
- Temporal service → Enrichment worker: dispatches task
- Qualification workflow → Temporal service: schedules warehouse
- Temporal service → Warehouse workflow: dispatches task
- Warehouse workflow → Temporal service: schedules value date
- Temporal service → Value-date worker: dispatches task
- Temporal service → Translation worker: dispatches task
- Normalize workflow → Temporal service: schedules translation
- Temporal service → MOP workflow: dispatches task
- MOP workflow → Temporal service: schedules MOP activity
- Temporal service → MOP worker: dispatches task
- MOP workflow → Temporal service: schedules processing
- Temporal service → Processing workflow: dispatches task
- Processing workflow → Temporal service: schedules partner work
- Temporal service → Partner worker: dispatches task
- Processing workflow → Temporal service: schedules clearing work
- Temporal service → Clearing worker: dispatches task
- Temporal service → Repair workflow: dispatches task
- Repair workflow → Temporal service: schedules repair activity
- Temporal service → Repair worker: dispatches task
- Repair workflow → Temporal service: schedules requalification
- Processing workflow → Temporal service: schedules reversal
- Temporal service → Reversal worker: dispatches task
- Partner worker → Kafka topics: publishes requests
- Clearing worker → Kafka topics: submits clearing
- Kafka topics → Response listeners: delivers responses
- Response listeners → Temporal service: signals workflows
- Partner worker → Correlation registry: registers pending
- Response listeners → Correlation registry: checks delivery
- Correlation registry → Redis: reads/writes keys
- Audit worker → Payment repository: writes payment
- Audit worker → Audit repository: writes audit trail
- Payment repository → MongoDB: persists state
- Audit repository → MongoDB: persists records
- Payment gateway → Payment repository: reads status
- Payment gateway → Audit repository: reads audit trail
- Enrichment worker → Customer/account services: enriches data
- Payment simulator → Kafka topics: publishes simulated replies
- Payment simulator → Inbound MQ: publishes synthetic input
