fix(guest): make Swish QR scannable on guest payment page (#22) #25

Open
hermes wants to merge 1 commit from fix/guest-qr-scannability into master
Collaborator

Why

Issue #22: GuestPaymentRedirect.vue still used the old non-compliant QR settings (margin 2, #111827, width 224) that fail the Swish app's scanner on desktop. PaymentRedirect.vue was already fixed in commit 573153b, but the guest payment page was not updated.

Changes

  • GuestPaymentRedirect.vue: QR options now match PaymentRedirect.vue exactly — margin 4, width 288, errorCorrectionLevel 'M', color #000000/#ffffff
  • CSS .payment__qr-img: 224px to 288px to match the larger QR
  • GuestPaymentRedirect.spec.ts: added assertions verifying margin, width, and color options

Test plan

  • npx vitest run src/__tests__/GuestPaymentRedirect.spec.ts — 16/16 pass
  • npm run lint — clean

Closes #22

## Why Issue #22: GuestPaymentRedirect.vue still used the old non-compliant QR settings (margin 2, #111827, width 224) that fail the Swish app's scanner on desktop. PaymentRedirect.vue was already fixed in commit 573153b, but the guest payment page was not updated. ## Changes - GuestPaymentRedirect.vue: QR options now match PaymentRedirect.vue exactly — margin 4, width 288, errorCorrectionLevel 'M', color #000000/#ffffff - CSS .payment__qr-img: 224px to 288px to match the larger QR - GuestPaymentRedirect.spec.ts: added assertions verifying margin, width, and color options ## Test plan - [x] `npx vitest run src/__tests__/GuestPaymentRedirect.spec.ts` — 16/16 pass - [x] `npm run lint` — clean Closes #22
hermes added 1 commit 2026-07-18 11:32:47 +00:00
fix(guest): make Swish QR scannable on guest payment page
Some checks failed
CI / Lint, type check, unit tests, coverage (pull_request) Successful in 2m49s
CI / E2E browser tests (pull_request) Failing after 1m24s
b4fdcbff9e
The guest payment page (GuestPaymentRedirect.vue) still used the old
non-compliant QR settings that were already fixed in PaymentRedirect.vue
(commit 573153b). Desktop users scanning the QR with the Swish app could
not pay via QR on the guest checkout path.

Root cause: GuestPaymentRedirect.vue was not updated when the auth-path
QR fix was applied. It kept:
  - margin: 2 (half the ISO/IEC 18004 minimum of 4 modules)
  - color #111827 (dark gray; Swish spec requires pure black)
  - width: 224 (borderline for ~80-90 char pre-fill URLs)

Changes:
  - GuestPaymentRedirect.vue: QR options now match PaymentRedirect.vue
    exactly — margin 4, width 288, errorCorrectionLevel 'M',
    color #000000/#ffffff
  - CSS .payment__qr-img: 224px -> 288px to match the larger QR
  - GuestPaymentRedirect.spec.ts: renamed 'renders QR code after loading
    swish info' to 'renders QR code with spec-compliant settings' and
    added assertions verifying margin, width, and color options

Closes #22
hermes reviewed 2026-07-18 11:33:47 +00:00
hermes left a comment
Author
Collaborator

Looks good - solid fix. Two minor suggestions.

The PR correctly mirrors the Swish QR fix from PaymentRedirect.vue into GuestPaymentRedirect.vue. The QR generation options, explanatory comment, and CSS dimensions all match the reference implementation exactly.

Critical

None.

Warnings

None.

Suggestions

  1. The test asserts margin, width, and color but not errorCorrectionLevel: 'M'. Since this is a new parameter that was absent in the old code, consider adding expect(options.errorCorrectionLevel).toBe('M') to the spec to guard against silent regression if someone removes it.

  2. The QR options object is now duplicated verbatim between GuestPaymentRedirect.vue and PaymentRedirect.vue. This exact duplication is how the original bug happened - PaymentRedirect was fixed in commit 573153b but GuestPaymentRedirect was missed. Extracting these options into a shared constant (e.g., QR_OPTIONS in @/api/payment.ts) would prevent this class of drift from recurring.

Looks Good

  • QR settings exactly match PaymentRedirect.vue (margin 4, width 288, errorCorrectionLevel: 'M', pure black on white).
  • CSS .payment__qr-img dimensions updated from 224px to 288px in sync with the QR generation change.
  • Comment thoroughly explains the QR spec reasoning (4-module quiet zone, scanner behavior).
  • Test renamed to reflect the new assertions and covers the key QR options.
  • PR description is well-structured with clear why, changes, and test plan sections.
## Looks good - solid fix. Two minor suggestions. The PR correctly mirrors the Swish QR fix from `PaymentRedirect.vue` into `GuestPaymentRedirect.vue`. The QR generation options, explanatory comment, and CSS dimensions all match the reference implementation exactly. ### Critical None. ### Warnings None. ### Suggestions 1. The test asserts `margin`, `width`, and `color` but not `errorCorrectionLevel: 'M'`. Since this is a new parameter that was absent in the old code, consider adding `expect(options.errorCorrectionLevel).toBe('M')` to the spec to guard against silent regression if someone removes it. 2. The QR options object is now duplicated verbatim between `GuestPaymentRedirect.vue` and `PaymentRedirect.vue`. This exact duplication is how the original bug happened - `PaymentRedirect` was fixed in commit 573153b but `GuestPaymentRedirect` was missed. Extracting these options into a shared constant (e.g., `QR_OPTIONS` in `@/api/payment.ts`) would prevent this class of drift from recurring. ### Looks Good - QR settings exactly match `PaymentRedirect.vue` (margin 4, width 288, `errorCorrectionLevel: 'M'`, pure black on white). - CSS `.payment__qr-img` dimensions updated from 224px to 288px in sync with the QR generation change. - Comment thoroughly explains the QR spec reasoning (4-module quiet zone, scanner behavior). - Test renamed to reflect the new assertions and covers the key QR options. - PR description is well-structured with clear why, changes, and test plan sections.
Author
Collaborator

💡 Suggestion: The test asserts margin, width, and color but not errorCorrectionLevel: 'M'. Consider adding expect(options.errorCorrectionLevel).toBe('M') to GuestPaymentRedirect.spec.ts to guard against silent regression on this parameter.

💡 **Suggestion:** The test asserts `margin`, `width`, and `color` but not `errorCorrectionLevel: 'M'`. Consider adding `expect(options.errorCorrectionLevel).toBe('M')` to `GuestPaymentRedirect.spec.ts` to guard against silent regression on this parameter.
Author
Collaborator

💡 Suggestion (DRY): The QR options object (width, margin, errorCorrectionLevel, color) is now duplicated verbatim between this file and PaymentRedirect.vue. This duplication is how the original bug happened. Consider extracting a shared QR_OPTIONS constant (e.g., in @/api/payment.ts) so both payment pages use the same source of truth.

💡 **Suggestion (DRY):** The QR options object (`width`, `margin`, `errorCorrectionLevel`, `color`) is now duplicated verbatim between this file and `PaymentRedirect.vue`. This duplication is how the original bug happened. Consider extracting a shared `QR_OPTIONS` constant (e.g., in `@/api/payment.ts`) so both payment pages use the same source of truth.
Some checks failed
CI / Lint, type check, unit tests, coverage (pull_request) Successful in 2m49s
CI / E2E browser tests (pull_request) Failing after 1m24s
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/guest-qr-scannability:fix/guest-qr-scannability
git checkout fix/guest-qr-scannability

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout master
git merge --no-ff fix/guest-qr-scannability
git checkout fix/guest-qr-scannability
git rebase master
git checkout master
git merge --ff-only fix/guest-qr-scannability
git checkout fix/guest-qr-scannability
git rebase master
git checkout master
git merge --no-ff fix/guest-qr-scannability
git checkout master
git merge --squash fix/guest-qr-scannability
git checkout master
git merge --ff-only fix/guest-qr-scannability
git checkout master
git merge fix/guest-qr-scannability
git push origin master
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: jocke/bilhej#25
No description provided.