Skip to content
This repository has been archived by the owner on Nov 23, 2019. It is now read-only.

A generator and validator for structured messages included in Belgian bank transfers

License

Notifications You must be signed in to change notification settings

netsensei/be-bank-transfer-message

Repository files navigation

BE Bank Transfer Message

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

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

Install

Via Composer

$ composer require netsensei/be-bank-transfer-message

Usage

Generate a structured 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();

Validate a structured message

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.

Testing

$ phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

A generator and validator for structured messages included in Belgian bank transfers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages