Skip to content

feardude/money-transfer-api

Repository files navigation

Build Status QualityGate Status

Money transfer API

Trial for Revolut

Deployed app on Heroku

The application represents API for processing accounts' money. No authentication, so anyone can see any account's balance. Real application should grant balance access only to account's owner.

For local run follow these steps:

  1. ./gradlew assemble check stage
  2. java -jar build/libs/money-transfer-api-all-*.jar

Architecture

  • SparkJava web framework.
  • Google Guice DI framework.
  • Sql2o for data access layer.
  • HSQLDB in-memory database.

Infrastructure

  • Continuous integration: Travis-CI
  • Continuous delivery: Heroku (github integration). App is deployed from master branch after successful CI build.
  • Code quality: SonarCloud (used inside CI pipeline)

Consider dockerizing of CI/CD pipeline.


API

GET /

Redirects to /api

GET /api

Returns all implemented API methods

GET /api/accounts

Returns info for all accounts (id, real id, amount).

GET /api/accounts/:id

Returns info for account with specific id.

POST /api/accounts/:id

Body payload: { "action": ${action}, "accountId": ${id}, "amount": ${amount} }

  • action: String (WITHDRAW, DEPOSIT)
  • id: long, id of existing account
  • amount: amount of money with dot as scale delimiter

Returns account info after processing. Returns InsufficientFundsException if account has not enough money.

POST /api/transfer

Body payload: { "fromAccountId": ${fromAccountId}, "toAccountId": ${toAccountId}, "amount": ${amount} }

  • fromAccountId: long, id of existing account to withdraw money from
  • toAccountId: long, id of existing account to deposit money to
  • amount: amount of money with dot as scale delimiter

Returns empty string in case of success. Returns InsufficientFundsException if from-account has not enough money.

Releases

No releases published

Packages

No packages published

Languages