Demo Backend Application for Nexbuy District Limited!
Offering trust in mediation and providing the right number of prospects!
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
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
- Product List
- Product Details
- Cart - Add Item
- Cart - Remove Item
- Cart - Details
- Checkout - Item
- Checkout - Verify Charge
The project was built natively with the following technologies
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
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"
}
]
}
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 |
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"
}
}
Field Name | Description |
---|---|
product_id | Product ID of product whose details are required |
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"
}
}
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"
}
}
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"
}
}
Field Name | Description |
---|---|
user_id | Customer User ID |
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"
}
}
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"
}
}
See the open issues for a list of proposed features (and known issues).
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.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU-V3 License. See LICENSE
for more information.
Project Link: https://github.com/nwokoyepraise/nexapp