Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
4a0154c
fix(feature/login): removing the 'unsuccessful login due to incorrect…
Dec 12, 2023
c50c111
fix(feature/login): 'unsuccessful login due to wrong password
Dec 12, 2023
b2e4006
fix(feature/login): fixing the 'unsuccessful login due to wrong email…
Dec 12, 2023
13e46e0
fix(feature/login): fixing the problems with parameters and lack of i…
Dec 12, 2023
d416782
feat(features): adding the payment_method.feature
breno-gabriel Feb 7, 2024
08d3821
add: adding the paymemt_methods_schemas, and some payment methods routes
breno-gabriel Feb 8, 2024
9dcd279
feat(database;py): adding a add function in the database.py file
breno-gabriel Feb 9, 2024
c88976e
feat: adding the pyament methods schemas
breno-gabriel Feb 9, 2024
ef72c5a
fix: removing the Pix schema and renaming the Boleto schema
breno-gabriel Feb 9, 2024
29092bf
feat: adding the payment methods service
breno-gabriel Feb 9, 2024
8ad1b55
fix: Improving the payment methods schemas
breno-gabriel Feb 9, 2024
bdb8347
fix: fixing the dict problem in the database
breno-gabriel Feb 9, 2024
bf834e7
feat: adding the inserting method route
breno-gabriel Feb 9, 2024
bf0ae2b
feat: adding the route of the payment method feature
breno-gabriel Feb 9, 2024
2ecba2c
feat(payment_methods.py) Adicionando uma base de dados para os método…
breno-gabriel Feb 14, 2024
d78128e
feat(schemas) Adicionando um schema para o cartao
breno-gabriel Feb 14, 2024
9f0fd54
fix(service): fixing the inserting_method of the PaymentService class
breno-gabriel Feb 14, 2024
03b3abb
fix: commitando alguns pequenos ajustes no codigo
breno-gabriel Feb 14, 2024
c6d4f47
feat(schemas): adding the Boleto and Pix schemas
breno-gabriel Feb 14, 2024
4d638d7
feat(router): adding a new endpoint for inserting a new payment method
breno-gabriel Feb 14, 2024
1286fd0
feat: adding a new endpoint
breno-gabriel Feb 14, 2024
11963a1
feat: adding a response function to the payment method feature
breno-gabriel Feb 14, 2024
f04e5d4
fix: some adjusts in /inserting/cartao endpoint
breno-gabriel Feb 14, 2024
9c61ade
fix: adding a () in the HttpPaymentResponse.INSERTION_SUCESSFULLY
breno-gabriel Feb 14, 2024
1be38c3
feat: adding the validity and CPF validation
breno-gabriel Feb 14, 2024
7ec86e0
feat: adding the HTTPPaymentResponse.INSERTION_SUCESSFULLY fot valida…
breno-gabriel Feb 14, 2024
95eaaa9
feat: adding the BAD_REQUEST method
breno-gabriel Feb 14, 2024
8229a83
fix: adding a tag to payment methods
breno-gabriel Feb 14, 2024
1ac7aef
feat: adding the Adicionar_boleto and Adicionar_pix methods
breno-gabriel Feb 14, 2024
2458ab9
feat: adding the insertion_boleto and insertion_pix methods
breno-gabriel Feb 14, 2024
737632b
feat: adding the PIX_INSERTED_SUCESSFULLY and BOLETO_INSERTED_SUCESSF…
breno-gabriel Feb 14, 2024
369a5d3
feat: adding the Boleto and Pix schemas
breno-gabriel Feb 14, 2024
a5876ff
feat: adding the '/inserting/pix' and '/inserting/boleto' endpoints
breno-gabriel Feb 14, 2024
3217788
fix: switching the summary for a description
breno-gabriel Feb 14, 2024
3a0514f
feat: changing the user identifier from CPF to username
breno-gabriel Feb 14, 2024
623cbd8
feat: Changing the CPF for username in the insertion of information i…
breno-gabriel Feb 14, 2024
e4d0003
feat: adicionando o método 'obter_lista_de_metodos_pagamento'
breno-gabriel Feb 14, 2024
846bc12
feat: adding the method 'get_payment_methods'
breno-gabriel Feb 14, 2024
7431e0d
feat: adding a get request method
breno-gabriel Feb 14, 2024
797d5b8
feat: adding a key existence verifier to the 'obter_lista_de_pagament…
breno-gabriel Feb 14, 2024
d6cd28d
feat: adding the 'ger_payment_methods' function
breno-gabriel Feb 14, 2024
0e62ce7
feat: adding the 'INEXISTENT_USER' response
breno-gabriel Feb 14, 2024
6f85562
fix: changing the user_name for CPF
breno-gabriel Feb 14, 2024
3e8cf7e
feat: adding the update payment
breno-gabriel Feb 15, 2024
4c2e5c5
feat: adding the deletion methods
breno-gabriel Feb 15, 2024
3c50c53
fix: some ajusts
breno-gabriel Feb 15, 2024
b085c37
refactor: unifying the 'InSERTION_SUCESSFULYY' method
breno-gabriel Feb 15, 2024
66b0288
feat: adding the card number validation
breno-gabriel Feb 15, 2024
e4ea717
feat: adding a CPF validator for pix and ticket
breno-gabriel Feb 16, 2024
1704a9b
refactor: Adding some comments and translating functions and variable…
breno-gabriel Feb 17, 2024
1d5ad24
feat: adding a already exist pix or boleto verifier
breno-gabriel Feb 18, 2024
b00e8d4
feat: adding the PIX_AREADY_EXIST and BOLETO_ALREADY_EXIST functions
breno-gabriel Feb 18, 2024
1da408a
feat: adding some final adjusts
breno-gabriel Feb 18, 2024
0ea3a73
adding some final adjusts
breno-gabriel Feb 18, 2024
d65e90b
Delete .idea/.gitignore
Diego-djaar Feb 19, 2024
7f621cd
Delete .idea/Projeto-ESS2.iml
Diego-djaar Feb 19, 2024
3b27c4a
Delete .idea/inspectionProfiles/profiles_settings.xml
Diego-djaar Feb 19, 2024
2d9a374
Delete .idea/misc.xml
Diego-djaar Feb 19, 2024
5364dfe
Delete .idea/modules.xml
Diego-djaar Feb 19, 2024
8529625
Delete .idea/vcs.xml
Diego-djaar Feb 19, 2024
78ed993
Delete backend/Usuários teste.json
Diego-djaar Feb 19, 2024
ac3531b
Delete backend/Usuários.json
Diego-djaar Feb 19, 2024
3b8c784
Merge branch 'development' into feature_payment_method
Feb 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions backend/payment_database.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"111.111.111-10": [
{
"id": "2616058799231613355",
"tipo": "pix",
"nome_completo": "Breno gabriel de Melo Lima",
"cpf": "111.111.111-10"
}
]
}
10 changes: 5 additions & 5 deletions backend/src/api/items.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fastapi import APIRouter, status
from src.schemas.response import HttpResponseModel
from src.service.impl.item_service import ItemService
# from src.service.impl.item_service import ItemService

