|
@@ -103,6 +103,7 @@ async def create_order(
|
|
|
"printer_hour_price": float(pricing_metadata['price_per_hour']),
|
|
"printer_hour_price": float(pricing_metadata['price_per_hour']),
|
|
|
"speed_coeff": float(pricing_metadata['speed_coeff']),
|
|
"speed_coeff": float(pricing_metadata['speed_coeff']),
|
|
|
"base_fee": float(pricing_metadata['base_fee']),
|
|
"base_fee": float(pricing_metadata['base_fee']),
|
|
|
|
|
+ "discount_percent": float(pricing_metadata['discount_percent']),
|
|
|
"estimated_price": float(estimated_price) if estimated_price is not None else 0.0,
|
|
"estimated_price": float(estimated_price) if estimated_price is not None else 0.0,
|
|
|
"quantity": quantity,
|
|
"quantity": quantity,
|
|
|
"color_name": color_name,
|
|
"color_name": color_name,
|
|
@@ -120,10 +121,10 @@ async def create_order(
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
order_query = """
|
|
order_query = """
|
|
|
- INSERT INTO orders (user_id, material_id, first_name, last_name, phone, email, shipping_address, model_link, status, is_company, company_name, company_pib, company_address, allow_portfolio, estimated_price, material_name, material_price, printer_hour_price, speed_coeff, color_name, quantity, notes, original_params)
|
|
|
|
|
- VALUES (%s, %s, %s, %s, %s, %s, %s, %s, 'pending', %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
|
|
|
|
|
|
+ INSERT INTO orders (user_id, material_id, first_name, last_name, phone, email, shipping_address, model_link, status, is_company, company_name, company_pib, company_address, allow_portfolio, estimated_price, material_name, material_price, printer_hour_price, speed_coeff, discount_percent, color_name, quantity, notes, original_params)
|
|
|
|
|
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, 'pending', %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
|
|
"""
|
|
"""
|
|
|
- order_params = (user_id, material_id, first_name, last_name, phone, email, shipping_address, model_link, is_company, company_name, company_pib, company_address, allow_portfolio, estimated_price, mat_name, mat_price, hour_price, speed_coeff, color_name, quantity, notes, original_params)
|
|
|
|
|
|
|
+ order_params = (user_id, material_id, first_name, last_name, phone, email, shipping_address, model_link, is_company, company_name, company_pib, company_address, allow_portfolio, estimated_price, mat_name, mat_price, hour_price, speed_coeff, pricing_metadata['discount_percent'], color_name, quantity, notes, original_params)
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
|
order_insert_id = db.execute_commit(order_query, order_params)
|
|
order_insert_id = db.execute_commit(order_query, order_params)
|