Skip to content

Fix Saferpay Fields visibility per active environment license#323

Merged
TLabutis merged 1 commit into
SL-346/accessibility-eaa-compliancefrom
BUGFIX/saferpay-fields-env-license-visibility
May 15, 2026
Merged

Fix Saferpay Fields visibility per active environment license#323
TLabutis merged 1 commit into
SL-346/accessibility-eaa-compliancefrom
BUGFIX/saferpay-fields-env-license-visibility

Conversation

@TLabutis

@TLabutis TLabutis commented May 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Saferpay Fields section was gated by a single hasBusinessLicense flag tied to the active environment at page load. Switching environments client-side never re-evaluated it, so the section remained visible after flipping to an env with no validated business license.
  • Backend now exposes testHasBusinessLicense and liveHasBusinessLicense separately (initial payload and save response).
  • api-credentials.tsx derives the active flag from isTest and gates the Saferpay Fields card on it.

Test plan

  • Test mode with valid test license: Saferpay Fields section visible
  • Switch dropdown to Live (no live credentials, no live license): section hides immediately
  • Switch back to Test: section reappears
  • Save credentials in each env and confirm both flags persist correctly across reloads

The Saferpay Fields section was driven by a single hasBusinessLicense
flag derived from the active environment's stored license at page load.
Switching environments client-side did not re-evaluate it, so the
section stayed visible after switching to an environment with no
validated business license.

Expose testHasBusinessLicense and liveHasBusinessLicense separately
from the controller (initial payload and save response), and pick the
active one in api-credentials.tsx based on testMode.

@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 updates the SaferPay settings to manage business license detection independently for test and live environments, adding backend logging for fetch failures and updating the UI to display per-environment statuses. Feedback highlights that the new frontend validation logic is overly restrictive, as the required attributes and the save button's disabled state prevent users from clearing credentials or saving settings if background validation fails.

<Button
className="sp-min-w-[120px]"
onClick={saveCredentials}
disabled={saving || !hasCredentials || credentialStatus === 'invalid' || credentialStatus === 'checking'}

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.

high

The disabled condition is too restrictive. Blocking the save when credentialStatus === 'invalid' or !hasCredentials prevents users from saving their settings if the background validation fails (e.g., due to transient network issues) or if they wish to clear the credentials. Since the backend performs its own validation upon saving, the frontend should ideally only provide feedback rather than blocking the action entirely.

Suggested change
disabled={saving || !hasCredentials || credentialStatus === 'invalid' || credentialStatus === 'checking'}
disabled={saving || credentialStatus === 'checking'}

Comment on lines 157 to 160
onChange={(e) => setField('username', e.target.value)}
required
aria-required="true"
/>

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 required and aria-required attributes prevent the form from being submitted if the field is empty. This prevents users from clearing credentials to reset or disable the module configuration. Since the backend already handles empty values and performs validation, these restrictions should be removed to allow for more flexibility in managing settings.

Suggested change
onChange={(e) => setField('username', e.target.value)}
required
aria-required="true"
/>
onChange={(e) => setField('username', e.target.value)}
/>

Comment on lines 173 to 176
className="sp-pr-10"
required
aria-required="true"
/>

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

Similar to the username field, the required and aria-required attributes here prevent clearing the password. It is recommended to remove them to allow users to clear credentials if needed.

Suggested change
className="sp-pr-10"
required
aria-required="true"
/>
className="sp-pr-10"
/>

@TLabutis TLabutis merged commit 0fd7498 into SL-346/accessibility-eaa-compliance May 15, 2026
1 of 3 checks passed
@TLabutis TLabutis deleted the BUGFIX/saferpay-fields-env-license-visibility branch May 15, 2026 08:24
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