Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/test/java/com/adyen/BalanceControlTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ public void baseUrlOnTest() throws NoSuchFieldException, IllegalAccessException
Field baseURLField = BalanceControlApi.class.getDeclaredField("baseURL");
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(balanceControlApi);
assertEquals("https://pal-test.adyen.com/pal/servlet/BalanceControl/v1", baseURL);
assertEquals(
String.format(
"https://pal-test.adyen.com/pal/servlet/BalanceControl/v%s",
BalanceControlApi.API_VERSION),
baseURL);
}

@Test
Expand All @@ -49,7 +53,10 @@ public void baseUrlOnLive() throws NoSuchFieldException, IllegalAccessException
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(balanceControlApi);
assertEquals(
"https://myCompany-pal-live.adyenpayments.com/pal/servlet/BalanceControl/v1", baseURL);
String.format(
"https://myCompany-pal-live.adyenpayments.com/pal/servlet/BalanceControl/v%s",
BalanceControlApi.API_VERSION),
baseURL);
}

@Test
Expand All @@ -60,7 +67,9 @@ public void TestBalanceControlApi() throws IOException, ApiException, HTTPClient

verify(client.getHttpClient())
.request(
"https://pal-test.adyen.com/pal/servlet/BalanceControl/v1/balanceTransfer",
String.format(
"https://pal-test.adyen.com/pal/servlet/BalanceControl/v%s/balanceTransfer",
BalanceControlApi.API_VERSION),
"{}",
client.getConfig(),
false,
Expand Down
10 changes: 8 additions & 2 deletions src/test/java/com/adyen/BalancePlatformTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public void baseUrlOnTest() throws NoSuchFieldException, IllegalAccessException
Field baseURLField = PlatformApi.class.getDeclaredField("baseURL");
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(platformApi);
assertEquals("https://balanceplatform-api-test.adyen.com/bcl/v2", baseURL);
assertEquals(
String.format(
"https://balanceplatform-api-test.adyen.com/bcl/v%s", PlatformApi.API_VERSION),
baseURL);
}

@Test
Expand All @@ -43,7 +46,10 @@ public void baseUrlOnLive() throws NoSuchFieldException, IllegalAccessException
Field baseURLField = PlatformApi.class.getDeclaredField("baseURL");
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(platformApi);
assertEquals("https://balanceplatform-api-live.adyen.com/bcl/v2", baseURL);
assertEquals(
String.format(
"https://balanceplatform-api-live.adyen.com/bcl/v%s", PlatformApi.API_VERSION),
baseURL);
}

@Test
Expand Down
11 changes: 9 additions & 2 deletions src/test/java/com/adyen/BinLookupTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public void baseUrlOnTest() throws NoSuchFieldException, IllegalAccessException
Field baseURLField = BinLookupApi.class.getDeclaredField("baseURL");
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(binLookupApi);
assertEquals("https://pal-test.adyen.com/pal/servlet/BinLookup/v54", baseURL);
assertEquals(
String.format(
"https://pal-test.adyen.com/pal/servlet/BinLookup/v%s", BinLookupApi.API_VERSION),
baseURL);
}

@Test
Expand All @@ -66,7 +69,11 @@ public void baseUrlOnLive() throws NoSuchFieldException, IllegalAccessException
Field baseURLField = BinLookupApi.class.getDeclaredField("baseURL");
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(binLookupApi);
assertEquals("https://myCompany-pal-live.adyenpayments.com/pal/servlet/BinLookup/v54", baseURL);
assertEquals(
String.format(
"https://myCompany-pal-live.adyenpayments.com/pal/servlet/BinLookup/v%s",
BinLookupApi.API_VERSION),
baseURL);
}

