refactor: swap currency

This commit is contained in:
2026-06-15 13:54:06 +03:00
parent 3432d95927
commit 5a0f1c8fd9
6 changed files with 31 additions and 31 deletions

View File

@@ -26,7 +26,7 @@ class CreatePurchaseRequestCommand:
self,
user_id: str,
*,
usdt_amount: Decimal,
rub_amount: Decimal,
comment: str | None = None,
target_wallet_chain: str | None = None,
target_wallet_address: str | None = None,
@@ -34,7 +34,7 @@ class CreatePurchaseRequestCommand:
legal_entity = await require_legal_entity(user_id, self._unit_of_work)
item = await self._unit_of_work.purchase_request_repository.create(
organization_id=legal_entity.id,
usdt_amount=usdt_amount,
rub_amount=rub_amount,
comment=comment,
target_wallet_chain=target_wallet_chain,
target_wallet_address=target_wallet_address,
@@ -52,29 +52,29 @@ class CreatePurchaseRequestCommand:
}
payload = {
'id_client': legal_entity.id,
'usdt_amount': usdt_amount,
'rub_amount': rub_amount,
}
message = {
'event': 'purchase_created',
'payload': payload,
'metadata': metadata,
}
self._logger.info(f'Create purchase request for organization_id={legal_entity.id } with usdt_amount={usdt_amount}')
try:
await self._messanger.publish_to_queue(
queue=settings.RABBIT_TELEGRAM_NOTIFY_QUEUE,
message=message,
persist=True,
correlation_id=trace_id,
message_id=message_id,
headers={'trace_id': trace_id} if trace_id else None,
)
except Exception as exception:
self._logger.error(f'Failed to publish purchase request notification for organization_id={legal_entity.id}: {str(exception)}')
raise ApplicationException(503, 'Temporary error. Please try again.')
self._logger.info(f'Create purchase request for organization_id={legal_entity.id } with rub_amount={rub_amount}')
# try:
# await self._messanger.publish_to_queue(
# queue=settings.RABBIT_TELEGRAM_NOTIFY_QUEUE,
# message=message,
# persist=True,
# correlation_id=trace_id,
# message_id=message_id,
# headers={'trace_id': trace_id} if trace_id else None,
# )
# except Exception as exception:
# self._logger.error(f'Failed to publish purchase request notification for organization_id={legal_entity.id}: {str(exception)}')
# raise ApplicationException(503, 'Temporary error. Please try again.')
self._logger.info(f'Purchase request created id= organization_id={legal_entity.id }')
return item
# self._logger.info(f'Purchase request created id= organization_id={legal_entity.id }')
# return item
class ListPurchaseRequestsCommand: