/checkout-api

Real-time marketplace RESTful API

Primary LanguageC#MIT LicenseMIT

Checkout.API

Build Status

About

Checkout.API simulates a real-time marketplace by exposing a RESTful API that allows customers to list a catalog of products, add/remove items to a cart, update their quantity according to the stock availble, as well as clearing out the cart entirely.

A set of back-office routes allows administrators to perform CRUD operations on the product catalog

Any operation that alters the state of a shopping cart (e.g adding or removing an item to cart) will trigger a push notification by the server (using SignalR) that will notify every connected clients with the newly updated available quantity for the given product.

On top of that, any iddle client that does not perform operations on their cart will trigger the cart the be cleared, updating therefore the available quantity of the products. Connected clients will be notified accordingly

Development Environment

Prerequesites: Checkout API is powered by ASP.NET Core 2.1 and SQL Server. Those two main dependecies should be installed locally.

  1. Clone the repo
  2. Run the following commands:
cd Checkout.API
cp 'appsettings.json' 'appsettings.Development.json'
## Replace the default connection string with the desired one
dotnet restore
dotnet ef database update
dotnet build
dotnet run
  1. Open a browser and navigate to http://{host}:{port}/api/swagger

API Documentation

A static documentation of the API can be found here

Otherwise, the API is fully self-documented by swagger and is accessible once the API is the deployed at the route: /api/swagger

Continuous Integration

Checkout.API uses Travis CI to run every tests in the test project Checkout.API.Test

Testing

cd Checkout.API.Tests
dotnet test

TODO

  • Support stock increase in administration
  • Add authentication
  • Setup continuous deployment script
  • Support checkout