router = APIRouter()

Expand Down Expand Up @@ -34,8 +34,8 @@ def get_item(item_id: str) -> HttpResponseModel:
- HTTPException 404: If the item is not found.

"""
item_get_response = ItemService.get_item(item_id)
return item_get_response
# item_get_response = ItemService.get_item(item_id)
# return item_get_response


@router.get(
Expand All @@ -60,9 +60,9 @@ def get_items() -> HttpResponseModel:

"""

item_list_response = ItemService.get_items()
# item_list_response = ItemService.get_items()

return item_list_response
# return item_list_response


# TODO: Add POST, PUT, DELETE endpoints
112 changes: 112 additions & 0 deletions backend/src/api/payment_methods.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
from fastapi import APIRouter, status, HTTPException
from src.service.impl.payment_method_service import PaymentService
from src.schemas.payment_schema import Cartao, Boleto, Pix, CartaoUpdate, PixUpdate, BoletoUpdate
from src.schemas.response import HTTPResponses, HttpResponseModel
from fastapi.responses import JSONResponse


router = APIRouter()

@router.post(
'/inserting/cartao',
response_model=HttpResponseModel,
status_code=201,
description="Insert a new card",
)
def insert_payment(cartao: Cartao) -> HttpResponseModel:
response = PaymentService.inserting_card(cartao)
return response

