Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/victor-david/restless-ofxsharper
Provides extended Ofx services: parsing of multiple statements, closing statements, financial institution profile info; and Ofx request building.
https://github.com/victor-david/restless-ofxsharper
multiple-statements ofx-bank-servers ofx-parser ofx-request open-financial-exchange
Last synced: about 1 month ago
JSON representation
Provides extended Ofx services: parsing of multiple statements, closing statements, financial institution profile info; and Ofx request building.
- Host: GitHub
- URL: https://github.com/victor-david/restless-ofxsharper
- Owner: victor-david
- License: mit
- Created: 2017-09-04T23:18:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-04-03T16:35:13.000Z (over 3 years ago)
- Last Synced: 2024-10-05T22:05:54.742Z (3 months ago)
- Topics: multiple-statements, ofx-bank-servers, ofx-parser, ofx-request, open-financial-exchange
- Language: C#
- Size: 140 KB
- Stars: 3
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Restless OfxSharper
[![Nuget](https://img.shields.io/nuget/v/Restless.OfxSharper.svg?style=flat-square)](https://www.nuget.org/packages/Restless.OfxSharper/)Provides extended Ofx services: parsing of multiple statements, closing statements, financial institution profile info;
and Ofx request building.## Main Features
- Build an Ofx request for a financial institution profile (what types of online services it supports)
and transform the response into a usuable object.- Build an Ofx request for an account statement (or multiple statements) and transform the resulting response.
Request and response can include account closing statements as well.## Code Samples
The following code samples demonstrate a few common scenarios.### Get FI Profile
```c#
public void OfxProfileExample()
{
// You need to get your own bank details into an IBank object.
IBank bank = GetMyBankInfo();var builder = OfxFactory.Builder.Create();
builder.BuildOfxRequest(() =>
{
builder.Signon.BuildMessageSet(bank);
builder.Profile.BuildMessageSet();
});// Send request to the bank and get the response
string response = GetResponseFromBank(builder.RequestText);
// Transform response string. Ready to go.
OfxProfileResponse profile = OfxFactory.ProfileResponse.Create(response);
// Do something.
if (profile.BillPay.CanAddPayee)
{
}
}
```### Bank Statement Download
```c#
public void BankStatementDownload()
{
// You need to get your own bank details into an IBank object.
IBank bank = GetMyBankInfo();
// You need to get your own account details into an IAccount object.
IAccount account = GetMyAccountInfo();OfxRequestBuilder builder = OfxFactory.Builder.Create();
builder.BuildOfxRequest(() =>
{
builder.Signon.BuildMessageSet(bank);builder.Bank.BuildMessageSet(() =>
{
// in your app, you'd have to determine an appropiate date to start with.
DateTime fromDate = new DateTime(2018, 1, 1);
builder.Bank.BuildStatementRequest(account, fromDate, null, true);
// add another statement request if you've got another account at the same bank
});
});// Send request to the bank and get the response
string response = GetResponseFromBank(builder.RequestText);// Transform response string. Ready to go.
OfxResponse ofx = OfxFactory.Response.Create(response);
}
```### Credit Card Statement Download (with closing statements)
```c#
public void CreditCardStatementDownload()
{
// You need to get your own bank details into an IBank object.
IBank bank = GetMyBankInfo();
// You need to get your own account details into an IAccount object.
IAccount account = GetMyAccountInfo();OfxRequestBuilder builder = OfxFactory.Builder.Create();
builder.BuildOfxRequest(() =>
{
builder.Signon.BuildMessageSet(bank);builder.CreditCard.BuildMessageSet(() =>
{
// in your app, you'd have to determine an appropiate date to start with
DateTime dateStart = new DateTime(2018, 1, 1);
builder.CreditCard.BuildStatementRequest(account, dateStart, null, true);
// Not using a start date or an end date. Bank will deliver whatever they've got.
builder.CreditCard.BuildClosingStatementRequest(account, null, null);
});
});// Send request to the bank and get the response
string response = GetResponseFromBank(builder.RequestText);// Transform response string. Ready to go.
OfxResponse ofx = OfxFactory.Response.Create(response);
if (ofx.Bank.Statements.Count == 1)
{
foreach (var closingPeriod in ((CreditCardStatement)ofx.Bank.Statements[0]).Closing.Periods)
{
// do something
}
}
}
```### Bank and Credit Card Statement Download
```c#
public void BankAndCreditCardStatementDownload()
{
// You need to get your own bank details into an IBank object.
IBank bank = GetMyBankInfo();
// You need to get your own account details into an IAccount object.
IAccount bankAccount = GetMyAccountInfo();
IAccount creditCardAccount = GetMyAccountInfo();OfxRequestBuilder builder = OfxFactory.Builder.Create();
builder.BuildOfxRequest(() =>
{
builder.Signon.BuildMessageSet(bank);builder.Bank.BuildMessageSet(() =>
{
// in your app, you'd have to determine an appropiate date to start with.
DateTime fromDate = new DateTime(2018, 1, 1);
builder.Bank.BuildStatementRequest(bankAccount, fromDate, null, true);
});builder.CreditCard.BuildMessageSet(() =>
{
// in your app, you'd have to determine an appropiate date to start with
DateTime dateStart = new DateTime(2018, 1, 1);
builder.CreditCard.BuildStatementRequest(creditCardAccount, dateStart, null, true);
// Not using a start date or an end date. Bank will deliver whatever they've got.
builder.CreditCard.BuildClosingStatementRequest(creditCardAccount, null, null);
});
});// Send request to the bank and get the response
string response = GetResponseFromBank(builder.RequestText);// Transform response string. Ready to go.
OfxResponse ofx = OfxFactory.Response.Create(response);
foreach (var statement in ofx.Bank.Statements)
{
if (statement.StatementType == StatementType.Bank)
{
// do something
}
if (statement.StatementType == StatementType.CreditCard)
{
// do something
}
}
}
```