Skip to content

tlhaeroglu/payment-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 */ [{...}]
}

Releases

No releases published

Packages

No packages published