nxtgauge-backend-rust/apps
Ashwin Kumar Sivakumar 63fd3f5135 feat: generate a GST invoice automatically after a successful Tracecoin/PayU purchase
crates/invoice (InvoiceService, GST computation, HTML rendering) was
fully built but never wired to anything and never had its tables —
invoices/invoice_line_items/billing_profiles/invoice_number_seq never
existed in any active migration (same root cause as everything else
this session: only in scripts/init-db.sql, which the real db-migrate
job never runs). Created them, matching InvoiceService's actual
columns exactly rather than init-db.sql's older, simpler invoices
shape.

Fixed a real bug in InvoiceService::create while at it: four money
fields (total, and three line-item amounts) were bound as i64 against
columns/read-models that are i32 everywhere else — would have failed
every insert with a Postgres type mismatch the first time this code
ever actually ran against a real table.

Wired invoice generation into apps/payments' PayU verify_payment
handler (the actual success callback) — right after the wallet is
credited, a one-line-item GST invoice is generated from the purchased
package and PayU's billing fields (firstname/email/phone), using a
new INVOICE_SELLER_* env-configurable seller identity. Generation
failures are logged, not surfaced to the buyer, since the payment and
wallet credit have already succeeded by that point.

Also added the missing user-facing endpoints to fetch what got
generated: GET /api/payments/invoices (list) and
GET /api/payments/invoices/{id} (detail + line items) — previously
only admin-side invoice viewing existed.

NOTE: the frontend (nxtgauge-frontend-solid, a separate repo) has an
existing invoice-viewing page at src/routes/dashboard/wallet/invoices/
but it calls /wallet/me/invoices (no /api/ prefix) via a different,
apparently-dead API helper (api.get, not apiFetch) that every other
live page avoids — same dead-code pattern as the earlier apps/leads
discovery. The live purchase flow (CreditsPage.tsx) has no invoice UI
at all yet. Not fixed here since it's out of this repo's scope this
session — flagging for a frontend pass.
2026-07-21 03:02:47 +05:30
..
catering_services fix: profession admin listing endpoints matched role_key in the wrong case 2026-07-21 01:28:09 +05:30
companies fix: company profile submission stored wrapper object as verification payload 2026-07-19 22:03:36 +05:30
cron fix: company job posting, job seeker profile submission, and job applications 2026-07-21 01:00:47 +05:30
customers fix: customer document submission and profile verification 2026-07-21 01:39:25 +05:30
developers fix: profession admin listing endpoints matched role_key in the wrong case 2026-07-21 01:28:09 +05:30
employees fix(db): make three more migrations idempotent; log swallowed login DB error 2026-07-19 04:40:31 +05:30
fitness_trainers fix: profession admin listing endpoints matched role_key in the wrong case 2026-07-21 01:28:09 +05:30
gateway chore: retrigger isolated CI builds for 6 more services on bad digests 2026-07-15 03:01:39 +05:30
graphic_designers fix: profession admin listing endpoints matched role_key in the wrong case 2026-07-21 01:28:09 +05:30
job_seekers fix: company job posting, job seeker profile submission, and job applications 2026-07-21 01:00:47 +05:30
jobs chore: retrigger isolated CI builds for 6 more services on bad digests 2026-07-15 03:01:39 +05:30
leads feat: human-readable reference numbers + fix verification document visibility 2026-07-19 16:34:00 +05:30
makeup_artists fix: profession admin listing endpoints matched role_key in the wrong case 2026-07-21 01:28:09 +05:30
payments feat: generate a GST invoice automatically after a successful Tracecoin/PayU purchase 2026-07-21 03:02:47 +05:30
photographers fix: profession admin listing endpoints matched role_key in the wrong case 2026-07-21 01:28:09 +05:30
social_media_managers fix: profession admin listing endpoints matched role_key in the wrong case 2026-07-21 01:28:09 +05:30
tutors fix: profession admin listing endpoints matched role_key in the wrong case 2026-07-21 01:28:09 +05:30
ugc_content_creators fix: profession admin listing endpoints matched role_key in the wrong case 2026-07-21 01:28:09 +05:30
users fix: customer document submission and profile verification 2026-07-21 01:39:25 +05:30
video_editors fix: profession admin listing endpoints matched role_key in the wrong case 2026-07-21 01:28:09 +05:30