@router.post(
'/inserting/pix',
response_model=HttpResponseModel,
status_code=201,
description="Insert a new pix acount",
)
def insert_payment(pix: Pix) -> HttpResponseModel:
response = PaymentService.insertion_pix(pix)
return response

@router.post(
'/inserting/boleto',
response_model=HttpResponseModel,
status_code=201,
description="Insert a new boleto acount",
)
def insert_payment(boleto: Boleto) -> HttpResponseModel:
response = PaymentService.insertion_ticket(boleto)
return response

# @router.get(
# "/get/payment_methods",
# description="Get the payments methods of a especific user"
# )
# def get_payment_methods(username:str):

# request = PaymentService.get_payment_methods(username)

# return request

@router.put(
"update/cartao/{id}",
response_model=HttpResponseModel,
status_code=200,
description="Update the card payment method"
)
def update_payment(id: str, cartao: CartaoUpdate):

response = PaymentService.update_card(id, cartao)

return response

@router.put(
"/update/pix/{id}",
response_model=HttpResponseModel,
status_code=200,
description="Update the pix payment method"
)
def update_payment(id: str, pix: PixUpdate):

response = PaymentService.update_pix(id, pix)

return response

@router.put(
"/update/boleto/{id}",
response_model=HttpResponseModel,
status_code=200,
description="Update the boleto payment method"
)
def update_payment(id: str, boleto: BoletoUpdate):

response = PaymentService.update_ticket(id, boleto)

return response

@router.delete(
"/delete/{method_id}",
response_model=HttpResponseModel,
status_code=200,
description="Delete a payment method"
)
def delete_method(method_id: str):

response = PaymentService.delete_method(method_id)

return response

# @router.post(
# "/inserting/{method_name}",
# response_model=HttpResponseModel,
# summary="Create a new payment method"
# )
# def insert_payment_method(method_name: str, cartao: Cartao, pix: Pix, boleto: Boleto) -> HttpResponseModel:
# if method_name == "boleto":
# response = PaymentService.inserting_cartao(boleto)
# return response
# elif method_name == "pix":
# response = PaymentService.insertion_pix(pix)
# return response
# elif method_name == "cartao":
# response = PaymentService.inserting_cartao(cartao)
# return response
7 changes: 4 additions & 3 deletions backend/src/api/router.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from fastapi import APIRouter
from src.api import users
from src.api import users, payment_methods

api_router = APIRouter()
# api_router.include_router(items.router, prefix="/items", tags=["items"])

api_router.include_router(users.router, prefix="/auth/user", tags = ["user"])

api_router.include_router(users.router, prefix="/auth/user", tags = ["user"])
api_router.include_router(payment_methods.router, prefix="/payment", tags=["Payment"])
3 changes: 0 additions & 3 deletions backend/src/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
from .user_database import UserDatabase
from .config.create_collections import create_collections

database = Database()
user_database = UserDatabase()
user_database_example = UserDatabase("Usuários teste.json")
user_database_example.clear_database()

# create_collections(database)
27 changes: 25 additions & 2 deletions backend/src/db/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def connect(self):

logger.setLevel(INFO)

self.db = mongo_connection[env.DB_NAME]
self.db = mongo_connection[str(env.DB_NAME)]

print("--------------------")
logger.info("MongoDB connected!")
Expand Down Expand Up @@ -208,4 +208,27 @@ def insert_item(self, collection_name: str, item: dict) -> dict:
- list:
A list of all items in the collection.

"""
"""

def add(self, collection_name: Collection, item: dict) -> dict:

#Insert a item in a collection.

#Args:
#collection_name (Collection) --> name of the collection.
#item (dict) --> the item in form of a dict.

#Process:
#acessing the collection of the item.
#storing the item in the collection.

#Outuput:
#A document containing:
#A boolean acknowledged as true if the operation ran with write concern or false if write concern was disabled.
#A field insertedId with the _id value of the inserted document.

collection: Collection = self.db[collection_name]

result = collection.insert_one(dict(item))

return result
Loading