Skip to content

JET test assignment (2023)

Notifications You must be signed in to change notification settings

antivoland/jet-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Takeaway Pay

Build Status

The task description can be found here. We need to handle payments between customers and restaurants. For this I implemented the transactional method utilizing optimistic locking on updates. And there are also a simple schema and some data that are used both at runtime and in the main test.

Run the application as follows, for instance:

mvn spring-boot:run

Let's now make a payment:

curl -i -X POST localhost:8080/customers/fry/pay \
  -H "Content-Type: application/json" \
  -d '{"restaurant_id": "slurm-dispensing-unit", "amount": 0.25}'

HTTP/1.1 201 
Content-Length: 0
Date: Sun, 09 Jul 2023 16:27:06 GMT

Then check the customer's balance:

curl -i localhost:8080/customers/fry/balance

HTTP/1.1 200 
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sun, 09 Jul 2023 16:28:59 GMT

9.75

The restaurant's balance is now updated as well:

curl -i localhost:8080/restaurants/slurm-dispensing-unit/balance

HTTP/1.1 200 
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sun, 09 Jul 2023 16:30:26 GMT

0.25

Swagger docs are available at http://localhost:8080/api.

About

JET test assignment (2023)

Resources

Stars

Watchers

Forks

Languages