Repository navigation
feat(payments): add cross-account payment splitting (#1720) - #1837
Merged
github-actions[bot] merged 3 commits intoOct 19, 2026
Merged
github-actions[bot] merged 3 commits into
github-actions[bot] merged 3 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
|
@Clement-coder 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! 🚀 |
| * Percentages must sum to exactly 100. | ||
| * Returns 200 when all splits succeed, 207 when some fail. | ||
| */ | ||
| router.post('/payments/split', wrap((req, res) => controller.split(req, res))); |
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
Splits a payment across multiple destination accounts by percentage, resolving #1720.
Changes
PaymentSplitService– domain service withvalidateSplits()(enforces ≥2 entries, each % > 0, sum within 0.01 of 100) andsplit()which issues one charge per destination, derives per-split idempotency keys, and continues through individual gateway failuresPaymentSplitController– handlesPOST /api/v1/payments/split; returns200when all splits succeed,207 Multi-Statuson partial failure,422when percentages don't sum to 100paymentSplitRouter– wired intocreateApiServerat/api/v1005_payment_split_records.sql– migration addingpayment_split_records(header) andpayment_split_entries(per-destination detail) tablesPaymentSplitService.test.ts– 46 passing tests covering validation, arithmetic, partial/full failure, idempotency key derivation, metadata forwarding, and all HTTP response codesAcceptance criteria
validateSplitsthrowsSPLIT_VALIDATION_ERRORotherwise)payment_split_entriestable + full result returned in response)Test output