feat: add itpay creds
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
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']
|
||||
|
||||
@@ -84,6 +84,8 @@ class Settings(BaseSettings):
|
||||
RABBIT_CONNECT_TIMEOUT: int = 5
|
||||
RABBIT_EMAIL_CODE_QUEUE: str = "email.verification_code"
|
||||
|
||||
ITPAY_AUTHORIZATION: str
|
||||
|
||||
LOG_LEVEL: Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "INFO"
|
||||
LOG_FORMAT: Literal["JSON", "TEXT"] = "TEXT"
|
||||
|
||||
@@ -149,6 +151,7 @@ class Settings(BaseSettings):
|
||||
database = read_secret('database')
|
||||
csrf = read_secret_optional('csrf')
|
||||
rabbitmq = read_secret_optional('rabbitmq')
|
||||
itpay = read_secret_optional('itpay')
|
||||
|
||||
db_ci = {str(k).lower(): v for k, v in database.items()}
|
||||
|
||||
@@ -197,6 +200,12 @@ class Settings(BaseSettings):
|
||||
rb_set('password','RABBIT_PASSWORD')
|
||||
rb_set('vhost','RABBIT_VHOST')
|
||||
|
||||
if itpay:
|
||||
itpay_ci = {str(k).lower(): v for k, v in itpay.items()}
|
||||
secret = itpay_ci.get('secret')
|
||||
if secret is not None and str(secret).strip():
|
||||
data['ITPAY_AUTHORIZATION'] = f'Token {str(secret).strip()}'
|
||||
|
||||
return data
|
||||
|
||||
@property
|
||||
|
||||
@@ -11,12 +11,12 @@ from src.application.domain.exceptions import ApplicationException
|
||||
from src.presentation.decorators import csrf_protect, require_access_token
|
||||
from src.presentation.dependencies.logger import get_logger
|
||||
from src.presentation.schemas.order import CreateOrder
|
||||
from src.infrastructure.config import settings
|
||||
|
||||
|
||||
order_router = APIRouter(prefix='/order', tags=['orders'])
|
||||
|
||||
ITPAY_API_BASE = 'https://api.gw.itpay.ru'
|
||||
ITPAY_AUTHORIZATION = 'Token REPLACE_WITH_JWT_FROM_ITPAY_DASHBOARD'
|
||||
HARDCODED_USDT_TO_RUB = Decimal('100')
|
||||
HARDCODED_GAS_RUB = Decimal('15')
|
||||
HARDCODED_OUR_COMMISSION_RUB = Decimal('25')
|
||||
@@ -52,7 +52,7 @@ async def create_order(
|
||||
}
|
||||
url = f'{ITPAY_API_BASE}/v1/payments'
|
||||
headers = {
|
||||
'Authorization': ITPAY_AUTHORIZATION,
|
||||
'Authorization': settings.ITPAY_AUTHORIZATION,
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user