Skip to content

SL-350 Settings UX/logic fixes (SL-366/367/370)#334

Merged
justelis22 merged 3 commits into
feature/react-admin-settingsfrom
SL-350/settings-ux-fixes
Jul 10, 2026
Merged

SL-350 Settings UX/logic fixes (SL-366/367/370)#334
justelis22 merged 3 commits into
feature/react-admin-settingsfrom
SL-350/settings-ux-fixes

Conversation

@justelis22

Copy link
Copy Markdown
Collaborator

Part of SL-350 settings redesign. Phase 2 — small logic / UX fixes.

Tickets

  • SL-367 — filter MPO & SPG terminals from selection. Defensive read of the terminal type (Type/TerminalType, case-insensitive) since the live API property was unconfirmed.
  • SL-366 — hide the password show/hide toggle until a new password is typed; the stored secret is never sent to the browser and stays masked.
  • SL-370 — split "Card Display & Saving" into two sections: "Card Display" and "Card Saving for Customers". Stored keys unchanged.

Tests

New unit test tests/Unit/Service/SaferPayGetTerminalsTest.php (4 tests) covering MPO/SPG exclusion, case-insensitivity, both property names, and the returned shape.

Verification

Unit tests green; settings-app build passes; php -l clean.

- SL-367: filter MPO/SPG terminals from selection (defensive Type/TerminalType read, case-insensitive) + unit test
- SL-366: hide password show/hide toggle until a new password is typed; keep saved secret masked
- SL-370: split 'Card Display & Saving' into 'Card Display' and 'Card Saving for Customers' sections

Stored config keys and save flow unchanged. Compiled bundle is gitignored (built in CI).

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces terminal filtering in the SaferPay service to exclude specific terminal types, updates translation strings for payment settings, and refactors the payment processing UI to separate card display and saving settings into distinct cards. Additionally, it adds a conditional password visibility toggle in the API credentials component. The review feedback suggests implementing scalar checks for terminal type properties to improve defensive programming and updating PHPUnit mock methods to use onlyMethods for better compatibility.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/Service/SaferPayGetTerminals.php Outdated
Comment on lines +101 to +107
if (isset($terminal->Type)) {
return strtoupper((string) $terminal->Type);
}

if (isset($terminal->TerminalType)) {
return strtoupper((string) $terminal->TerminalType);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To ensure robust defensive programming, we should verify that the Type or TerminalType properties are scalar values (e.g., strings or numbers) before casting them to string and calling strtoupper(). If the API response unexpectedly contains an array or an object for these fields, casting them directly to string will trigger a TypeError or Error in PHP 8.0+.

        if (isset($terminal->Type) && is_scalar($terminal->Type)) {
            return strtoupper((string) $terminal->Type);
        }

        if (isset($terminal->TerminalType) && is_scalar($terminal->TerminalType)) {
            return strtoupper((string) $terminal->TerminalType);
        }


$mock = $this->getMockBuilder(GetTerminalsService::class)
->disableOriginalConstructor()
->setMethods(['getTerminals'])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The setMethods() method is deprecated in PHPUnit 8/9 and has been completely removed in PHPUnit 10. Since getTerminals is an existing method on GetTerminalsService, you should use onlyMethods() instead to ensure compatibility with newer PHPUnit versions.

            ->onlyMethods(['getTerminals'])

Justas added 2 commits July 10, 2026 11:34
Address review feedback: verify Type/TerminalType are scalar before casting to string,
so an unexpected array/object in the API response can't trigger a TypeError.
…to SL-350/settings-ux-fixes

# Conflicts:
#	views/js/admin/settings-app/src/components/settings/api-credentials.tsx
@justelis22 justelis22 merged commit 9b979c8 into feature/react-admin-settings Jul 10, 2026
1 of 3 checks passed
@justelis22 justelis22 deleted the SL-350/settings-ux-fixes branch July 10, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant