This is an API for authorize credit card transactions. The project was built with the purpose of solve a technical challenge.
- View the benefits balance of an account
- Authorize transactions
- Java 21
- Spring Boot 3
- Gradle
- Docker Compose
- Lombok
- JUnit 5
- RestAssured
- OpenAPI 3 (Swagger)
- Java 21
- Gradle
- Docker
You can download Java 21 here.
Follow the instructions in the official Gradle documentation for installation here.
The project uses Docker Compose for containerization of the database. You'll need to install docker compose in your local machine to run the database locally. You can access the docker documentation for installation and configuration instructions here.
This is an example of request for authorize a transaction. (All the fields are required)
{
"account": "123",
"totalAmount": 100.00,
"mcc": 5411,
"merchant": "Supermarket XYZ"
}
- If
mcc
is"5411"
or"5412"
, theFOOD
balance will be used. - If
mcc
is"5811"
or"5812"
, theMEAL
balance will be used. - For any other
mcc
values, theCASH
balance will be used as fallback. - If the benefit balance has insufficient amount then
CASH
balance will be used as fallback. - Sometimes, the
mcc
are incorrect and a transaction must be processed taking into account the merchant's data as well. Register merchants using theimport.sql
file located atsrc/main/resources/
to make sure that the name will be considered.
Merchant Name Type
-------------------------------
UBER EATS MEAL
PADARIA DO ZE FOOD
RESTAURANTE DA MARIA MEAL
SUPERMERCADOS BH FOOD
- Remember: For more merchants just add them in the insert query on
import.sql
{ "code": "00" }
if the transaction is approved{ "code": "51" }
if the transaction is declined due to insufficient funds{ "code": "07" }
for any other issue preventing the transaction
Once you have the application running, you can access the documentation of the API in the URL:
http://localhost:8080/authorizer/api/swagger-ui/index.html