- Before everything make sure that you've installed
Nodejs
andMongoDB
on your server. - Then make a clone from this project on your server:
git clone git@github.com:sadra/atipay.git
- Then, install the dependencies:
npm install
- Install the
pm2
npm install pm2 -g
- Modify the
config.js
and replaceport
anddatabase
to every thing you want. - Run the app throw pm2:
pm2 start atipay.js
The base route starts with your server Server Address plus the PORT and the users key. for example
0.0.0.0:32002
Method : POST
ROUTE : BASE_ROUTE/users/add
REQUEST BODY (JSON):
{
"mobile" : "09112223333", //string
"serial_number" : "123456789", //string
"ref_number" : "123456789", //string
}
STATUS : 200
{
"user_add": true,
"message": {
"user": {
"__v": 0,
"created_at": "2018-08-04T18:08:19.014Z",
"updated_at": "2018-08-04T18:08:19.014Z",
"user_id": "09119991124123456",
"mobile": "09119991124",
"serial_number": "123456",
"ref_number": "123456789",
"_id": "5b65eb930c0c5a3b4859d8c5"
}
}
}
If user exist and paid before, and that caused the conflict.
STATUS : 409
{
"result": "Conflict. User is exist!",
"user": {
"_id": "5b65eb930c0c5a3b4859d8c5",
"created_at": "2018-08-04T18:08:19.014Z",
"updated_at": "2018-08-04T18:08:19.014Z",
"user_id": "09119991124123456",
"mobile": "09119991124",
"serial_number": "123456",
"ref_number": "123456789",
"__v": 0
},
"status": 409
}
Method : GET
ROUTE : BASE_ROUTE/users/verify/MOBILE_NUMBER/SERIAL_NUMBER
STATUS : 200
{
"user_exist": true,
"result": {
"message": "The user is exist.",
"user": {
"_id": "5b65eb930c0c5a3b4859d8c5",
"created_at": "2018-08-04T18:08:19.014Z",
"updated_at": "2018-08-04T18:08:19.014Z",
"user_id": "09119991124123456",
"mobile": "09119991124",
"serial_number": "123456",
"ref_number": "123456789",
"__v": 0
}
}
}
If user not existed
STATUS : 404
{
"message": "User not found!",
"status": 404
}
Method : POST
ROUTE : BASE_ROUTE/users/settings/version
REQUEST BODY (JSON):
{
"version" : "2.0.0", //string
"password" : "abcd1234", //string
}
STATUS : 200
{
"version": "2.0.0"
}
If password wrong
STATUS : 403
{
"result": "Not Allowed.",
"message": "Check secrets, please."
}