A Java service for calculating Ukrainian taxes, specifically designed for Interactive Brokers income declarations. This service helps calculate personal income tax (ПДФО) and military tax (Військовий збір) based on your income.
- Calculate taxes for Interactive Brokers income:
- Personal Income Tax (ПДФО) - 18%
- Military Tax (Військовий збір) - 1.5%
- Dividend Tax - 9%
- Foreign Income Tax - 18%
- Generate tax declarations with all required information
- Precise decimal calculations using BigDecimal
- Comprehensive logging
- Input validation and error handling
- Full test coverage
- Java 21 or higher
- Maven 3.6 or higher
- Clone the repository:
git clone [repository-url]
cd [project-directory]- Build the project:
mvn clean install// Create tax service instance
UkrainianTaxService taxService = new UkrainianTaxServiceImpl();
// Calculate taxes for income
BigDecimal income = new BigDecimal("10000.00");
Map<UkrainianTaxCategory, BigDecimal> taxes = taxService.calculateInteractiveBrokersTaxes(income);
// Get individual tax amounts
BigDecimal incomeTax = taxes.get(UkrainianTaxCategory.INCOME_TAX); // 1800.00 (18%)
BigDecimal militaryTax = taxes.get(UkrainianTaxCategory.MILITARY_TAX); // 150.00 (1.5%)
// Calculate total tax
BigDecimal totalTax = taxService.calculateTotalTax(income); // 1950.00// Generate tax declaration for specific year
Map<String, Object> declaration = taxService.generateTaxDeclaration(income, 2024);
// Declaration contains:
// - year: 2024
// - income: 10000.00
// - incomeTax: 1800.00
// - militaryTax: 150.00
// - totalTax: 1950.00
// - generatedDate: current dateThe service supports the following tax categories:
| Category | Rate | Description |
|---|---|---|
| INCOME_TAX | 18.0% | Personal Income Tax (ПДФО) |
| MILITARY_TAX | 1.5% | Military Tax (Військовий збір) |
| DIVIDEND_TAX | 9.0% | Dividend Tax |
| FOREIGN_INCOME_TAX | 18.0% | Foreign Income Tax |
The service uses the following default configuration:
- Decimal places: 2
- Rounding mode: HALF_UP
- Logging: SLF4J with Logback
Run the tests using:
mvn testThe test suite includes:
- Basic tax calculations
- Total tax calculations
- Tax declaration generation
- Input validation
- Error handling
The service uses SLF4J with Logback for logging. Log messages include:
- Tax calculation details
- Input validation errors
- Declaration generation events
The service includes validation for:
- Null income values
- Negative income values
- Invalid tax categories
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Uses TestNG for testing
- Implements precise decimal calculations using BigDecimal