This is receipt-proccess
challenge developed by Carlos Rosas for Fetch Backend Engineer position.
Challenge was developed using:
- Java 17
- Gradle
- Micronaut
- Redis
- Docker
And designed with Hexagonal Architecture and Domain Driven Design.
The only assume is that the reviewer has UNIX like OS workstation and Docker.
Open your Terminal and follow next steps.
- Download SDKMan.
curl -s "https://get.sdkman.io" | bash
- Install java jdk 17.
sdk install java 17.0.8-zulu
- Install Gradle.
sdk install gradle 7.6.1
Previous steps are not strictly necessary, because this project uses gradle wrapper.
But there's no reason to take risks 😃
- Clone or paste project in your preferred location.
git clone https://github.com/carolusquintus/receipt-processor.git
- Move to project.
cd receipt-processor
Now that your located in the project, there are some small tweaks in order to build it properly.
- Print your current working directory and copy it.
pwd
-
Open
.env
file located at root project, with your favorite text editor. -
Replace
PROJECT_DIR
var env with path copied from Build -> Step 1. -
Replace
DOCKER_USER
var env with your personal or business Docker Hub user. -
Build
receipt-processor
project.
gradle build
Or
./gradlew build
- Build and run
docker-compose.yml
docker-compose up -d
- Validate that services are up & running.
docker-compose top
Next steps are for Postman configuration.
- Import api.yml provided by
receipt-processor-challenge
https://raw.githubusercontent.com/fetch-rewards/receipt-processor-challenge/main/api.yml
-
Once imported, double click on Receipt Processor collection and go to collection variables tab
and substitutebaseUrl
Current value withhttp://localhost:8080
-
Open
POST Submits a receipt for processing
request and go to Tests tab.
Insert this snippet in order to setreceiptId
as a collection variable after each request.
var jsonData = pm.response.json();
pm.collectionVariables.set("receiptId", jsonData.id);
-
Open
GET Returns the points awarded for the recipt
request and go to Params tab.
Substituteid
Path variable with previous{{receiptId}}
-
Go back to
POST Submits a receipt for processing
request and copy a json body provided by the challenge
fromREADME.md
or receipt-processor-challenge/examples
Send a request and you will see the UUID response, which will be saved in{{receipId}}
collections variable. -
Go to
GET Returns the points awarded for the recipt
request and you will see that current request provides previous UUID saved.
and also the proper receipt points calculation.
This project uses JaCoCo
(Java Code Coverage) plugin to generate html test reports.
- Run and generate test reports.
./gradlew test