Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/andrewindeche/clientorderservice

The project contains a python service for customers to make orders
https://github.com/andrewindeche/clientorderservice

ansible cicd django-rest-framework kubernetes postgresql rest-api terraform

Last synced: about 20 hours ago
JSON representation

The project contains a python service for customers to make orders

Awesome Lists containing this project

README

        

# Client Order Service

|Tool | Description | Tags for tools used |
| ------------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------- |
| 1.GitHub| Version Control| [Version-Control]; [Repo]; [Pipeline]; [Continuous integration];[Continuous Delivery]|
| 2.Django Rest API | Python Based Backend Framework| [python]; [Django];|
| 3.PostgresQl | Relational Database| [Relational Integrity]; [Database];|
| 4.Pipenv | Package/Dependency manager| [Virtual Environment];[Dependency];|
| 5.Ansible |Configuration Automation Tool | [Orchestration];[ configuration management]|
| 6.Terraform | Infrastructure as Code Tool | [IaC]; [Provisioning]; [Cloud Resources];|
| 7.Kubernetes | Container Orchestration Platform | [Containers]; [Cluster Management]; [Scalability];|
| 8.Africa’s Talking SMS Gateway | Communication Platform | [SMS]; [API]; [Messaging];|
| 9.OpenID | Connect Authentication Protocol | [OAuth 2.0]; [Authentication]; [Identity Management];|
| 10.Google Cloud Platform | Infrastructure As A Service | [Cloud Platform]; [Deployment];|
| 11.CircleCI | continuous integration and delivery (CI/CD) Platform | [Continuous integration]; [Continuous Delivery];[CI/CD]|

##

Description


The aim of the project is to build a DRF(Django Rest Framework) client order service that enables a client to make orders.

##

Set up Instructions


Github



  • Download the Zip file from the code tab on github to get the project Zip files (Recommended)

  • Clone the project using 'git clone https://github.com/andreindeche/clientorderservice.git'.

  • Unzip the file and add the Project folder to your IDE/Compiler

1. Create an .env environment on the Django root folder and add the recessary environment variables.
Use env.example as a guide for environment variables.

Django


The project uses pipenv, django and postgresql backend

1. Install pipenv using the command

```bash
pip install pipenv
```

2. Activate your virtual enviromnment

```bash
pipenv shell
```

3. Naviagte to your Django project and use in the directory path: backend\requirements.txt to install the required django dependencies

```bash
pipenv install -r requirements.txt
```

4. Create an .env on the Django root folder and add the recessary environment variables.

Use (backend\env.example) as a guide for environment variables

5. Create a Super User using

```bash
python manage.py createsuperuser
```

6. Migrate your DB using

```bash
python manage.py migrate
```

7. To run the project outside of a shell environment use:

```bash
pipenv run python manage.py runserver
```

or while in the shell environment use:

```bash
python manage.py runserver
```

8. To Run Tests:

```bash
python manage.py test
```

Africa's Talking


Africa's talking has been used as the SMS/Communication gateway for the project to enable SMSes on order or update of the orders.
1. Create an account on the site https://africastalking.com/sms.
2. Generate an api key and set it on the environment variable 'YOUR_API_KEY'.

Endpoints


Use POSTMAN or any API tool to test the endpoints after login.
Orders can only be made by authenticated users.

Authentication


Authenticate to register as a user and interact with the API Endpoints.
For logins, click on the link and authenticate on a browser.
URL = 'http://localhost:8000'

1.Login.
http://{URL}/accounts/login/ or http://{URL}/accounts/google/login/
2.Register
http://{URL}/accounts/signup/

3.View Customer code:
http://{URL}/accounts/account_page/

4.Logout
navigate to:
http://{URL}/accounts/google/login/
Select Logout

5.Generate Tokens for transactions:
Fields: "username", "password",

POST:/api/token/

POST:/api/token/refresh/ to refresh token

6.Create Order
POST:http://{URL}/api/create_order/
Headers: Content-Type: application/json
Authorization: Add Token
Example:Json payload:{
"customer_code": "CUST123",
"item": "Laptop",
"amount": 500
}
7.Update Order
PUT,PATCH:http://{URL}/api/update_order//
To get UUID via Python shell for ORM :


  • python3 manage.py shell

  • from orders.models import Order
    order = Order.objects.first() # Or use a filter to get a specific order
    print(order.order_id) # This will print the UUID
    or
    SELECT order_id FROM orders;

##

Author


Built by Andrew Indeche