Skip to content

Conversation

@kevintang513
Copy link

Summary

  • Fixed inverted logic in createTransaction() that was causing payments to behave as requests and vice versa
  • Changed condition from if (isRequestTransaction(transaction)) to if (!isRequestTransaction(transaction))
  • All unit tests now pass (44 tests passing)

Changes

File: backend/database.ts:549

  • Negated the isRequestTransaction() condition to correctly execute payment logic for payments
  • Before: Request transactions were immediately completing with balance transfers (payment behavior)
  • After: Payment transactions immediately complete with balance transfers; requests stay pending until accepted

Impact

This fixes a critical bug where:

  • Payments were only sending notifications instead of transferring money and completing
  • Requests were immediately transferring money and completing instead of waiting for acceptance

The logic now correctly implements:

  • Payments: Debit sender → Credit receiver → Mark complete → Send "received" notification
  • Requests: Send "requested" notification → Wait for acceptance

Test Plan

  1. Run unit tests: yarn test:unit
    • All 44 tests should pass
    • Specifically, transactions.test.ts tests "should create a payment" and "should create a request" now pass
  2. Manual testing:
    • Create a payment transaction and verify it immediately completes with balance transfer
    • Create a request transaction and verify it stays pending until accepted

🤖 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]>
The condition was checking for request transactions but executing payment logic (immediate balance transfer and completion), and vice versa. This caused payments to only send notifications and requests to immediately complete, which is the opposite of intended behavior.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@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.

@cypress-app-bot
Copy link

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