Investor dashboard aggregate, invoice due-date validation, KYC audit logs, stroops formatter - #57
Merged
Conversation
Resolves StellarState#49. Uses integer arithmetic throughout so conversions are exact even for amounts above MAX_SAFE_INTEGER.
Resolves StellarState#47. Adds validateInvoiceForPublish and wires it into InvoiceService.publishInvoice ahead of the state transition.
Resolves StellarState#46. GET /api/v1/investments/dashboard returns totalInvested (all statuses), totalReturns (settled only), and activeInvestments (pending/confirmed) for the authenticated investor.
Resolves StellarState#48. approve-kyc.ts now targets the real User model (it was reading src/entities/User, a stale duplicate with no stellarAddress column) and logs after the DB update commits. Adds reject-kyc.ts, which didn't previously exist, mirroring the same flow plus a rejection_reason field.
|
@mhikel66 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.
Closes #47
Closes #48
Closes #46
Closes #49
Summary
GET /api/v1/investments/dashboard. ReturnstotalInvested(sum across all statuses),totalReturns(settled only), andactiveInvestments(pending/confirmed count) for the authenticated investor. Integration test seeds the exact scenario from the issue (2000 + 3000 active, 1000/1100 settled → totalInvested 6000, totalReturns 1100, activeInvestments 2) plus zero-investments and cancelled-exclusion cases.validateInvoiceForPublish, wired intoInvoiceService.publishInvoicebefore the status transition. Rejects any due date under 24h out. Unit tests cover the exact boundary (24h passes, 23h59m fails, past fails, now fails). Also fixed two existingpublishInvoicetests whose fixture due date was in the past and would otherwise now fail.approve-kyc.tswas readingsrc/entities/User— a stale duplicate of the real model with nostellarAddresscolumn, and the route wasn't wired into the app at all. Repointed it atsrc/models/User.model, and added an info-level log emitted after the DB update commits (wallet_addresstruncated,decision,reviewer_id,decided_at). Also addedreject-kyc.ts, which didn't exist previously, with the same shape plusrejection_reason.stroopsToXlm(stroops, decimals?)using integer arithmetic throughout (no float conversion at any point), so it's exact even aboveMAX_SAFE_INTEGER.Test plan
npx jest— 171/171 passingnpm run lint— cleannpx tsc --noEmit— clean