feat: add get payments and orders
This commit is contained in:
@@ -91,6 +91,24 @@ class ListPaymentsCommand:
|
||||
return payments
|
||||
|
||||
|
||||
class GetPaymentCommand:
|
||||
def __init__(self, *, unit_of_work: IUnitOfWork, logger: ILogger):
|
||||
self._unit_of_work = unit_of_work
|
||||
self._logger = logger
|
||||
|
||||
|
||||
@transactional
|
||||
async def __call__(self, *, payment_id: str, user_id: str) -> PaymentEntity:
|
||||
payment = await self._unit_of_work.payment_repository.get_by_id_for_user(
|
||||
payment_id=payment_id,
|
||||
user_id=user_id,
|
||||
)
|
||||
if payment is None:
|
||||
raise NotFoundException(message='Payment not found')
|
||||
self._logger.info({'event':'payment_detail_requested','payment_id':payment_id,'user_id':user_id})
|
||||
return payment
|
||||
|
||||
|
||||
class GetOrderCommand:
|
||||
def __init__(self, *, unit_of_work: IUnitOfWork, logger: ILogger):
|
||||
self._unit_of_work = unit_of_work
|
||||
|
||||
Reference in New Issue
Block a user