Skip to content

Refund claim flow, stream pause/resume tests, period-reset event, and SDK pre-auth wrapper - #559

Merged
Pvsaint merged 2 commits into
MetroLogic:mainfrom
ndii-dev:feat/issues-454-455-450-452
Jul 26, 2026
Merged

Refund claim flow, stream pause/resume tests, period-reset event, and SDK pre-auth wrapper#559
Pvsaint merged 2 commits into
MetroLogic:mainfrom
ndii-dev:feat/issues-454-455-450-452

Conversation

@ndii-dev

Copy link
Copy Markdown

Summary

  • Refund approve/claim flow: approve_refund and the requester-eligible path in process_refund already existed in RefundManager. Added a dedicated claim_refund(requester, refund_id) entry point so customers have a clearly-named self-serve path once an operator approves, distinct from operator-driven process_refund. Added Error::RefundNotApproved, returned when a customer claims before approval. Closes feat: implement operator-approval flow for refunds (approved flag, Issue #168) #450
  • Payment stream pause/resume: pause_stream/resume_stream were already fully implemented and exposed on PaymentProcessor (checkpointing accrual on pause, resetting the checkpoint on resume, sender-only, STREAM/PAUSED/STREAM/RESUMED events) but had zero test coverage. Added tests for checkpoint correctness, double-pause rejection, resume timing, and unauthorized-caller rejection. Closes feat: implement payment stream pause and resume entry points #452
  • Merchant pre-auth period reset: pull_payment's period-rollover logic (reset pulled_this_period, advance period_start, atomic with the pull) was already correct — it just didn't emit the MERCHANT_AUTH/PERIOD_RESET event the issue asked for. Added that event plus tests for period reset on first pull of a new period, limit enforcement within a period, and multi-period pulls. Closes feat: implement MerchantPreAuth period reset logic for pull billing #455
  • SDK pre-auth wrapper: added preAuthorizeMerchant, pullFromAuthorization, revokeAuthorization, and getAuthorization to FluxapayClient, plus MerchantAuthorization/MerchantAuthError types and a README section. These call the PaymentProcessor entry points that already exist in the Rust contract (pre_authorize_merchant, pull_payment, revoke_merchant_authorization, get_merchant_authorization); since the checked-in sdk/src/contracts/fluxapay bindings predate those entry points, the calls go through a documented as any cast until npm run generate is re-run against a freshly built contract to pick up proper typings. Closes feat: implement SDK wrapper for MerchantPreAuth (pre-authorization billing) #454

Test plan

  • cd fluxapay && cargo test claim_refund — approve→claim success, claim-before-approval, non-requester claim, double-claim
  • cd fluxapay && cargo test pause_stream resume_stream — new stream pause/resume coverage
  • cd fluxapay && cargo test period_reset — new merchant-auth period reset coverage (in merchant_auth.rs)
  • cd sdk && npm run build — new FluxapayClient pre-auth methods type-check
  • Regenerate SDK bindings (npm run generate:build) against a contract build that includes the pre-auth entry points, then drop the as any casts in preAuthorizeMerchant/pullFromAuthorization/revokeAuthorization/getAuthorization

🤖 Generated with Claude Code

Ndifreke000 and others added 2 commits July 26, 2026 18:58
… and SDK pre-auth wrapper

- feat(refund): add claim_refund entry point letting the original requester
  self-serve an operator-approved refund; adds Error::RefundNotApproved.
  approve_refund/process_refund already existed and needed no changes.
  Closes MetroLogic#450
- test(stream): pause_stream/resume_stream were already implemented on
  PaymentProcessor but untested; add coverage for checkpointing, double-pause,
  resume timing, and unauthorized access. Closes MetroLogic#452
- feat(merchant-auth): emit MERCHANT_AUTH/PERIOD_RESET when pull_payment
  rolls over into a new billing period; add tests for period reset, limit
  enforcement, and multi-period pulls (period-reset logic itself already
  existed and was correct). Closes MetroLogic#455
- feat(sdk): expose preAuthorizeMerchant, pullFromAuthorization,
  revokeAuthorization, and getAuthorization on FluxapayClient, plus
  MerchantAuthorization/MerchantAuthError types and a README section.
  Closes MetroLogic#454
@Pvsaint
Pvsaint merged commit 1a1d3c0 into MetroLogic:main Jul 26, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants