feat: add full pay path
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from src.application.domain.entities.user import UserEntity
|
||||
from src.application.domain.entities.session import SessionEntity
|
||||
from src.application.domain.entities.order import OrderEntity
|
||||
from src.application.domain.entities.payment import PaymentEntity
|
||||
|
||||
|
||||
__all__ = ['UserEntity', 'SessionEntity']
|
||||
__all__ = ['PaymentEntity', 'OrderEntity']
|
||||
36
src/application/domain/entities/order.py
Normal file
36
src/application/domain/entities/order.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from __future__ import annotations
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
from src.application.domain.enums import OrderStatus
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class OrderEntity:
|
||||
id: str | None = None
|
||||
created_at: datetime | None = None
|
||||
updated_at: datetime | None = None
|
||||
|
||||
user_id: str | None = None
|
||||
usdt_amount: Decimal | None = None
|
||||
usdt_exchange_rate: Decimal | None = None
|
||||
gas_fee: Decimal | None = None
|
||||
total_price: Decimal | None = None
|
||||
service_fee: Decimal | None = None
|
||||
status: OrderStatus | None = None
|
||||
|
||||
client_payment_id: str | None = None
|
||||
|
||||
itpay_payment_qr_url_desktop: str | None = None
|
||||
itpay_payment_qr_url_android: str | None = None
|
||||
itpay_payment_qr_url_ios: str | None = None
|
||||
|
||||
itpay_payment_qr_image_desktop: str | None = None
|
||||
itpay_payment_qr_image_android: str | None = None
|
||||
itpay_payment_qr_image_ios: str | None = None
|
||||
|
||||
itpay_id: str | None = None
|
||||
itpay_qr_id: str | None = None
|
||||
itpay_amount: Decimal | None = None
|
||||
itpay_created_at: datetime | None = None
|
||||
|
||||
21
src/application/domain/entities/payment.py
Normal file
21
src/application/domain/entities/payment.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from __future__ import annotations
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
from src.application.domain.enums import PaymentStatus
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class PaymentEntity:
|
||||
user_id: str | None = None
|
||||
|
||||
order_id: str | None = None
|
||||
status: PaymentStatus | None = None
|
||||
|
||||
receipt_cloudekassir_link: str | None = None
|
||||
|
||||
itpay_payment_id: str | None = None
|
||||
transaction_id: str | None = None
|
||||
web3_transaction_hash: str | None = None
|
||||
paid_at: str | None = None
|
||||
expired_date: str | None = None
|
||||
@@ -1,2 +1,5 @@
|
||||
from src.application.domain.enums.log_level import LogLevel
|
||||
from src.application.domain.enums.log_format import LogFormat
|
||||
from src.application.domain.enums.log_format import LogFormat
|
||||
from src.application.domain.enums.itpay_payment_status import ItPayPaymentStatus
|
||||
from src.application.domain.enums.order_status import OrderStatus
|
||||
from src.application.domain.enums.payment_status import PaymentStatus
|
||||
7
src/application/domain/enums/itpay_payment_status.py
Normal file
7
src/application/domain/enums/itpay_payment_status.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class ItPayPaymentStatus(Enum):
|
||||
COMPLETED = "payment.completed"
|
||||
REJECTED = "payment.rejected"
|
||||
CANCELLED = "payment.canceled"
|
||||
10
src/application/domain/enums/order_status.py
Normal file
10
src/application/domain/enums/order_status.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class OrderStatus(str, Enum):
|
||||
PENDING = 'pending'
|
||||
REJECTED = 'rejected'
|
||||
COMPLETED = 'completed'
|
||||
CANCELLED = 'cancelled'
|
||||
ERROR = 'error'
|
||||
CANCELED = 'canceled'
|
||||
12
src/application/domain/enums/payment_status.py
Normal file
12
src/application/domain/enums/payment_status.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class PaymentStatus(str,Enum):
|
||||
PENDING='pending'
|
||||
MONEY_ACCEPTED='money_accepted'
|
||||
WEB3_HASH_ERROR='web3_hash_error'
|
||||
WEB3_BALANCE_PROBLEM='web3_balance_problem'
|
||||
USDT_DELIVERED='usdt_delivered'
|
||||
RECEIPT_ERROR='receipt_error'
|
||||
COMPLETED='completed'
|
||||
|
||||
@@ -15,4 +15,4 @@ class ApplicationException(Exception):
|
||||
self.headers = headers
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.status_code}: {self.message}"
|
||||
return f'{self.status_code}: {self.message}'
|
||||
|
||||
Reference in New Issue
Block a user