Hi everyone, i would like to present a project that was done by my internship group, this project consists of a ecommerce based on a microservice architecture. Well, we have three microservice connect by feign and they all have great importance in the operation of the application.
Endpoints:
CREATE_ORDER:
localhost:8000/orders
GET_ORDER_BY_ID:localhost:8000/orders/{id}
CANCEL_ORDER:localhost:8000/orders/{id}/cancel
UPDATE_ORDER:localhost:8000/orders/{id}
GET_ALL_ORDERS:localhost:8000/orders
{
"products": [
{
"productId": 6,
"quantity": 2
},
{
"productId": 3,
"quantity": 1
}
],
"address": {
"street": "Av. do Alemão",
"number": 2,
"postalCode": "65919-2701"
},
"paymentMethod": "PIX"
}
Note
product IDs in products list must exists in database and the postalCode
can be real beacause it uses geradordecep API to find the real postal code and bring all the informations.
PaymentMethod
field can only be CREDIT_CARD, BANK_TRANSFER, CRYPTOCURRENCY, GIFT_CARD, PIX or OTHER
.
{
"cancelReason": "message"
}
Important
If the order that you want to cancel has status
field as SENT
or the creation date exceeds 90 days, you cannot cancel that order.
The payload of the update endpoint is the same as the creation one, but if the order you want to update has a status of SENT
or CANCELED
, you can update it.
Endpoints:
CREATE_PRODUCT:
localhost:8080/products
GET_PRODUCT_BY_ID:localhost:8080/products/{id}
DELETE_PRODUCT:localhost:8080/products/{id}
UPDATE_PRODUCT:localhost:8080/products/{id}
GET_ALL_PRODUCTS:localhost:8080/products
{
"name": "shadow t-shirt2",
"description": "very well tshit",
"value": 15
}
Note
The description
must be more than 10 characteres.
No field can be empty or null.
Update payload
is the same as create product but you have to add an id.
Endpoints:
CREATE_FEEDBACK:
localhost:8100/feedbacks
GET_FEEDBACK_BY_ID:localhost:8100/feedbacks/{id}
DELETE_FEEDBACK:localhost:8100/feedbacks/{id}
UPDATE_FEEDBACK:localhost:8100/feedbacks/{id}
GET_ALL_FEEDBACKS:localhost:8100/feedbacks
{
"scale": "SATISFIED",
"comment": "very good product",
"orderId": 80
}
Note
The field orderId
must represent a real id in order database.
Update payload
is the same as create product but you have to add an id.
The rest of endpoint don't require any type of payload.
Warning
If you choose to run the project manually, i recommend running the order microservice first to avoid problems.