Repository navigation
feat(settlements): partial settlement history timeline on invoice detail (#478) - #500
Open
solomonadzape95 wants to merge 1 commit into
Open
solomonadzape95 wants to merge 1 commit into
solomonadzape95 wants to merge 1 commit into
Conversation
…ail page (StellarState#478) - Add settlement timeline domain: orders interim payments, running cumulative and remaining balance, repayment percentage and final-entry detection (lib/settlementTimeline.ts) - Read get_interim_payments via fetchInterimPayments + useInterimPayments - Build SettlementTimeline: progress bar, per-payment date/amount/cumulative/remaining, Settled badge on the closing payment, empty/loading/error states, mobile-friendly layout - Render it below the invoice financials for funded and settled invoices - Also drop the duplicated CompareToggleButton import whose syntax error broke the invoice-detail test transform - Cover cumulative maths, hook states, timeline rendering and detail-page placement with tests
|
@solomonadzape95 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! 🚀 |
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.
Summary
Implements #478 — a partial-settlement history timeline on the invoice detail page. It lists every interim and final payment the issuer has made, with each entry's date, amount, running cumulative total and remaining balance, a repayment progress bar, and a Settled badge on the payment that closes the invoice.
Changes
lib/settlementTimeline.ts) — ordersget_interim_paymentsrows oldest-first, computes the running cumulative and remaining balance, clamps overpayments, derives the repayment percentage, and identifies the final settlement entry (contractis_finalflag,settledstatus, or a cleared balance).lib/api/index.ts,hooks/useInterimPayments.ts) —fetchInterimPayments(invoiceId)for the read-onlyget_interim_paymentsquery, exposed through a hook keyed by invoice id.SettlementTimeline(components/invoices/SettlementTimeline.tsx) — top progress bar (% repaid, paid-of-total, remaining), a vertical ledger of payments, a green Settled badge on the closing entry, plus loading / error / empty states. Entry metadata uses a 2-column grid that becomes 3 columns on larger screens so amounts stay readable on mobile.components/invoices/InvoiceDetailView.tsx) — rendered below the invoice financials (the stats card) forfundedandsettledinvoices.Acceptance criteria
Testing
New coverage (22 tests):
lib/__tests__/settlementTimeline.test.ts— ordering, cumulative/remaining maths, partial vs final settlement, overpayment clamping, zero/invalid inputs, formattinghooks/__tests__/useInterimPayments.test.tsx— fetch by invoice id, cache key, idle without an id, error propagationcomponents/invoices/__tests__/SettlementTimeline.test.tsx— entries, progress, Settled badge, empty/loading/error statescomponents/invoices/__tests__/InvoiceDetailView.settlementTimeline.test.tsx— shown for funded/settled, hidden for openTargeted run:
npx vitest run lib/__tests__/settlementTimeline.test.ts hooks/__tests__/useInterimPayments.test.tsx components/invoices/__tests__/SettlementTimeline.test.tsx components/invoices/__tests__/InvoiceDetailView.settlementTimeline.test.tsx→ 22 passed (26 including the existing detail-view tests).Also removed the duplicated
CompareToggleButtonimport incomponents/marketplace/invoice-card.tsx, a syntax error already ondevthat prevented the invoice-detail test files from even transforming.Merge safety
Verified locally that merging
#474 → #476 → #478in order is conflict-free; the combined feature suites run green (100 tests).Closes #478