Repository navigation
Conversation
Adds searchByMemo(invoices, query, opts) to src/search.ts for substring matching on Invoice.memo across an in-memory array, exported from src/index.ts. - case-insensitive by default; caseSensitive: true for exact-case matching - empty query returns all invoices unchanged - invoices with undefined/null memo are skipped without error - unit tests cover all acceptance criteria Fixes Stellar-split#614
7 tasks
This branch has not been deployed
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
Adds
searchByMemo(invoices, query, opts?)tosrc/search.tsand exports it fromsrc/index.ts— a substring search overInvoice.memofor an in-memory invoice array.Payment memo text is a common way users tag invoices (e.g.
"split:INV-001"), andsrc/search.tscould only search Horizon by status/recipient with no way to filter a local array by memo. This is a self-contained, synchronous helper that complementssearchInvoices(which stays async/Horizon-backed).Changes
src/search.ts— newsearchByMemo()+SearchByMemoOptionsinterface.src/index.ts— re-exportssearchByMemoandSearchByMemoOptions.test/searchByMemo.test.ts— unit tests covering every acceptance criterion.Acceptance criteria
searchByMemo(invoices: Invoice[], query: string, opts?: { caseSensitive?: boolean }): Invoice[]exported fromsrc/search.tsinvoice.memocontainsqueryas a substring; case-insensitive by defaultqueryreturns all invoices unchangedmemoofundefined/nullare skipped without erroropts.caseSensitive = trueenables exact-case matchingsrc/index.tsImplementation notes
How I tested
Negative check (mandatory): with the fix reverted, all 7 tests fail; with the fix restored, all 7 pass.
Regression:
npm test(client / retryPolicy / network-environment) — 110 tests pass.tsc --noEmitintroduces no new errors from the three files in this PR (the repo has unrelated pre-existing type errors elsewhere).Fixes #614