diff --git a/external/billing/schemas.py b/external/billing/schemas.py index a41a524..002238c 100644 --- a/external/billing/schemas.py +++ b/external/billing/schemas.py @@ -1,5 +1,5 @@ import re -from typing import List +from typing import List, Optional from pydantic import field_validator @@ -62,7 +62,7 @@ class NotifyReceivedBillRequestSchema(BaseSchema): class CreateBillingResponseSchema(BaseSchema): ok: bool - + message:Optional[str] class NotifyReceivedBillResponseSchema(BaseSchema): ok: bool diff --git a/services/billing.py b/services/billing.py index d36b016..c1e7c0f 100644 --- a/services/billing.py +++ b/services/billing.py @@ -154,6 +154,9 @@ class BillingService(BaseService): billing_request_values: List[CreateBillingRequestValue] = [] for service in services.values(): + # Omit services that have no price + if not service.price: + continue billing_request_values.append( CreateBillingRequestValue( name=service.name, @@ -178,7 +181,7 @@ class BillingService(BaseService): ) create_bill_response = await billing_client.create(create_bill_request) if not create_bill_response.ok: - return CreateCardBillResponse(ok=create_bill_response.ok, message='Ошибка!') + return CreateCardBillResponse(ok=create_bill_response.ok, message=create_bill_response.message or 'Неизвестная ошибка') if basic_card.group: await self.create_group_bill_request(basic_card.group)