investor-freeze¶
Append-only history of investor freezes and unfreezes.
The table is investor_freeze_history. A row is one action, a freeze or an unfreeze. A freeze on an account that is already frozen does not change customers.transactionRights (cashin_fundraise = frozen, all = not). It is recorded when its reason differs from the latest freeze row. The same reason writes nothing. No earlier freeze row writes a line.
Single write point¶
CustomerFreezeService.freezeCustomer and safeUnfreeze insert the entry in the same transaction as the transactionRights update. No other application path writes that table. A manual freeze goes through CustomerFreezeService, never raw SQL: the database does not validate the cause.
When safeUnfreeze owns the transaction and the P2P replay returns an error, that transaction rolls the entry back with the unfreeze. A caller that passes parent owns the rollback: the error does not roll the entry back by itself.
Entry¶
kind—freezeorunfreeze. The cause does not encode the direction.cause— jsonb, validated byInvestorFreezeModel.causeininvestor-freeze.model.ts. The database only checks that it is an object.reason—InvestorFreezeModel.Reason, the union ofAdminReasonandAutomaticReason. The cause of the action, on a freeze and on an unfreeze. An unfreeze names the cause being lifted: automatic callers reuse the freeze reason, an admin picksdeath,fraud_victimorother. The BO contract declares only the admin reasons, with their French labels. It does not import this file. The automatic reasons keep their French labels here, for the Slack message.detail— optional text, trimmed, at least 1 character. Required whenreasonisother. No maximum length: a long detail must not block the freeze.CustomerFreezeServiceparsesInvestorFreezeModel.causebefore writing, so every caller is checked. The chargeback webhook cuts the Lemonway comment to 500 characters before that parse. Automatic callers otherwise write a short sentence: the KYC transition, the file name, or the balance sentence.adminId— session admin. Required fordeath,fraud_victimandother. Absent for an automatic action. The Excel upload passes the session admin. The waiting-purchases script does not.adminId_view— generated fromcause->>'adminId'. Holds the foreign key tobetter_auth_userfor the admin email join. The repository does not return it.
Entries are never rewritten. Removing or renaming a reason, or tightening a cause rule, breaks the parse of past entries.
Slack¶
A freeze that changes transactionRights, and a successful unfreeze, post to #suivi-investor-freeze in production. The message names the investor, the reason, and links to the BO Invest profile (/customers/:id/profile). The origin is BO_INVEST_URL. No stack trace. Other environments stay on their dev alert channel.