feat: Increase reputation on successful loan payment#63
Merged
Josue19-08 merged 1 commit intoTrustUp-app:mainfrom Mar 28, 2026
Conversation
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.
Pull Request
Description
Integrates reputation score increases on successful loan repayment. Borrowers now receive a score bonus based on payment timing: +15 for early repayment (before the due date) and +10 for on-time/late repayment. Failures in the reputation contract call are handled gracefully and never block a repayment from completing.
Closes #22
Type of Change
Changes Made
handle_reputation_increasehelper function inCreditLineContractthat calculates score increase based on payment timing (payment_date < due_date→ +15 early bonus, otherwise +10 on-time)full_repayment_rewardreputation call inrepay_loanwith a call to the new helper, using the last installment'sdue_dateas the reference datetry_invoke_contractso failures are silently ignored — repayment always succeeds regardless of reputation contract availabilityTesting
New tests added in
creditline-contract/src/tests.rsusing the fullRealIntegrationCtxintegration setup:test_on_time_full_repayment_increases_score_by_10— payment at exactly the due date gives +10test_early_full_repayment_increases_score_by_15— payment before the due date gives +15test_partial_repayment_does_not_change_reputation_score— partial payment triggers no score changetest_reputation_call_failure_does_not_block_repayment— loan moves toPaideven when the reputation contract rejects the call (updater permission revoked)Checklist