Loading repository data…
Loading repository data…
ABeatrizSC / repository
Solution to the PicPay backend challenge - 'PicPay Simplified' using Clean Architecture | Java | Spring Boot | H2 Database
This repository contains the solution to the PicPay Back-end technical challenge – "PicPay Simplified". For study purposes, I chose to implement the application following Clean Architecture principles.
You can find the full challenge description in the repository above: https://github.com/PicPay/picpay-desafio-backend?tab=readme-ov-file
Java 17: A high-level, object-oriented programming language widely used for building server-side applications, web services, and Android applications.
Spring Boot 3.5.3: A framework that simplifies the development of Java applications by providing built-in features for dependency injection, configuration, and microservices support.
Spring Retry: Spring Retry is a module within the Spring framework that provides declarative retry support for Spring applications. Its primary purpose is to automatically re-invoke a failed operation, making applications more resilient to transient failures.
H2 Database: H2 is an open-source lightweight Java database. It can be embedded in Java applications or run in the client-server mode.
Jakarta Bean Validation: A standard framework for declaring and validating constraints on Java objects using annotations, commonly used to enforce business rules and input validation in a clean and declarative way.
JPA: The Java Persistence API, a specification that provides object-relational mapping (ORM) to manage relational data in Java applications.
Lombok 1.18.28: A Java library that reduces boilerplate code by generating common methods like getters, setters, constructors, and more through annotations.
Postman: A tool used for API testing and development, enabling users to send HTTP requests, inspect responses, and automate API tests.
To run the project on your machine, the following tools must be installed and configured beforehand:
Follow the steps below to download, configure, and run the project in your environment:
git clone https://github.com/ABeatrizSC/picpay-simplified-challenge.git
cd picpay-simplified-challenge
mvn spring-boot:run
/api/v1/usersList<UserResponseDto>[
{
"fullName": "John",
"userType": "CUSTOMER",
"email": "john@example.com"
},
{
"fullName": "Alice",
"userType": "MERCHANT",
"email": "alice@example.com"
}
]
/api/v1/usersUserCreateDto{
"fullName": "New user",
"userType": "CUSTOMER", //user type: CUSTOMER or MERCHANT
"document": "123.456.789-12",
"email": "newuser@email.com",
"password": "12345678"
}
201 CREATED/api/v1/users/depositsDepositFundsRequestDto{
"userId": "421b2925...",
"amount": 50.0
}
User{
"id": "421b2925..",
"fullName": "New user",
"userType": "CUSTOMER",
"document": "123.456.789-12",
"email": "newuser@email.com",
"password": "12345678",
"balance": 50.00
}
/api/v1/transactionsTransactionRequestDto{
"amount": 50.0,
"sender": "421...",
"receiver": "cfe..."
}
201 CREATEDMethodArgumentNotValidException){
"status": 400,
"error": "BAD_REQUEST",
"message": "The field 'email' must not be blank."
}
BusinessException)InsufficientBalanceExceptionUnauthorizedTransactionException: Merchants are not allowed to perform transfers.{
"status": 500,
"error": "INTERNAL_SERVER_ERROR",
"message": "The available balance is insufficient to complete the transfer." //Variable
}
TransactionErrorException){
"status": 500,
"error": "INTERNAL_SERVER_ERROR",
"message": "An error occurred during the transaction. Please try again."
}
NotificationSendException){
"status": 500,
"error": "INTERNAL_SERVER_ERROR",
"message": "An error occurred while attempting to send the notification."
}
UserNotFoundException){
"status": 404,
"error": "NOT_FOUND",
"message": "User not found." //Variable
}