Skip to content

Fix Issue 875#1124

Merged
davedumto merged 1 commit into
StreamFi-x:devfrom
razeprasine:FixIssue875
Jul 1, 2026
Merged

Fix Issue 875#1124
davedumto merged 1 commit into
StreamFi-x:devfrom
razeprasine:FixIssue875

Conversation

@razeprasine

Copy link
Copy Markdown
Contributor

Description
Closes #875

Changes proposed
What were you told to do?
feat(routes-f): invoice total calculator — Compute invoice totals from line items with tax and discount.

What did you do?
Created a new route app/api/routes-f/invoice-total/ with:

  • route.ts — POST handler accepting { items: [{ description, qty, unit_price }], tax_percent?, discount_percent? }. Returns { subtotal, discount, taxable, tax, total, line_totals } with cent precision (2 decimal rounding at every step). Uses zod validation via the shared validateBody helper.
  • tests/route.test.ts — 8 unit tests covering single line item, multi-line, discount-only, tax-only, tax + discount stacking, multi-line stacking, zero percent edge case, and cent precision rounding.
    All code lives inside app/api/routes-f/invoice-total/ — no files outside that folder were modified.
    Check List
  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.
  • I am making a pull request against the main branch (left side).
  • My commit messages styles matches our requested structure.
  • My code additions will fail neither code linting checks nor unit test.
  • I am only making changes to files I was requested to.
    Screenshots/Videos
    N/A — pure backend route, no UI changes.

@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

@razeprasine is attempting to deploy a commit to the david's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 1, 2026

Copy link
Copy Markdown

@razeprasine Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@davedumto davedumto merged commit 22659e3 into StreamFi-x:dev Jul 1, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(routes-f): invoice total calculator

2 participants