sprain / php-swiss-qr-bill

A PHP library to create Swiss QR bills | QR-Rechnung in PHP erstellen
MIT License
282 stars 82 forks source link

No reference, normal IBAN #100

Closed wurschmedia closed 4 years ago

wurschmedia commented 4 years ago

Is there a way to skip the reference number and use a normal IBAN (replacement for the red invoice slip) ? Right now it throws an error if I just delete the $qrBill->setPaymentReference() section

wurschmedia commented 4 years ago

Found the answer myself :-)

// Add payment reference // Explicitly define that no reference number will be used by setting TYPE_NON. $qrBill->setPaymentReference( QrBill\DataGroup\Element\PaymentReference::create( QrBill\DataGroup\Element\PaymentReference::TYPE_NON ));

sprain commented 4 years ago

Normal IBANs can be used when using references of type SCOR or NON.

See these examples: https://github.com/sprain/php-swiss-qr-bill/blob/master/example/example_minimal.php https://github.com/sprain/php-swiss-qr-bill/blob/master/example/example_scor.php

garga11 commented 4 days ago

Hi, thankyou for your work, I've only a question ... wat I need to change for use the example_scor.php ? my qr is generated only with the BESR number, in my case I've only a normal IBAN and no reference... Thankyou

kohlerdominik commented 4 days ago

@garga11 you probably want to use example_minimal.php, with the PaymentReference::TYPE_NON.

garga11 commented 4 days ago

thankyou Dominik, exactly, my questione is how can I use example_minimal.php ? I 've to copy the code in another file? thankyou

kohlerdominik commented 4 days ago

It's required, that your project has a proper Composer setup. You can check out the docs here: Introduction - Composer

Once done completely, you can composer require sprain/swiss-qr-bill, copy the example_minimal.php to your project and adjust to your needs.

garga11 commented 3 days ago

Thnakyou Dominik, I don't have composer, but I've solved only modifing this file app/Helpers/SwissQrGenerator.php at line 78 inserting this:

$qrBill->setCreditorInformation( QrBill\DataGroup\Element\CreditorInformation::create( 'CHXXXXXXXXXXXXX' // This is a classic iban. QR-IBANs will not be valid in this minmal setup. )
);