feat: end-point for deal document generation

This commit is contained in:
2024-09-20 20:02:17 +04:00
parent 03aba9649a
commit 5316f7f9ce
9 changed files with 482 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ from starlette import status
from weasyprint import HTML
import backend.config
from constants import MONTHS
from constants import MONTHS, ENV
from external.billing import BillingClient, CreateBillingRequestValue, CreateBillRequestSchema, CreateBillRequestItems, \
BillStatusUpdateRequest, NotificationChannel, NotifyReceivedBillRequestSchema, DeleteBillRequestSchema
from models import DealBillRequest, Deal, DealProduct, DealService as DealServiceModel
@@ -20,8 +20,6 @@ from services.base import BaseService
from services.deal import DealService
from utils.list_utils import to_locale_number
env = Environment(loader=FileSystemLoader(Path("templates") / Path("documents")))
class BillingService(BaseService):
async def _process_update_details(
@@ -182,7 +180,7 @@ class BillingService(BaseService):
deal_price = sum((service.price * service.amount for service in services))
deal_price_words = get_string_by_number(deal_price)[0:-10]
deal_price = to_locale_number(deal_price)
template = env.get_template("bill-of-payment.html")
template = ENV.get_template("bill-of-payment.html")
now = datetime.datetime.now()
curr_date = f"{now.day} {MONTHS[now.month - 1]} {now.year} г."