A Java 8 Spring Boot application focused exclusively on logging Fintoc API v2 account validation calls and their responses.
- π― Account Validation Focused - Only logs
/accounts/{id}/validatecalls - π Fintoc API v2 Integration - Uses the latest Fintoc API version
- π Detailed Validation Logging - Stores validation requests, responses, and results
- π Secure HMAC-SHA256 Authentication - Proper Fintoc API authentication
- π Validation Analytics - Track success rates, performance, and trends
- ποΈ SQL Server Database - Optimized for validation data storage
- β‘ Built with Java 8 and Spring Boot 2.7.xount Validation Logger
A Java 8 Spring Boot application focused exclusively on logging Fintoc account validation API calls and their responses.
- οΏ½ Account Validation Focused - Only logs
/accounts/{id}/validatecalls - π Detailed Validation Logging - Stores validation requests, responses, and results
- π Secure HMAC-SHA256 Authentication - Proper Fintoc API authentication
- π Validation Analytics - Track success rates, performance, and trends
- ποΈ SQL Server Database - Optimized for validation data storage
- β‘ Built with Java 8 and Spring Boot 2.7.x
POST /api/fintoc/accounts/{accountId}/validate- Validate account (logged to database)
GET /api/validation-logs- Get all validation logs with paginationGET /api/validation-logs/account/{accountId}- Get logs for specific accountGET /api/validation-logs/type/{validationType}- Get logs by validation typeGET /api/validation-logs/failed- Get failed validation attemptsGET /api/validation-logs/pending- Get pending validationsGET /api/validation-logs/search- Search validation logs by criteriaGET /api/validation-logs/stats/summary- Get validation summary statisticsGET /api/validation-logs/count- Get validation counts
This application implements proper Fintoc API authentication according to their official documentation:
Every API request includes:
- Authorization Header: Your Fintoc API key
- Fintoc-Signature Header: HMAC-SHA256 signature
The signature is generated using the following message format:
timestamp + HTTP_METHOD + endpoint + request_body
Example:
1633024800POST/accounts/acc_123/validate{"validation_type":"ownership"}
This message is then signed using HMAC-SHA256 with your API secret and Base64 encoded.
This application uses Fintoc API v2 (https://api.fintoc.com/v2) for all API calls, ensuring compatibility with the latest Fintoc features and improvements.
- β Automatic signature generation for every API call
- β Timestamp-based security prevents replay attacks
- β Secure credential handling - API secrets are never logged
- β Error handling for authentication failures
- Java 8 or higher
- Maven 3.6+
- SQL Server 2012+ (or use H2 for testing)
-
Clone and navigate to the project:
cd /path/to/fintoc-account-validation-logger -
Set up environment variables:
cp .env.example .env # Edit .env with your actual credentials -
Configure database:
- Create a SQL Server database named
FintocApiLogger - Run the database creation script:
database/sqlserver/create_database.sql - Update
application.ymlwith your database credentials
- Create a SQL Server database named
-
Build and run:
mvn clean install mvn spring-boot:run
Or for SQL Server:
mvn spring-boot:run -Dspring.profiles.active=sqlserver
Create a .env file or set environment variables:
FINTOC_API_KEY=your_fintoc_api_key
FINTOC_API_SECRET=your_fintoc_api_secret
DB_USERNAME=fintoc_user
DB_PASSWORD=your_secure_passwordStores detailed information about each account validation:
| Column | Type | Description |
|---|---|---|
id |
BIGINT IDENTITY | Primary key |
account_id |
NVARCHAR(100) | Account being validated |
validation_type |
NVARCHAR(50) | Type of validation (ownership, balance, etc.) |
validation_result |
NVARCHAR(20) | SUCCESS, FAILED, or PENDING |
request_headers |
NTEXT | Request headers JSON |
request_body |
NTEXT | Request body |
response_status |
INT | HTTP response status |
response_headers |
NTEXT | Response headers JSON |
response_body |
NTEXT | Response body |
execution_time_ms |
BIGINT | Execution time in milliseconds |
created_at |
DATETIME2(7) | Timestamp (UTC) |
success |
BIT | Success flag |
link_id |
NVARCHAR(100) | Associated Fintoc link ID |
Stores aggregated validation statistics:
| Column | Type | Description |
|---|---|---|
validation_type |
NVARCHAR(50) | Validation type |
validation_count |
BIGINT | Total validations |
success_count |
BIGINT | Successful validations |
failed_count |
BIGINT | Failed validations |
pending_count |
BIGINT | Pending validations |
avg_execution_time_ms |
FLOAT | Average execution time |
# This call will be logged to the database
curl -X POST http://localhost:8080/api/fintoc/accounts/acc_123/validate \
-H "Content-Type: application/json" \
-d '{"validation_type": "ownership"}'# Get recent validation logs
curl http://localhost:8080/api/validation-logs?page=0&size=10
# Get failed validations
curl http://localhost:8080/api/validation-logs/failed
# Get validations for a specific account
curl http://localhost:8080/api/validation-logs/account/acc_123
# Get validation statistics
curl http://localhost:8080/api/validation-logs/stats/summarysrc/
βββ main/java/com/fintoc/logger/
β βββ FintocApiLoggerApplication.java # Main Spring Boot application
β βββ config/
β β βββ AppConfig.java # Spring configuration
β βββ controller/
β β βββ FintocController.java # Account validation endpoint
β β βββ ValidationLogsController.java # Logs and analytics endpoints
β βββ entity/
β β βββ AccountValidationLog.java # Validation log entity
β βββ repository/
β β βββ AccountValidationLogRepository.java # Validation logs repository
β βββ service/
β βββ FintocApiService.java # Fintoc API client service
β βββ AccountValidationLogService.java # Validation logging service
βββ main/resources/
βββ application.yml # Main configuration
βββ application-sqlserver.yml # SQL Server configuration
βββ application-test.yml # Test configuration
β
Account ID - Which account was validated
β
Validation Type - Type of validation performed (ownership, balance, etc.)
β
Request/Response Data - Complete HTTP request and response
β
Validation Result - SUCCESS, FAILED, or PENDING
β
Performance Metrics - Execution time, response codes
β
Error Details - Complete error information for failed validations
β
Authentication Data - Masked API keys used
Run tests with:
mvn testTests use H2 in-memory database for isolation.
The application includes Spring Boot Actuator endpoints:
/actuator/health- Application health status/actuator/metrics- Application metrics
Clean up old validation logs:
curl -X DELETE "http://localhost:8080/api/validation-logs/cleanup?daysToKeep=30"This project is licensed under the MIT License.