Fix: Make BIC optional for Girocode Version 2 by Shane32 · Pull Request #622 · Shane32/QRCoder

@Shane32

- Modified IsValidBic to accept a 'required' parameter
- BIC is now required for Version 1 (as per spec)
- BIC is optional for Version 2 (as per spec)
- Fixed NullReferenceException when BIC is null
- Added comprehensive tests for all scenarios:
  - Version 2 with null BIC (passes)
  - Version 2 with empty BIC (passes)
  - Version 2 with valid BIC (passes)
  - Version 2 with invalid BIC (throws exception)
  - Version 1 with null BIC (throws exception)
  - Version 1 with empty BIC (throws exception)

Fixes issue where Girocode constructor threw NullReferenceException
when BIC was null with Version 2, which should be allowed per the
Girocode specification.

@Shane32 added this to the 1.7.0 milestone

Oct 2, 2025

@Shane32 Shane32 linked an issue

Oct 2, 2025

that may be closed by this pull request

@Shane32

coderabbitai[bot]

@Shane32

@Shane32

@Shane32 Shane32 deleted the fix/girocode-version2-bic-optional branch

October 5, 2025 20:02

This was referenced

Oct 9, 2025

This was referenced

Nov 25, 2025

This was referenced

Dec 5, 2025

This was referenced

Oct 13, 2025

This was referenced

Nov 25, 2025

This was referenced

Dec 5, 2025