Refund claim flow, stream pause/resume tests, period-reset event, and SDK pre-auth wrapper - #559
Merged
Merged
Conversation
… 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
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.
Summary
approve_refundand the requester-eligible path inprocess_refundalready existed inRefundManager. Added a dedicatedclaim_refund(requester, refund_id)entry point so customers have a clearly-named self-serve path once an operator approves, distinct from operator-drivenprocess_refund. AddedError::RefundNotApproved, returned when a customer claims before approval. Closes feat: implement operator-approval flow for refunds (approved flag, Issue #168) #450pause_stream/resume_streamwere already fully implemented and exposed onPaymentProcessor(checkpointing accrual on pause, resetting the checkpoint on resume, sender-only,STREAM/PAUSED/STREAM/RESUMEDevents) 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 #452pull_payment's period-rollover logic (resetpulled_this_period, advanceperiod_start, atomic with the pull) was already correct — it just didn't emit theMERCHANT_AUTH/PERIOD_RESETevent 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 #455preAuthorizeMerchant,pullFromAuthorization,revokeAuthorization, andgetAuthorizationtoFluxapayClient, plusMerchantAuthorization/MerchantAuthErrortypes and a README section. These call thePaymentProcessorentry points that already exist in the Rust contract (pre_authorize_merchant,pull_payment,revoke_merchant_authorization,get_merchant_authorization); since the checked-insdk/src/contracts/fluxapaybindings predate those entry points, the calls go through a documentedas anycast untilnpm run generateis re-run against a freshly built contract to pick up proper typings. Closes feat: implement SDK wrapper for MerchantPreAuth (pre-authorization billing) #454Test plan
cd fluxapay && cargo test claim_refund— approve→claim success, claim-before-approval, non-requester claim, double-claimcd fluxapay && cargo test pause_stream resume_stream— new stream pause/resume coveragecd fluxapay && cargo test period_reset— new merchant-auth period reset coverage (inmerchant_auth.rs)cd sdk && npm run build— newFluxapayClientpre-auth methods type-checknpm run generate:build) against a contract build that includes the pre-auth entry points, then drop theas anycasts inpreAuthorizeMerchant/pullFromAuthorization/revokeAuthorization/getAuthorization🤖 Generated with Claude Code