Skip to content

feat(sponsors): enable refunds for offline payments in order details - #1130

Closed
smarcet wants to merge 1 commit into
masterfrom
worktree-offline-payment-refunds-plan
Closed

smarcet wants to merge 1 commit into
masterfrom
worktree-offline-payment-refunds-plan

Conversation

@smarcet

@smarcet smarcet commented Oct 15, 2026 •

Copy link
Copy Markdown

ref: https://app.clickup.com/t/9014802374/86bck106e

Summary

Enables the "Issue a Refund" form on the sponsor purchase detail page for orders paid offline (invoice). Until now the form was disabled client-side for offline orders and showed "Only online payments are eligible for refunds", even though purchases-api already supports offline refunds (RefundService.create_refund records them as processed immediately, no gateway call).

Changes

  • sponsor-order-details.js: stop passing disabled to RefundForm for offline orders.
  • RefundForm: remove the now-unused disabled prop, the warning alert and the refund_form.only_online_payments i18n key.
  • en.json: reword refund_form.info so it explains both cases (Stripe refunds are queued and processed through Stripe; offline refunds are recorded as refunded immediately and the funds are returned outside the platform).

Tests

  • New sponsor-order-details.test.js: the refund form is enabled for Offline and Online orders, and submitting an offline refund calls refundSponsorOrder(orderId, amountInCents, reason).
  • refund-form.test.js: info note renders and submit is enabled on first render.
  • yarn test passes (231 suites, 2016 tests).

Not verified

  • Live E2E against dev (it would create a real refund on a dev order).

Summary by CodeRabbit

  • New Features
    • Refund forms are available for both online and offline sponsor purchases. Offline refunds can be recorded in the platform; the funds must be returned to the sponsor outside the platform.
  • Updates
    • Refund information now explains that Stripe refunds are queued for automatic processing, while offline payments are recorded as refunded immediately.
    • Removed the online-payment restriction message from the refund form.

Remove the client-side offline gate on the Issue a Refund form;
purchases-api already records offline refunds. Drop the unused disabled
prop and only_online_payments copy from RefundForm and update the
refund info note.
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: c997656d-a7da-4dc8-8567-6a7e7d8aa726
📥 Commits

Reviewing files that changed from the base of the PR and between b8d3e31 and 06c206c.

📒 Files selected for processing: 5
  • src/components/mui/RefundForm/__tests__/refund-form.test.js
  • src/components/mui/RefundForm/index.jsx
  • src/i18n/en.json
  • src/pages/sponsors/sponsor-page/tabs/sponsor-purchases-tab/__tests__/sponsor-order-details.test.js
  • src/pages/sponsors/sponsor-page/tabs/sponsor-purchases-tab/sponsor-order-details.js

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

📝 Walkthrough

The refund form is no longer disabled for offline orders. It displays refund information for Stripe and offline payments, and tests cover enabled controls and offline refund submission.

Changes: Sponsor Order Refunds

Layer / File(s) Summary
Refund form behavior and information
src/components/mui/RefundForm/index.jsx, src/i18n/en.json, src/components/mui/RefundForm/__tests__/refund-form.test.js
The form is disabled only while submitting, and its information note is always displayed. The note describes Stripe and offline refund handling.
Sponsor order refund flow
src/pages/sponsors/sponsor-page/tabs/sponsor-purchases-tab/sponsor-order-details.js, src/pages/sponsors/sponsor-page/tabs/sponsor-purchases-tab/__tests__/sponsor-order-details.test.js
Sponsor order details render the form without disabling it for offline orders. Tests cover enabled controls for both order types and verify the refund action for an offline order.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor Sponsor
  participant SponsorOrderDetails
  participant RefundForm
  participant refundSponsorOrder
  Sponsor->>SponsorOrderDetails: Open an offline order
  SponsorOrderDetails->>RefundForm: Render refund form
  Sponsor->>RefundForm: Submit amount and reason
  RefundForm->>refundSponsorOrder: Submit order ID, amount, and reason
Loading

Suggested reviewers: santipalenque

Merge Risk: ⚪ Minimal · up to 06c20

The UI now allows offline refund submissions and explains that funds must be returned outside the platform. No concrete code-backed issue was established; the change is mergeable with normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: enabling refunds for offline payments in sponsor order details.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@smarcet smarcet closed this Oct 15, 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

Development

Successfully merging this pull request may close these issues.

1 participant