Skip to content

Conversation

@kevintang513
Copy link

Summary

  • Fixed critical bug where payment and request transaction logic was inverted
  • Payments now correctly complete immediately with status "complete"
  • Requests now correctly remain "pending" until accepted/rejected

Changes

File: backend/database.ts

  • Line 549: Changed if (isRequestTransaction(transaction)) to if (!isRequestTransaction(transaction))

Root Cause:
The transaction creation logic had inverted conditional logic that caused:

  • Payments to be processed as requests (status remained "pending", no balance debit/credit)
  • Requests to be processed as payments (status set to "complete", balance immediately debited/credited)

Impact:
This bug broke the fundamental transaction flow:

  • Payment transactions were not completing
  • Request transactions were auto-completing without user approval
  • Balance updates were happening at the wrong time

Test Plan

Unit Tests:

  • All unit tests now pass (yarn test:unit:ci)
  • Transaction creation tests verify correct status:
    • should create a payment - expects status "complete" ✓
    • should create a request - expects status "pending" ✓

Manual Testing:

  1. Start the app (yarn start)
  2. Log in as a test user
  3. Create a payment transaction:
    • Navigate to "New Transaction"
    • Select a contact and choose "Pay"
    • Submit the transaction
    • Expected: Transaction status should be "complete", balances updated immediately
  4. Create a request transaction:
    • Navigate to "New Transaction"
    • Select a contact and choose "Request"
    • Submit the transaction
    • Expected: Transaction status should be "pending", balances unchanged until accepted

Files Changed:

  • backend/database.ts (1 line)

Tests Passing:

  • 44 unit tests passing
  • 0 failures

🤖 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,
causing payments to remain pending and requests to be immediately completed.

The condition check was incorrectly processing requests as payments and vice
versa, leading to incorrect status updates and balance operations.

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.

❌ devin-ai-integration[bot]
❌ kevintang513
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-inversion branch January 20, 2026 18:36
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