Skip to content

rkoszalka/purchase-transactions

 
 

Repository files navigation

Purchase Transaction

Summary

This assessments aims to provide a purchase and exchange transactions platform utilizing Treasury Reporting Rates of Exchange API. The application returns, after consuming Rates of Exchange API, the amount of Dollar in the transaction converted to a desired currency.

API documentation

   https://fiscaldata.treasury.gov/datasets/treasury-reporting-rates-exchange/treasury-reporting-rates-of-exchange

How to run the project

  • Clone the repository
  • Move into repository folder
  • Build and start the application using Docker Compose
docker compose up

This will build and up two containers one containing Postgres and another containing the application artifact.

  • The application will be exposed at the following address
http://localhost:8080/transaction

Endpoints

  • Create a purchase:
      http://localhost:8080/transaction/purchase
    
  • Body:
    {"amount":100.00, "description":"desc up to 50 char","transactionDate": "2024-12-19"}
  • Retrieve a purchase:
     http://localhost:8080/transaction/retrieve/{{purchase uuid}}
    
  • Retrieve a purchase in a desired currency
      http://localhost:8080/transaction/retrieve?id={{purchase uuid}}&currency={{desired currency (i.e. Real}}
    
    • You can check the currencies supported in this link.

Testing

The application contains integration and unit tests using H2 Database, MockMvc and Mockito. You can run all the tests using your favorite IDE (i.e. IntelliJ) or run

  • Windows
.\gradlew.bat clean test --info
  • Linux or Mac
./gradlew clean test --info

Tech Stack

Java Spring Gradle Docker Postgres H2 Database Flyway Jacoco

About

purchase-transactions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.7%
  • Dockerfile 0.3%