Pp 2324 support new qr code types#1182
Open
abolfazlimahdi wants to merge 17 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the Capture SDK’s QR/payment-code support by recognizing and extracting parameters from additional payment code formats (including PDF417-based HUB3), and adds corresponding validation and tests.
Changes:
- Added new supported code formats to
GiniQRCodeDocumentdetection andQRCodesExtractorparameter extraction (SPC, SPD, Pay-by-Square, UPNQR, HUB3). - Updated the camera metadata output to scan both
.qrand.pdf417payloads. - Introduced a Pay-by-Square decoder (base32hex + LZMA) and added/extended tests for the new formats.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
CaptureSDK/GiniCaptureSDK/Tests/GiniCaptureSDKTests/GiniQRCodeDocumentTests.swift |
Adds Swift-Testing suites covering new formats and extraction behavior. |
CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Camera.swift |
Enables scanning of QR + PDF417 metadata types and handles both in delegate callback. |
CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Models/GiniQRCodeDocument.swift |
Extends QR/code format detection to include new formats and Pay-by-Square heuristic. |
CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Helpers/QRCodesExtractor.swift |
Adds extraction logic for SPC/SPD/Pay-by-Square/UPNQR/HUB3 and extends format enum. |
CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Helpers/PayBySquareDecoder.swift |
New decoder for Pay-by-Square payloads (base32hex + LZMA) and field parsing. |
CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Helpers/GiniCaptureDocumentValidator.swift |
Adds validation branches for newly supported formats. |
- Add pure Swift LZMA1 decoder (LZMADecoder.swift) since Apple's Compression framework only supports XZ/LZMA2, not the raw LZMA1 format used by the bysquare spec - Fix PayBySquare beneficiary index calculation to account for PaymentOptions extension fields (standing order/direct debit) - Fix looksLikePayBySquare to avoid redundant uppercased() call - Add official bysquare spec test vector with full decode coverage PP-2324
…m/gini/gini-mobile-ios into PP-2324-support-new-qr-code-types
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.







Pull Request Description
Adds support for five new QR/barcode payment formats — SPC, SPD, PayBySquare, UPNQR, and HUB3 — extending GiniCaptureSDK beyond the existing EPC, EPS, Bezahl, and GiniQR formats.
PP-2324
What changed and how:
New formats detected and parsed:
QRCodesFormatenum extended with.spc,.spd,.payBySquare,.upnqr, and.hub3. Format detection inGiniQRCodeDocumentuses prefix/first-line matching; parameter extraction inQRCodesExtractorimplements format-specific field parsing for each.PDF417 scanning enabled:
Camera.swiftnow registers both.qrand.pdf417metadata object types. HUB3 (Croatian payment slip) is distributed as a PDF417 barcode, not a QR code.PayBySquare decoder: Slovak PayBySquare encodes payment data as base32hex + LZ77-compressed binary. A pure Swift
LZMADecoder(LZMA1 stream, no Apple compression framework dependency) and aPayBySquareDecoderwere added to handle the full decode pipeline.Validation:
GiniCaptureDocumentValidatorupdated with per-format validation rules. SPC, UPNQR, and HUB3 require a valid IBAN. SPD requires IBAN presence but skips strict validation (non-SEPA formats in the wild). PayBySquare validation is implied by a successful decode.Unit tests:
GiniQRCodeDocumentTestscovers format detection, field extraction, and validation for all five new formats using fixture strings.Notes for Reviewers
Tested on: iPhone 12 Pro, iOS 26.5
Manual checks:
Camera.swift— both.qrand.pdf417are registered if the hardware supports them; no crash if.pdf417is unavailableswitchdispatch)Unit tests added:
GiniCaptureSDKTests/GiniQRCodeDocumentTests.swift— 262 lines covering all new formatsKnown limitation: PayBySquare uses LZMA1 (not LZMA2); the pure Swift decoder handles the subset of LZMA1 streams produced by the PayBySquare spec. Apple's Compression framework only exposes LZMA2, which is why the custom decoder was necessary.