Skip to content

Feature/fraud detection#7

Merged
soraiayugulis merged 4 commits into
mainfrom
feature/fraud-detection
Jun 12, 2026
Merged

Feature/fraud detection#7
soraiayugulis merged 4 commits into
mainfrom
feature/fraud-detection

Conversation

@soraiayugulis

Copy link
Copy Markdown
Owner

Summary

Implements a decoupled fraud detection module with a basic rule set and fail-safe integration into the authorization flow.

Changes

Interface

  • FraudDetectionService — domain-level interface with isFraudulent(Card, amount, recentTransactions) method

Implementation

  • BasicFraudDetectionService — detects fraud when 3+ recent transactions target the same merchant (rapid repeated transaction rule)

Integration

  • AuthorizationService now accepts an optional FraudDetectionService
  • Fraud check runs after daily limit check, before balance check
  • Returns FRAUD_DETECTED rejection reason when triggered
  • Fail-safe: if fraud detection throws an exception, the transaction proceeds (does not block legitimate transactions)

Tests

  • 100 unit tests — all passing
  • Covers: normal transactions pass, rapid repeated transactions detected, different merchants pass, decoupled architecture, fail-safe behavior

Design Decisions

  • Fraud detection is injected as a dependency (decoupled from core authorization)
  • Null-safe: when no fraud service is provided, authorization proceeds normally
  • Fail-safe: exceptions in fraud detection do not block transactions

@soraiayugulis soraiayugulis self-assigned this Jun 12, 2026
@soraiayugulis soraiayugulis merged commit 1bb40b5 into main Jun 12, 2026
2 checks passed
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