Giter Site home page Giter Site logo

redesigned-meme's Introduction

Build and test

mvn verify

Requires JDK11 and maven to build. Depends on jackson, joda.money and junit.

Run

java -jar target/revolut-1.0-SNAPSHOT.jar $PORT

API

Every API call returns either HTTP code 200 and a JSON-encoded result, or a relevant 4xx code and a JSON with error description. All endpoints return 400 when invoked with invalid JSON, invalid money amount, or unsupported currency. All endpoints accept and return money/currencies in joda.money format.

GET /account/{id}

Returns account balance, for example { "balance" : "GBP 17.19" }, or 404, if account does not exist.

PUT /account/{id}

Accepts JSON of form { "currency" : "{code}" } and creates an account with requested currency and zero balance. Returns 200 if account was created, or 409 if the account already exists, but the currencies do not match. Returns 200 if an account with matching id and currency already exists. Balance stays untouched in that case.

PUT /operation/{id}

Accepts a JSON with account ids as keys and money amounts to add or subtract from them as values. Runs atomically, either all updates are applied, or none. Runs at most once, subsequent invocations do nothing and return the same result as the first one. Returns 200 if the operation succeeded. Returns 404 if any of updated accounts is missing. Returns 409 if an operation with the same id, but different data exists. Returns 412 if any of updated accounts does not have enough funds to perform the operation, or has a different currency than was requested in the update. Long random operation ids, such as UUID, are recommended.

Sample deposit operation: { "A" : "GBP 4.20" }

Sample transfer operation: { "A" : "GBP -42", "B" : "GBP 42" }

redesigned-meme's People

Contributors

swined avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.