Skip to content

Conversation

@kevintang513
Copy link

Summary

  • Fixed critical bug where payment and request transaction logic was inverted in createTransaction()
  • Payments now correctly complete immediately, requests stay pending as expected
  • All unit tests passing (previously 2 failures)

Changes

File: backend/database.ts

  • Line 549: Changed condition from isRequestTransaction(transaction) to isPayment(transaction)

Root Cause:
The transaction creation logic was checking for request transactions when it should have been checking for payment transactions. This caused:

  • Payments to incorrectly remain in pending status (should be complete)
  • Requests to incorrectly be marked complete immediately (should be pending until accepted)

Solution:
Use isPayment(transaction) instead of isRequestTransaction(transaction) to properly identify when to:

  1. Debit sender's balance
  2. Credit receiver's balance
  3. Mark transaction status as complete
  4. Send "received" notification

Request transactions correctly skip this logic and remain pending until explicitly accepted via updateTransactionById().

Test Plan

  1. Run unit tests to verify fix:

    npm run test:unit:ci
    • should create a payment - expects status "complete"
    • should create a request - expects status "pending"
    • ✅ All 44 tests passing
  2. Manual testing:

    npm run dev
    • Create a payment transaction → should complete immediately with balance changes
    • Create a request transaction → should stay pending, no balance change until accepted
  3. Integration tests should continue to pass:

    npm run test:api

🤖 Generated with Claude Code

devin-ai-integration bot and others added 14 commits September 16, 2025 08:10
- Extract notification badge logic from NavBar into standalone NotificationBadge component
- Add comprehensive Cypress component tests covering edge cases (negative numbers, large numbers, undefined values)
- Preserve existing data-test selector for backward compatibility with E2E tests
- Use @mui/material to match existing project dependencies
- Remove customBadge styling from NavBar component
- All 9 component tests passing including Material-UI Badge behavior verification

Co-Authored-By: [email protected] <[email protected]>
Extract NotificationBadge component and add comprehensive tests
…58009691

Revert "Extract NotificationBadge component and add comprehensive tests"
This reverts commit 531adfb.
Simplified allowed-tools from pattern-based permissions to general Bash access to resolve permission issues when running the command.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Fixed critical bug where payment and request transaction logic was inverted.
Payments were incorrectly staying in pending status instead of completing,
while requests were being marked complete immediately on creation.

Changed createTransaction condition from isRequestTransaction() to isPayment()
to correctly process payments (debit/credit/complete) versus requests (pending).

All unit tests now passing.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@cypress-app-bot
Copy link

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ kevintang513
❌ devin-ai-integration[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

@kevintang513 kevintang513 deleted the fix/transaction-status-logic branch January 20, 2026 07:06
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.

3 participants