This package contains a validator and generator for structured messages included in Belgian bank transfers. Common use cases:
- Automatic generation of order invoices.
- Association of payment provider messages to orders stored in your application.
The structured message format adheres to the Febelfin Guidelines
Via Composer
$ composer require netsensei/be-bank-transfer-message
Based on a random number
$transferMessage = new BeBankTransferMessage\TransferMessage();
echo transferMessage->getStructuredMessage();
Based on a predefined number
$transferMessage = new BeBankTransferMessage\TransferMessage(12345);
echo transferMessage->getStructuredMessage();
Change to a different predefined number
$transferMessage->setNumber(54321);
$transferMessage->generate();
echo transferMessage->getStructuredMessage();
Or a random number
$transferMessage->setNumber();
$transferMessage->generate();
echo transferMessage->getStructuredMessage();
The default, valid circumfix of a structured message is the plus sign. Optionally, it's possible to use asterisks as a circumfix, if your formatting demands it.
$transferMessage->setNumber();
$transferMessage->generate(TransferMessage::CIRCUMFIX_ASTERISK);
echo transferMessage->getStructuredMessage();
A valid message
$transferMessage = new BeBankTransferMessage\TransferMessage();
$transferMessage->setStructuredMessage('+++090/9337/55493+++');
$result = $transferMessage->validate(); // TRUE
An invalid message
$transferMessage = new BeBankTransferMessage\TransferMessage();
$transferMessage->setStructuredMessage('+++011/9337/55493+++');
$result = $transferMessage->validate(); // FALSE
Additionally the setter method will throw an TransferMessageException()
if the format of the structured message is not valid.
$ phpunit
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.