CNA Pay
Payments platform of the CNA network (recipients, their subaccounts at the payment vendor, bank accounts and gateway configurations). Records the facts of its objects in an outbox and publishes them through a separate process. Consumes no topic of another application.
Overview
cna-pay is the payments platform of the CNA network, a Go API (api/) that client systems command through GraphQL. It does not share the TypeScript event framework of the other applications: each contract it owns is an events.Definition in api/internal/platform/events/pay/<entity>/<event_name>.go, with the same envelope (api/docs/EVENTS.md).
Outbox, then publisher. A service records the payload of each fact in events.outbox_messages, in the transaction of the change, byte for byte as it will be sent; the publisher wraps it in a new envelope at each round. A separate process, cmd/publisher, sends the outbox to Kafka in rounds, keyed by the routing key and in the recording order of each object, and marks a message published only once the brokers confirm it. Delivery is at least once, so every payload of a PAY contract opens with eventId and objectVersion for the consumer to deduplicate and order.
Envelope. cna-pay sets metadata.owner from the definition, always sends producedBy: PAY and also sends the contract version in metadata, as cna-one does.
Nothing is published yet. cna-pay keeps its facts in the outbox and publishes none until its message is in this catalog (cna-pay-docs, Eventos, “Caminho dos eventos até o CNA Event Catalog”): the deployed cna-pay runs the API alone, without the publisher. The topic is the aggregate root today (events.Topic); a topic per client system waits for the catalog team (cna-br/cna-pay#104).
Messages
Messages for this service
Sends messages (7)
Quickly find the message you need by searching for the name, type, or summary.Receives messages (0)
Quickly find the message you need by searching for the name, type, or summary.| Name | Version | Type | Summary |
|---|---|---|---|
| No messages found | |||
Kafka consumers
Consumers run in their own process, one per domain: cmd/consumer <domain>.
| Consumer group | Topics | Handler |
|---|---|---|
recipients-subaccount-reports | pay.internal.Subaccount (internal, outside the model) | api/internal/domains/recipients/subaccount/consumers/subaccount_reports_consumer.go |
The group is prefixed with KAFKA_CONSUMER_GROUP_NAMESPACE when it is set (staging-recipients-subaccount-reports). It reads only the internal facts its own payment gateway records, which no client system receives (see Outside the model on PayPayDomainv1.0.0Payments platform bounded context of the CNA network. Owns the PAY message contracts for the recipients that receive mon...Ownercna-platformMapView docs).
Custom properties
| Property | Value |
|---|---|
| Runtimex-runtime | Go 1.27 + gqlgen (GraphQL) + Ent/PostgreSQL + franz-go |
| Events Pathx-events-path | api/internal/platform/events/<owner>/<entity>/<event_name>.go |