Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update international IP address rule card behavior when the rule is being affected by another configuration #7827

Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: update

Updates the behavior and display of the international IP address rule card if the rule is being affected by the WooCommerce core selling locations general option.
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,6 @@ const AllowedCountriesNotice: React.FC< AllowedCountriesNoticeProps > = ( {
const supportedCountriesType = getSupportedCountriesType();
const settingCountries = getSettingCountries();

if ( 'all' === supportedCountriesType ) {
return (
<FraudProtectionRuleCardNotice type={ 'warning' }>
{ __(
'Enabling this filter will not have any effect because you are selling to all countries.',
'woocommerce-payments'
) }
</FraudProtectionRuleCardNotice>
);
}
return (
<FraudProtectionRuleCardNotice type={ 'info' }>
{ getNoticeText( supportedCountriesType, isBlocking ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ import interpolateComponents from '@automattic/interpolate-components';
*/
import FraudProtectionRuleCard from '../rule-card';
import FraudProtectionRuleDescription from '../rule-description';
import FraudProtectionRuleCardNotice from '../rule-card-notice';
import FraudProtectionRuleToggle from '../rule-toggle';
import AllowedCountriesNotice from '../allow-countries-notice';
import { getAdminUrl } from 'wcpay/utils';
import { getSupportedCountriesType } from '../utils';

const InternationalIPAddressRuleCard: React.FC = () => {
const supportsAllCountries = 'all' === getSupportedCountriesType();

return (
<FraudProtectionRuleCard
title={ __( 'International IP Address', 'woocommerce-payments' ) }
Expand Down Expand Up @@ -46,21 +50,35 @@ const InternationalIPAddressRuleCard: React.FC = () => {
} ) }
id="international-ip-address-card"
>
<FraudProtectionRuleToggle
setting={ 'international_ip_address' }
label={ __(
'Block transactions for international IP addresses',
'woocommerce-payments'
) }
></FraudProtectionRuleToggle>
{ supportsAllCountries && (
<FraudProtectionRuleCardNotice type={ 'warning' }>
{ __(
"This filter is disabled because you're currently selling to all countries.",
'woocommerce-payments'
) }
</FraudProtectionRuleCardNotice>
) }
{ ! supportsAllCountries && (
<FraudProtectionRuleToggle
setting={ 'international_ip_address' }
label={ __(
'Block transactions for international IP addresses',
'woocommerce-payments'
) }
></FraudProtectionRuleToggle>
) }
<FraudProtectionRuleDescription>
{ __(
'You should be especially wary when a customer has an international IP address but uses domestic billing and ' +
'shipping information. Fraudsters often pretend to live in one location, but live and shop from another.',
'woocommerce-payments'
) }
</FraudProtectionRuleDescription>
<AllowedCountriesNotice setting={ 'international_ip_address' } />
{ ! supportsAllCountries && (
<AllowedCountriesNotice
setting={ 'international_ip_address' }
/>
) }
</FraudProtectionRuleCard>
);
};
Expand Down
Loading
Loading