Skip to content

sadra/atipay

Repository files navigation

atipay

Installation

  1. Before everything make sure that you've installed Nodejs and MongoDB on your server.
  2. Then make a clone from this project on your server:
git clone git@github.com:sadra/atipay.git
  1. Then, install the dependencies:
npm install
  1. Install the pm2
npm install pm2 -g
  1. Modify the config.js and replace port and database to every thing you want.
  2. Run the app throw pm2:
pm2 start atipay.js

API Usage

The base route starts with your server Server Address plus the PORT and the users key. for example

0.0.0.0:32002

Add User Payment

Method : POST

ROUTE : BASE_ROUTE/users/add

REQUEST BODY (JSON):

{
    "mobile" : "09112223333", //string
    "serial_number" : "123456789", //string
    "ref_number" : "123456789", //string
}

RESPONSE:

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"
        }
    }
}

FAILURE RESPONSE:

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
}

Verify User Payment

Method : GET

ROUTE : BASE_ROUTE/users/verify/MOBILE_NUMBER/SERIAL_NUMBER

RESPONSE:

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
        }
    }
}

FAILURE RESPONSE:

If user not existed

STATUS : 404

{
    "message": "User not found!",
    "status": 404
}

Settings

Check the version

Method : POST

ROUTE : BASE_ROUTE/users/settings/version

REQUEST BODY (JSON):

{
    "version" : "2.0.0", //string
    "password" : "abcd1234", //string
}

RESPONSE:

STATUS : 200

{
    "version": "2.0.0"
}

FAILURE RESPONSE:

If password wrong

STATUS : 403

{
    "result": "Not Allowed.",
    "message": "Check secrets, please."
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published