Skip to content

REST API back-end server for Nexbuy District Limited, an e-commerce company featuring PostgreSQL and payment gateway integration!

License

Notifications You must be signed in to change notification settings

nwokoyepraise/nexapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nexapp

Demo Backend Application for Nexbuy District Limited!


Logo

Demo Backend for Nexapp Application

Offering trust in mediation and providing the right number of prospects!
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. API Endpoints
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

This is a demo backend for Nexbuy's Disttrict shopping platform. It consists of endoints for some important services such as the ability to get list of available products, get product details, add and remove item to user cart, chekout cart as well as verify transaction charge.

Nexbuy District Limited is linked at here

Services Available on the Demo Backend

  • Product List
  • Product Details
  • Cart - Add Item
  • Cart - Remove Item
  • Cart - Details
  • Checkout - Item
  • Checkout - Verify Charge

Built With

The project was built natively with the following technologies

Getting Started

To build the project locally, simply clone the github repository. Navigate to root project folder and run the following to install packages:

npm install

After packages have been installed. Proceed to run:

node src/app.js

API Endpoints

Product List Endpoint

This endpoint is used to get a list of products under a specific tab e.g. "For You" tab

GET /api/products/list?tab=FOR%20YOU HTTP/1.1
Host: localhost:3000

Response:
{
  "status": true,
    "data": [
        {
            "product_id": "string",
            "seller_id": "string",
            "timestamp": "number",
            "product_name": "string",
            "unit_price": "number",
            "currency": "string",
            "photo": [
                "string"
            ],
            "seller_name": "string",
            "verified": "boolean"
        }
           ]
}

Request Params

Field Name Description
tab Product tab to list from. Can either be "FOR YOU", "TRENDING", "CATEGORIES", "EARLY ACCESS" OR "SPECIALS"
lt (not required) This refers to the last timestamp of the last object returned in the previous query. Used for pagination.
forward (not required) This is used for pagination and can either be true or false for forward and backward pagination respectively

Product Details Endpoint

This endpoint is used to get the details of a particular product

GET /api/products/product_details?product_id=product_0001 HTTP/1.1
Host: localhost:3000

Response:
{
  "status": true,
    "data":
        {
            "product_id": "string",
            "seller_id": "string",
            "product_name": "string",
            "unit_price": "number",
            "currency": "string",
            "photo": [
                "string"
            ],
            "seller_name": "string",
            "verified": "boolean",
             "product_desc": "string",
        "delivery_methods": [],
        "avail_colors": [],
        "avail_sizes": [],
        "avail_quantity": "number",
        "pckg_fee": "number",
        "delivery_fee": "number"
        }
}

Request Params

Field Name Description
product_id Product ID of product whose details are required

Cart - Add Item

Endpoint used to add product to cart

POST /api/user/cart/add_item HTTP/1.1
Host: localhost:3000
Content-Type: application/json

{"user_id": "string", "product_id": "product_0001", "quantity": "number", "delivery_method": "string", "product_color": "string", "product_size":"number", "delivery_addr": "string"}

Response:
{
  "status": true,
    "data":
        {
            "item_id": "string",
            "product_id": "string",
            "user_id": "string",
            "quanitity": "number",
            "delivery_method": "string",
            "product_color": "string",
            "product_size": "string",
            "delivery_addr": "string"
        }
}

Cart - Remove Item

Endpoint used to add product to cart

DELETE /api/user/cart/remove_item HTTP/1.1
Host: localhost:3000
Content-Type: application/json

{"user_id":"string", "item_id": "string"}

Response:
{
    "status": true,
    "data": {
        "message": "string"
    }
}

Cart Details Endpoint

This endpoint is used to get user cart details

GET /api/user/cart?user_id=string HTTP/1.1
Host: localhost:3000

Response:
{
  "status": true,
    "data": 
        {
            "item_id": "string",
            "product_id": "string",
            "user_id": "string",
            "quantity": "number",
            "delivery_method": "string",
            "product_color": "string",
            "product_size": "string",
            "unit_price": "number",
            "delivery_addr": "string",
            "product_name": "string",
            "product_desc": "string",
            "photo": [
                "string"
            ],
            "delivery_fee": "number",
            "pckg_fee": "number",
            "currency": "string",
            "seller_id": "string",
            "seller_name": "string",
            "verified": "boolean",
             "total": "number"
        }
}

Request Params

Field Name Description
user_id Customer User ID

Checkout - Item

This endpoint is used to checkout item from cart

POST /api/cart/checkout/item HTTP/1.1
Host: localhost:3000
Content-Type: application/json

{"user_id":"string","item_id":"string","card_number": "string", "cvv": "string", "expiry_month": "string", "expiry_year": "string", "fullname": "string", "email":"string", "phone_number": "string"
}

Response:
{
    "status": true,
    "data": {
        "id": "number",
        "tx_ref": "string",
        "flw_ref": "string",
        "device_fingerprint": "string",
        "amount": "number",
        "charged_amount": "number",
        "app_fee": "number",
        "merchant_fee": "number",
        "processor_response": "string",
        "auth_model": "string",
        "currency": "string",
        "ip": "string",
        "narration": "string",
        "status": "string",
        "auth_url": "string",
        "payment_type": "string",
        "plan": "string",
        "fraud_status": "string",
        "charge_type": "string",
        "created_at": "string",
        "account_id": "number"
    }
}

Verify Charge Endpoint

This endpoint is used verify if a transaction (charge) was successfully

POST /api/cart/checkout/verify_charge HTTP/1.1
Host: localhost:3000
Content-Type: application/json

{"user_id":"string", "tx_id": "string"}

Response:
{
  "status": true,
    "data":
        {
            "message": "string"          
        }
}

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GNU-V3 License. See LICENSE for more information.

Contact

Project Link: https://github.com/nwokoyepraise/nexapp

Acknowledgements

About

REST API back-end server for Nexbuy District Limited, an e-commerce company featuring PostgreSQL and payment gateway integration!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published