Recipient State Changed
v1.0.0eventsThe registry state of a recipient changed, such as ACTIVE to REFUSED when the vendor refuses its creation, or back to ACTIVE on a new attempt: its public state after the change, the state it left and the refused fields. Recorded by cna-pay in its outbox in the transaction of the change. No consumer yet.
1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "title": "RecipientStateChanged payload",
4 "type": "object",
5 "additionalProperties": false,
6 "properties": {
7 "eventId": {
8 "type": "string",
9 "format": "uuid",
10 "description": "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."
11 },
12 "objectVersion": {
13 "type": "integer",
14 "minimum": 1,
15 "description": "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."
16 },
17 "id": {
18 "type": "string",
19 "format": "uuid",
20 "description": "Id of the recipient in cna-pay. Kafka message key."
21 },
22 "externalReference": {
23 "type": ["string", "null"],
24 "minLength": 1,
25 "description": "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."
26 },
27 "role": {
28 "type": "string",
29 "enum": ["SCHOOL", "FRANCHISOR", "CNA_INSTITUTE", "SUPPLIER"],
30 "description": "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)."
31 },
32 "masterSystem": {
33 "type": "string",
34 "enum": ["CNA_ONE", "CNA_INSTITUTE"],
35 "description": "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)."
36 },
37 "registryState": {
38 "type": "string",
39 "enum": ["ACTIVE", "SUSPENDED", "DEREGISTERED", "REFUSED"],
40 "description": "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."
41 },
42 "refusalReason": {
43 "type": ["string", "null"],
44 "enum": [
45 "VENDOR_REFUSED_DATA",
46 "VENDOR_REFUSED",
47 "CREATION_RETAKE_EXHAUSTED",
48 null
49 ],
50 "description": "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."
51 },
52 "verificationStatus": {
53 "type": ["string", "null"],
54 "enum": ["IN_REVIEW", "AWAITING_RECIPIENT", "APPROVED", "REJECTED", null],
55 "description": "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."
56 },
57 "eligibility": {
58 "type": "object",
59 "additionalProperties": false,
60 "description": "What the recipient may do (RN-RCB-150): two answers, each with the reasons that deny it.",
61 "properties": {
62 "canTransact": {
63 "type": "boolean",
64 "description": "Whether the recipient may take new payments, referenced in a new order. True exactly when transactReasons is empty."
65 },
66 "transactReasons": {
67 "type": "array",
68 "items": {
69 "type": "string",
70 "enum": [
71 "REGISTRY_SUSPENDED",
72 "REGISTRY_DEREGISTERED",
73 "REGISTRY_REFUSED",
74 "SUBACCOUNT_CREATING",
75 "SUBACCOUNT_BLOCKED",
76 "VERIFICATION_REJECTED",
77 "VERIFICATION_PENDING",
78 "HELD_BALANCE_CEILING_REACHED",
79 "VERIFICATION_DEADLINE_EXPIRED",
80 "WINDING_DOWN"
81 ]
82 },
83 "description": "Reasons that deny transacting, in their declared order (cna-pay recipients.IneligibilityReason); an empty array, never null, when canTransact is true."
84 },
85 "canWithdraw": {
86 "type": "boolean",
87 "description": "Whether the recipient may move its balance to its bank account. True exactly when withdrawReasons is empty."
88 },
89 "withdrawReasons": {
90 "type": "array",
91 "items": {
92 "type": "string",
93 "enum": [
94 "REGISTRY_SUSPENDED",
95 "REGISTRY_DEREGISTERED",
96 "REGISTRY_REFUSED",
97 "SUBACCOUNT_CREATING",
98 "SUBACCOUNT_BLOCKED",
99 "VERIFICATION_REJECTED",
100 "VERIFICATION_PENDING",
101 "HELD_BALANCE_CEILING_REACHED",
102 "VERIFICATION_DEADLINE_EXPIRED",
103 "WINDING_DOWN"
104 ]
105 },
106 "description": "Reasons that deny withdrawing, in their declared order (cna-pay recipients.IneligibilityReason); an empty array, never null, when canWithdraw is true."
107 }
108 },
109 "required": [
110 "canTransact",
111 "transactReasons",
112 "canWithdraw",
113 "withdrawReasons"
114 ]
115 },
116 "previousRegistryState": {
117 "type": "string",
118 "enum": ["ACTIVE", "SUSPENDED", "DEREGISTERED", "REFUSED"],
119 "description": "Registry state the recipient left (cna-pay lifecycle.RegistryState)."
120 },
121 "refusedFields": {
122 "type": "array",
123 "items": {
124 "type": "string"
125 },
126 "description": "Paths of the fields the vendor refused, in the input of the command that created the recipient or started its new attempt (company.address.zipCode, bankAccount.agency), when the change is a refusal with refusalReason VENDOR_REFUSED_DATA, which lists at least one; an empty array, never null, otherwise. Never their values."
127 }
128 },
129 "required": [
130 "eventId",
131 "objectVersion",
132 "id",
133 "role",
134 "masterSystem",
135 "registryState",
136 "eligibility",
137 "previousRegistryState",
138 "refusedFields"
139 ]
140}
141Details
- Format
- JSON Schema
- Resource
- events
- Filename
- schema.json