Skip to content

fix: recalculateCampaignStats now decrements raisedAmount after refund#37

Merged
Alqku merged 3 commits into
OrbitChainLabs:mainfrom
iyanumajekodunmi756:fix/issue-8-refund-recalculate-stats
Jun 23, 2026
Merged

fix: recalculateCampaignStats now decrements raisedAmount after refund#37
Alqku merged 3 commits into
OrbitChainLabs:mainfrom
iyanumajekodunmi756:fix/issue-8-refund-recalculate-stats

Conversation

@iyanumajekodunmi756

Copy link
Copy Markdown
Contributor

Issue #8 - When donations are refunded, the campaign raisedAmount was never decremented, permanently inflating the campaign total.

Changes:

Issue OrbitChainLabs#8 - When donations are refunded, the campaign raisedAmount was
never decremented, permanently inflating the campaign total.

Changes:
- recalculateCampaignStats wrapped in Prisma $transaction for atomicity
- Added POST /admin/donations/:id/refund endpoint (admin-only)
- AdminService.refundDonation uses atomic $transaction to update status
  and recalculate raisedAmount
- verifyDonationOnChain now recalculates stats when confirming donations
  and protects CONFIRMED donations from accidental FAILED transitions
- Regression tests covering all refund scenarios
@iyanumajekodunmi756

Copy link
Copy Markdown
Contributor Author

CI Issues have been resolved. Here is the PR link for the resolved CI issue. iyanumajekodunmi756#1

@iyanumajekodunmi756

Copy link
Copy Markdown
Contributor Author

CI issues resolved and PR ready for review and merging

@Alqku Alqku left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

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.

[MEDIUM] — recalculateCampaignStats never decrements raisedAmount after a refund, permanently inflating the campaign total

2 participants