Функционал для физ лиц #2
@@ -34,13 +34,20 @@ from src.presentation.schemas.mappers import (
|
|||||||
)
|
)
|
||||||
from src.presentation.schemas.organization import (
|
from src.presentation.schemas.organization import (
|
||||||
CreateOrganizationRequest,
|
CreateOrganizationRequest,
|
||||||
|
OrganizationListResponse,
|
||||||
|
DocumentResponse,
|
||||||
|
OrganizationResponse,
|
||||||
|
UpdateOrganizationRequest,
|
||||||
|
)
|
||||||
|
from src.presentation.schemas.entity import (
|
||||||
CreateWalletsResponse,
|
CreateWalletsResponse,
|
||||||
MnemonicResponse,
|
MnemonicResponse,
|
||||||
OrganizationListResponse,
|
|
||||||
OrganizationResponse,
|
OrganizationResponse,
|
||||||
|
PartySearchResponse,
|
||||||
PartySearchListResponse,
|
PartySearchListResponse,
|
||||||
|
PurchaseRequestResponse,
|
||||||
|
PurchaseRequestListResponse,
|
||||||
SecretKeyResponse,
|
SecretKeyResponse,
|
||||||
UpdateOrganizationRequest,
|
|
||||||
WalletResponse,
|
WalletResponse,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ from src.presentation.dependencies.commands import (
|
|||||||
get_update_purchase_request_status_command,
|
get_update_purchase_request_status_command,
|
||||||
)
|
)
|
||||||
from src.presentation.schemas.mappers import purchase_request_to_response
|
from src.presentation.schemas.mappers import purchase_request_to_response
|
||||||
from src.presentation.schemas.organization import (
|
from src.presentation.schemas.entity import (
|
||||||
CreatePurchaseRequestBody,
|
CreatePurchaseRequestBody,
|
||||||
PurchaseRequestListResponse,
|
PurchaseRequestListResponse,
|
||||||
PurchaseRequestResponse,
|
PurchaseRequestResponse,
|
||||||
|
|||||||
115
src/presentation/schemas/entity.py
Normal file
115
src/presentation/schemas/entity.py
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from decimal import Decimal
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
|
class PartySearchResponse(BaseModel):
|
||||||
|
id: str
|
||||||
|
account_type: str
|
||||||
|
user_id: str
|
||||||
|
email: str | None
|
||||||
|
name: str | None
|
||||||
|
inn: str | None
|
||||||
|
phone: str | None
|
||||||
|
status: str | None
|
||||||
|
kyc_verified: bool | None
|
||||||
|
created_at: str | None
|
||||||
|
|
||||||
|
|
||||||
|
class PartySearchListResponse(BaseModel):
|
||||||
|
items: list[PartySearchResponse]
|
||||||
|
total: int
|
||||||
|
|
||||||
|
|
||||||
|
class WalletResponse(BaseModel):
|
||||||
|
id: str
|
||||||
|
chain: str
|
||||||
|
address: str
|
||||||
|
derivation_path: str
|
||||||
|
created_at: str | None
|
||||||
|
|
||||||
|
|
||||||
|
class CreateWalletsResponse(BaseModel):
|
||||||
|
wallets: list[WalletResponse]
|
||||||
|
mnemonic: str
|
||||||
|
|
||||||
|
|
||||||
|
class MnemonicResponse(BaseModel):
|
||||||
|
mnemonic: str
|
||||||
|
|
||||||
|
|
||||||
|
class SecretKeyResponse(BaseModel):
|
||||||
|
chain: str
|
||||||
|
address: str
|
||||||
|
derivation_path: str
|
||||||
|
private_key: str
|
||||||
|
|
||||||
|
|
||||||
|
class CreatePurchaseRequestBody(BaseModel):
|
||||||
|
organization_id: str
|
||||||
|
usdt_amount: Decimal = Field(gt=0)
|
||||||
|
status: str = 'submitted'
|
||||||
|
rub_amount: Decimal | None = Field(default=None, gt=0)
|
||||||
|
exchange_rate: Decimal | None = Field(default=None, gt=0)
|
||||||
|
service_fee_percent: Decimal | None = Field(default=None, ge=0)
|
||||||
|
comment: str | None = None
|
||||||
|
admin_comment: str | None = None
|
||||||
|
target_wallet_chain: str | None = Field(default='ETH', max_length=16)
|
||||||
|
target_wallet_address: str | None = Field(default=None, max_length=128)
|
||||||
|
tx_hash: str | None = Field(default=None, max_length=128)
|
||||||
|
assigned_to: str | None = None
|
||||||
|
|
||||||
|
|
||||||
|
class UpdatePurchaseRequestStatusBody(BaseModel):
|
||||||
|
status: str
|
||||||
|
admin_comment: str | None = None
|
||||||
|
assigned_to: str | None = None
|
||||||
|
tx_hash: str | None = None
|
||||||
|
|
||||||
|
|
||||||
|
class UpdatePurchaseRequestBody(BaseModel):
|
||||||
|
status: str | None = None
|
||||||
|
usdt_amount: Decimal | None = Field(default=None, gt=0)
|
||||||
|
rub_amount: Decimal | None = Field(default=None, gt=0)
|
||||||
|
exchange_rate: Decimal | None = Field(default=None, gt=0)
|
||||||
|
service_fee_percent: Decimal | None = Field(default=None, ge=0)
|
||||||
|
comment: str | None = None
|
||||||
|
admin_comment: str | None = None
|
||||||
|
target_wallet_chain: str | None = Field(default=None, max_length=16)
|
||||||
|
target_wallet_address: str | None = Field(default=None, max_length=128)
|
||||||
|
tx_hash: str | None = Field(default=None, max_length=128)
|
||||||
|
assigned_to: str | None = None
|
||||||
|
|
||||||
|
|
||||||
|
class SetPurchaseRequestQuoteBody(BaseModel):
|
||||||
|
rub_amount: Decimal = Field(gt=0)
|
||||||
|
exchange_rate: Decimal = Field(gt=0)
|
||||||
|
service_fee_percent: Decimal | None = None
|
||||||
|
admin_comment: str | None = None
|
||||||
|
|
||||||
|
|
||||||
|
class PurchaseRequestResponse(BaseModel):
|
||||||
|
id: str
|
||||||
|
organization_id: str
|
||||||
|
status: str
|
||||||
|
usdt_amount: str
|
||||||
|
rub_amount: str | None
|
||||||
|
exchange_rate: str | None
|
||||||
|
service_fee_percent: str | None
|
||||||
|
comment: str | None
|
||||||
|
admin_comment: str | None
|
||||||
|
target_wallet_chain: str | None
|
||||||
|
target_wallet_address: str | None
|
||||||
|
tx_hash: str | None
|
||||||
|
assigned_to: str | None
|
||||||
|
created_at: str | None
|
||||||
|
updated_at: str | None
|
||||||
|
completed_at: str | None
|
||||||
|
|
||||||
|
|
||||||
|
class PurchaseRequestListResponse(BaseModel):
|
||||||
|
items: list[PurchaseRequestResponse]
|
||||||
|
total: int
|
||||||
@@ -8,6 +8,10 @@ from src.application.domain.entities.organization import (
|
|||||||
PurchaseRequestEntity,
|
PurchaseRequestEntity,
|
||||||
)
|
)
|
||||||
from src.presentation.schemas.organization import (
|
from src.presentation.schemas.organization import (
|
||||||
|
DocumentResponse,
|
||||||
|
OrganizationResponse,
|
||||||
|
)
|
||||||
|
from src.presentation.schemas.entity import (
|
||||||
CreateWalletsResponse,
|
CreateWalletsResponse,
|
||||||
DocumentResponse,
|
DocumentResponse,
|
||||||
MnemonicResponse,
|
MnemonicResponse,
|
||||||
|
|||||||
@@ -62,48 +62,6 @@ class OrganizationListResponse(BaseModel):
|
|||||||
total: int
|
total: int
|
||||||
|
|
||||||
|
|
||||||
class PartySearchResponse(BaseModel):
|
|
||||||
id: str
|
|
||||||
account_type: str
|
|
||||||
user_id: str
|
|
||||||
email: str | None
|
|
||||||
name: str | None
|
|
||||||
inn: str | None
|
|
||||||
phone: str | None
|
|
||||||
status: str | None
|
|
||||||
kyc_verified: bool | None
|
|
||||||
created_at: str | None
|
|
||||||
|
|
||||||
|
|
||||||
class PartySearchListResponse(BaseModel):
|
|
||||||
items: list[PartySearchResponse]
|
|
||||||
total: int
|
|
||||||
|
|
||||||
|
|
||||||
class WalletResponse(BaseModel):
|
|
||||||
id: str
|
|
||||||
chain: str
|
|
||||||
address: str
|
|
||||||
derivation_path: str
|
|
||||||
created_at: str | None
|
|
||||||
|
|
||||||
|
|
||||||
class CreateWalletsResponse(BaseModel):
|
|
||||||
wallets: list[WalletResponse]
|
|
||||||
mnemonic: str
|
|
||||||
|
|
||||||
|
|
||||||
class MnemonicResponse(BaseModel):
|
|
||||||
mnemonic: str
|
|
||||||
|
|
||||||
|
|
||||||
class SecretKeyResponse(BaseModel):
|
|
||||||
chain: str
|
|
||||||
address: str
|
|
||||||
derivation_path: str
|
|
||||||
private_key: str
|
|
||||||
|
|
||||||
|
|
||||||
class DocumentResponse(BaseModel):
|
class DocumentResponse(BaseModel):
|
||||||
organization_id: str
|
organization_id: str
|
||||||
document_type: str
|
document_type: str
|
||||||
@@ -112,70 +70,3 @@ class DocumentResponse(BaseModel):
|
|||||||
content_type: str | None = None
|
content_type: str | None = None
|
||||||
file_size_bytes: int | None = None
|
file_size_bytes: int | None = None
|
||||||
download_url: str | None = None
|
download_url: str | None = None
|
||||||
|
|
||||||
|
|
||||||
class CreatePurchaseRequestBody(BaseModel):
|
|
||||||
organization_id: str
|
|
||||||
usdt_amount: Decimal = Field(gt=0)
|
|
||||||
status: str = 'submitted'
|
|
||||||
rub_amount: Decimal | None = Field(default=None, gt=0)
|
|
||||||
exchange_rate: Decimal | None = Field(default=None, gt=0)
|
|
||||||
service_fee_percent: Decimal | None = Field(default=None, ge=0)
|
|
||||||
comment: str | None = None
|
|
||||||
admin_comment: str | None = None
|
|
||||||
target_wallet_chain: str | None = Field(default='ETH', max_length=16)
|
|
||||||
target_wallet_address: str | None = Field(default=None, max_length=128)
|
|
||||||
tx_hash: str | None = Field(default=None, max_length=128)
|
|
||||||
assigned_to: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
class UpdatePurchaseRequestStatusBody(BaseModel):
|
|
||||||
status: str
|
|
||||||
admin_comment: str | None = None
|
|
||||||
assigned_to: str | None = None
|
|
||||||
tx_hash: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
class UpdatePurchaseRequestBody(BaseModel):
|
|
||||||
status: str | None = None
|
|
||||||
usdt_amount: Decimal | None = Field(default=None, gt=0)
|
|
||||||
rub_amount: Decimal | None = Field(default=None, gt=0)
|
|
||||||
exchange_rate: Decimal | None = Field(default=None, gt=0)
|
|
||||||
service_fee_percent: Decimal | None = Field(default=None, ge=0)
|
|
||||||
comment: str | None = None
|
|
||||||
admin_comment: str | None = None
|
|
||||||
target_wallet_chain: str | None = Field(default=None, max_length=16)
|
|
||||||
target_wallet_address: str | None = Field(default=None, max_length=128)
|
|
||||||
tx_hash: str | None = Field(default=None, max_length=128)
|
|
||||||
assigned_to: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
class SetPurchaseRequestQuoteBody(BaseModel):
|
|
||||||
rub_amount: Decimal = Field(gt=0)
|
|
||||||
exchange_rate: Decimal = Field(gt=0)
|
|
||||||
service_fee_percent: Decimal | None = None
|
|
||||||
admin_comment: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
class PurchaseRequestResponse(BaseModel):
|
|
||||||
id: str
|
|
||||||
organization_id: str
|
|
||||||
status: str
|
|
||||||
usdt_amount: str
|
|
||||||
rub_amount: str | None
|
|
||||||
exchange_rate: str | None
|
|
||||||
service_fee_percent: str | None
|
|
||||||
comment: str | None
|
|
||||||
admin_comment: str | None
|
|
||||||
target_wallet_chain: str | None
|
|
||||||
target_wallet_address: str | None
|
|
||||||
tx_hash: str | None
|
|
||||||
assigned_to: str | None
|
|
||||||
created_at: str | None
|
|
||||||
updated_at: str | None
|
|
||||||
completed_at: str | None
|
|
||||||
|
|
||||||
|
|
||||||
class PurchaseRequestListResponse(BaseModel):
|
|
||||||
items: list[PurchaseRequestResponse]
|
|
||||||
total: int
|
|
||||||
|
|||||||
Reference in New Issue
Block a user