feat: update recipit

This commit is contained in:
2026-05-09 10:30:27 +03:00
parent be8aee7b73
commit b6e4f8165f
5 changed files with 32 additions and 45 deletions

View File

@@ -46,24 +46,15 @@ class CreatePaymentCloudkassirCommand:
user = await self._unit_of_work.user_repository.get(user_id)
if user is None:
raise ApplicationException(status_code=404, message='User not found')
email_meta = metadata.get('customer_email')
if email_meta is None:
email_meta = metadata.get('email')
email = str(email_meta or user.email or '').strip()
email = str(user.email or '').strip()
if not email:
raise ApplicationException(status_code=400, message='User email missing')
phone_raw = str(metadata.get('phone') or '').strip()
if not phone_raw:
phone_raw = str(user.phone or '').strip()
phone = phone_raw if phone_raw else None
customer_inn_meta = metadata.get('customer_inn')
if customer_inn_meta is None:
customer_inn_meta = metadata.get('customerInn')
customer_inn = str(customer_inn_meta or user.inn or '').strip()
paid_total = _parse_money(payment.amount)
if paid_total is None:
paid_total = _parse_money(metadata.get('amount'))
if paid_total is None:
paid_total = _parse_money(metadata.get('total_amount'))
meta_principal = _parse_money(metadata.get('principal_amount'))
meta_agent = _parse_money(metadata.get('agent_fee'))
@@ -109,7 +100,5 @@ class CreatePaymentCloudkassirCommand:
total_amount=total_amount,
principal_amount=principal_amount,
service_fee=service_fee,
phone=phone,
customer_inn=customer_inn,
request_id=str(ULID()),
)