EcommerceApp


EcommerceApp Server

A checkout functionality for an ecommerce application 📖

Made with Golang 🚀

GitHub language count
Made by Lgdev07
License

Stargazers

Installation and execution   |   
Available Routes   |   
How to contribute   

🚀 Installation and execution

  1. Clone this repository and go to the directory;
  2. Rename sample .env;

🔧 Development

  1. Rename .env_sample to .env;
  2. Run docker-compose up;
  3. Make the Requests to http://localhost:8080;

🧪 Tests

  1. 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.


GitHub

View Github