How haddjs/payment-gateway-cip works
This Spring Boot payment gateway exposes token issuance and authenticated payment APIs to banking channels. Its main workflow validates a payment, creates a pending transaction, debits Core Banking, then pays the biller only after a successful debit; it persists the final state and returns a response. Separate capabilities include transaction lookup, JWT security, error formatting, and mock endpoints for the two external systems. Edges reflect the provided service/controller excerpts and README; mock implementation internals and some configuration wiring were not sampled.
Main entry points: PaymentService.java Payment orchestration · PaymentController.java Payment API · CoreBankClient.java Core Banking client · BillerClient.java Biller client
Components 23
API and security
- Payment API
src/main/java/com/nadirhadd/payment_gateway_cip/controller/PaymentController.java - Token API
src/main/java/com/nadirhadd/payment_gateway_cip/controller/AuthController.java - JWT security
src/main/java/com/nadirhadd/payment_gateway_cip/config/SecurityConfig.java - Payment request DTO
src/main/java/com/nadirhadd/payment_gateway_cip/dto/request/PaymentRequest.java - Token request DTO
src/main/java/com/nadirhadd/payment_gateway_cip/dto/request/TokenRequest.java - API error handling
src/main/java/com/nadirhadd/payment_gateway_cip/exceptions/GlobalExceptionHandler.java
Payment processing
- Payment orchestration
src/main/java/com/nadirhadd/payment_gateway_cip/service/PaymentService.java - Payment response DTO
src/main/java/com/nadirhadd/payment_gateway_cip/dto/response/PaymentResponse.java - Transaction ID codec
src/main/java/com/nadirhadd/payment_gateway_cip/util/TransactionIds.java - Payment statuses
src/main/java/com/nadirhadd/payment_gateway_cip/enums/TransactionStatus.java - Channel types
src/main/java/com/nadirhadd/payment_gateway_cip/enums/PaymentChannel.java
Transaction persistence
- Transaction record
src/main/java/com/nadirhadd/payment_gateway_cip/entity/Transaction.java - Transaction repository
src/main/java/com/nadirhadd/payment_gateway_cip/repository/TransactionRepository.java - PostgreSQL
Payment integrations
- Core Banking client
src/main/java/com/nadirhadd/payment_gateway_cip/client/CoreBankClient.java - Debit DTOs
src/main/java/com/nadirhadd/payment_gateway_cip/client/dto/DebitRequest.java - Core Banking
- Biller client
src/main/java/com/nadirhadd/payment_gateway_cip/client/BillerClient.java - Biller payment DTOs
src/main/java/com/nadirhadd/payment_gateway_cip/client/dto/BillerPayRequest.java - Biller aggregator
- Core Banking mock
src/main/java/com/nadirhadd/payment_gateway_cip/mock/MockCoreBankController.java - Biller mock
src/main/java/com/nadirhadd/payment_gateway_cip/mock/MockBillerController.java
Other components
- Banking channel
Connections 22
- Banking channel → Payment API: submits payment
README.md - Payment API → Payment orchestration: delegates
src/main/java/com/nadirhadd/payment_gateway_cip/controller/PaymentController.java - Payment API → Payment request DTO: accepts
src/main/java/com/nadirhadd/payment_gateway_cip/controller/PaymentController.java - Payment orchestration → Payment response DTO: returns
src/main/java/com/nadirhadd/payment_gateway_cip/service/PaymentService.java - Payment API → Transaction ID codec: parses ID
src/main/java/com/nadirhadd/payment_gateway_cip/controller/PaymentController.java - Payment orchestration → Transaction ID codec: formats ID
src/main/java/com/nadirhadd/payment_gateway_cip/service/PaymentService.java - Payment orchestration → Transaction repository: reads and saves
src/main/java/com/nadirhadd/payment_gateway_cip/service/PaymentService.java - Transaction repository → Transaction record: persists
src/main/java/com/nadirhadd/payment_gateway_cip/repository/TransactionRepository.java - Transaction record → PostgreSQL: stored in
README.md - Payment orchestration → Core Banking client: requests debit
src/main/java/com/nadirhadd/payment_gateway_cip/service/PaymentService.java - Core Banking client → Debit DTOs: uses
src/main/java/com/nadirhadd/payment_gateway_cip/client/CoreBankClient.java - Core Banking client → Core Banking: calls debit
src/main/java/com/nadirhadd/payment_gateway_cip/client/CoreBankClient.java - Payment orchestration → Biller client: requests payment
src/main/java/com/nadirhadd/payment_gateway_cip/service/PaymentService.java - Biller client → Biller payment DTOs: uses
src/main/java/com/nadirhadd/payment_gateway_cip/client/BillerClient.java - Biller client → Biller aggregator: calls payment
src/main/java/com/nadirhadd/payment_gateway_cip/client/BillerClient.java - Payment API → JWT security: protected by
README.md - Banking channel → Token API: requests token
README.md - Token API → Token request DTO: accepts
src/main/java/com/nadirhadd/payment_gateway_cip/controller/AuthController.java - Core Banking → Core Banking mock: simulated by
README.md - Biller aggregator → Biller mock: simulated by
README.md - Payment orchestration → Payment statuses: sets status
src/main/java/com/nadirhadd/payment_gateway_cip/service/PaymentService.java - Payment request DTO → Channel types: validates channel
src/main/java/com/nadirhadd/payment_gateway_cip/dto/request/PaymentRequest.java