ABC Bank receives monthly deliveries of customer statement records. This information is delivered in two formats CSV, JSON. These records need to be validated.
The format of the file is a simplified version of the MT940 format. The format is as follows:
Field | Description |
---|---|
Transaction reference |
A numeric value |
Account number |
An IBAN |
Start Balance |
The starting balance in Euros |
Mutation |
Either an addition (+) or a deduction (-) |
Description |
Free text |
End Balance |
The end balance in Euros |
Transaction Date |
Date in the format: yyyy-mm-dd |
You need to create a library that can take these csv or json data as input.
This data has to be validated against the following validations:
-
all transaction references should be unique
-
the end balance needs to be validated
-
The start & end balances in the input data should be greater than or equal to 0
-
Transaction Date should not be a future date
At the end of the processing, a list of report objects should be returned which should have both the transaction reference and description of each of the failed records.
A sample csv(records.csv) & json(records.json) file can also be found in this repo!