An open API service indexing awesome lists of open source software.

https://github.com/lastunicorn/bcr-toolkit

A set of helpers to interact with files generated by BCR bank.
https://github.com/lastunicorn/bcr-toolkit

bank bank-statement bank-transactions bcr csharp statement toolkit

Last synced: 17 days ago
JSON representation

A set of helpers to interact with files generated by BCR bank.

Awesome Lists containing this project

README

          

# BCR Bank Toolkit

[![GitHub Repo](https://img.shields.io/badge/github-repo-blue?logo=github)](https://github.com/lastunicorn/bcr-toolkit) [![GitHub Build](https://img.shields.io/github/actions/workflow/status/lastunicorn/bcr-toolkit/build-master.yml?logo=github)](https://github.com/lastunicorn/bcr-toolkit/actions/workflows/build-master.yml) [![NuGet Version](https://img.shields.io/nuget/v/DustInTheWind.Bcr.Toolkit?logo=nuget)](https://www.nuget.org/packages/DustInTheWind.Bcr.Toolkit) [![NuGet Downloads](https://img.shields.io/nuget/dt/DustInTheWind.Bcr.Toolkit?logo=nuget)](https://www.nuget.org/packages/DustInTheWind.Bcr.Toolkit)

A set of helpers to interact with files generated by BCR bank.

**Banca Comercială Română (BCR)** is a Romanian financial services company and investment bank:

- https://en.wikipedia.org/wiki/Banca_Comercial%C4%83_Rom%C3%A2n%C4%83
- https://www.bcr.ro

## Installation

Package Manager:

```
Install-Package DustInTheWind.Bcr.Toolkit
```

.NET CLI:

```
dotnet add package DustInTheWind.Bcr.Toolkit
```

## Runtime Requirements

- Library target framework: `.NET 8.0` (`net8.0`)

## Quick Start

### Step 1 - Export Statement CSV File

- Go to the BCR web application (https://george.bcr.ro) and login.
- Select an account
- From the left menu select "Account Statements"
- On that page create a new CSV statement for the desired time period.
- Download the CSV statement file

### Step 2 - Parse the Exported Document

The `StatementDocument` class provides several methods to parse and load a CSV file, to accommodate different input sources. Here it is one of them:

**From a file path:**

```csharp
StatementDocument document = StatementDocument.LoadFile("statement.csv");

foreach (BankTransaction bankTransaction in document)
{
...
}
```

## CSV Document Structure

The parser expects a header row followed by one or more transaction rows, then a footer row.

### Header row

```csv
Issuing date of the statement,Issuing time of the statement,Starting date,End date,Currency ,BNR exchange rate,Statement issued for account ,Product type,Account owner,First opening accounting balance,Transaction completion date,Transaction completion hour,Transaction's details,Operation's reference,Debit (amount),Credit (amount),Total debit (amount),Total credit (amount),Final accounting balance,Blocked amounts,Available balance,Credit lines available limit
```

### Transaction columns

Each transaction row contains statement-level fields (same values on all rows of one export) and transaction-level fields.

| CSV column | Populated property |
| --- | --- |
| `Issuing date of the statement` | `StatementDocument.IssuingDate` |
| `Issuing time of the statement` | `StatementDocument.IssuingTime` |
| `Starting date` | `StatementDocument.StartingDate` |
| `End date` | `StatementDocument.EndDate` |
| `Currency` | `StatementDocument.Currency` |
| `BNR exchange rate` | `StatementDocument.BnrExchangeRate` |
| `Statement issued for account` | `StatementDocument.BankAccount` |
| `Product type` | `StatementDocument.ProductType` |
| `Account owner` | `StatementDocument.AccountOwner` |
| `First opening accounting balance` | `BankTransaction.OpeningBalance` |
| `Transaction completion date` | `BankTransaction.CompletionDate` |
| `Transaction completion hour` | `BankTransaction.CompletionHour` |
| `Transaction's details` | `BankTransaction.Details` |
| `Operation's reference` | `BankTransaction.OperationReference` |
| `Debit (amount)` | `BankTransaction.DebitAmount` |
| `Credit (amount)` | `BankTransaction.CreditAmount` |
| `Total debit (amount)` | `BankTransaction.DebitTotal` |
| `Total credit (amount)` | `BankTransaction.CreditTotal` |
| `Final accounting balance` | `BankTransaction.FinalBalance` |
| `Blocked amounts` | `BankTransaction.BlockedAmounts` |
| `Available balance` | `BankTransaction.AvailableBalance` |
| `Credit lines available limit` | `BankTransaction.CreditAvailableLimit` |

### Footer row

The last CSV row is a footer, not a transaction. It is recognized by an empty first column.

- Column `Transaction completion date` (index 10) is parsed as footer completion date and must match `StatementDocument.IssuingDate`.
- Column `Available balance` (index 20) is parsed as footer available balance and stored in `StatementDocument.EndBalance`.

## Demo Project

The repository includes a sample CLI project in `sources/Bcr.Toolkit.Demo` that demonstrates:

- reading `statement.csv`
- printing parsed data.

You can use this project as a reference implementation for your own importer/exporter tools.