Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Direct Debit Library for Producing Records For Use With Albany Products
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Producer/Consumer Library For Albany Direct Debit Products

This library allows a developer to generate output compatable with Albany Direct Debit products (initally EPay).


Released under a MIT license -


Configuration and usage are handled distinctly. If no configuration section is used, then a default output is used consisting of the following fields:

Record: Destination, TransCode, Originator, Amount, Reference BankAccount: SortCode, Number, Name

To use a configuration section, add the following to your app.config/web.config:

        <section name="DirectDebit" type="OrangeTentacle.DirectDebitAlbany.DirectDebitConfiguration, DirectDebitAlbany" />

                <add field="SortCode" />
                <add field="Number" />
                <add field="Name" />

                <add field="Destination.Line" />
                <add field="TransCode" />
                <add field="Originator.Line" />
                <add field="Amount" />
                <add field="Reference" />

BankAccount and Record are both optional. See DirectDebitAlbanyTest/Sample/.config for configuration examples.

New Feature

Individual fields from bank accounts can now be composed as part of a record.

                <add field="Destination.SortCode" />
                <add field="TransCode" />
                <add field="Originator" />
                <add field="Amount" />
                <add field="Reference" />


Creating Transactions


Each output Record (big R) represents a transaction or AUDDIS instruction. A Record consists of an originator and destination bank account, a transaction type, value and reference. A record is created thus:

var originator = new BankAccount(..); // See BankAccounts
var destination = new BankAccount(..);
var transcode = TransCode.Payment; // See TransCode enum
var value = 123.45m;
var reference = "Transaction Reference";

var record = new Record(originator, destination, transcode, value, reference);

Bank Account

Each BankAccount may represent a originator or destination bank account.

var number = "12345678";
var sortcode = "123456";
var name = "Mr Marty McFly";
var bank = Bank.Other;
var bankaccount = new BankAccount(number, sortcode, name, bank);

The default BankAccount constructor takes a six to eight digit account number and six digit sortcode. Optionally, a bank can be supplied (see Bank enum). Supplying a bank allows a nine or ten digit account number to be submitted - this will be truncated to eight digits as appropiate for the supplied bank.


Given a complete record, the output can then be serialized to a fixed width format. The Serialize method may be invoked with different parameters to return the serialized result:

var serialized = record.Serialize(SerializeMethod.Fixed); // Returns fields in default order.

var fields = new [] { "Originator", "TransCode" };
var serialized = record.Serialize(SerializeMethod.Fixed, fields); // Returns provided properties.

var config = DirectDebitConfiguration.GetSection();
var serialized = record.Serialize(SerializeMethod.Fixed, config); // Returns properies in configuration file.

For CSV output use SerializeMethod.CSV.

Line returns a string suitable for writing to a text file.

using (var file = new StreamWriter("output.txt"))


Orange Tentacle accepts NO LIABILITY whatsoever, in any way, shape, or form, in this world of the next, for the stability of this library or for your financial health. USE AT YOUR OWN RISK.


  • Add reading of Albany Direct Debit formats.
  • Release library on NuGet.
Something went wrong with that request. Please try again.