Skip to content

Commit

Permalink
Merge pull request #146 from sprain/specs-2.2
Browse files Browse the repository at this point in the history
Update specifications to v2.2 and adjust behaviour accordingly
  • Loading branch information
sprain authored Oct 22, 2021
2 parents 7ba1d72 + 449738b commit c76cd7e
Show file tree
Hide file tree
Showing 90 changed files with 59 additions and 48 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The beauty of open source software lies in the fact that everybody can benefit f
## Official resources
The repository contains the official specifications the library is based on:

- [Swiss Implementation Guidelines QR-bill](docs/specs/ig-qr-bill-en-v2.1.pdf)
- [Swiss Implementation Guidelines QR-bill](docs/specs/ig-qr-bill-en-v2.2.pdf)
- [Technical information about the QR-IID and QR-IBAN](docs/specs/qr-iid_qr-iban-en.pdf)
- [Style Guide QR-bill](docs/specs/style-guide-en.pdf)
- [Validation Tool](https://validation.iso-payments.ch)
Expand Down
Binary file removed docs/specs/ig-qr-bill-en-v2.1.pdf
Binary file not shown.
Binary file added docs/specs/ig-qr-bill-en-v2.2.pdf
Binary file not shown.
9 changes: 7 additions & 2 deletions src/DataGroup/Element/AdditionalInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,16 @@ public function getFormattedString(): ?string

public function getQrCodeData(): array
{
return [
$qrCodeData = [
$this->getMessage(),
self::TRAILER_EPD,
$this->getBillInformation()
];

if ($this->getBillInformation()) {
$qrCodeData[]= $this->getBillInformation();
}

return $qrCodeData;
}

public static function loadValidatorMetadata(ClassMetadata $metadata): void
Expand Down
3 changes: 1 addition & 2 deletions src/DataGroup/EmptyElement/EmptyAdditionalInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public function getQrCodeData(): array
{
return [
null,
self::TRAILER_EPD,
null
self::TRAILER_EPD
];
}
}
Binary file modified tests/TestData/FpdfOutput/qr-additional-information.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-additional-information.print.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-alternative-schemes.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-alternative-schemes.print.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-full-set.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-full-set.print.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-international-ultimate-debtor.pdf
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-minimal-setup.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-minimal-setup.print.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-payment-reference-non.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-payment-reference-non.print.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-payment-reference-scor.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-payment-reference-scor.print.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-ultimate-debtor.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-ultimate-debtor.print.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/TestData/HtmlOutput/qr-alternative-schemes.svg.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/TestData/HtmlOutput/qr-minimal-setup.svg.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/TestData/HtmlOutput/qr-minimal-setup.svg.print.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/TestData/HtmlOutput/qr-ultimate-debtor.svg.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions tests/TestData/QrCodes/TestDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ public function testQrFile(string $file, string $hash): void
public function qrFileProvider(): array
{
return [
[__DIR__ . '/qr-additional-information.png', '3a23f70cc8cf519f66d27b73f002d828'],
[__DIR__ . '/qr-alternative-schemes.png', '5bba5e41336c8e22fa50bea7627da41c'],
[__DIR__ . '/qr-full-set.png', '766de4a121a49a7e88dacce508f1588f'],
[__DIR__ . '/qr-international-ultimate-debtor.png', 'fc074aaf23921f9e262c0cf101ba07bb'],
[__DIR__ . '/qr-minimal-setup.png', '069e274f22816fcdd799acb1c0cc1dd9'],
[__DIR__ . '/qr-payment-information-without-amount.png', '5705acaab9b9219884fdb2bc99c2cfce'],
[__DIR__ . '/qr-payment-information-without-amount-but-debtor.png', '281316342f09a85af4ad137dc4d30998'],
[__DIR__ . '/qr-payment-information-zero-amount.png', 'aac0aef35bd36e9b79e903998db4756f'],
[__DIR__ . '/qr-payment-reference-non.png', '2e1ebe0623baf0f52922c2e6b988bcc6'],
[__DIR__ . '/qr-payment-reference-scor.png', '03daab8e7c66094bbef308236882c739'],
[__DIR__ . '/qr-ultimate-debtor.png', '5c359ee3333833a54a2076e5e83d2d20'],
[__DIR__ . '/qr-additional-information.png', 'c690b3c552cb31057a34d1bbe1e3a158'],
[__DIR__ . '/qr-alternative-schemes.png', 'ca22587f45609486ec9128f8bfb9ef83'],
[__DIR__ . '/qr-full-set.png', 'ae3aa21373bb4b6ad61a8df96995f06b'],
[__DIR__ . '/qr-international-ultimate-debtor.png', '3178b54237dbbf43df99ea98bba82aaa'],
[__DIR__ . '/qr-minimal-setup.png', '246e856c5c75e92ad9e70298e870d957'],
[__DIR__ . '/qr-payment-information-without-amount.png', 'd21e7106158945a52c7b2be00fbd5369'],
[__DIR__ . '/qr-payment-information-without-amount-but-debtor.png', '67b382fdaa8cd69eb328862d8393fb9f'],
[__DIR__ . '/qr-payment-information-zero-amount.png', '66c1373bac50b98705d94b33462a72c6'],
[__DIR__ . '/qr-payment-reference-non.png', '5843f882b1883f8202c43c17fa07ae86'],
[__DIR__ . '/qr-payment-reference-scor.png', '4ef959e7b428650ec4198491a6d91f1c'],
[__DIR__ . '/qr-ultimate-debtor.png', '9d1d257c2b65d9d04d4d7a20ced6ef1a'],

[__DIR__ . '/proof-of-validation.png', '655b00b5181eef2c01c550fdc3465db5'],
[__DIR__ . '/proof-of-validation.png', '3fbef2c8e8554fe16276c4ce89a09cda'],
];
}
}
Binary file modified tests/TestData/QrCodes/proof-of-validation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/TestData/QrCodes/qr-additional-information.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/TestData/QrCodes/qr-alternative-schemes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion tests/TestData/QrCodes/qr-alternative-schemes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@ QRR
123456789012345678901234567

