Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions docs/adr/0024-party-reference-data-directory-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Every `Retrieve` is a query, and every other operation is a command (mission pri
**Retrieve request (1.7).** `GET /PartyReferenceDataDirectory/{partyreferencedatadirectoryid}/Retrieve` answers `200` from the entry's view only, with the BIAN Retrieve fields (`PartyType`, `DirectoryEntryDateType` = `OpenDate`, `DirectoryEntryDate`) and the ids of the entry and its three singleton BQs, in the same shape as the Register response. BIAN's `PartyReference` is not returned: the party's details are served by the Demographics and Reference Retrieves (1.9, 1.10). The entry's version is the strong `ETag` (`"1"`), and an `If-None-Match` that names it (weak comparison, a list or `*`) answers `304 Not Modified` with the `ETag` and no body. A route value that is not an identifier RimBank issues (not a GUID, empty, or not a version 7 GUID) is `400` with the shared `shared.invalid-identifier` code and `errors["partyreferencedatadirectoryid"]`; an unknown entry is `404` `party.party-not-found`.

**Update request (1.8).** `PUT /PartyReferenceDataDirectory/{partyreferencedatadirectoryid}/Update` takes BIAN's `UpdatePartyReferenceDataDirectoryEntry` body.
- **What changes.** Only `PartyType` is used, and it is optional. When it is omitted, the entry keeps its type. When it is given, it is read like Register's, except that a blank value is `party.party-type-invalid`.
- **What changes.** Only `PartyType` is used, and it is optional. When it is omitted, the entry keeps its type. When it is given, it is read like Register's, except that a blank value is `party.party-type-invalid`. From 1.21, an organisation whose Reference records corporate or officer references cannot become a `Person` (`party.corporate-references-need-organisation`, [ADR 0034](0034-reference-corporate-and-officer-references.md)): the client clears them first.
- **RefreshDate.** Every accepted Update records the time of the update (`TimeProvider`) as the entry's `RefreshDate`, BIAN's second `DirectoryEntryDateType`. An Update with an unchanged type is therefore still a business fact and appends `PartyReferenceDataDirectoryEntryUpdated`.
- **Ignored fields.** `PartyReference`, `DirectoryEntryDateType` and `DirectoryEntryDate` are accepted and ignored, as in Register.
- **Headers.** The request requires `Idempotency-Key` and `If-Match` ([ADR 0027](0027-optimistic-concurrency-for-commands.md)): missing → `428` `shared.if-match-required`, malformed → `400` `shared.if-match-invalid`, stale → `409` `party.version-conflict`.
Expand Down Expand Up @@ -100,13 +100,18 @@ Every `Retrieve` is a query, and every other operation is a command (mission pri
- `GovernmentIssuedDocumentDetails` (type, number, name and validity period) and `DocumentDirectoryEntryInstanceReference` (an opaque identification).
- A value left out keeps its value, and an empty one (or an object whose parts are all empty) clears it. An invalid one is `party.reference-invalid` with the BIAN field names in `errors`.
- Every accepted Update appends `PartyReferenceUpdated`, even when nothing changes.
- The four references to other parties (`CorporateCustomerReference`, `CorporateCustomerLegalEntityReference`, `CompanyOfficerReference`, `CompanyOfficerRole`) are refused with `party.reference-field-not-supported` until 1.21, after Associations (ADR 0029, ADR 0032). So are the parts of the objects above that RimBank does not record.
- From 1.21, it also updates the corporate customer's references to other parties ([ADR 0034](0034-reference-corporate-and-officer-references.md)):
- `CorporateCustomerReference.PartyReference` and `CorporateCustomerLegalEntityReference.PartyReference` (registered organisations) and `CompanyOfficerReference.PartyReference` (a registered person), each another entry of this directory, loaded through the write port;
- `CompanyOfficerRole` (Max35Text, only with an officer);
- only on an organisation's entry.
- The parts of the objects above that RimBank does not record are refused with `party.reference-field-not-supported`, including `InvolvementReference`.
- **Retrieve** (`GET …/Reference/{referenceid}/Retrieve`) answers from the entry's view, with the entry's version as `ETag` and `304` on a matching `If-None-Match`. Before the first Update, it answers `200` with the ids only.
- **Headers and responses.** Update requires `Idempotency-Key` and `If-Match`, as in 1.8. Both answer `200` with the same body:
- `GovernmentIssuedIdentityReference` and `PartyLegalEntityReference`, each left out when it holds no identifier;
- from 1.18: the names, `DateofBirth` as `YYYY-MM-DD`, `Nationality` and `PartyCountryOfResidence` as `{ "Code": … }`, and `ResidencyStatus`, each left out when unknown;
- from 1.19: the three addresses, each part left out when unknown, and the contact points as `{ "EmailAddress": … }`, `{ "MobileNumber": … }` and `{ "URLAddress": … }`, each left out when unknown;
- from 1.20: the legal structure and political exposure type in BIAN spelling, the description, `CustomerSinceDate` as `YYYY-MM-DD`, the document in BIAN's nested shape (validity dates as `YYYY-MM-DD`) and the directory reference, each left out when unknown;
- from 1.21: the three references as `{ "PartyReference": … }` and `CompanyOfficerRole` as a string, each left out when unknown;
- the entry and Reference ids.

Update builds it from its acknowledgement.
Expand Down Expand Up @@ -188,6 +193,10 @@ The `ETag` returned by a Retrieve, and the `If-Match` a command sends back, is t
| `party.association-not-found` | NotFound (404) | The association does not exist, or the path's entry is not its owner (1.11) |
| `party.associate-not-registered` | BusinessRule (422) | `AssociateReference` is not an entry of this directory (1.11) |
| `party.self-association` | BusinessRule (422) | The associate is the owning entry (1.11) |
| `party.corporate-references-need-organisation` | BusinessRule (422) | Corporate or officer references on an entry that is not an organisation, or an entry Update to `Person` while they are recorded (1.21, [ADR 0034](0034-reference-corporate-and-officer-references.md)) |
| `party.self-reference` | BusinessRule (422) | A Reference reference names the entry itself (1.21, ADR 0034) |
| `party.referenced-party-not-registered` | BusinessRule (422) | A Reference reference is not an entry of this directory (1.21, ADR 0034) |
| `party.referenced-party-type-mismatch` | BusinessRule (422) | The corporate customer or legal entity is not an organisation, or the officer is not a person (1.21, ADR 0034) |
| `party.association-invalid` | Validation (400) | An Associations value is missing or not valid; `errors` names each BIAN path (1.11, [ADR 0033](0033-party-associations.md)) |
| `party.association-field-not-supported` | Validation (400) | An Associations request sends a BIAN field or part RimBank does not record (1.11, ADR 0033) |
| `party.associate-cannot-change` | BusinessRule (422) | An Associations Update names another associate than the registered one (1.11, ADR 0033) |
Expand Down
23 changes: 16 additions & 7 deletions docs/adr/0029-reference-fields-in-stages.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,22 @@ Option 4, chosen when 1.10 was planned.
| `GovernmentIssuedDocumentDetails` | `GovernmentIssuedDocument` | `PartyDocumentType` and the number (required), the name and the validity period |
| `DocumentDirectoryEntryInstanceReference` | `DocumentDirectoryEntryReference` | `DocumentDirectoryEntryIdentification`, Max35Text, opaque |

### The other fields, in stages
### Corporate and officer references (recorded from 1.21)

| Phase | BIAN fields |
|---|---|
| 1.21 Corporate and officer references | `CorporateCustomerReference`, `CorporateCustomerLegalEntityReference`, `CompanyOfficerReference`, `CompanyOfficerRole` |
The four fields were planned for 1.20. They reference other parties, so they moved to 1.21, after the Associations BQ (1.11, ADR 0032). [ADR 0034](0034-reference-corporate-and-officer-references.md) gives the full rules.

The four fields were planned for 1.20. They reference other parties, so they moved to 1.21, after the Associations BQ (1.11, ADR 0032).
| BIAN field | Recorded as | Rule |
|---|---|---|
| `CorporateCustomerReference` | `PartyReferenceDataDirectoryEntryId` | Its `PartyReference`: another registered entry, an organisation |
| `CorporateCustomerLegalEntityReference` | `PartyReferenceDataDirectoryEntryId` | Its `PartyReference`: another registered entry, an organisation |
| `CompanyOfficerReference` | `PartyReferenceDataDirectoryEntryId` | Its `PartyReference`: another registered entry, a person |
| `CompanyOfficerRole` | `CompanyOfficerRole` | Max35Text, only with an officer |

They are recorded only on an organisation's entry. `InvolvementReference` is refused, with no phase named.

### The fields in stages

Since 1.21, every BIAN Reference field is recorded and `PartyReferenceFields.Staged` is empty. A field a later BIAN release adds would be staged there with its phase.

- **Refused until their phase lands.** A request that sends any of these fields with a value (not `null`) is `party.reference-field-not-supported` (400). `errors` names each field and the phase that will add it, and nothing is stored. The same applies to any other part of `GovernmentIssuedIdentityReference` or `PartyLegalEntityReference`, such as `OtherIdentification`. No phase is planned for those parts, so their message names none.
- **The check comes first.** It runs before the identifiers are checked, so a request is never applied partly.
Expand All @@ -126,7 +135,7 @@ The four fields were planned for 1.20. They reference other parties, so they mov
## Consequences

- **Roadmap.** Rows 1.18, 1.19 and 1.20 are listed right after 1.10, and 1.21 right after 1.11. Each one removes its fields from `PartyReferenceFields.Staged`, adds them to `PartyReferenceDetails`, and updates this ADR's table.
- **Tests.** `PartyReferenceChangesTests` pins the staged fields and their phases, so a phase cannot add a field without updating the table: 22 across three phases at 1.10, 16 across 1.19 and 1.20 after 1.18, 10, all for 1.20, after 1.19, and 4, all for 1.21, since 1.20.
- **Tests.** `PartyReferenceChangesTests` pins the staged fields and their phases, so a phase cannot add a field without updating the table: 22 across three phases at 1.10, 16 across 1.19 and 1.20 after 1.18, 10, all for 1.20, after 1.19, 4, all for 1.21, after 1.20, and none since 1.21.
- **Clients.** A client that sends a staged field gets a 400 that says when the field will be supported, never a silent drop.
- **Uniqueness.** Identifiers are not unique across entries. A uniqueness rule (for example one LEI per entry) needs a cross-stream check and its own ADR.
- **PII.** The identifiers, from 1.18 the names, birth date, nationality and residency, from 1.19 the addresses and contact points, and from 1.20 the declared legal standing and documents, are personal data; political exposure and identity documents are sensitive. They live only in this context's stream and view, and are listed for 7.2. No new code logs them.
- **PII.** The identifiers, from 1.18 the names, birth date, nationality and residency, from 1.19 the addresses and contact points, from 1.20 the declared legal standing and documents, and from 1.21 the corporate customer's references and its officer's role, are personal data; political exposure and identity documents are sensitive. They live only in this context's stream and view, and are listed for 7.2. No new code logs them.
2 changes: 1 addition & 1 deletion docs/adr/0032-reference-legal-standing-and-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Option 3. **The directory records what the party declares, never the bank's asse

## Consequences

- **Roadmap.** Row 1.20 is reworded to the six fields. A new row, **1.21 Reference BQ: corporate and officer references**, is added after 1.11, and the four references are tagged `1.21` in `PartyReferenceFields.Staged`.
- **Roadmap.** Row 1.20 is reworded to the six fields. A new row, **1.21 Reference BQ: corporate and officer references**, is added after 1.11, and the four references are tagged `1.21` in `PartyReferenceFields.Staged`. 1.21 records them as checked directory entries on organisations only ([ADR 0034](0034-reference-corporate-and-officer-references.md)).
- **Events.** `PartyReferenceUpdated` keeps its name. `PartyReferenceDetails` gains the nullable `LegalStanding` and `Documents` members, so events and views stored before 1.20 still load, fold and rebuild (proved by the PostgreSQL tests).
- **Tests.**
- The cross-field rules are Given / When / Then decision tests, and they are part of the entry's decider laws.
Expand Down
Loading
Loading