Skip to content

krishna1m/dodo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dodo

Simple backend service for managing transactions and user accounts.

Demo link

Prerequisites

  1. Make sure you have cargo installed.
  2. Make sure you have PostgreSQL installed and it is up and running. Try using PostgreSQL 15 or later.
  3. You can optionally use psql to connect to the postgresql database.

How to run

  1. Create a database with the name dodo_payments.
$ psql
user=# create database dodo_payments;
  1. Start the application. It starts at port 3030.
$ cargo run
  1. Use the APIs listed in the next section via curl or a tool of your choice.

APIs and Features

The application provides the following features.

  1. User Management

Registration

POST /register

{
    "email": "test@email.com",
    "password": "testpass"
}

Response

User Added

Login/Authentication

POST /login

{
    "email": "test@email.com",
    "password": "testpass"
}

Response

"<authorization token>"
  1. Transaction Management

Credit amount

POST /credit

Content-Type: application/json
Authorization: <token>

Request

{
    "amount": 4.32
}

Response

{
    "ttype": "Credit",
    "amt": 4.32
}

Debit amount

POST /debit

Content-Type: application/json
Authorization: <token>

Request

{
    "amount": 1.50
}

Response

{
    "ttype": "Debit",
    "amt": 1.50
}

List transactions

  1. Account Balances GET /transactions
Authorization: <token>

Response

[
    {
        "id": 2,
        "ttype": "Debit",
        "amt": 1.50
    },
    {
        "id": 1,
        "ttype": "Credit",
        "amt": 4.32
    }
]

Get balance

GET /balance

Authorization: <token>

Response

{
    "amount": 2.82
}

About

Dodo payments backend service

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages