Feat: implement loan installment due date tracking#41
Merged
EmeditWeb merged 1 commit intoJun 28, 2026
Merged
Conversation
Contributor
Author
|
@EmeditWeb, This is ready for review. Thanks! |
7 tasks
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.
Closes #22
Description
Completes loan installment due-date tracking in the creditline contract. Adds an
is_on_time()helper toRepaymentInstallmentand enforces that every installmentcarries a concrete, future due date before a loan can be activated. (The
due_dateand
paid_atfields,paid_atcaptures on repayment, and timing-based reputationupdates were already present; this PR fills the remaining gaps.)
Type of Change
Changes Made
types.rs: AddRepaymentInstallment::is_on_time()→ returnspaid && paid_at <= due_date(paying exactly on the due date counts as on time; unpaid installments are never on time).
errors.rs: AddInvalidDueDate = 27error variant.lib.rs:approve_loannow rejects loans with an empty schedule or any installment whosedue_dateis0(unset) or already in the past. Caller-supplied schedules are preserved —nothing is overwritten. The check runs after the existing status/auth checks, so those errors
still take precedence.
Testing
cargo test -p creditline-contract: 113 passed, 0 failedtest_installment_is_on_time— early / exact / late / unpaid casestest_repay_installment_on_time_reflected_by_is_on_timetest_repay_installment_late_reflected_by_is_on_timetest_approve_loan_rejects_zero_due_datetest_approve_loan_rejects_past_due_dateChecklist
cargo clippy -p creditline-contractis clean