@@ -53,6 +53,8 @@ YOOKASSA_AUTOPAYMENTS_REQUIRE_CARD_BINDING=True #
|
||||
# Nalogo (self-employed receipts)
|
||||
NALOGO_INN=your_inn # INN for nalog.ru
|
||||
NALOGO_PASSWORD=your_nalogo_password # Password for nalog.ru
|
||||
NALOGO_RECEIPT_NAME_SUBSCRIPTION=subscription {months} months # Receipt name for time-based subscriptions ({months} = duration)
|
||||
NALOGO_RECEIPT_NAME_TRAFFIC=traffic package {gb} GB # Receipt name for traffic packages ({gb} = traffic amount)
|
||||
|
||||
# FreeKassa Payment Gateway Configuration
|
||||
FREEKASSA_MERCHANT_ID=your_shop_id # Your shop ID in FreeKassa
|
||||
|
||||
@@ -282,9 +282,9 @@ async def process_successful_payment(session: AsyncSession, bot: Bot,
|
||||
receipt_item_name = payment_info_from_webhook.get("description")
|
||||
if not receipt_item_name:
|
||||
if sale_mode == "traffic":
|
||||
receipt_item_name = f"Remnawave traffic package {traffic_label} GB"
|
||||
receipt_item_name = settings.NALOGO_RECEIPT_NAME_TRAFFIC.format(gb=traffic_label)
|
||||
else:
|
||||
receipt_item_name = f"Remnawave subscription {int(subscription_months)} months"
|
||||
receipt_item_name = settings.NALOGO_RECEIPT_NAME_SUBSCRIPTION.format(months=int(subscription_months))
|
||||
try:
|
||||
await nalogo_service.create_income_receipt(
|
||||
item_name=receipt_item_name,
|
||||
|
||||
@@ -61,10 +61,12 @@ class NalogoService:
|
||||
return None
|
||||
|
||||
try:
|
||||
# API expects quantity as integer when it's a whole number
|
||||
qty = int(quantity) if float(quantity).is_integer() else Decimal(str(quantity))
|
||||
service_item = IncomeServiceItem(
|
||||
name=item_name,
|
||||
amount=Decimal(str(amount)),
|
||||
quantity=Decimal(str(quantity)),
|
||||
quantity=qty,
|
||||
)
|
||||
total_amount = service_item.get_total_amount()
|
||||
request = IncomeRequest(
|
||||
|
||||
@@ -54,6 +54,14 @@ class Settings(BaseSettings):
|
||||
default=None,
|
||||
description="Password for nalog.ru (self-employed) authentication"
|
||||
)
|
||||
NALOGO_RECEIPT_NAME_SUBSCRIPTION: str = Field(
|
||||
default="subscription {months} months",
|
||||
description="Receipt item name for time-based subscriptions. Use {months} placeholder for duration."
|
||||
)
|
||||
NALOGO_RECEIPT_NAME_TRAFFIC: str = Field(
|
||||
default="traffic package {gb} GB",
|
||||
description="Receipt item name for traffic packages. Use {gb} placeholder for traffic amount."
|
||||
)
|
||||
|
||||
WEBHOOK_BASE_URL: Optional[str] = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user