Skip to content

Conversation

@devin-ai-integration
Copy link

Filter fund transfer transaction history to show only last 60 days

Summary

Updates the transaction history retrieval to only return transactions from the last 60 days (instead of all transactions). This change affects the GET /accounts/transactions/{accountNumber} endpoint.

Changes made:

  1. Fixed Transaction entity bug: Changed @Temporal(TemporalType.TIME) to @Temporal(TemporalType.TIMESTAMP) in Transaction.java to properly store both date and time (previously only stored time, which wouldn't work for date filtering)
  2. Added filtered repository method: Created findByAccountNumberAndTxDateTimeAfter() in TransactionRepository using Spring Data JPA method naming convention
  3. Updated service layer: Modified findTransactionsByAccountNumber() to calculate 60-day cutoff date and use the new filtered query

Review & Testing Checklist for Human

This is a YELLOW risk PR that requires manual verification:

  • Manual end-to-end test: Use Swagger UI (http://localhost:8989/bank-api/swagger-ui.html) to test the /accounts/transactions/{accountNumber} endpoint with test data spanning more than 60 days. Verify only transactions from the last 60 days are returned.
  • Database compatibility: Verify the temporal type change from TIME to TIMESTAMP doesn't cause issues with existing data or require database migration (should be fine with H2 in-memory DB, but worth confirming)
  • Breaking change check: Confirm no other parts of the codebase depend on getting ALL transactions. This is a behavior change to the existing endpoint.
  • Edge case testing: Test with accounts that have (a) no transactions, (b) only old transactions (>60 days), and (c) transactions exactly at the 60-day boundary

Test Plan

  1. Start the application: mvn spring-boot:run
  2. Create test transactions with various dates (some within 60 days, some older)
  3. Call the transactions endpoint and verify only recent (≤60 days) transactions are returned
  4. Verify transactions older than 60 days are excluded

Notes

  • The existing test suite passed (1 test), but there are no specific tests for the 60-day filtering logic
  • Using Calendar.add(Calendar.DAY_OF_MONTH, -60) for the cutoff date calculation
  • Spring Data JPA will automatically generate the query implementation for findByAccountNumberAndTxDateTimeAfter based on method naming convention
  • The bug fix to use TIMESTAMP instead of TIME is necessary for date-based filtering to work correctly

Link to Devin run: https://app.devin.ai/sessions/0320ed9e95d149b1ba6808a443c74c88
Requested by: Jaime Mizrachi (@jaime-leo)

- Fix Transaction entity temporal type from TIME to TIMESTAMP to store both date and time
- Add findByAccountNumberAndTxDateTimeAfter method to TransactionRepository
- Update findTransactionsByAccountNumber in BankingServiceImpl to calculate 60-day cutoff date and use filtered query
- Transactions older than 60 days from current date are now excluded from history retrieval

Co-Authored-By: Jaime Mizrachi <[email protected]>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration bot changed the base branch from dependabot/maven/io.springfox-springfox-swagger-ui-2.10.0 to master October 23, 2025 14:30
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