Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PFS-165 Add finance admin upload & client created events #97

Merged
merged 6 commits into from
Oct 29, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"clientId": 1,
"courtRef": "12345678"
}
30 changes: 30 additions & 0 deletions domains/Supervision/events/client-created/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: client-created
version: 0.0.1
summary: |
A client has been created in Sirius
producers:
- opg.supervision.sirius
consumers:
- opg.supervision.finance
owners:
- supervision
---

## Context

In order to increase the performance of some queries, the finance hub needs access to the court reference for the finance client from its own schema. This event populates that field on creation of a client.

## Trigger

A client is created.

## Effect

The supervision_finance.finance_client table is updated, setting the value of court_ref.

<NodeGraph title="Consumer / Producer Diagram" />

<EventExamples />

<Schema />
20 changes: 20 additions & 0 deletions domains/Supervision/events/client-created/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$id": "https://opg.service.justice.gov.uk/opg.supervision.sirius/client-created.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "opg.supervision.sirius/client-created",
"type": "object",
"properties": {
"clientId": {
"type": "integer",
"description": "The client's ID"
},
"courtRef": {
"type": "string",
"description": "The client's court reference number"
}
},
"required": [
"clientId",
"courtRef"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"emailAddress": "[email protected]",
"reportType": "PAYMENTS_MOTO_CARD",
"error": "Failed to read file"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"emailAddress": "[email protected]",
"reportType": "PAYMENTS_MOTO_CARD",
"failedLines": ["Line 1: Duplicate payment", "Line 5: Failed to parse date"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"emailAddress": "[email protected]",
"reportType": "PAYMENTS_MOTO_CARD"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: finance-admin-upload-processed
version: 0.0.1
summary: |
The payment report has been successfully processed
producers:
- opg.supervision.finance
consumers:
- opg.supervision.finance.admin
owners:
- supervision
---

## Context

The finance hub API will automatically process payment reports uploaded to it's S3 directory. This event triggers an email to the uploader outlining the results of the report's processing.

## Trigger

A payment report is processed.

## Effect

An email is sent to the report's uploader describing its success, partial failure or full error, and the reason.

<NodeGraph title="Consumer / Producer Diagram" />

<EventExamples />

<Schema />
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$id": "https://opg.service.justice.gov.uk/opg.supervision.sirius/finance-admin-upload-processed.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "opg.supervision.sirius/finance-admin-upload-processed",
"type": "object",
"properties": {
"emailAddress": {
"type": "string",
"description": "The email address of the user who uploaded the report"
},
"error": {
"type": "string",
"description": "A description of the error that occurred which caused the report to not be processed"
},
"reportType": {
"type": "string",
"description": "The key for the report type that has been uploaded"
},
"failedLines": {
"type": "array",
"description": "The lines of the report which were unable to be processed successfully",
"items": {
"type": "string",
"description": "The line's index and a description of why the line couldn't be processed"
}
}
},
"required": ["emailAddress"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"emailAddress": "[email protected]",
"filename": "moto-card-payments/feemoto_01/01/2024normal.csv",
"reportType": "PAYMENTS_MOTO_CARD"
}
30 changes: 30 additions & 0 deletions domains/Supervision/events/finance-admin-upload/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: finance-admin-upload
version: 0.0.1
summary: |
The payment report has been uploaded
producers:
- opg.supervision.finance.admin
consumers:
- opg.supervision.finance
owners:
- supervision
---

## Context

When a payment report is uploaded from the finance admin system, the finance hub API needs to download the report and process it's contents. This event indicates to the finance hub that a file has been uploaded, and provides its location.

## Trigger

A payment report is uploaded.

## Effect

The finance hub API downloads the report from S3 and processes its payments.

<NodeGraph title="Consumer / Producer Diagram" />

<EventExamples />

<Schema />
21 changes: 21 additions & 0 deletions domains/Supervision/events/finance-admin-upload/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$id": "https://opg.service.justice.gov.uk/opg.supervision.sirius/finance-admin-upload.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "opg.supervision.sirius/finance-admin-upload-processed",
"type": "object",
"properties": {
"emailAddress": {
"type": "string",
"description": "The email address of the user who uploaded the report"
},
"filename": {
"type": "string",
"description": "The sub-directory and filename of the report in the async S3 bucket"
},
"reportType": {
"type": "string",
"description": "The key for the report type that has been uploaded"
}
},
"required": ["emailAddress", "filename"]
}