Webshop is a web based software developed using the RESTful pattern. Python Pyramid Framework is used here.
The users can have the following facilities by this software:
- A database with all their products
- Their clients are able to add products to their virtual shopping cart
- Their clients are able to change the contents of their cart
- Their clients are able to place an order
- Their clients are able to supply a preferred date and time of delivery
For the sake of simplicity and time constraint:
- Login isn't implemented. Anonymous user can order the product.
- Currently there is no authentication & authorization
- I didn't maintain any stock assuming car parts aren't in the inventory.
- The cart is managed in client side using cookie
- Payment system hasn't been added.
Webshop uses:
- Python Pyramid Framework
- MySQL
- Python 3.6 - sudo add-apt-repository ppa:jonathonf/python-3.6 + sudo apt-get install python3.6
- Install pip - sudo apt install python-pip
- Install pyramid - pip install pyramid
- Python Dev - sudo apt-get install python3-dev
- MySQL client - sudo apt-get install libmysqlclient-dev + venv/bin/pip install mysqlclient
git clone https://github.com/Nushrat-Nishi/CarWebshop
cd CarWebshop
- Change the value of conn_string in CarWebshop/carwebshop/factory/db_session_factory.py file according to your database.
- Change the value of sqlalchemy.url in CarWebshop/development.ini file according to your database.
venv/bin/pserve development.ini
Download postman collection from here
POST - Create Product - http://localhost:6543/products
Body:
{
"name": "BMW Wheel",
"description": "BMW Wheel",
"brand": "BMW",
"category": "Wheel",
"sales_price":1.2,
"sku": "mn1"
}
Output:
{
"id": 1,
"name": "BMW Wheel",
"description": "BMW Wheel",
"brand": "BMW",
"category": "Wheel",
"sales_price": "1.20",
"sku": "mn1"
}
GET - Get All the Products - http://localhost:6543/products
Output:
[
{
"id": 1,
"name": "BMW Wheel",
"description": "BMW Wheel",
"brand": "BMW",
"category": "Wheel",
"sales_price": "1.20",
"sku": "mn1"
}
]
GET - Get Product By Id - http://localhost:6543/products/1
Output:
{
"id": 1,
"name": "BMW Wheel",
"description": "BMW Wheel",
"brand": "BMW",
"category": "Wheel",
"sales_price": "1.20",
"sku": "mn1"
}
PUT - Update Product - http://localhost:6543/products/1
Body:
{
"name": "BMW Wheel Updated",
"description": "BMW Wheel",
"brand": "BMW",
"category": "Wheel",
"sales_price":1.2,
"sku": "mn1"
}
DELETE - Delete Product - http://localhost:6543/products/1
POST - Add To Cart - http://localhost:6543/cart/1
Body:
{
"quantity": 6
}
GET - Show added products in the Cart - http://localhost:6543/cart
Output:
[
{
"product_id": 1,
"quantity": 6
}
]
DELETE - Product from the Cart - http://localhost:6543/cart/1
POST - Create an order - http://localhost:6543/orders
Body:
{
"shipping_address": "Amsterdam",
"delivery_date": "1987-07-21",
"delivery_time": "18:00",
"status":"open"
}
Output:
{
"id": 1,
"shipping_address": "Amsterdam",
"delivery_date": "1987-07-21 00:00:00",
"delivery_time": "18:00",
"status": "open"
}
GET - Get all the orders made - http://localhost:6543/orders
Output:
[
{
"id": 1,
"shipping_address": "Amsterdam",
"delivery_date": "1987-07-21 00:00:00",
"delivery_time": "18:00",
"status": "open",
"odered_product": [
{
"product_id": 1,
"quantity": 6
}
]
}
]
GET - Order by Order Id - http://localhost:6543/orders/1
Output:
{
"id": 1,
"shipping_address": "Amsterdam",
"delivery_date": "1987-07-21 00:00:00",
"delivery_time": "18:00",
"status": "open",
"odered_product": [
{
"product_id": 1,
"quantity": 6
}
]
}
PUT Update Order Status - http://localhost:6543/orders/1/status
Body:
{
"status":"close new"
}