Skip to content

fix: validate partial project payments against remaining amount - #1472

Open
sachinacharyaa wants to merge 1 commit into
SuperteamDAO:mainfrom
sachinacharyaa:fix/partial-project-payments
Open

fix: validate partial project payments against remaining amount#1472
sachinacharyaa wants to merge 1 commit into
SuperteamDAO:mainfrom
sachinacharyaa:fix/partial-project-payments

Conversation

@sachinacharyaa

Copy link
Copy Markdown

What does this PR do?

This PR adds secure partial-payment support for project payments.

  • Project payments are validated against the remaining project amount.
  • Partial payments are explicitly allowed when the payment is greater than 0 and does not exceed the remaining amount.
  • Bounty and grant payments retain the existing exact-match validation behavior.
  • Prevents expectedAmount <= 0 from bypassing payment amount validation.
  • Rejects zero/negative expected amounts unless an explicit partial-payment mode is enabled.

Where should the reviewer start?

Start with:

src/features/sponsor-dashboard/utils/paymentRPCValidation.ts

Then review the project payment verification flow, specifically how the remaining project amount is calculated and passed to validatePayment.

Finally, review the tests covering full, partial, zero, and excessive project payments.

How should this be manually tested?

  1. Create a project with a payment amount greater than 0.
  2. Make a payment for less than the remaining amount.
  3. Verify the payment.
    • The payment should be accepted as a partial payment.
    • The remaining amount should be updated accordingly.
  4. Make a payment for the exact remaining amount.
    • The payment should be accepted.
  5. Attempt a payment of 0.
    • The payment should be rejected.
  6. Attempt a payment greater than the remaining project amount.
    • The payment should be rejected.
  7. Verify a bounty payment with an amount different from the expected amount.
    • It should still be rejected.
  8. Verify a grant payment with an amount different from the expected amount.
    • It should still be rejected.

Any background context you want to provide?

Previously, project payment verification could rely on an expectedAmount of 0, which caused the amount validation to be skipped.

This change makes partial project payments explicit and validates them against the server-derived remaining amount while preserving exact-match behavior for bounty and grant payments.

This also addresses Finding 3, where validatePayment could skip amount checks when expectedAmount <= 0.

What are the relevant issues?

Finding 3 — validatePayment skips amount checks when expectedAmount <= 0.

Related to the partial-payment findings for project payment verification.

Screenshots (if appropriate)

Not applicable — this is a backend/payment-validation change with no user-facing UI changes.

@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown

@sachinacharyaa is attempting to deploy a commit to the Superteam Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@sachinacharyaa, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 seconds

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: de007f25-3dc7-4113-87b4-bb91860f9a23

📥 Commits

Reviewing files that changed from the base of the PR and between af39bd1 and 0dee910.

📒 Files selected for processing (2)
  • src/features/sponsor-dashboard/utils/paymentRPCValidation.ts
  • src/pages/api/sponsor-dashboard/listings/verify-external-payment.ts

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

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

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