From 70d7d8971cb7c382b50d1c7095120bb5bd47f0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armando=20Rodr=C3=ADguez?= <127134616+armando-rodriguez-cko@users.noreply.github.com> Date: Wed, 28 Aug 2024 18:43:11 +0200 Subject: [PATCH] Update DNS Merchant regular expression length --- src/main/java/com/checkout/EnvironmentSubdomain.java | 2 +- .../java/com/checkout/DefaultCheckoutConfigurationTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/checkout/EnvironmentSubdomain.java b/src/main/java/com/checkout/EnvironmentSubdomain.java index 27bd65e0..a971f137 100644 --- a/src/main/java/com/checkout/EnvironmentSubdomain.java +++ b/src/main/java/com/checkout/EnvironmentSubdomain.java @@ -25,7 +25,7 @@ private static URI addSubdomainToApiUrlEnvironment(IEnvironment environment, Str } catch (final URISyntaxException e) { throw new CheckoutException(e); } - Pattern pattern = Pattern.compile("^[0-9a-z]{8,11}$"); + Pattern pattern = Pattern.compile("^[0-9a-z]+$"); Matcher matcher = pattern.matcher(subdomain); if (matcher.matches()) { String host = apiUrl.getHost(); diff --git a/src/test/java/com/checkout/DefaultCheckoutConfigurationTest.java b/src/test/java/com/checkout/DefaultCheckoutConfigurationTest.java index e5385023..c0c0666a 100644 --- a/src/test/java/com/checkout/DefaultCheckoutConfigurationTest.java +++ b/src/test/java/com/checkout/DefaultCheckoutConfigurationTest.java @@ -47,7 +47,7 @@ void shouldCreateConfiguration() { } @ParameterizedTest - @ValueSource(strings = {"123dmain", "123domain", "1234domain", "12345domain"}) + @ValueSource(strings = {"a", "ab", "abc", "abc1", "12345domain"}) void shouldCreateConfigurationWithSubdomain(String subdomain) { final StaticKeysSdkCredentials credentials = Mockito.mock(StaticKeysSdkCredentials.class); @@ -58,7 +58,7 @@ void shouldCreateConfigurationWithSubdomain(String subdomain) { } @ParameterizedTest - @ValueSource(strings = {"", "123", "123bad", "12345domainBad"}) + @ValueSource(strings = {"", " ", " ", " - ", "a b", "ab c1"}) void shouldCreateConfigurationWithBadSubdomain(String subdomain) { final StaticKeysSdkCredentials credentials = Mockito.mock(StaticKeysSdkCredentials.class);