Giter VIP home page Giter VIP logo

payment-demo's Introduction

payment-demo

It is a fake payment rest api running on memory.
This application is written using Node.js and Express.js.
The Ajv.js library was also used for validations.

Run

If you do not have node installed on your computer, you must install it first. Adress here:
https://nodejs.org/en/download/

First, clone the project:

git clone https://github.com/tlhaeroglu/payment-demo.git
cd /payment-demo

and install the libraries:
npm install

if you want to test:
npm test

to get the project up and running:
npm start

http://localhost:5050 project on started.

Routes Defintion

4 POST routes here:


POST /account

This route is create account route. Valid post:

{
    accountNumber: { type: "integer" },
    currencyCode: { enum: ["TRY", "USD", "EUR"] },
    ownerName: { type: "string" },
    accountType: { enum: ["individual", "corporate"] },
    balance: { type: "number" },
}

required: ["accountNumber", "currencyCode", "ownerName", "accountType"]
POST /payment

This route is make payment route. Valid post:

{
    senderAccount: { type: "integer" },
    receiverAccount: { type: "integer" },
    amount: { type: "number" },
}

required: ["senderAccount", "receiverAccount", "amount"]
POST /deposit

This route is make deposit route. Valid post:

{
    accountNumber: { type: "integer" },
    amount: { type: "number" },
}

required: ["accountNumber", "amount"]
POST /withdraw

This route is make withdraw route. Valid post:

{
    accountNumber: { type: "integer" },
    amount: { type: "number" },
}

required: ["accountNumber", "amount"]

2 GET routes here:


GET /account/{accountNumber}

This route is get account info. Valid get:

required: ["accountNumber"];
GET /accounting/{accountNumber}

This route is get transaction history. Valid get:

required: ["accountNumber"];

Responses

POST Routes:

Will be:

{
    "success": true /* or */ false,
    "message": "Message"
}

GET Routes:

Will be:

{
    "success": true /* or */ false,
    "data": {...} /* or */ [{...}]
}

payment-demo's People

Contributors

tlhaeroglu avatar

Stargazers

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