Skip to main content
Financial operations require a robust security perimeter that prevents the processing of invalid data (such as negative amounts or null values). The API implements a strict validation barrier through Jakarta Validation and a global exception handler.

🚨 Sanitization and Global Error Handling

To keep the controller code clean from try-catch blocks, the application uses a centralized design pattern via @ControllerAdvice. The GlobalExceptionHandler automatically intercepts any HTTP validation failure or business exception (IllegalArgumentException, IllegalStateException), and transforms them into a standardized JSON response with language support (EN).

📑 Data Validation Contracts (DTO Records)

To ensure that business constraints are met from the very moment data enters the API, the HTTP perimeter uses Java records enriched with Jakarta Validation annotations (@NotNull, @Positive). This acts as a shield that prevents null, empty, or negative financial amounts from reaching the service layer or the database.