Skip to content

Stop on payment requests and refunds net of partial refunds for back campaigns (#89) - #91

Merged
JOY (JOY) merged 5 commits into
devfrom
claude/89-pledge-net-refunds
Nov 3, 2026
Merged

JOY (JOY) merged 5 commits into
devfrom
claude/89-pledge-net-refunds

Conversation

@JOY

@JOY JOY (JOY) commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Refs #89

App side of #89.

Deploy order: DOS/DOS.Me#1551 (migration 20261106110000_give_pledge_net_refunds_and_payment_stop) must be applied before this ships. paymentCampaign, the money totals and the contributions list read the new payments_stopped_* columns and give.pledge_balances; without them the pledge pages fail.

What changes

  • Pay page hidden when stopped (/me/pledges/[code]): while a moderator has stopped the campaign's payment requests, the page shows "Give đã tạm dừng yêu cầu thanh toán… Đừng chuyển tiền" with the public note and never calls pledge_payment (loadPledgeMoney; the database also returns no row). The decision is paymentView() in lib/pledges.ts; the stop wins over everything, and no details before the deadline shows "reload" rather than "closed". The wording says the stop does not count against the deadline (no lapse while stopped; a resume moves the deadline), only for pledges the stop holds (stopHoldsPledge); a pledge overdue before the stop shows as closed.
  • Amounts net of refunds: the refund_due and overpaid lines on the pledge page use give.pledge_balances (refund owed = received - refunded, or the excess of a paid pledge) and name refunds already made; if that read fails the amounts are left out rather than shown gross.
  • Contributions list (/me/contributions): amounts due and owed back net of refunds; a stopped campaign shows "Give đang tạm dừng yêu cầu thanh toán" and no Thanh toán button. The "nothing due" note is reworded now that amount_due is net.
  • Admin action /admin/payment-requests (moderator/admin, linked from /admin): lists succeeded back campaigns (stopped first) with stop (internal reason + public note), change note, and resume (reason). Server action checks the role with the moderator's own token, then calls give.set_payment_requests_stopped as service role; database refusals are worded.
  • Public notice: PledgeTotals on the campaign page shows the stop and its note first. MoneyTotals reads payments_stopped_at / payments_stopped_note.
  • Notice wording (lib/notices.ts): refund_due / refund_owed use refund_amount (net) when present; refund_owed reason overpaid says "đã chuyển nhiều hơn số cam kết… hoàn lại phần thừa"; new kinds payment_requests_stopped and payment_requests_resumed (backer and creator variants); reminder fallback amount is net of refunded_amount.

Tests

  • Vitest 913 passed (new: paymentView, pledgeListSummary/offersPayment, pledgeBalances, loadPledgeMoney never calls pledge_payment while stopped, admin action, notices, PledgeTotals stop notice); tsc --noEmit and eslint clean.

Reviews

General and money reviews: no P1; P2s (contributions list, gross/net mix, deploy order) and most P3s fixed. Left as follow-ups: the creator's matching hint (lib/reconciliation.ts waitsFor) ignores refunds; payment_due/reminder notices sent before a stop still read "pay" (their link shows the stop).

🤖 Generated with Claude Code

…campaigns (#89)

The pledge page hides the transfer details while a moderator has stopped
the campaign's payment requests, and shows amounts owed back net of refunds
(give.pledge_balance). Moderators stop or resume the payment requests of a
succeeded back campaign at /admin/payment-requests. The campaign page shows
the public stop notice. Notices word refund_amount, the overpaid refund_owed
and the stop and resume notices.

Needs DOS/DOS.Me 20261106110000_give_pledge_net_refunds_and_payment_stop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 52218d28-8528-48f1-bb11-61cba4ff6cfd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

dos[bot]
dos Bot approved these changes Nov 3, 2026

@dos dos Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱️ Code Review completed (18 eligible files · 49,877 chars · 4 model call(s) · 2 PR unit(s))

Whole diff with bounded context at base ffa6bb0 / head dfa86b4.

✅ CLEAN_PASS: Complete diff reviewed

Context investigation was bounded to the explicitly requested snapshot paths.

…d wording from review (#89)

- /me/contributions reads give.pledge_balances: amounts due and owed back are
  net of refunds, and a stopped campaign shows no Thanh toán button.
- The pledge page asks for payment details through loadPledgeMoney, which
  never calls pledge_payment while stopped; no details before the deadline
  is 'unavailable', not 'closed'; refunds already made are named next to the
  received amount; a failed balance read leaves the amounts out.
- The stop notice and the stopped page give the deadline; the creator gets
  a resume notice; the admin page says a note change sends no new notices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dos[bot]
dos Bot approved these changes Nov 3, 2026

@dos dos Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱️ Code Review completed (19 eligible files · 64,731 chars · 3 model call(s) · 3 PR unit(s))

Whole diff with bounded context at base ffa6bb0 / head be9434e.

✅ CLEAN_PASS: Complete diff reviewed

Context investigation was bounded to the explicitly requested snapshot paths.

Owner decision: no pledge lapses while payment requests are stopped, and a
resume moves the deadlines by the time stopped. The pledge page, the stop and
resume notices and the moderator page now say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dos[bot]
dos Bot approved these changes Nov 3, 2026

@dos dos Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱️ Code Review completed (19 eligible files · 65,091 chars · 2 model call(s) · 3 PR unit(s))

Whole diff with bounded context at base ffa6bb0 / head f6d7529.

✅ CLEAN_PASS: Complete diff reviewed

Context investigation was bounded to the explicitly requested snapshot paths.

JOY (JOY) and others added 2 commits November 3, 2026 22:48
A pledge already overdue when the stop began lapses as usual, so its page
shows the deadline as passed instead of the stop wording (stopHoldsPledge).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dos

dos Bot commented Nov 3, 2026

Copy link
Copy Markdown

⏸️ DOS Review: Automatic Review Limit Reached

DOS Code Review already reviewed 3 commits of this pull request automatically, the limit for one pull request, so this commit was not reviewed automatically and nothing was charged. Please step back before pushing another fix: a pull request that needs this many review rounds usually needs a rethink of its approach or a smaller scope, not one more patch. When you are ready, a maintainer can comment /review to review the current commit.

@JOY

Copy link
Copy Markdown
Contributor Author

PO acceptance: merge at 4d32cca. Lint + Build green, Vitest 913, tsc/eslint clean; reviews no P1. DB part DOS/DOS.Me#1551 merged.

@JOY
JOY (JOY) merged commit 899592f into dev Nov 3, 2026
3 of 4 checks passed
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