feat(invoice-escrow): implement configurable grace period window for … - #421
Open
neyij wants to merge 1 commit into
Open
feat(invoice-escrow): implement configurable grace period window for …#421neyij wants to merge 1 commit into
neyij wants to merge 1 commit into
Conversation
…overdue invoice settlement
|
@neyij 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.
Description
Implemented a configurable grace period for overdue invoice settlement in the
invoice-escrowcontract.The grace period allows payments to be recorded after the invoice due date while the configured grace window is still active. Refunds are only permitted once the grace period has fully expired.
This change adds the
grace_period_secondsconfiguration field, an admin setter for updating the grace period, updated payment and refund deadline checks, and aGracePeriodExpiredevent when an overdue refund is triggered.Closes #375
Type of Change
Checklist
Testing
The
invoice-escrowtest suite was updated to verify payment and refund behavior before, during, and after the configured grace period.How to Test
cargo test -p invoice-escrowdue_date + grace_period_secondsand verify that the transaction is rejected withError::EscrowOverdue.Error::EscrowNotOverdue.GracePeriodExpiredevent is emitted.Test Coverage
Screenshots (if applicable)
Not applicable — this change affects the Soroban contract logic and test suite rather than a user interface.
Additional Notes
The overdue threshold is now calculated as:
due_date + grace_period_secondsPayments remain valid while the current timestamp is within the grace-period window. Refunds become available only after the grace period has fully elapsed.
The grace period can be updated by an authorized admin using
set_grace_period, allowing the contract configuration to accommodate different settlement requirements.For Reviewers
Please focus on:
In particular, review the deadline boundary conditions, authorization of
set_grace_period, payment eligibility within the grace window, refund eligibility after expiration, andGracePeriodExpiredevent emission.