joelwmale / aba-generator
此包已被弃用且不再维护。未建议替代包。
提供一种简单的方式来生成ABA文件,该文件由银行用于批量交易。
v1.0.4
2018-09-05 23:46 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: 5.4.*
README
提供一种简单的方式来生成ABA文件,该文件由银行用于批量交易。
贡献
由于存款参考字符串填充问题,此分支是从 https://github.com/anam-hossain/aba 分支出来的。此分支修复了文本左对齐而不是右对齐。
功能
- 简单的API
- 框架无关
要求
- PHP 5.4+
安装
Aba
通过 Composer 提供
$ composer require joelwmale/aba-generator
集成
Laravel集成
尽管 Aba
是框架无关的,但它支持Laravel并自带服务提供者和外观,以便于集成。
安装 Aba
后,打开Laravel附带并包含的 config/app.php
文件,并添加以下行。
在 $providers
数组中添加以下服务提供者。
Joelwmale\AbaGenerator\AbaServiceProvider::class
将此包的外观添加到 $aliases
数组。
'Aba' => Joelwmale\AbaGenerator\Facades\Aba::class,
您现在可以在以下示例中使用此外观,而不是自己实例化转换器。
使用
use Joelwmale\AbaGenerator\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();
多笔交易
$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示例
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();
附录
验证
字段 | 描述 |
银行名称 | 银行名称必须为3个字符长,且为大写。例如:CBA |
BSB | 有效的BSB格式为XXX-XXX。 |
账号号码 | 账号号码最多为9位数字。 |
用户名(描述性记录) | 用户或首选名称必须是字母,长度不超过26个字符。 |
账户名称(详细记录) | 账户名称必须是BECS字符,长度不超过32个字符。 |
用户编号 | 由APCA分配的用户编号长度最多为6位。澳大利亚联邦银行默认值为301500。 |
描述(描述性记录) | 描述长度不超过12个字符,且必须是字母。 |
参考(详细记录) | 参考必须是BECS字符,长度不超过18个字符。例如:工资单号码。 |
汇款人 | 汇款人必须是字母,长度不超过16个字符。 |
交易代码
代码 | 交易描述 |
13 | 外部发起的借项 |
50 | 带有交易代码之外的外部发起的贷项 |
51 | 澳大利亚政府担保权益 |
52 | 家庭津贴 |
53 | 工资 |
54 | 养老金 |
55 | 拨款 |
56 | 股息 |
57 | 债券/票据利息 |