@Test
Expand Down
29 changes: 21 additions & 8 deletions src/test/java/com/adyen/CheckoutTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public void baseUrlOnTest() throws NoSuchFieldException, IllegalAccessException
Field baseURLField = PaymentsApi.class.getDeclaredField("baseURL");
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(paymentsApi);
assertEquals("https://checkout-test.adyen.com/v71", baseURL);
assertEquals(
String.format("https://checkout-test.adyen.com/v%s", PaymentsApi.API_VERSION), baseURL);
}

@Test
Expand All @@ -70,7 +71,11 @@ public void baseUrlOnLive() throws NoSuchFieldException, IllegalAccessException
Field baseURLField = PaymentsApi.class.getDeclaredField("baseURL");
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(paymentsApi);
assertEquals("https://myCompany-checkout-live.adyenpayments.com/checkout/v71", baseURL);
assertEquals(
String.format(
"https://myCompany-checkout-live.adyenpayments.com/checkout/v%s",
PaymentsApi.API_VERSION),
baseURL);
}

/** Should make a payment */
Expand Down Expand Up @@ -450,7 +455,9 @@ public void testLiveURLCheckout() throws Exception {

verify(client.getHttpClient())
.request(
"https://prefix-checkout-live.adyenpayments.com/checkout/v71/storedPaymentMethods/recurringId",
String.format(
"https://prefix-checkout-live.adyenpayments.com/checkout/v%s/storedPaymentMethods/recurringId",
RecurringApi.API_VERSION),
null,
client.getConfig(),
false,
Expand All @@ -472,7 +479,9 @@ public void testLiveURLCheckoutWithSetEnviroment() throws Exception {

verify(client.getHttpClient())
.request(
"https://prefix-checkout-live.adyenpayments.com/checkout/v71/storedPaymentMethods/recurringId",
String.format(
"https://prefix-checkout-live.adyenpayments.com/checkout/v%s/storedPaymentMethods/recurringId",
RecurringApi.API_VERSION),
null,
client.getConfig(),
false,
Expand Down Expand Up @@ -575,7 +584,7 @@ public void testPaymentWithRatepay() throws Exception {

verify(client.getHttpClient())
.request(
"https://checkout-test.adyen.com/v71/payments",
String.format("https://checkout-test.adyen.com/v%s/payments", PaymentsApi.API_VERSION),
paymentRequest.toJson(),
client.getConfig(),
false,
Expand Down Expand Up @@ -648,7 +657,7 @@ public void testPaymentWithRiverty() throws Exception {

verify(client.getHttpClient())
.request(
"https://checkout-test.adyen.com/v71/payments",
String.format("https://checkout-test.adyen.com/v%s/payments", PaymentsApi.API_VERSION),
paymentRequest.toJson(),
client.getConfig(),
false,
Expand Down Expand Up @@ -694,7 +703,9 @@ public void testSessionsCheckDefaultValues() throws Exception {
final ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
verify(client.getHttpClient())
.request(
eq("https://checkout-test.adyen.com/v71/sessions"),
eq(
String.format(
"https://checkout-test.adyen.com/v%s/sessions", PaymentsApi.API_VERSION)),
captor.capture(),
any(com.adyen.Config.class),
eq(false),
Expand Down Expand Up @@ -808,7 +819,9 @@ public void testPaymentWithIdempotencyKey() throws Exception {
ArgumentCaptor<RequestOptions> optionsCaptor = ArgumentCaptor.forClass(RequestOptions.class);
verify(client.getHttpClient())
.request(
eq("https://checkout-test.adyen.com/v71/payments"),
eq(
String.format(
"https://checkout-test.adyen.com/v%s/payments", PaymentsApi.API_VERSION)),
isNotNull(),
eq(client.getConfig()),
eq(false),
Expand Down
16 changes: 13 additions & 3 deletions src/test/java/com/adyen/DataProtectionServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ public void baseUrlOnTest() throws NoSuchFieldException, IllegalAccessException
Field baseURLField = DataProtectionApi.class.getDeclaredField("baseURL");
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(dataProtectionApi);
assertEquals("https://ca-test.adyen.com/ca/services/DataProtectionService/v1", baseURL);
assertEquals(
String.format(
"https://ca-test.adyen.com/ca/services/DataProtectionService/v%s",
DataProtectionApi.API_VERSION),
baseURL);
}

@Test
Expand All @@ -56,7 +60,11 @@ public void baseUrlOnLive() throws NoSuchFieldException, IllegalAccessException
Field baseURLField = DataProtectionApi.class.getDeclaredField("baseURL");
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(dataProtectionApi);
assertEquals("https://ca-live.adyen.com/ca/services/DataProtectionService/v1", baseURL);
assertEquals(
String.format(
"https://ca-live.adyen.com/ca/services/DataProtectionService/v%s",
DataProtectionApi.API_VERSION),
baseURL);
}

/** Test success flow for POST /requestSubjectErasure */
Expand All @@ -72,7 +80,9 @@ public void TestRequestSubjectErasureSuccessMocked() throws Exception {

verify(client.getHttpClient())
.request(
"https://ca-test.adyen.com/ca/services/DataProtectionService/v1/requestSubjectErasure",
String.format(
"https://ca-test.adyen.com/ca/services/DataProtectionService/v%s/requestSubjectErasure",
DataProtectionApi.API_VERSION),
"{}",
client.getConfig(),
false,
Expand Down
40 changes: 23 additions & 17 deletions src/test/java/com/adyen/DisputesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ public void baseUrlOnTest() throws NoSuchFieldException, IllegalAccessException
Field baseURLField = DisputesApi.class.getDeclaredField("baseURL");
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(disputesApi);
assertEquals("https://ca-test.adyen.com/ca/services/DisputeService/v30", baseURL);
assertEquals(
String.format(
"https://ca-test.adyen.com/ca/services/DisputeService/v%s", DisputesApi.API_VERSION),
baseURL);
}

@Test
Expand All @@ -37,7 +40,10 @@ public void baseUrlOnLive() throws NoSuchFieldException, IllegalAccessException
Field baseURLField = DisputesApi.class.getDeclaredField("baseURL");
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(disputesApi);
assertEquals("https://ca-live.adyen.com/ca/services/DisputeService/v30", baseURL);
assertEquals(
String.format(
"https://ca-live.adyen.com/ca/services/DisputeService/v%s", DisputesApi.API_VERSION),
baseURL);
}

@Test
Expand All @@ -54,9 +60,9 @@ public void acceptDispute() throws IOException, ApiException, HTTPClientExceptio

verify(client.getHttpClient())
.request(
"https://ca-test.adyen.com/ca/services/DisputeService/v"
+ DisputesApi.API_VERSION
+ "/acceptDispute",
String.format(
"https://ca-test.adyen.com/ca/services/DisputeService/v%s/acceptDispute",
DisputesApi.API_VERSION),
request.toJson(),
client.getConfig(),
false,
Expand All @@ -82,9 +88,9 @@ public void defendDispute() throws IOException, ApiException, HTTPClientExceptio

verify(client.getHttpClient())
.request(
"https://ca-test.adyen.com/ca/services/DisputeService/v"
+ DisputesApi.API_VERSION
+ "/defendDispute",
String.format(
"https://ca-test.adyen.com/ca/services/DisputeService/v%s/defendDispute",
DisputesApi.API_VERSION),
request.toJson(),
client.getConfig(),
false,
Expand Down Expand Up @@ -112,9 +118,9 @@ public void deleteDisputeDefenseDocument() throws IOException, ApiException, HTT

verify(client.getHttpClient())
.request(
"https://ca-test.adyen.com/ca/services/DisputeService/v"
+ DisputesApi.API_VERSION
+ "/deleteDisputeDefenseDocument",
String.format(
"https://ca-test.adyen.com/ca/services/DisputeService/v%s/deleteDisputeDefenseDocument",
DisputesApi.API_VERSION),
request.toJson(),
client.getConfig(),
false,
Expand All @@ -141,9 +147,9 @@ public void retrieveApplicableDefenseReasons()

verify(client.getHttpClient())
.request(
"https://ca-test.adyen.com/ca/services/DisputeService/v"
+ DisputesApi.API_VERSION
+ "/retrieveApplicableDefenseReasons",
String.format(
"https://ca-test.adyen.com/ca/services/DisputeService/v%s/retrieveApplicableDefenseReasons",
DisputesApi.API_VERSION),
request.toJson(),
client.getConfig(),
false,
Expand Down Expand Up @@ -211,9 +217,9 @@ public void supplyDefenseDocument() throws IOException, ApiException, HTTPClient

verify(client.getHttpClient())
.request(
"https://ca-test.adyen.com/ca/services/DisputeService/v"
+ DisputesApi.API_VERSION
+ "/supplyDefenseDocument",
String.format(
"https://ca-test.adyen.com/ca/services/DisputeService/v%s/supplyDefenseDocument",
DisputesApi.API_VERSION),
request.toJson(),
client.getConfig(),
false,
Expand Down
18 changes: 13 additions & 5 deletions src/test/java/com/adyen/LegalEntityManagementTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public void baseUrlOnTest() throws NoSuchFieldException, IllegalAccessException
Field baseURLField = LegalEntitiesApi.class.getDeclaredField("baseURL");
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(legalEntitiesApi);
assertEquals("https://kyc-test.adyen.com/lem/v4", baseURL);
assertEquals(
String.format("https://kyc-test.adyen.com/lem/v%s", LegalEntitiesApi.API_VERSION), baseURL);
}

@Test
Expand All @@ -40,7 +41,8 @@ public void baseUrlOnLive() throws NoSuchFieldException, IllegalAccessException
Field baseURLField = LegalEntitiesApi.class.getDeclaredField("baseURL");
baseURLField.setAccessible(true);
String baseURL = (String) baseURLField.get(legalEntitiesApi);
assertEquals("https://kyc-live.adyen.com/lem/v4", baseURL);
assertEquals(
String.format("https://kyc-live.adyen.com/lem/v%s", LegalEntitiesApi.API_VERSION), baseURL);
}

@Test
Expand Down Expand Up @@ -277,7 +279,9 @@ public void BusinessLinesUpdateTest() throws Exception {
assertEquals("string", response.getId());
verify(client.getHttpClient())
.request(
"https://kyc-test.adyen.com/lem/v4/businessLines/SE322KT223222D5FJ7TJN2986",
String.format(
"https://kyc-test.adyen.com/lem/v%s/businessLines/SE322KT223222D5FJ7TJN2986",
BusinessLinesApi.API_VERSION),
request.toJson(),
client.getConfig(),
false,
Expand Down Expand Up @@ -388,7 +392,9 @@ public void DocumentsDeleteTest() throws Exception {
service.deleteDocument("SE322KT223222D5FJ7TJN2986");
verify(client.getHttpClient())
.request(
"https://kyc-test.adyen.com/lem/v4/documents/SE322KT223222D5FJ7TJN2986",
String.format(
"https://kyc-test.adyen.com/lem/v%s/documents/SE322KT223222D5FJ7TJN2986",
DocumentsApi.API_VERSION),
null,
client.getConfig(),
false,
Expand Down Expand Up @@ -428,7 +434,9 @@ public void HostedOnboardingPageRetrieveThemesTest() throws Exception {
assertEquals("SE322KT223222D5FJ7TJN2986", response.getId());
verify(client.getHttpClient())
.request(
"https://kyc-test.adyen.com/lem/v4/themes/SE322KT223222D5FJ7TJN2986",
String.format(
"https://kyc-test.adyen.com/lem/v%s/themes/SE322KT223222D5FJ7TJN2986",
HostedOnboardingApi.API_VERSION),
null,
client.getConfig(),
false,
Expand Down
Loading
Loading