Skip to content

Commit

Permalink
Exit early
Browse files Browse the repository at this point in the history
  • Loading branch information
daquinons committed May 3, 2024
1 parent eaa8669 commit f030830
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions client/settings/fraud-protection/advanced-settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,22 @@ const FraudProtectionAdvancedSettingsPage: React.FC = () => {

const handleSaveSettings = () => {
if ( validateSettings( protectionSettingsUI ) ) {
const settings = writeRuleset( protectionSettingsUI );

if ( ! checkAnyRuleFilterEnabled( protectionSettingsUI ) ) {
if ( ProtectionLevel.BASIC !== currentProtectionLevel ) {
updateProtectionLevel( ProtectionLevel.BASIC );
updateAdvancedFraudProtectionSettings( settings );
saveSettings();
}
dispatch( 'core/notices' ).createErrorNotice(
__(
'At least one risk filter needs to be enabled for advanced protection.',
'woocommerce-payments'
)
);

return;
} else if ( ProtectionLevel.ADVANCED !== currentProtectionLevel ) {
updateProtectionLevel( ProtectionLevel.ADVANCED );
dispatch( 'core/notices' ).createSuccessNotice(
Expand All @@ -190,8 +196,6 @@ const FraudProtectionAdvancedSettingsPage: React.FC = () => {
);
}

const settings = writeRuleset( protectionSettingsUI );

// Persist the AVS verification setting until the account cache is updated locally.
if (
wcpaySettings?.accountStatus?.fraudProtection
Expand Down

0 comments on commit f030830

Please sign in to comment.