fix: mock 20 rub

This commit is contained in:
2026-04-22 13:24:31 +03:00
parent 64125149be
commit ab772f1f02

View File

@@ -1,4 +1,5 @@
import json import json
import os
from decimal import Decimal from decimal import Decimal
from urllib.parse import parse_qs from urllib.parse import parse_qs
import aiohttp import aiohttp
@@ -20,6 +21,7 @@ ITPAY_API_BASE = 'https://api.gw.itpay.ru'
HARDCODED_USDT_TO_RUB = Decimal('100') HARDCODED_USDT_TO_RUB = Decimal('100')
HARDCODED_GAS_RUB = Decimal('15') HARDCODED_GAS_RUB = Decimal('15')
HARDCODED_OUR_COMMISSION_RUB = Decimal('25') HARDCODED_OUR_COMMISSION_RUB = Decimal('25')
HARDCODED_ITPAY_TEST_AMOUNT_RUB = Decimal('20.00')
def _amount_rub_for_itpay(amount_usdt: Decimal) -> Decimal: def _amount_rub_for_itpay(amount_usdt: Decimal) -> Decimal:
@@ -36,6 +38,8 @@ async def create_order(
logger: ILogger = Depends(get_logger), logger: ILogger = Depends(get_logger),
) -> ORJSONResponse: ) -> ORJSONResponse:
amount_rub = _amount_rub_for_itpay(body.amount_usdt) amount_rub = _amount_rub_for_itpay(body.amount_usdt)
if (os.getenv('ITPAY_TEST_FORCE_20_RUB') or '').strip() == '1':
amount_rub = HARDCODED_ITPAY_TEST_AMOUNT_RUB
amount_str = str(amount_rub) amount_str = str(amount_rub)
client_payment_id = str(ULID()) client_payment_id = str(ULID())
payload = { payload = {