fix(settlement-engine): remove circular dependency with api-gateway#1
Open
mayborn005 wants to merge 1 commit into
Open
fix(settlement-engine): remove circular dependency with api-gateway#1mayborn005 wants to merge 1 commit into
mayborn005 wants to merge 1 commit into
Conversation
Remove HTTP call from /api/settlements/reconcile endpoint to api-gateway. The reconciliation now performs a local consistency check against the settlement engine's own database instead of calling the api-gateway. Changes: - Remove signHS256 JWT generation function - Remove HTTP fetch to api-gateway settlement endpoint - Replace cross-service comparison with local consistency validation: - Mathematical consistency: grossAmount - feeAmount = netAmount - Fee calculation accuracy: feeAmount matches feeBps - Merchant reference validity: settlements reference existing merchants - Add comprehensive test suite for reconciliation logic (20 tests) - Update test script to include reconciliation tests Closes Betta-Pay#247
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
/api/settlements/reconcileendpoint to api-gateway, eliminating the circular dependencysignHS256JWT generation function that was only used for this HTTP callChanges
Removed
signHS256()function for JWT generationapi-gateway/api/settlementsAdded
grossAmount - feeAmount = netAmountfeeAmountmatchesfeeBpsapplied togrossAmountreconciliation.test.tswith 20 unit testsUpdated Response Format
The reconcile endpoint now returns:
{ "summary": { "total": 10, "valid": 9, "inconsistent": 1 }, "statusBreakdown": { "pending": 2, "completed": 8 }, "totals": { "gross": "1000", "fee": "10", "net": "990" }, "inconsistencies": [...], "reconciliationType": "local_consistency_check" }Test plan
/api/settlements/reconcileendpointCloses Betta-Pay#247