anam/aba

Provides a simple way to generate an ABA file which is used by banks to allow for batch transactions.

v1.0.1 2016-08-16 02:47 UTC

This package is not auto-updated.

Last update: 2024-11-09 19:39:43 UTC


README

Provides a simple way to generate an ABA file which is used by banks to allow for batch transactions.

Features

  • Simple API
  • Framework agnostic

Requirements

  • PHP 5.4+

Installation

Aba is available via Composer

$ composer require anam/aba

Integrations

Laravel integrations

Although Aba is framework agnostic, it does support Laravel out of the box and comes with a Service provider and Facade for easy integration.

After you have installed the Aba, open the config/app.php file which is included with Laravel and add the following lines.

In the $providers array add the following service provider.

Anam\Aba\AbaServiceProvider::class

Add the facade of this package to the $aliases array.

'Aba' => Anam\Aba\Facades\Aba::class,

You can now use this facade in place of instantiating the converter yourself in the following examples.

Usage

use Anam\Aba\Aba;

$aba = new Aba();

// Descriptive record or file header
// The header information is included at the top of every ABA file
// and is used to describe your bank details.
$aba->addFileDetails([
    'bank_name' => 'CBA', // bank name
    'user_name' => 'Your account name', // Account name
    'bsb' => '062-111', // bsb with hyphen
    'account_number' => '101010101', // account number
    'remitter' => 'Name of remitter', // Remitter
    'user_number' => '301500', // User Number (as allocated by APCA). The Commonwealth bank default is 301500
    'description' => 'Payroll', // description
    'process_date'  => '270616' // DDMMYY - Date to be processed 
]);

// Add a transaction or Detail record
$aba->addTransaction([
    'bsb' => '111-111', // bsb with hyphen
    'account_number' => '999999999',
    'account_name'  => 'Jhon doe',
    'reference' => 'Payroll number',
    'transaction_code'  => '53',
    'amount' => '250.87'
]);

$abaFileContent = $aba->generate(); // Generate ABA string.

$aba->download();
Mutiple transactions
$transactions = [
    [
        'bsb' => '111-111', // bsb with hyphen
        'account_number' => '999999999',
        'account_name'  => 'Jhon doe',
        'reference' => 'Payroll number',
        'transaction_code'  => '53',
        'amount' => '250.87'
    ],
    [
        'bsb' => '222-2222', // bsb with hyphen
        'account_number' => '888888888',
        'account_name'  => 'Foo Bar',
        'reference' => 'Rent',
        'transaction_code'  => '50',
        'amount' => '300'
    ]
];

foreach ($transactions as $transaction) {
    $aba->addTransaction($transaction);
}

$aba->generate();

$aba->download("Multiple-transactions");

Laravel example

use Aba;

// Descriptive record or file header
// The header information is included at the top of every ABA file
// and is used to describe your bank details.
Aba::addFileDetails([]);

Aba::addTransaction([]);

Aba::generate();

Aba::download();

Appendix

Validation
Transaction codes

Reference