feat(send): wire confirm step to /api/send and computeAllocation#494
Open
Wetshakat wants to merge 1 commit into
Open
feat(send): wire confirm step to /api/send and computeAllocation#494Wetshakat wants to merge 1 commit into
Wetshakat wants to merge 1 commit into
Conversation
Replaces mocked hash/recipient/splits in handleConfirm with a typed /api/send call and computeAllocation()-derived breakdown feeding TransactionSuccessReceipt. Adds pending + error states.
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.
closed #456
Summary
feat(send): Wire confirm step to real /api/send endpoint and compute allocationDescription
This PR replaces the simulated transaction flow in the Send Money feature with a production-ready implementation. It wires the Review step directly to the
/api/sendendpoint, integrates the remittance split logic client-side, and introduces robust error handling, pending states, and i18n support.Changes Included
🏗 Backend & Typings
SendTransactionRequest,SendTransactionResponse, andSendTransactionResulttolib/types/api.tsto enforce a unified contract across the frontend and backend./api/sendstub (app/api/send/route.ts) to validate the request payload (checks for amount > 0 and missing recipients) before returning a typed placeholder payload.🖥 Frontend & UX
"Maria Santos", fabricated hashes, and inline split math (amount * 0.5) fromapp/send/page.tsx.apiClient.post, gracefully handling session expirations, 4xx/5xx API failures, and network timeouts.computeAllocation()(imported fromlib/remittance/split.ts) to generate integer-safe allocation splits dynamically based on the sent amount.ReviewStep.tsxto accept anisPendingprop. The Confirm button now disables during flight, shows a spinning loader, and usesaria-busy/ dynamicaria-labels for screen readers.TransactionSuccessReceiptto acceptsplits.spendingrather than the mismatcheddailySpendingproperty.🌍 Localization
sendnamespace inen.jsonandes.json.🧪 Testing & Documentation
tests/unit/send-handler.test.ts(Vitest-compatible) which asserts:README_SPLIT_TRANSACTIONS.mdoutlining why the app calculates the split breakdown client-side.Testing Instructions
git checkout feat/connect-send-money-api-flow.npm run dev) and navigate to the Send flow.vitest run tests/unit/send-handler.test.ts) to verify coverage.