fix: cover untested settlement methods, thread admin identity, deduplicate settle logic, and adopt decimal-safe arithmetic - #273
Merged
martinzhames merged 2 commits intoSep 1, 2026
Conversation
…icate settle logic, and adopt decimal-safe arithmetic - Add unit tests for executeFiatTransfer, handlePartnerCallback (including duplicate-callback idempotency), findAllAdmin, retrySettlement, and approveSettlement (closes dupdab#196) - Thread authenticated admin identity from AdminSettlementsController through to approveSettlement, replacing hardcoded 'admin' approvedBy (closes dupdab#197) - Extract shared settle-then-notify logic from executeFiatTransfer and handlePartnerCallback into private settleSettlementPayments helper (closes dupdab#198) - Replace floating-point Number arithmetic with big.js in settlements.service.ts and payments.service.ts for all money calculations (closes dupdab#199)
|
@kelvin1john0901-blip 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! 🚀 |
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
executeFiatTransfer,handlePartnerCallback(including duplicate-callback idempotency),findAllAdmin,retrySettlement, andapproveSettlement(Five key SettlementsService methods have zero unit test coverage #196)AdminSettlementsControllerthrough toapproveSettlement, replacing hardcoded'admin'approvedBy(approveSettlement hardcodes approvedBy = 'admin', losing audit trail #197)executeFiatTransferandhandlePartnerCallbackinto privatesettleSettlementPaymentshelper (executeFiatTransfer and handlePartnerCallback duplicate settle logic #198)Numberarithmetic withbig.jsinsettlements.service.tsandpayments.service.tsfor all money calculations (Settlement/payment money math uses floating-point Number arithmetic #199)Changes
src/settlements/settlements.service.ts— big.js math, extractedsettleSettlementPayments, added duplicate-callback guard,approveSettlementnow acceptsapprovedBysrc/settlements/admin-settlements.controller.ts— passesreq.user?.idtoapproveSettlementsrc/payments/payments.service.ts— big.js for XLM/USDC conversion and refund ratio mathsrc/settlements/settlements.service.spec.ts— new test suites covering all five previously untested methodsCloses #196, Closes #197, Closes #198, Closes #199