Skip to content

xp-rodion/interview-rishat

Repository files navigation

Interview Rishat

Setup

  1. Clone repository
$ git clone https://github.com/xp-rodion/StoreApi.git
  1. Configure environment:

    1. Copy example environment preset and open its:
    $ cp .env.example .env && vim .env
    1. Configurate DB connection for local db or use default values for docker running(default already in env.example):
    POSTGRES_USER=
    POSTGRES_PASSWORD=
    POSTGRES_HOST=
    POSTGRES_PORT=
    POSTGRES_DB=
    

    I will write the keys for stripe and django here: 3.

       SECRET_KEY=django-insecure-j+&f=#oewr%mh)r5c%p^*0nd695agi-_g4-k!$$)$r4bq$w_(j
       STRIPE_PUB_KEY=pk_test_51MUuvEJE4wc8vNIdQq2Da8zV04wmR3Wk5NAQiAAqen0oVbSr2vp7zlhHeeZg0Y9WmlWB5ZtvElNO2tCitjNjc36600NMHC2Soj
       STRIPE_SEC_KEY=sk_test_51MUuvEJE4wc8vNIdaD2yATDtrrZQGI7MsJNYVbUjayN6UeJOAGpdvKs8QMNAnleBclCwVe4lMZUehPJU7g9SLXYz00WnAn6JdS
    
    1. Default set for server:
        SERVER_HOST=0.0.0.0
        SERVER_PORT=8000
    
  2. Run server: 1. Inside container:

    $ docker-compose up -d --build
    1. Using the admin panel, you can set up models and test the api or upload fixture data:
      $ sudo docker exec -it web python manage.py loaddata --format=json [Model] > [JSON fixture].json

API documentation

  1. http://45.8.248.105:8000/admin - admin panel for creating items, taxes, orders and discounts
  2. http://45.8.248.105:8000/api/item/<item_id> - getting the session_id of the item
  3. http://45.8.248.105:8000/api/buy/<item_id> - stripe page for payment of item
  4. http://45.8.248.105:8000/api/buy_order/<order_id> - getting the session_id of the order
  5. http://45.8.248.105:8000/api/order/<order_id> - stripe page for payment of order

login: admin password: 16082003

Description:

Taxes and discounts are checked by hanging their admin panel on order

About

Тестовое задание для Ришат

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages