Repository navigation
Releases: AlexGeryavenko/payment-gateway-challenge-java
Releases · AlexGeryavenko/payment-gateway-challenge-java
Release list
v1.0.2 - Post MVP Improvements
Post MVP Improvements
Feature enhancements, reliability improvements, and documentation updates added after the initial MVP implementation.
Features
- [PAYGATE-20] Idempotency key support — Optional
Idempotency-Keyheader (UUID) on POST prevents duplicate bank charges on client retries. Cached responses are returned
without calling the bank again. - [PAYGATE-21] Luhn algorithm validation — Card numbers are validated against the Luhn checksum before contacting the bank, catching typos and clearly fake numbers early.
- [PAYGATE-22] HTTP 201 Created — POST
/v1/paymentnow returns201 Createdwith aLocationheader pointing to the created payment resource, following REST
conventions. - [PAYGATE-23] Retry with exponential backoff — Bank calls are retried up to 3 times (500ms base, 2x multiplier) on transient failures before falling through to the
circuit breaker. - [PAYGATE-24] Correlation ID in error responses — Non-validation errors (404, 429, 502, 500) now include
correlationIdandtimestampin the JSON body for
traceability. - [PAYGATE-25] Bank failure logging — Failed bank authorization attempts are logged with payment context (paymentId, cardLast4, currency, amount) for incident
investigation.
Tests
- [PAYGATE-26] Rejected payment verification — Added tests confirming that rejected payments (expired card, Luhn-invalid) are not stored and return 404 on GET.
Documentation
- [PAYGATE-27] Error reference — Added comprehensive
doc/ERROR_REFERENCE.mdcovering all error types, HTTP status codes, validation rules, and troubleshooting guide. - [PAYGATE-28] README and manual testing guide — Updated README and
doc/MANUAL_TESTING_GUIDE.mdwith all new features: idempotency, Luhn validation, 201 status, retry
config, correlation ID in errors.
Fixes
- [PAYGATE-29] Dockerfile JAR version — Replaced hardcoded JAR version in Dockerfile with wildcard glob to prevent build failures on version bumps.
- [PAYGATE-30] Luhn-valid test cards — Replaced test card numbers that fail Luhn validation with valid alternatives (declined:
2222405343248828, bank error:
2222405343248810).
v0.2.0 — MVP
v0.2.0 — MVP
Highlights
MVP payment gateway with full observability, resilience patterns, build-time quality enforcement, and API versioning.
What's Changed
Observability
- Structured logging — JSON-formatted logs with correlation IDs and PCI-compliant masking ([PAYGATE-13])
- Business metrics —
payment_processed_totalcounter by status,bank_authorization_duration_secondshistogram ([PAYGATE-13]) - Docker support — Dockerfile and
docker-compose.ymlwith 6 services ([PAYGATE-13]) - Monitoring stack — Prometheus, Grafana, and Tempo with pre-provisioned dashboards (Application, Business, Infrastructure, Alerts) ([PAYGATE-14])
- Alerting — 5 Prometheus alert rules (HighBankErrorRate, HighRejectionRate, HighLatency, HighErrorRate, HighHeapUsage) routed through Alertmanager ([PAYGATE-15])
Resilience
- Circuit breaker — Resilience4j
bankClientinstance; opens on configurable failure rate, returns 502 with structured error ([PAYGATE-16]) - Rate limiting — Bucket4j per-IP token-bucket filter with separate GET/POST limits; returns 429 with
Retry-Afterheader ([PAYGATE-16])
Configuration & Quality
- Externalized config — All settings driven by
.envvia spring-dotenv (23 variables across 8 categories) ([PAYGATE-17]) - Quality gates —
./gradlew checkenforces JaCoCo >= 80% line coverage, Google Java Style (Checkstyle), and SpotBugs + FindSecBugs ([PAYGATE-18])
Bug Fixes
- API path versioning — Controller and rate limit filter now serve
/v1/paymentmatching the OpenAPI spec ([PAYGATE-19])
Documentation
- README rewrite — Services table, full configuration reference, resilience, monitoring, dashboards, and alerting sections ([PAYGATE-19])
Changelog
| Task | Type | Description |
|---|---|---|
| PAYGATE-13 | feat | Add structured logging, metrics, and Docker support |
| PAYGATE-14 | feat | Add Prometheus, Tempo, and Grafana observability stack |
| PAYGATE-15 | feat | Add Prometheus alerting rules and Alertmanager |
| PAYGATE-16 | feat | Add circuit breaker and per-IP rate limiting |
| PAYGATE-17 | chore | Externalize config with spring-dotenv and .env |
| PAYGATE-18 | feat | Add build-time quality gates |
| PAYGATE-19 | docs | Update README and fix API path versioning |
Services
| Service | Image | Port(s) |
|---|---|---|
| payment-gateway | (local build) | 8090 |
| bank_simulator | bbyars/mountebank:2.8.1 | 8080, 2525 |
| prometheus | prom/prometheus:v2.48.0 | 9090 |
| grafana | grafana/grafana:10.2.2 | 3000 |
| tempo | grafana/tempo:2.3.1 | 3200, 4317, 4318 |
| alertmanager | prom/alertmanager:v0.26.0 | 9093 |
API Endpoints
| Method | Path | Success | Error |
|---|---|---|---|
| POST | /v1/payment |
200 | 400, 429, 502 |
| GET | /v1/payment/{id} |
200 | 404, 429 |
v0.1.0 — Functional MVP
Functional MVP — Payment Gateway
Functional MVP implementation of the payment gateway service.
Features
- PAYGATE-1 — Implementation plan, OpenAPI specs, and C4 diagrams
- PAYGATE-2 — Characterization tests for
GET /payment/{id} - PAYGATE-3 — OpenAPI code generation for server interface and bank client
- PAYGATE-4 — Replace hand-written DTOs with generated models
- PAYGATE-5 — Domain model, entity, MapStruct mappers, and CQRS use cases
- PAYGATE-6 — Bank simulator integration with
POST /payment - PAYGATE-7 — PCI DSS log masking for PAN and CVV
- PAYGATE-8 — Externalize test fixtures to JSON files
- PAYGATE-9 — Externalize bank config with
@ConfigurationProperties - PAYGATE-10 — Validation edge-case tests for payment processing
- PAYGATE-11 — Catch-all exception handler to prevent stack trace leaks
- PAYGATE-12 — README rewrite and centralized dependency versions
Highlights
POST /paymentandGET /payment/{id}endpoints- OpenAPI-generated server interfaces and bank client
- Request validation with descriptive error responses
- In-memory payment storage
- Configurable bank simulator connection (URL, timeouts)
- PCI-compliant log masking
- Swagger UI at
/swagger-ui/index.html