feat: BillingProfile + PaymentAccount — client billing map #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/billing-profiles"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds the billing map layer to haskos-finance — BillingProfile and PaymentAccount models that separate billing-specific client data from the entity registry.
What changed
New models
New API endpoints
/billing-profiles— CRUD with list filtering by client_id/payment-accounts— CRUD (operator-only for create/update)Migration
payment_accountandbilling_profiletables with indexes on entity_id and client_idWhy
When generating invoices via haskydocs, the caller currently has to supply all client details (name, UEN, address, bank details) per request. The billing profile resolves this — the system looks up the client's billing profile and assembles the full payload automatically.
Next
- Add haskydocs client service (HTTP client with job polling) - Add generate endpoints: - POST /invoices/{id}/generate — invoice or proforma (based on status) - POST /invoices/{id}/receipt — receipt for paid invoices - POST /billing-profiles/{id}/statement — statement of accounts - Add provider config (FINANCE_PROVIDER_NAME, UEN, ADDRESS) - Add .env.example with finance-specific env vars - Add httpx + pydantic-settings dependencies Orchestration flow: load invoice + billing profile + payment account + provider config → assemble data payload → call haskydocs /generate → return document_id + download_urlWhen client_id is set and no invoice_number is provided, the service resolves the billing profile, gets the invoice_prefix, and generates the next sequential number: HT-{PREFIX}-{YEAR}-{SEQ}. Also auto-resolves company name, currency, and payment terms from the billing profile when not explicitly provided.