Create an application Backend with below details:
Tech stack to be used:
Java/Kotlin (Kotlin is preferred)
Spring Boot
Application Requirements:
- Service should expose a Rest API to accept
money transfers
to other accounts. Money transfers should persist a new balance of accounts - Service should expose a Rest API for getting the
account
details. You can disregard currencies at this time
Points to consider:
- Keep the design simple and to the point. Should be scalable for adding new features
- The datastore should run in-memory for the tests
- Proper unit testing and decent coverage is a must
- Upload the code to a repository
- Disregard Currency or Rate Conversion
- Improvise where details are not provided
Plus Points:
- Kotlin used => Sowwyyyy
- Proper handling of concurrent transactions for the accounts
- Documentation of API
- Dockerized app
- Account: Specific user, who has basic information. (name, email, username, password and county) and (balance).
- Role: Granted Authority for our accounts: User, Moderator and Admin accounts. (Focus will be on user roles).
- Transaction: a transfer of money happens in the system, It can be either (PAY) Involving 2 parties, (WITHDRAW/DEPOSIT) Which involves only one party, sender side, with a specific amount of money.
- Pay Transaction: Example (Hassan sends 1000$ to Marco).
- Withdraw Transaction: Example (Hassan withdraws 1000$ from his account).
- Deposit Transaction: Example (Hassan deposits 1000$ to his account).
Authentication used to set valid cookie, which lasts for 1 day. (With testing with postman, It's auto set, you can check it in cookies section.) An Account should be able to deposit and withdraw only to/from his account through the identified cookie.
You can follow /api/bsfdv/swagger-ui.html
to find all information about APIs.
You can follow the OpenAPI specification here.
-
Signup => POST
/api/bsfdv/accounts
with payload in Body.{ "name": "Hassan", "country": "Egypt", "email": "hassan.elseoudy1@gmail.com", "password": "123456", "username": "semsem" }
-
Login => POST
/api/bsfdv/accounts/login
with payload in Body.{ "username": "semsem", "password": "123456" }
-
Make a deposit transaction => POST
/api/bsfdv/transactions
with payload in Body.{ "transactionType": "DEPOSIT", "amount": 20000 }
-
Now try to get account details (For development purposes, there's no restrictions, anyone can see balance information). => GET
/api/bsfdv/accounts/1
and the balance should be 20000 now.