Skip to main content
Version: v2

Improvement Roadmap

Purpose

This document captures the current state, target state, and migration path for each area of the Convenient Checkout v2 platform. In a highly regulated payments industry, engineering excellence is not optional — it directly impacts compliance, reliability, customer trust, and speed of delivery.

Every improvement listed here is grounded in industry best practices for payment platforms: data protection, observability-driven operations, schema-first API development, and domain-driven design.


Roadmap Summary

#AreaCurrent MaturityTarget MaturityPriorityPhase
1Commons Library Consolidation🟡 Mixed v1/v2🟢 Unified v2P1Phase 1
2Error Model Unification🟡 Dual models🟢 Problem everywhereP1Phase 1
3Domain Boundary Enforcement🟠 Blurred🟢 Clean bounded contextsP2Phase 2
4Test Coverage & Contract Testing🟠 Inconsistent🟢 Enforced minimums + contractsP2Phase 2
5Observability & Structured Logging🟠 Basic🟢 Full distributed tracing + dashboardsP2Phase 2
6Schema-First API Development🟡 Manual sync🟢 Generated validation from OpenAPIP3Phase 3
7Event-Driven Architecture🟡 Partial🟢 Full event sourcing for auditP3Phase 3
8Automated Compliance Checks🟠 Manual review🟢 CI/CD pipeline gatesP3Phase 3

Phase 1 — Foundation (Current Focus)

1. Commons Library Consolidation

AspectCurrent StateTarget State
Package structurev1 DTOs in event/, v2 DTOs in events/v2/, POJOs in pojo/ — significant overlapSingle v2/ package hierarchy; event/ and pojo/ deprecated
Enum duplicationPaymentStatus exists in both enums.payment and event.shared.paymentSingle canonical location in enums/
v1/v2 coexistenceBoth ErrorResponse (v1) and Problem (v2) actively consumedAll services migrated to Problem; ErrorResponse deprecated
JavadocPartial — some classes documented, some not100% of public classes and enums documented

Migration Steps:

  1. Audit all services for v1 DTO usage → produce dependency matrix
  2. Create @Deprecated annotations on all v1 classes with Javadoc pointing to v2 replacement
  3. Service-by-service migration: replace v1 imports with v2 equivalents
  4. Remove deprecated v1 classes after all services migrated (min 2-sprint window)
  5. Clean up duplicate enums — keep enums/ as the canonical source

2. Error Model Unification

AspectCurrent StateTarget State
Error response DTOErrorResponse (v1) with ErrorDetails and ErrorGroupProblem (v2) with RFC 7807 alignmentProblem as the only error response DTO
Error propagationInconsistent: some services return raw exception messagesAll errors flow through Problem.from(ErrorResponse) or factory methods
Error codesJSON files in docs site (payment-api.json, refund-api.json)JSON files as source of truth; generated documentation

Migration Steps:

  1. Ensure all v2 controller exception handlers return Problem instances
  2. Replace all raw ErrorResponse returns with Problem.from() conversions
  3. Add Problem builder validation: status must match title semantics
  4. Update all integration tests to assert against Problem structure

Phase 2 — Quality & Observability

3. Domain Boundary Enforcement

AspectCurrent StateTarget State
Service responsibilitiesSome services handle concerns from multiple domainsEach service owns a single bounded context
Cross-service communicationDirect REST calls + shared database access in some casesEvent-driven communication; no shared databases
Commons couplingServices depend on DTOs they don't needDomain-specific commons modules (e.g., commons-payment, commons-merchant)

Migration Steps:

  1. Map current cross-domain dependencies per service
  2. Identify and extract domain-specific modules from wallet-event-commons
  3. Implement anti-corruption layers at service boundaries
  4. Replace any shared database access with API calls or events

4. Test Coverage & Contract Testing

AspectCurrent StateTarget State
Unit test coverageVaries by service (30-80%)≥80% on all services, enforced in CI
Integration testsPresent but inconsistentTestcontainers-based, running on every PR
Contract testsNot consistently appliedConsumer-driven contracts between all service pairs
Webhook schema validationManualAutomated validation against openapi/v2/webhooks.yaml

Migration Steps:

  1. Add JaCoCo coverage reporting to all service CI pipelines
  2. Set minimum coverage gates (fail build below threshold)
  3. Implement Pact or Spring Cloud Contract for inter-service contracts
  4. Add webhook payload schema validation in integration tests

5. Observability & Structured Logging

AspectCurrent StateTarget State
LoggingMixed format; some structured, some freeform100% structured JSON logging with standard fields across all services
Correlation IDsPartially propagatedFull X-Request-Id propagation across all service hops
Azure Application InsightsBasic integrationFull distributed tracing with custom dimensions (merchantId, resourceId, requestId) on all telemetry
SplunkLogs shipped but inconsistent formatStructured JSON logs with standardized fields; operational dashboards per service
DashboardsLimitedPer-domain dashboards in Splunk and Application Insights: success rate, latency P50/P95/P99, error rate by code
AlertingAd-hocStandardized actionable alerts: error rate, latency, availability, dependency health
Sensitive data in logsManual reviewAutomated sensitive-field detection in log pipelines

Migration Steps:

  1. Standardize logging library and structured JSON format across all services
  2. Implement X-Request-Id propagation middleware in every service
  3. Add custom dimensions to Application Insights telemetry (merchantId, resourceId, requestId)
  4. Build per-domain dashboards in Splunk and Application Insights
  5. Configure actionable alerts with proper severity levels and escalation paths
  6. Add log scanning for sensitive data in CI

See the Observability guide for the full standards.


Phase 3 — Excellence

6. Schema-First API Development

AspectCurrent StateTarget State
API designCode-first; OpenAPI spec maintained manuallySchema-first: OpenAPI spec is the source of truth
Request validationBean validation annotations; manually synchronized with specGenerated validators from OpenAPI schema
Response contractsManually maintained DTOsGenerated response models from schema

7. Event-Driven Architecture

AspectCurrent StateTarget State
Event publishingWebhooks dispatched synchronously from serviceAsync event bus (Kafka/SQS) with webhook adapter
Audit trailDatabase records with timestampsFull event sourcing for payment state changes
Replay capabilityNot availableAbility to replay events for debugging or reconciliation

8. Automated Compliance Checks

AspectCurrent StateTarget State
Security scanningManual code reviewAutomated SAST rules for sensitive data patterns
Dependency scanningBasicAutomated CVE scanning with blocking gates
Secret detectionManualPre-commit hooks + CI scanning for secrets/keys
Audit log verificationManualAutomated tests verifying all state transitions produce audit records

Measuring Progress

MetricCurrentPhase 1 TargetPhase 2 TargetPhase 3 Target
v1 DTO usage (count of imports)~150+ across services< 5000
Unit test coverage (avg)~55%65%80%85%
Contract test coverage0 service pairs2 pairsAll pairsAll pairs
Structured logging adoption~40% of services60%100%100%
Sensitive data log violations (monthly)UnknownTracked< 50
Mean time to detect (MTTD)~30 min15 min5 min< 2 min