Online Shop API using Lumen Framework
This Online Shop is created using Lumen Framework and microservice best practice approach
- OpenSSL PHP Extension
- PHP >= 7.0
- Mbstring Extension
- PHP PDO Extension
- MySQL DB Server
Before install this API, create DB use "os_" prefix to each microservice and do not forget to edit the .env file to suit your local environment.
CREATE DATABASE os_order
-
clone this repository, to your local repo
git clone https://github.com/yogaukha/online-shop.git
-
change directory to microservice using new tab terminal
cd online-shop/order-api/
-
change the permission on run.sh
chmod +x run.sh
-
run the run.sh
- Linux & Windows
./run.sh
- MAC
sh run.sh
- Shipment Fee.
- I assume that the weight of product using grams, so it must divides by 1000.
- I assume that the shipment fee is IDR 14.000, I take it from average of shipment fee from Jogja to Jakarta
- The discount is using nominal.
- Order is valid when the amount paid from customer matched with the grand total of order, and payment date is not empty, and payment proof is not empty. Else will reject (cancel) the order.
The Ports that used is hardcode, so you won't to change it. You can run this API with Postman Application.
- Use Port 3132, Endpoints:
http://localhost:3132/api/v1/user/
- Register
- Method: POST
- Parameter: {name}, {email}, {password}, {role}. All parameters are required.
- URI:
register
- Login
- Method: POST
- Parameter: {email}, {password}
- URI:
login
- Return value: The one of return value is
api_token
, you have to save it for accessing the other API
- Use Port 3131, Endpoints:
http://localhost:3131/api/v1/product/
- Get all products
- Method: GET
- Header: api_token, required
- Parameter: None
- URI: None
- Get product
- Method: GET
- Header: api_token, required
- Parameter: {id}
- URI:
1
- Use Port 3134, Endpoints:
http://localhost:3134/api/v1/coupon/
- Get all coupons
- Method: GET
- Header: api_token, required
- Parameter: None
- URI: None
- Get coupon detail
- Method: GET
- Header: api_token, required
- Parameter: {code_name}
- URI:
HARBOLNAS11
- Use Port 3133, Endpoints:
http://localhost:3133/api/v1/cart/
- Add to cart
- Method: GET
- Header: api_token, required
- Parameter: {product_id}, {qty}
- URI:
add-to-cart/2/1
- Get cart
- Method: GET
- Header: api_token, required
- Parameter: None
- URI:
get-cart
- Remove from cart
- Method: GET
- Header: api_token, required
- Parameter: {product_id}
- URI:
remove-product/1
- Submit coupon
- Method: POST
- Header: api_token, required
- Parameter: {code_name}, required
- URI:
submit-coupon
- Remove coupon
- Method: GET
- Header: api_token, required
- Parameter: None
- URI:
remove-coupon
- Delete cart
- Method: GET
- Header: api_token, required
- Parameter: None
- URI:
delete-cart
- Use Port 3135, Endpoints:
http://localhost:3135/api/v1/order/
- Checkout cart
- Method: POST
- Header: api_token, required
- Parameter: {shipping_name}, {shipping_phone}, {shipping_email}, {shipping_address}, all parameters are required
- URI:
checkout
- Return Value: the one which is
order_no
, you have to save it to confirm the payment later
- Payment Confirmation
- Method: POST
- Header: api_token, required
- Parameter: {order_no}, {paid_grand_total}, {paid_date}, {payment_proof}, all parameters are required
- URI:
payment-confirm
- Track Order
- Method: POST
- Header: api_token, required
- Parameter: {order_no}, required
- URI:
track
- Track Shipment
- Method: POST
- Header: api_token, required
- Parameter: {order_no}, {shipping_ID}, required
- URI:
track-shipment
- List all orders
- Method: GET
- Header: api_token, required
- Parameter: None
- URI: None
- Role: Admin
- Get detail Order
- Method: GET
- Header: api_token, required
- Parameter: {id}
- URI:
1
- Role: Admin
- Validate order (automatically check the order is valid or invalid based on my #Assumption above)
- Method: POST
- Header: api_token, required
- Parameter: {order_no}, required
- URI:
validate
- Role: Admin
- Submit the Shipping ID to Order
- Method: POST
- Header: api_token, required
- Parameter: {order_no}, {shipping_ID}, All parameters are required
- URI:
shipment
- Role: Admin
This project is licensed under the MIT License