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.
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-demoand install the libraries:
npm installif you want to test:
npm testto get the project up and running:
npm starthttp://localhost:5050 project on started.
4 POST routes here:
POST /accountThis 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 /paymentThis route is make payment route. Valid post:
{
senderAccount: { type: "integer" },
receiverAccount: { type: "integer" },
amount: { type: "number" },
}
required: ["senderAccount", "receiverAccount", "amount"]POST /depositThis route is make deposit route. Valid post:
{
accountNumber: { type: "integer" },
amount: { type: "number" },
}
required: ["accountNumber", "amount"]POST /withdrawThis 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"];POST Routes:
Will be:
{
"success": true /* or */ false,
"message": "Message"
}GET Routes:
Will be:
{
"success": true /* or */ false,
"data": {...} /* or */ [{...}]
}