Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/andrekuratomi/pagar.me

Simplified version of a market place API and also a payment system where it is possible to buy products and process payments considering products quantity and payment fees.
https://github.com/andrekuratomi/pagar.me

django django-rest-framework generic-views python3

Last synced: about 1 month ago
JSON representation

Simplified version of a market place API and also a payment system where it is possible to buy products and process payments considering products quantity and payment fees.

Awesome Lists containing this project

README

        

# PAGAR.ME

- [Translations](#translations)
- [About](#about)
- [Diagram](#diagram)
- [Description](#Description)
- [Instalation](#instalation)
- [Documentation](#documentation)
- [References](#references)
- [Terms_of_use](#terms-of-use)


## Translations

- [Português brasileiro / Brazilian portuguese](./.multilingual_readmes/README_pt-br.md)
- [English](https://github.com/AndreKuratomi/pagar.me)


## About

The API Pagar.me is a simplified version of a market place and it is also a payment system where it is possible to buy products and process payments. This API uses python's framework Django and its Generic Views.


## Description

The Pagar.me API works with 4 tables: Users (Accounts), products (Product), fees (Fee), and payments (PaymentInfo). Bellow a brief description of each one and its register rules:

USERS:

Types:

There are 3 types of users: Seller (seller), Administrador (admin) and the common user (the one who's neither admin nor seller).

Permissons:

- Only logged admin users may register another user and list them.
- All logged users may update their own data.

PRODUCTS:

Permissons:

- Only logged seller users can register products and list them by id.
- A seller may list all of its registered products.

Register rules:

All products to be registered may have at least 1 copy.

FEES:

Permissons:

Only logged admin users can register fees and list them.

Other info:

- The default system fees are:

Credit card - 5%
Debit card - 3%

- Fees cannot be deleted.

PAYMENT INFO:

Permissons:

Only logged users that are neither administradors nor sellers can register cards and list them.

Register rules:

- Card numbers out of the expiration date cannot be registered.
- A card number may be registerd more than once if its payments metyhods are different (eg: credit or debit).

Other info:

- Only the last 4 card number digits are displayed.
- As well as the user's password, the card's CVV is registered but not displayed.

Bellow the tables diagram:

## Diagram

diagram of table relationships
Table relationshipts


## Instalation:

0. It is first necessary to have instaled the following devices:

- The code versioning [Git](https://git-scm.com/downloads).

- A code editor, also known as IDE. For instance, [Visual Studio Code (VSCode)](https://code.visualstudio.com/).

- A client API REST program. [Insomnia](https://insomnia.rest/download) or [Postman](https://www.postman.com/product/rest-client/), for instance.

-

And versioning your directory to receive the aplication clone:

```
git init
```



1. Clone the repository pagar.me by your machine terminal or by the IDE's:

```
git clone https://github.com/AndreKuratomi/pagar.me.git
```

WINDOWS:

Obs: In case of any mistake similar to this one:

```
unable to access 'https://github.com/AndreKuratomi/pagar.me.git/': SSL certificate problem: self-signed certificate in certificate chain
```

Configure git to disable SSL certification:

```
git config --global http.sslVerify "false"
```

Enter the directory:

```
cd pagar.me
```

2. After cloning the repository install:

Install virtual enviroment and update its dependencies with the following command:

LINUX:
```
python3 -m venv venv --upgrade-deps
```

WINDOWS:
```
py -m venv venv --upgrade-deps
```


Ativate your virtual enviroment with the command:

LINUX:
```
source venv/bin/activate
```

WINDOWS:

On Windows operational system it is necessary to configure the Execution Policy at PowerShell:

```
Get-ExecutionPolicy # to check the Execution policy type
Set-ExecutionPolicy RemoteSigned # to change the type of policy if the command above shows 'Restricted'
```
Obs: It may often be necessary to open PowerShell as administrador for that.

```
.\env\Scripts\activate
```


Install its dependencies:

```
pip install -r requirements.txt
```

WINDOWS:

In case any error similar to the one bellow be returned:

```
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\andre.kuratomi\\OneDrive - Company\\Área de Trabalho\\pagar.me\\pagar.me\\env\\Lib\\site-packages\\jedi\\third_party\\django-stubs\\django-stubs\\contrib\\contenttypes\\management\\commands\\remove_stale_contenttypes.pyi'
HINT: This error might have occurred since this system does not have Windows Long Path support enabled. You can find information on how to enable this at https://pip.pypa.io/warnings/enable-long-paths
```

Run cmd as adminstrador with the following command:

```
reg.exe add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
```

3. Open the aplication with your IDE:

```
code .
```

4. And run django:

LINUX:
```
python manage.py runserver
```

WINDOWS:
```
py manage.py runserver
```

## Documentation

For full description of endpoints and its responses check the insomnia documentation on the link bellow (necessary free login account):

https://pagar-5frujasuz-abkuras-projects.vercel.app/


## References

- [Django](https://www.djangoproject.com/)
- [Django Rest Framework](https://www.django-rest-framework.org/)
- [Generic views](https://www.django-rest-framework.org/api-guide/generic-views/)
- [Git](https://git-scm.com/downloads)
- [Insomnia-documenter](https://www.npmjs.com/package/insomnia-documenter)
- [Insomnia-documenter (quick tutorial)](https://www.youtube.com/watch?v=pq2u3FqVVy8)
- [Python](https://www.python.org/downloads/)
- [SQLite3](https://docs.python.org/3/library/sqlite3.html)
- [Visual Studio Code (VSCode)](https://code.visualstudio.com/)


## Terms of use

This project is exclusively for didatic purposes and has no commercial intent.