def leave_close_claim(self, request, *args, **kwargs):
"""
:param request:
{
"target_account_id": account_id
}
"""
deposit = self.get_object()
if deposit.status in deposit.INOPERABLE_STATUSES:
raise ValidationError('???????? ? ????????? ??????????')
if deposit.status == deposit.STATUS_REQUESTED_CLOSING:
raise ValidationError('?????? ?? ???????? ???????? ??? ??????.')
target_account_id = request.data['target_account_id']
if not fin_models.Account.objects.filter(pk=target_account_id):
raise ValidationError('?????????? ????? ?? ??????????.')
account = fin_models.Account.objects.get(pk=target_account_id)
if account.status in fin_models.Account.INOPERABLE_STATUSES:
raise ValidationError('???????? ? ????????? ?????? ??????????.')
res, info = deposit.leave_close_claim(target_account_id)
return Response(info, status=status.HTTP_200_OK if res else status.HTTP_400_BAD_REQUEST)
评论列表
文章目录