This repository contains a microservice made in Spring Boot Java. The goal is an application that allows the user to enter an expired boleto code and receive interest and penalty values.
The is application that meets the following functional requirements:
• Receive a valid boleto code
• Check if the boleto is expired
• Only NPC type boletos can be calculated
• Consume the Builders Boletos API to receive boleto information
• In case of an error, return the reason for the error
• The definition of bank slip interest occurs considering the delay days, proportionally
• Interest rate of 1% per month
• 1% every 30 days: 1 ÷ 30 = 0.033% per day
• The late payment fine must be 2%
• The final value of the boleto should be:
• Boleto amount + fine value + delayed interest value = charged value
At the end, all performed calculations are saved in the database, so that it is possible to cross-reference paid boletos with calculated boletos.
To run and test the project, it is necessary to have Java 17 and Maven installed on your machine. It is also necessary to have a MongoDB database installed and configured. In addition, the variable.properties file must be configured in the src/main/resources folder.
• Clone this repository and open the project in your preferred IDE.
• Open the terminal and navigate to the root folder of the project.
• Run the mvn clean install command to download the dependencies and compile the project.
• Make sure that MongoDB is running on your machine before starting the project.
• Run the mvn spring-boot:run command to start the server.
The application works through a Java-built REST API, which consumes the Builders Boletos API to calculate the interest and penalty of an expired boleto.
The user must send a valid boleto code through the /api/boletoservice/calc-interest route, with the following payload:
{
"bar_code": "string",
"payment_date": "string"
}
Then, the API will return a payload with boleto information and calculated interest and penalty values:
{
"original_amount": 0,
"amount": 0,
"due_date": "string",
"payment_date": "string",
"interest_amount_calculated": 0,
"fine_amount_calculated": 0
}
POST /api/boletoservice/calc-interest
POST /api/user/updateUser
POST /api/user/authenticate
POST /api/user/addUser
GET /api/user/getUser/{user-id}
DELETE /api/user/deleteUser/{user-id}
DOC. PAGE /swagger-ui/index.html
If an error occurs during processing, the API will return an error message with the reason for the problem.