EPD

foo
foo
Binary file modified tests/TestData/QrCodes/qr-full-set.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/TestData/QrCodes/qr-international-ultimate-debtor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ DE
QRR
123456789012345678901234567

EPD
EPD
Binary file modified tests/TestData/QrCodes/qr-minimal-setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/TestData/QrCodes/qr-minimal-setup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ CHF
QRR
123456789012345678901234567

EPD
EPD
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ CH
QRR
123456789012345678901234567

EPD
EPD
Binary file modified tests/TestData/QrCodes/qr-payment-information-without-amount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ EUR
QRR
123456789012345678901234567

EPD
EPD
Binary file modified tests/TestData/QrCodes/qr-payment-information-zero-amount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/TestData/QrCodes/qr-payment-information-zero-amount.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ EUR

QRR
123456789012345678901234567

EPD
DO NOT USE FOR PAYMENT
EPD
Binary file modified tests/TestData/QrCodes/qr-payment-reference-non.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/TestData/QrCodes/qr-payment-reference-non.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ CHF
NON


EPD
EPD
Binary file modified tests/TestData/QrCodes/qr-payment-reference-scor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/TestData/QrCodes/qr-payment-reference-scor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ CHF
SCOR
RF18539007547034

EPD
EPD
Binary file modified tests/TestData/QrCodes/qr-ultimate-debtor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/TestData/QrCodes/qr-ultimate-debtor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ CH
QRR
123456789012345678901234567

EPD
EPD
Binary file modified tests/TestData/TcPdfOutput/qr-additional-information.svg.pdf
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-alternative-schemes.svg.pdf
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-alternative-schemes.svg.print.pdf
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-full-set.svg.pdf
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-full-set.svg.print.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-minimal-setup.svg.pdf
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-minimal-setup.svg.print.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-payment-reference-non.svg.pdf
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-payment-reference-non.svg.print.pdf
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-payment-reference-scor.svg.pdf
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-payment-reference-scor.svg.print.pdf
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-ultimate-debtor.svg.pdf
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-ultimate-debtor.svg.print.pdf
Binary file not shown.
10 changes: 9 additions & 1 deletion tests/TestQrBillCreatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Sprain\SwissQrBill\DataGroup\Element\Header;
use Sprain\SwissQrBill\DataGroup\Element\PaymentAmountInformation;
use Sprain\SwissQrBill\DataGroup\Element\PaymentReference;
use Sprain\SwissQrBill\PaymentPart\Translation\Translation;
use Sprain\SwissQrBill\QrBill;

trait TestQrBillCreatorTrait
Expand Down Expand Up @@ -53,7 +54,8 @@ public function validQrBillsProvider()
'creditorInformationQrIban',
'creditor',
'paymentAmountInformationZeroAmount',
'paymentReferenceQr'
'paymentReferenceQr',
'additionalInformationZeroPayment'
])
],
['qr-payment-reference-scor',
Expand Down Expand Up @@ -308,6 +310,12 @@ public function additionalInformation(QrBill &$qrBill)
$qrBill->setAdditionalInformation($additionalInformation);
}

public function additionalInformationZeroPayment(QrBill &$qrBill)
{
$additionalInformation = AdditionalInformation::create(Translation::get('doNotUseForPayment', 'en'));
$qrBill->setAdditionalInformation($additionalInformation);
}

public function structuredAddress()
{
return StructuredAddress::createWithStreet(
Expand Down

0 comments on commit c76cd7e

Please sign in to comment.