Code Monkey home page Code Monkey logo

digisure_assignment's Introduction

Setup Instructions

Standard rails application setup

  bundle install
  bin/rails db:setup

You can confirm that everything is working by running specs

bundle exec rspec

Implementation Notes

Registration is somewhat product driven. Questions like:

  • Do we need a password confirmation or we want as simple sign up as possible?
  • What security requirements should we add to our passwords?

I've purposefully haven't answered those questions myself since they are both opiniated and not challanging to introduce

High priority features

From Product Perspective

There are multiple things that can be improved in terms of security UX. Although, some of them would require introduction of ActionMailer

  1. Password Recovery or Password reset
  2. ApiTokens endpoints a. Save current user agents or other device information a. List all currently used api tokens b. Retract access from all tokens

From Home Assignment Perspective

  1. Add loyalty system when user makes first deposit/transfer

Endpoints Documentation

General Notes

  • All Endpoints may return 404 or 422 errors with body containing error_message
  • For authentication pass header X-API-TOKEN with token you acquire from authentication or user creation

Authentication

POST /user

Request Params

Field Required Type
email true String
password true String

Response Body

{
  "api_token":"b2ae5fce5685902c2a0728fac9a7be6f",
  "balance":0,
  "email":"[email protected]"
}

Create User

POST /user
Field Required Type
email true String
password true String

Response Body

{
  "api_token":"b2ae5fce5685902c2a0728fac9a7be6f",
  "balance":0,
  "email":"[email protected]"
}

Get User

GET /user

Response Body

{
  "balance":0,
  "email":"[email protected]"
}

Get User Transactions

GET /transactions

Response Body

[
  {
    "created_at": "2023-05-24 09:36:03 UTC",
    "data": {},
    "operation_description": "incoming",
    "operation_type": "deposit",
    "quantity": 100
  },
  {
    "created_at": "2023-05-24 09:36:03 UTC",
    "data": {},
    "operation_description": "incoming",
    "operation_type": "deposit",
    "quantity": 100
  },
  {
    "created_at": "2023-05-24 09:36:03 UTC",
    "data": {
      "transfer_to": "[email protected]"
    },
    "operation_description": "outgoing",
    "operation_type": "transfer_sent",
    "quantity": 100
  }
]

Deposit

POST /transactions

Request Params

Field Required Type Value
quantity true Integer
operation_type true String Deposit

Transfer

POST /transactions

Request Params

Field Required Type Value
quantity true Integer
recipient_email true Integer
operation_type true String Transfer

digisure_assignment's People

Contributors

thesmartnik 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.