feat: E-Way Bill JSON Generator (GST Portal Compatible) — with review fixes + tests#379
Open
nikhilb2 wants to merge 9 commits into
Open
feat: E-Way Bill JSON Generator (GST Portal Compatible) — with review fixes + tests#379nikhilb2 wants to merge 9 commits into
nikhilb2 wants to merge 9 commits into
Conversation
Adds: - Migration for eway_bill_transporters table - Backend EWB service with pre-check, validation, and JSON generation - API routes for pre-check, generation, and transporter CRUD - Frontend E-Way Bill modal integrated into Invoice Preview - E-Way Bill button shown on Tax Invoice PDF Preview - Smart missing-data detection + single consolidated form - Saved transporter profiles with default selection - NIC schema-compliant JSON output
…y_desc, add comprehensive tests - Fix totalValue using total_amount instead of taxable_amount - Add validation for sub_supply_desc when sub_supply_type is 'Others' - Add GST check in frontend button visibility (matches issue requirements) - Add 38 backend tests: 13 unit (service layer) + 11 API integration tests - Test coverage: pre_check, validate_form_data, generate_eway_bill_json, CRUD endpoints, edge cases
…ny settings UI - Add eway_enabled, eway_local_threshold, eway_interstate_threshold, eway_always_show_button fields to company_profiles (migration) - Remove hardcoded GST check from precheck — eway_enabled controls availability - Remove ALL upper invoice value restrictions — any amount can generate - Add threshold warning (guidance only, never blocks) in pre_check - Add E-Way Bill Configuration card to Company Settings page - Fix InvoicePreview button visibility: show when module enabled, not based on invoice.company_gst - Add threshold warning and disabled notices in EwayBillModal - Add GET /api/eway-bill/settings endpoint - Add 6 new tests: threshold logic, eway_disabled, large invoices, custom thresholds, default thresholds - Closes feedback from @tbhatia2006 on issue #378
The E-Way Bill backend produced portal-invalid JSON and crashed for common invoices. Targeted rewrite of the service/schema/tests; the frontend modal and settings plumbing are kept. - precheck no longer 500s when the buyer has no GSTIN (B2C): all DB values are coerced null-safe before building the form - buyer GSTIN is now optional — unregistered recipients emit "URP" - NIC-compliant JSON: numeric subSupplyType/transactionType/transMode, subSupplyDesc only for "Others", cessNonAdvol, and a balancing otherValue so totInvValue reconciles - intra/inter-state tax nature taken consistently from the invoice's IGST amount (was re-derived from form state codes, could disagree) - blocking errors (missing seller GSTIN, disabled module) surfaced via the precheck result and shown in the modal, gating generation - frontend sends NIC sub-supply codes and adds a Transaction Type field - rewrote the service test suite (incl. a null-GSTIN regression test), renamed it to avoid a basename collision with the API test file - fixed a test-isolation bug where the API test wiped global dependency_overrides and broke ~38 unrelated tests Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
97cc61c to
a4cc800
Compare
added 2 commits
June 14, 2026 20:46
… array The transporters GET returned an AxiosResponse object, not a raw array. Casting it as TransporterProfile[] and calling .find() threw 'transRes.find is not a function', which was caught by the outer try/catch and set step='error', showing the 'Cannot Generate E-Way Bill' screen. Fix: catch(() => null) and use transRes?.data ?? [] to correctly extract the array from the AxiosResponse.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a fully integrated E-Way Bill JSON Generator within the Invoice PDF Preview screen.
Backend
eway_bill_transporterstableFrontend
Review fixes (committed)
totalValueusingtotal_amount→ now usestaxable_amountsub_supply_descwhen sub-supply type is "Others"Tests added
Service layer (13 tests): pre_check with valid/edge cases, validate_form_data with all field combos, generate JSON for intrastate/interstate/transport variations, totalValue fix verification
API integration (11 tests): pre-check endpoints, generate endpoints (200/422/full structure), save transporter on generate, transporter CRUD (list/create/update/delete)
Closes #378
🔍 Review fixes (Clawy — June 14, 2026)
Bugs fixed:
Tests added (24 total):
Pushed as commit
291436f.