sirgix / bvr-bundle
A bundle with useful functions and template for swiss bvr+
Installs: 102
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 1
Type:symfony-bundle
Requires
- symfony/framework-bundle: ~2.1
This package is not auto-updated.
Last update: 2022-02-01 12:37:04 UTC
README
The goal of this bundle is to help you generating swiss BVR+ with Symfony2. For more information and documentation about BVR+ (in french) go to http://fr.wikipedia.org/wiki/Bulletin_de_versement_avec_num%C3%A9ro_de_r%C3%A9f%C3%A9rence
License
GPL-V2
Installation
Using Composer (Symfony 2.1+)
- Add a new line to your
composer.json
file:
"require": {
...
"sirgix/bvr-bundle": "1.0.*@dev"
}
- Run a command
php composer.phar update
- Add a new line to
app/AppKernel.php
:
$bundles = array(
...
new sirgix\BvrBundle\BvrBundle(),
)
A Quick Start guide
The BVR classes
There are currently 2 bvr classes extending an abstract bvr class. If you just need to generate the encoding lines, you need to instantiante the bvr class and fill all the variables:
$bvr = new PosteBVR();
$bvr->setType(PosteBVR::BVR_CHF_PLUS);
$bvr->setAmount(234.8);
$bvr->setPaymentFor('test testson
route des chemins 4
1000 tonvillage');//Provide an adress. It will be displayed with nl2br
$bvr->setPaymentFrom(/*see paymentFor*/);
$bvr->setPostalAccount('17-6358-7');
$bvr->setReferenceNumber(23456);
$bvrRender = $this->get("sirgix.bvr.renderer");
echo $bvrRender->renderBVR($bvr);
Generate the HTML to print the BVR
I have provided some html for the generation of the bvr html template. This can be used with mpdf to render a PDF. It should be placed at the end of a page. It has been tested with https://github.com/tasmanianfox/MpdfPortBundle
$bvrRender = $this->get("sirgix.bvr.renderer");
echo $bvrRender->renderBVR($bvr);//$bvr is an instance of a BVR class
/!\ THIS IS STILL WIP
Banks
Some banks have different ways to use the reference number. PosteBVR is the standard one. UbsBVR implements it for the UBS Bank
Warning
This is still work in progress and there could be bugs. Use at your own risk.