Recipient Bank Account Replaced
The vendor confirmed the change of the bank account of a recipient, and the new account became current: the public state of the recipient, the new account masked, since when it is current and the account it replaced. Recorded by cna-pay in its outbox in the transaction of the confirmation. No consumer yet.
Overview
Fact: the bank account of a RecipientRecipientEntityv1.0.0A recipient (recebedor) of CNA Pay - every CPF or CNPJ enabled to receive money on the platform - a school, the franchis...Ownercna-platformView docs changed (PRD 1, US-105). The payload is the public state of the recipient after the change, after eventId and objectVersion, plus bankAccount, the new current account, becameCurrentAt, from when the transfers go to it, and replacedBankAccountId, the account it replaced.
When it is published. The master system of the recipient, or the back office of the platform, commands the change with replaceRecipientBankAccount. The new account waits PENDING while the current one keeps receiving the transfers, and the change is forwarded to the subaccount at the vendor. When the vendor confirms it, CNA PayCNA PayServicev1.0.0Payments platform of the CNA network (recipients, their subaccounts at the payment vendor, bank accounts and gateway con...PublishesRecipientCreated, RecipientStateChanged +5Ownercna-platformMapRepoView docs records this fact in its outbox, in the transaction that makes the new account CURRENT and the old one REPLACED, kept for the transfers that used it (RN-RCB-170). The publisher process then sends it to Recipient (Kafka topic)Recipient (Kafka topic)Channelv1.0.0Kafka topic for the Recipient aggregate of CNA Pay - every CPF or CNPJ enabled to receive money on the platform. Carries...Ownercna-platformView docs.
- The change is accepted only for an
ACTIVErecipient with its subaccountACTIVE(BANK_ACCOUNT_REPLACEMENT_NOT_ALLOWED, a proposal in cna-br/cna-pay-docs#49). - An account equal to the current one is no change and records nothing.
- A change the vendor neither confirms nor refuses leaves the new account
PENDING; a retry of the command sends it again, and its outcome is then this fact or Recipient Bank Account Replacement RefusedRecipient Bank Account Replacement RefusedEventv1.0.0The vendor refused the change of the bank account of a recipient, and the current account stays: the public state of the...Ownercna-platformSchemaMapView docs. - The change advances the version of the recipient. When the eligibility recalculated with it turns an answer, Recipient Eligibility ChangedRecipient Eligibility ChangedEventv1.0.0An answer of what a recipient may do changed, transacting or withdrawing, such as when the vendor creates its subaccount...Ownercna-platformSchemaMapView docs goes right before this fact, with the same
objectVersion.
The account is masked: the agency and the account number show only their last digits (at most 2 and 4, never more than half of them), and the holder and the check digits are never sent (RN-RCB-176; decided on cna-br/cna-pay#52 on 2026-11-03). The full account is read only by the master system. The payload carries neither the document nor the name of the recipient, nor any data of its managing partner (guard-rail 9, data minimization).
No consumer yet. The One is the expected first consumer. Delivery is at least once: a consumer drops an event whose eventId it already applied and a state older than the objectVersion it holds; a fact of the version it holds is still applied. cna-pay publishes nothing until this message is in the catalog (see Recipient (Kafka topic)Recipient (Kafka topic)Channelv1.0.0Kafka topic for the Recipient aggregate of CNA Pay - every CPF or CNPJ enabled to receive money on the platform. Carries...Ownercna-platformView docs).
Kafka
Topic (AggregateRoot) | Recipient |
Message key (RoutingKey) | payload.id |
| Contract owner | PAY |
metadata.event | RecipientBankAccountReplaced |
| Consumer group | (none yet) |
Payload schema
Source of truth
events.Fact and State are embedded without a JSON name, so their fields are written inline, before the fields of this payload. Both are shown on Recipient CreatedRecipient CreatedEventv1.0.0The platform recorded a new recipient: its public state at its birth, ACTIVE and neither transacting nor withdrawing whi...Ownercna-platformSchemaMapView docs. BankAccount is shared with Recipient Bank Account Replacement RefusedRecipient Bank Account Replacement RefusedEventv1.0.0The vendor refused the change of the bank account of a recipient, and the current account stays: the public state of the...Ownercna-platformSchemaMapView docs; the masks come from recipients.BankAccount.MaskedAgency and MaskedAccountNumber (redact.Tail), and BecameCurrentAt is written by dates.ISO, in UTC with milliseconds.
type BankAccountReplacedPayload struct { events.Fact State BankAccount BankAccount `json:"bankAccount"` BecameCurrentAt string `json:"becameCurrentAt"` ReplacedBankAccountID uuid.UUID `json:"replacedBankAccountId"`}
var RecipientBankAccountReplaced = events.Definition[BankAccountReplacedPayload]{ Name: "RecipientBankAccountReplaced", Owner: events.OwnerPay, AggregateRoot: "Recipient", Version: "1.0.0", RoutingKey: func(p BankAccountReplacedPayload) string { return p.ID.String() },}
// api/internal/platform/events/pay/recipient/bank_account.gotype BankAccount struct { ID uuid.UUID `json:"id"` Institution string `json:"institution"` MaskedAgency string `json:"maskedAgency"` MaskedAccountNumber string `json:"maskedAccountNumber"` Type string `json:"type"`}The definition exists only in cna-pay.
Custom properties
| Property | Value |
|---|---|
| Contract Ownerx-contract-owner | PAY |
| Kafka Topicx-kafka-topic | Recipient |
| Message Keyx-message-key | id |
| Sourcex-source | cna-pay api/internal/platform/events/pay/recipient/recipient_bank_account_replaced.go |
Unique, immutable id of the event (events.Fact), the same in every resend of it. A consumer drops an event whose eventId it already applied.
Version of the recipient after the change the event reports, from 1 (events.Fact). The facts of one change share it, so a consumer applies a fact of the version it holds and drops one older than it.
1Id of the recipient in cna-pay. Kafka message key.
Id of the registry in the master system, which correlates the recipient with it; not unique, since after a change of ownership the old and the new recipient point to the same registry (RN-RCB-130). Always sent; null for a recipient the platform administration created, such as the franchisor.
1Role of the recipient in the network (cna-pay recipients.Role). The One creates a SCHOOL or a SUPPLIER, and the platform administration only the FRANCHISOR; no command creates a CNA_INSTITUTE yet (cna-br/cna-pay#262).
SCHOOL FRANCHISOR CNA_INSTITUTE SUPPLIERClient system that owns the registry and receives the facts of the recipient, RN-EVT-155 (cna-pay recipients.MasterSystem): CNA_ONE for a school, a supplier and the franchisor; CNA_INSTITUTE for the CNA Institute, which has no topic yet, so a change of such a recipient fails whole until its topic exists (cna-br/cna-pay#297).
CNA_ONE CNA_INSTITUTEState of the registry after the change (cna-pay lifecycle.RegistryState): ACTIVE, what it may do being in eligibility; REFUSED, the vendor refused its creation and refusalReason says why; SUSPENDED and DEREGISTERED (final) are not produced in this delivery.
ACTIVE SUSPENDED DEREGISTERED REFUSEDNormalized reason of a REFUSED recipient (cna-pay recipients.RefusalReason): VENDOR_REFUSED_DATA, the vendor refused fields of the creation; VENDOR_REFUSED, it refused it without naming a field; CREATION_RETAKE_EXHAUSTED, the creation got no answer of the vendor until its retakes ran out (not produced yet, cna-br/cna-pay#389). Always sent; null unless registryState is REFUSED.
VENDOR_REFUSED_DATA VENDOR_REFUSED CREATION_RETAKE_EXHAUSTED Verification (KYC) of the recipient as the vendor reflects it (cna-pay lifecycle.VerificationStatus): IN_REVIEW, AWAITING_RECIPIENT (the vendor waits for the recipient; the pending items stay in the query of the recipient), APPROVED, or REJECTED (final). Always sent; null until the vendor reflects the first result.
IN_REVIEW AWAITING_RECIPIENT APPROVED REJECTED What the recipient may do (RN-RCB-150): two answers, each with the reasons that deny it.
The new current bank account, to which the transfers go from becameCurrentAt. Masked: never the holder (name or document) nor the check digits (cna-pay recipient.BankAccount; RN-RCB-176).
When cna-pay recorded the confirmation of the vendor, from which the transfers go to the new account: ISO 8601 in UTC with milliseconds (2026-11-18T12:00:00.000Z).
Id of the bank account the new one replaced, now REPLACED and kept for the transfers that used it (RN-RCB-170).