Repository navigation
feat(payments): add cross-account payment splitting - #1849
Merged
github-actions[bot] merged 4 commits intoOct 19, 2026
Merged
github-actions[bot] merged 4 commits into
github-actions[bot] merged 4 commits into
Conversation
Split a payment across multiple destination accounts by percentage. - Add PaymentSplitService with validateSplits() enforcing sum=100 - Add PaymentSplitController (POST /api/v1/payments/split) - Returns 200 when all splits succeed, 207 on partial failure - Returns 422 when percentages do not sum to 100 - Add paymentSplitRouter and mount it in createApiServer - Add migration 005_payment_split_records.sql with payment_split_records + payment_split_entries tables - Add 46 passing tests covering validation, arithmetic, failure handling, idempotency key derivation, and HTTP responses Closes Smartdevs17#1720
This branch was successfully 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
Implements issue #1720 — cross-account payment splitting.
Revenue sharing between accounts was manual. This PR makes it automatic: a single payment can now be split across multiple destination accounts by percentage with a single API call.
What's in this PR
backend/migrations/005_payment_split_records.sqlbackend/services/payment/interfaces.ts—PaymentSplittype +splits?onPaymentRequestbackend/services/payment/errors.ts—SPLIT_VALIDATION_ERRORerror codebackend/services/payment/domain/PaymentSplitService.tsbackend/services/payment/controller/paymentSplitController.tsbackend/services/payment/router/paymentSplitRouter.tsbackend/server/createApiServer.tsbackend/services/payment/index.tsbackend/services/payment/__tests__/PaymentSplitService.test.ts— 46 tests, all passingAcceptance criteria
validateSplitsthrowsSPLIT_VALIDATION_ERROR(HTTP 422) when splits don't sum to 100 (±0.01 tolerance for floating-point)SplitEntryResultper destination in the response;payment_split_records/payment_split_entriestables persist outcomesAPI
Returns 200 when all splits succeed, 207 Multi-Status when at least one fails (remaining splits are still attempted).
Closes #1720