feat(backend): PDF deviz + portal client + SMS + invoice service
- PDF generation with WeasyPrint: deviz and factura templates (A4, branding)
- GET /orders/{id}/pdf/deviz returns PDF with order lines and totals
- Client portal (public, no auth): GET /p/{token}, POST /p/{token}/accept|reject
- SMS service (SMSAPI.ro) - skips in dev when no token configured
- Invoice service: create from validated order, auto-number (F-YYYY-NNNN)
- GET /invoices/{id}/pdf returns factura PDF
- Order status_client field for client accept/reject tracking
- Alembic migration for status_client
- 19 passing tests (auth + sync + orders + pdf + portal + invoices)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
18
backend/app/sms/service.py
Normal file
18
backend/app/sms/service.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import httpx
|
||||
|
||||
from app.config import settings
|
||||
|
||||
|
||||
async def send_deviz_sms(
|
||||
telefon: str, token_client: str, tenant_name: str, base_url: str
|
||||
):
|
||||
if not settings.SMSAPI_TOKEN:
|
||||
return # skip in dev/test
|
||||
url = f"{base_url}/p/{token_client}"
|
||||
msg = f"{tenant_name}: Devizul tau e gata. Vizualizeaza: {url}"
|
||||
async with httpx.AsyncClient() as c:
|
||||
await c.post(
|
||||
"https://api.smsapi.ro/sms.do",
|
||||
headers={"Authorization": f"Bearer {settings.SMSAPI_TOKEN}"},
|
||||
data={"to": telefon, "message": msg, "from": "ROAAUTO"},
|
||||
)
|
||||
Reference in New Issue
Block a user