event

Recipient Eligibility Changed

An answer of what a recipient may do changed, transacting or withdrawing, such as when the vendor creates its subaccount and it may transact: its public state after the change. Recorded by cna-pay in its outbox in the transaction of the change. No consumer yet.

Event Topic: RecipientKey: idNo consumer

Overview

Fact: the eligibility 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, what it may do (RN-RCB-150), changed. The payload is the public state of the recipient after the change, after eventId and objectVersion, with its new eligibility.

When it is published. 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 it in its outbox, in the transaction of a change, when that change turns canTransact or canWithdraw (cna-pay-docs RN-EVT-110). A change of the reasons alone, with both answers as they were, records no fact: the next fact of the recipient carries the reasons as they are then. 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 changes that can turn an answer:

  • The vendor creates the subaccount of a recipient born with 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: SUBACCOUNT_CREATING leaves both lists, the recipient may transact (canTransact: true) and withdrawing waits for the approval of its verification (VERIFICATION_PENDING in withdrawReasons).
  • A verification result the vendor reflects, such as an approval that lets the recipient withdraw: Recipient Verification ChangedRecipient Verification ChangedEventv1.0.0The verification (KYC) status of a recipient changed as the payment vendor reflects it: its public state after the chang...Ownercna-platformSchemaMapView docs goes first, and this fact right after it, in the same transaction and with the same objectVersion.
  • A block of the subaccount by the vendor, or its lift (SUBACCOUNT_BLOCKED).
  • A limit of the network for a recipient not approved yet: its held balance reaches the ceiling (HELD_BALANCE_CEILING_REACHED) or its verification passes the deadline (VERIFICATION_DEADLINE_EXPIRED), which denies transacting.
  • A change of the bank account the vendor confirms or refuses, when the eligibility recalculated with it turns an answer: this fact goes right before Recipient Bank Account ReplacedRecipient Bank Account ReplacedEventv1.0.0The vendor confirmed the change of the bank account of a recipient, and the new account became current: the public state...Ownercna-platformSchemaMapView docs 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, with the same objectVersion.

The refusal of the creation changes the registry state and adds REGISTRY_REFUSED to the reasons, but no answer, so it is Recipient State ChangedRecipient State ChangedEventv1.0.0The registry state of a recipient changed, such as ACTIVE to REFUSED when the vendor refuses its creation, or back to AC...Ownercna-platformSchemaMapView docs alone, whose state carries the eligibility too (recorded in cna-br/cna-pay-docs#66). The reflections of the notifications of the vendor (the verification, a block or its lift) have no production entry point yet (cna-br/cna-pay#85, cna-br/cna-pay#295).

The payload carries neither the document (CPF or CNPJ) 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 ownerPAY
metadata.eventRecipientEligibilityChanged
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. 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.

api/internal/platform/events/pay/recipient/recipient_eligibility_changed.go
type EligibilityChangedPayload struct {
events.Fact
State
}
var RecipientEligibilityChanged = events.Definition[EligibilityChangedPayload]{
Name: "RecipientEligibilityChanged",
Owner: events.OwnerPay,
AggregateRoot: "Recipient",
Version: "1.0.0",
RoutingKey: func(p EligibilityChangedPayload) string { return p.ID.String() },
}

The definition exists only in cna-pay.

Custom properties

PropertyValue
Contract Ownerx-contract-ownerPAY
Kafka Topicx-kafka-topicRecipient
Message Keyx-message-keyid
Sourcex-sourcecna-pay api/internal/platform/events/pay/recipient/recipient_eligibility_changed.go
14 properties
eventIdstring<uuid>
required

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.

objectVersioninteger
required

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.

Minimum: 1
idstring<uuid>
required

Id of the recipient in cna-pay. Kafka message key.

externalReferencestring | null

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.

Min length: 1
rolestring
required

Role 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).

Allowed values: SCHOOL FRANCHISOR CNA_INSTITUTE SUPPLIER
masterSystemstring
required

Client 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).

Allowed values: CNA_ONE CNA_INSTITUTE
registryStatestring
required

State 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.

Allowed values: ACTIVE SUSPENDED DEREGISTERED REFUSED
refusalReasonstring | null

Normalized 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.

Allowed values: VENDOR_REFUSED_DATA VENDOR_REFUSED CREATION_RETAKE_EXHAUSTED
verificationStatusstring | null

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.

Allowed values: IN_REVIEW AWAITING_RECIPIENT APPROVED REJECTED
eligibilityobject
required

What the recipient may do (RN-RCB-150): two answers, each with the reasons that deny it.