feat: add full pay path
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
from typing import Protocol, runtime_checkable
|
||||
from src.application.abstractions.repositories import IUserRepository, ISessionRepository
|
||||
from src.application.abstractions.repositories import IOrderRepository,IPaymentRepository
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
@@ -12,8 +12,8 @@ class IUnitOfWork(Protocol):
|
||||
async def rollback(self) -> None: ...
|
||||
|
||||
@property
|
||||
def user_repository(self) -> IUserRepository: ...
|
||||
def order_repository(self) -> IOrderRepository: ...
|
||||
|
||||
@property
|
||||
def session_repository(self) -> ISessionRepository: ...
|
||||
def payment_repository(self) -> IPaymentRepository: ...
|
||||
|
||||
|
||||
@@ -1,18 +1,2 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Protocol,runtime_checkable
|
||||
|
||||
from src.application.domain.entities import SessionEntity,UserEntity
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class IUserRepository(Protocol):
|
||||
...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class ISessionRepository(Protocol):
|
||||
...
|
||||
|
||||
|
||||
__all__=['IUserRepository','ISessionRepository','UserEntity','SessionEntity']
|
||||
from src.application.abstractions.repositories.i_order_repository import IOrderRepository
|
||||
from src.application.abstractions.repositories.i_payment_repository import IPaymentRepository
|
||||
@@ -0,0 +1,24 @@
|
||||
from abc import ABC,abstractmethod
|
||||
|
||||
from src.application.domain.entities.order import OrderEntity
|
||||
|
||||
|
||||
class IOrderRepository(ABC):
|
||||
@abstractmethod
|
||||
async def create(self,order: OrderEntity) -> OrderEntity:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@abstractmethod
|
||||
async def get_by_client_payment_id(self,client_payment_id: str) -> OrderEntity | None:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@abstractmethod
|
||||
async def update_after_itpay_payment_created(self,order: OrderEntity) -> OrderEntity:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@abstractmethod
|
||||
async def update_after_itpay_failure(self,order: OrderEntity) -> OrderEntity:
|
||||
raise NotImplementedError
|
||||
@@ -0,0 +1,10 @@
|
||||
from abc import ABC,abstractmethod
|
||||
|
||||
from src.infrastructure.database.models.payment import Payment
|
||||
|
||||
|
||||
class IPaymentRepository(ABC):
|
||||
@abstractmethod
|
||||
async def create_completed(self,*,user_id:str,order_id:str,itpay_payment_id:str,itpay_paid_amount:str|None,transaction_id:str|None,paid_at:str|None,expired_date:str|None) -> Payment:
|
||||
raise NotImplementedError
|
||||
|
||||
Reference in New Issue
Block a user