tazama-lf / event-flow

Apache License 2.0
0 stars 0 forks source link

Retrieve conditions for an account #4

Open Sandy-at-Tazama opened 2 months ago

Sandy-at-Tazama commented 2 months ago

Story statement

As a fraud analyst, I want to be able to retrieve conditions from ArangoDB via the Admin API So that I can view what blocking and override conditions exist in the system and so that I can effectively review and monitor compliance and risk management settings within the Tazama system.

Description / Overview

New functionality is being added to the Tazama system to be able to block or override a transaction event evaluation based on the evaluation of conditions against one of the transaction event attributes. The purpose of this user story is to provide a feature to allow a user to submit a request to retrieve specific conditions from the database via an Admin API.

See epic https://github.com/frmscoe/tazama-project/issues/12

Sequence diagram

sequenceDiagram
  participant clientsystem as Client System
  participant tmsapi as Admin API
  participant cache as Cache
  participant DB as DB

  clientsystem->>tmsapi: fetchCondition()
  tmsapi->>DB: fetchCondition()
  DB->>tmsapi: {conditions} list
  DB->>cache: updateConditions(activeOnly)
  tmsapi->>clientsystem: {conditions} list

Acceptance criteria

  1. Create an Admin API that has access to the Tazama database
    • recommended /v1/admin/event-flow-control/account
  2. Create a REST (GET) endpoint to allow a client system to retrieve conditions in the Tazama graph database by account id

Functionality

  1. The request parameter must be an account id url:port/v1/event-flow-control/account?id=4315e3271f5548c78242c70a7bc1bda7&&schmenm=IBAN&&agt=dfsp001&&synccache=no`
  2. If the account does not exist in the accounts collection in the pseudonyms DB, return an error "Account does not exist in the database"
  3. If the account exists, and there are no conditions, return HTTP Status 204

Parameters:

Response data - account

JSON ```JSON { "acct": { "id": "1010101010", "schmeNm": { "prtry": "Mxx" }, "agt": { "finInstnId": { "clrSysMmbId": { "mmbId": "dfsp001" } } } }, "conditions":[ { "condId": "57bccf4497b64cd99e92d0a7f3352d41", "condTp": "non-overridable-block", "incptnDtTm": "2024-01-01T24:00:00.999Z", "xprtnDtTm": "2024-03-03T24:00:00.999Z", "condRsn": "R001", "usr": "bob", "creDtTm": "2024-01-01T24:00:00.999Z", "prsptvs": [ { "prsptv": "governed_as_debtor_account_by", "evtTp": ["pacs.008.01.10", "pacs.002.01.11"], "incptnDtTm": "2024-01-01T24:00:00.999Z", "xprtnDtTm": "2024-03-03T24:00:00.999Z" } { "prsptv": "governed_as_creditor_account_by", "evtTp": ["pacs.008.01.10", "pacs.002.01.11"], "incptnDtTm": "2024-01-01T24:00:00.999Z", "xprtnDtTm": "2024-03-03T24:00:00.999Z" } ] }, { "condId": "57bccf4497b64cd99e92d0a7f3352d41", "condTp": "override", "incptnDtTm": "2024-01-23T24:00:00.999Z", "xprtnDtTm": "2024-03-23T24:00:00.999Z", "condRsn": "R001", "usr": "bob", "creDtTm": "2024-01-04T24:00:00.999Z", "prsptvs": [ { "prsptv": "governed_as_debtor_account_by", "evtTp": ["all"], "incptnDtTm": "2024-01-01T24:00:00.999Z", "xprtnDtTm": "2024-03-03T24:00:00.999Z" } ] } ] } ```

Complete Success Criteria

  1. Retrieve all conditions for the account id

Success response 200 OK

If no account id is provided, return an {UP} status

If the request does not return any data, return a 204 No Content status with empty response body

Error responses
4xx 5xx

cshezi commented 2 weeks ago

BUG: Parameter keys were implemented in the camel case this should not be an issue but with validation emphasizing the camel case since validation is case sensitive this immediately becomes an issue.