We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

SwissQRBill empty element StrdBkgInf (BillInformation)

I’m using SwissQRCodetext to create SwissQR code (Version 22.2.0).
If property BillInformation is not set (null) the QR code validation on https://validation.iso-payments.ch/ fails with remark: Das Element <StrdBkgInf> darf nicht leer sein, wenn dieses geliefert wird. Ausnahme: Wenn nachfolgende Elemente verwendet werden.

Code snippet to create the QR code:

        //create Swiss QR Bill
        SwissQRCodetext swissQRCode = new SwissQRCodetext();
        swissQRCode.Bill.Version = SwissQRBill.QrBillStandardVersion.V2_0;
        swissQRCode.Bill.Account = "CH4431999123000889012";
        swissQRCode.Bill.Amount = 1000.25m;
        swissQRCode.Bill.Currency = "CHF";
        swissQRCode.Bill.Reference = "210000000003139471430009017";
        swissQRCode.Bill.Creditor = new Address
        {
            Name = "Muster & Söhne",
            Street = "Musterstrasse",
            HouseNo = "12b",
            PostalCode = "8200",
            Town = "Zürich",
            CountryCode = "CH"
        };

        swissQRCode.Bill.Debtor = new Address
        {
            Name = "Muster AG",
            Street = "Musterstrasse",
            HouseNo = "1",
            PostalCode = "3030",
            Town = "Bern",
            CountryCode = "CH"
        };

        //encode Swiss QR Bill
        ComplexBarcodeGenerator generator = new ComplexBarcodeGenerator(swissQRCode);
        generator.Parameters.Barcode.XDimension.Pixels = 4;
        generator.Parameters.Barcode.QR.QrEncodeMode = QREncodeMode.ECIEncoding;
        generator.Parameters.Barcode.QR.QrECIEncoding = ECIEncodings.UTF8;
        string fileNmae = $"SwissQRBill-{Guid.NewGuid()}.png";
        generator.Save(fileNmae);

Specification of Billinformation (StrdBkgnInf)

SwissQRBill-634e222f-1a11-4df8-8890-bc25656ac499.png (2.5 KB)

@silviofuchs,

Thanks for the sample code and details.

I did test your scenario/case using your sample and found it generates the barcode Ok. Do you need Aspose.BarCode for .NET should throw an exception something like “Das Element darf nicht leer sein, wenn dieses geliefert wird. Ausnahme: Wenn nachfolgende Elemente verwendet werden” in english if BillInformation is not set, please confrim? After your confirmation, we will log appropriate ticket for evaluation/investigation.

Yes, I’m using Aspose.BarCode for .NET (current version 22.2.0). I explicit do not set property BillInformation, as you can see in my code sample. I don’t like to set any BillInformation. There is no exception when I generate the QR code.
Without BillInformation the StrdBkgInf element should not exists in the QR-Code. This is what the validation message basically explains in german.
If I set BillInformation property to a non emtpy string like
swissQRCode.Bill.BillInformation = "this text makes it valid";
everything works as expected and QR-Code validation passes without any hint or error.

I’ve added a running console application showing the issue
AsposeQrCodeSample.zip (1.5 MB)

@silviofuchs,

Thanks for your confirmation and sample project.

I have logged a ticket with an id “BARCODENET-38136” for your issue. We need to investigate it in details. We will look into it to figure it out soon.

Once we have an update on it, we will let you know.

1 Like

This issue seems to be fixed with version 22.3.0.
Thank you very much for the quick fix.

@silviofuchs,

Thanks for your feedback.

Yes, we fixed the issue in Aspose.BarCode for .NET 22.3.0. Feel free to write us back if you have further queries or comments.

1 Like

@silviofuchs,

The issue (logged as [Ticket ID: BARCODENET-38136]) has been resolved in Aspose.BarCode for .NET 22.3 (Download | NuGet). Please try it and in case you still find any issue, let us know with details.

I’ve tested it already. It works as expected.
Thank you very much for fixing it so fast.

@silviofuchs,

Thanks for your feedback.

It is nice to know that your issue is resolved by the new version.