Fraud Detection

GET /fraud-check evaluates float fraud signals for a user before Float Service disburses; POST /fraud-check records the outcome. Signals are 24-hour lookbacks in the fraud log (site-float-service-log) plus one live query on bank account hashes.

Check Sequence

Request body: user_id, install_id, float_type, account_id, zip_code. Checks run in order; the first failure returns can_float: false with the matching error_code.

Check Fails when error_code

1. Bank account activity

MAX_SIMILAR_ACCOUNTS or more distinct users share the bank account’s account_routing_hash (live query on the BANKINFO# hash index)

BANK_ACCOUNT_ACTIVITY_HIGH

2. Install ID

A SUCCESS log row exists for install_id in the last 24 hours. Skipped when the install-ID check is disabled or install_id is empty or "null".

INSTALL_ID_DUPLICATE

3. User ID

A SUCCESS log row exists for user_id in the last 24 hours

USER_ID_DUPLICATE

4. Payment-method hash

A SUCCESS log row exists for the hash in the last 24 hours. float_type = PINLESS hashes the primary debit card (masked number + expiration + zip); otherwise the bank account’s account_routing_hash.

ACCOUNT_HASH_DUPLICATE

A passing check writes REQUEST rows for the user, install ID, and hash. For pinless floats a second card hash without the zip code is also computed and looked up; a hit only logs a warning, and its REQUEST row is written too.

Source: pkg/fraud/fraud.go, pkg/api/fraud.go

Result Recording

POST /fraud-check with float_result:

float_result Rows written

SUCCESS

SUCCESS rows for user_id, install_id, and the hash

FAILURE

FAILED rows for user_id and the hash

Only SUCCESS rows count toward the 24-hour checks. Row keys are USER, INSTALL_ID, ACCOUNT_HASH, CARD_HASH (schema).

Environment Toggles

Production is unaffected by every toggle below.

Check Toggle Effect

Install ID

INSTALL_ID_CHECK_ENABLED on the API Lambda; Terraform hardcodes true in prod and honours var.install_id_check_enabled elsewhere

Off by default outside prod: the lookup is skipped and install_id fraud check is disabled, skipping install_id lookup is logged. REQUEST and SUCCESS rows are still written.

Card hash

ENVIRONMENT is test or staging

Always bypassed

Bank account hash

ENVIRONMENT is test or staging

Bypassed for the two Plaid sandbox account hashes (custom_patri1, user_good)

Bank account activity

MAX_SIMILAR_ACCOUNTS

3 in prod (var.max_similar_accounts_fraud_check), 1000000 elsewhere

Source: deploy/main.tf, cmd/api/main.go, pkg/fraud/fraud.go