EcommerceApp Server
A checkout functionality for an ecommerce application
Made with Golang
Installation and execution | Available Routes | How to contribute
๐
Installation and execution
- Clone this repository and go to the directory;
- Rename sample .env;
๐ง
Development
- Rename
.env_sample
to.env
; - Run
docker-compose up
; - Make the Requests to
http://localhost:8080
;
๐งช
Tests
- Run
docker-compose -f docker-compose.test.yml up --build --abort-on-container-exit
;
๐ฃ๏ธ
Available Routes
POST - Create Checkout:
- /checkout
Expected Json Body Request:
{
"products": [
{
"id": 1,
"quantity": 1
}
]
}
Expected Json Response:
{
"total_amount": 20000,
"total_amount_with_discount": 19500,
"total_discount": 500,
"products": [
{
"id": 1,
"quantity": 2,
"unit_amount": 10000,
"total_amount": 20000,
"discount": 500,
"is_gift": false
},
{
"id": 3,
"quantity": 1,
"unit_amount": 0,
"total_amount": 0,
"discount": 0,
"is_gift": true
}
]
}
๐ค
How to contribute
- Fork this repository;
- Create a branch with your feature:
git checkout -b my-feature
; - Commit your changes:
git commit -m 'feat: My new feature'
; - Push to your branch:
git push origin my-feature
.
After the merge of your pull request is done, you can delete your branch.