Skip to content

Feat/issues 696 700 702 706 - #828

Merged
misrasamuelisiguzor-oss merged 4 commits into
WHEELBACK:mainfrom
moralstephenxxo-a11y:feat/issues-696-700-702-706
Oct 19, 2026
Merged

misrasamuelisiguzor-oss merged 4 commits into
WHEELBACK:mainfrom
moralstephenxxo-a11y:feat/issues-696-700-702-706

Conversation

@moralstephenxxo-a11y

Copy link
Copy Markdown
Contributor

Description

Related Issue

Closes #696
Closes #706
Closes #700
Closes #702

Checklist

  • Description of changes included
  • Test coverage confirmation (new/updated tests added)
  • Screenshot/gif for UI changes (if applicable)
  • ABI snapshot regenerated (if contract interface changed)
  • just check passing locally

Add .github/workflows/check.yml that runs `cargo check --workspace --all-targets`
on every PR to main. This catches declared-but-missing modules (mod template;
mod transfer; with no backing files) and test-only breakage before merging.

Document the required check in CONTRIBUTING.md under 'Before opening a PR'.

Closes WHEELBACK#696
MAX_LATE_FEE_BPS was duplicated across invoice.rs (1_000) and validation.rs
(1000). Keep a single definition in invoice.rs and import it in validation.rs,
eliminating the risk of the two files disagreeing about the cap.

- Add `pub const MAX_LATE_FEE_BPS: u32 = 1_000` to invoice.rs as the sole
  source of truth.
- Import MAX_LATE_FEE_BPS in validation.rs; add require_late_fee_within_cap()
  that validates the late-fee markup against that constant.
- Call require_late_fee_within_cap in create_invoice and amend_invoice.
- Re-export MAX_LATE_FEE_BPS from lib.rs.

Closes WHEELBACK#706
Add a single-call read entrypoint that returns the consolidated refund state
and fee breakdown for an invoice (WHEELBACK#700).

Changes:
- Add MaybeU64 contracttype to invoice.rs (nullable u64 wrapper, mirrors the
  MaybeAddress/MaybeBytes pattern) and RefundStatus contracttype with fields:
  status, requested_at, gross_amount, processing_fee, network_fee, net_amount.
- Add DataKey::RefundWindow and DataKey::RefundRequestedAt variants to DataKey
  (append-only; existing discriminants are unchanged).
- Update request_refund to store RefundRequestedAt(id) so get_refund_status
  can return the ledger timestamp of the request without re-reading history.
- Add get_refund_status(id) -> Result<RefundStatus, InvoiceError> to lifecycle.rs.
  Read-only, no auth, works while paused.
- Export MaybeU64, RefundStatus from lib.rs.
- Update storage_key_uniqueness_test to cover the two new DataKey variants.

Closes WHEELBACK#700
Limit how long after payment a refund can be requested (WHEELBACK#702).

Payers could previously call request_refund at any time after mark_paid,
giving merchants indefinite exposure. This adds an admin-configured
refund_window_secs measured from paid_at. When the window elapses,
request_refund returns the new RefundWindowClosed error. Zero means no
limit, preserving the current behaviour.

Changes:
- Add RefundWindowClosed = 29 to InvoiceError (appended at the end, no
  renumbering of existing discriminants).
- Add set_refund_window(admin, seconds) and get_refund_window() to admin.rs,
  following the same pattern as set_grace_window / get_grace_window.
- Guard request_refund with the window check: if refund_window > 0 and
  paid_at + refund_window <= now, return RefundWindowClosed. Uses
  saturating_add so an astronomically large window never wraps to the past.
- DataKey::RefundWindow (unit variant, added in the WHEELBACK#700 commit) is used
  as the storage key.
- Add RefundWindowClosed to the exhaustive match in
  crates/protocol-errors/src/lib.rs to keep it compiling.

Closes WHEELBACK#702
@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@moralstephenxxo-a11y 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! 🚀

Learn more about application limits

@misrasamuelisiguzor-oss
misrasamuelisiguzor-oss merged commit 7887ae6 into WHEELBACK:main Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants