Skip to content

Commit d628aff

Browse files
Release - 7.1.0 (#552)
This release introduces improved handling of request serialization and adds support for new identity-related API clients. The most significant update is the refactoring of the transport layer to support both JSON and form-encoded requests, making it more flexible for different content types. Additionally, several new clients for identity verification and screening have been integrated into the main API interface. ### Transport layer improvements * Refactored `ApacheHttpClientTransport` to accept an `Object` as the request payload, allowing both JSON and `UrlEncodedFormEntity` form-encoded requests. Added logic to serialize objects to JSON or pass form entities directly, and set the appropriate `Content-Type` header. (`src/main/java/com/checkout/ApacheHttpClientTransport.java`) [[1]](diffhunk://#diff-3b863271ae76c2c75fc4ab50e731525ce851c694ee144332dd038c68e2873e44R91-R102) [[2]](diffhunk://#diff-3b863271ae76c2c75fc4ab50e731525ce851c694ee144332dd038c68e2873e44R238-R260) [[3]](diffhunk://#diff-3b863271ae76c2c75fc4ab50e731525ce851c694ee144332dd038c68e2873e44L265-R303) * Updated `ApiClientImpl` methods to pass raw request objects to the transport layer instead of pre-serializing them, aligning with the new transport interface. (`src/main/java/com/checkout/ApiClientImpl.java`) [[1]](diffhunk://#diff-17788e6798031a3a75095fb61f03d1a3c404d2b6a6960c446262cfaae5d2688cL130-R130) [[2]](diffhunk://#diff-17788e6798031a3a75095fb61f03d1a3c404d2b6a6960c446262cfaae5d2688cL234-R234) [[3]](diffhunk://#diff-17788e6798031a3a75095fb61f03d1a3c404d2b6a6960c446262cfaae5d2688cL346-R346) [[4]](diffhunk://#diff-17788e6798031a3a75095fb61f03d1a3c404d2b6a6960c446262cfaae5d2688cL396-R396) ### Identity API client integration * Added new identity-related clients (`FaceAuthenticationClient`, `ApplicantClient`, `IdentityVerificationClient`, `IdDocumentVerificationClient`, `AmlScreeningClient`) to `CheckoutApi` and `CheckoutApiImpl`, including their instantiation and interface methods. (`src/main/java/com/checkout/CheckoutApi.java`, `src/main/java/com/checkout/CheckoutApiImpl.java`) [[1]](diffhunk://#diff-9241579b48dfbc8729f69d42cd3fc2532b3ce2868663f46a307fc3b73638ef57R12-R16) [[2]](diffhunk://#diff-9241579b48dfbc8729f69d42cd3fc2532b3ce2868663f46a307fc3b73638ef57R77-R86) [[3]](diffhunk://#diff-9e68f52b37d22f45b3135eb0837bed690d1e0be8740b6ced9b5a65c94dafd478R21-R30) [[4]](diffhunk://#diff-9e68f52b37d22f45b3135eb0837bed690d1e0be8740b6ced9b5a65c94dafd478R84-R88) [[5]](diffhunk://#diff-9e68f52b37d22f45b3135eb0837bed690d1e0be8740b6ced9b5a65c94dafd478R116-R120) [[6]](diffhunk://#diff-9e68f52b37d22f45b3135eb0837bed690d1e0be8740b6ced9b5a65c94dafd478R221-R235) ### Supporting changes * Updated imports in `GsonSerializer.java` to support form-encoded serialization, including `UrlEncodedFormEntity` and related classes. (`src/main/java/com/checkout/GsonSerializer.java`) [[1]](diffhunk://#diff-9b967a13c2a5016ea0995c3b77a5b750b221cf2d49970df6815d52970d5a73d8R46-R53) [[2]](diffhunk://#diff-9b967a13c2a5016ea0995c3b77a5b750b221cf2d49970df6815d52970d5a73d8L57) These changes enhance the SDK's flexibility for handling different request types and expand its functionality for identity verification workflows.
1 parent fa86d65 commit d628aff

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group=com.checkout
2-
version=7.0.2
2+
version=7.1.0
33

44
project_name=Checkout SDK Java
55
project_description=Checkout SDK for Java https://checkout.com

‎src/main/java/com/checkout/ApiClientImpl.java‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,20 @@ private <T extends HttpMetadata> CompletableFuture<T> sendRequestAsync(final Cli
238238

239239
private Response errorCheck(final Response response) {
240240
if (!CheckoutUtils.isSuccessHttpStatusCode(response.getStatusCode())) {
241-
final Map<String, Object> errorDetails = serializer.fromJson(response.getBody());
241+
Map<String, Object> errorDetails = null;
242+
try{
243+
errorDetails = serializer.fromJson(response.getBody());
244+
}
245+
catch (final Exception e) {
246+
// Ignore deserialization errors, errorDetails will be null or the response body if
247+
// existing and the exception will not be propagated as we want to throw a CheckoutApiException
248+
// with the raw response details
249+
if(response.getBody() != null) {
250+
errorDetails = new HashMap<>();
251+
errorDetails.put("Unknown Error", response.getBody());
252+
}
253+
}
254+
242255
throw new CheckoutApiException(response.getStatusCode(), response.getHeaders(), errorDetails);
243256
}
244257
return response;

‎src/test/java/com/checkout/accounts/AccountsTestIT.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import com.checkout.common.InstrumentType;
1515
import org.apache.commons.lang3.RandomStringUtils;
1616
import org.apache.http.entity.ContentType;
17+
import org.junit.jupiter.api.Disabled;
1718
import org.junit.jupiter.api.Test;
1819

1920
import java.io.File;
@@ -32,6 +33,7 @@ class AccountsTestIT extends SandboxTestFixture {
3233
super(PlatformType.DEFAULT_OAUTH);
3334
}
3435

36+
@Disabled("Recently giving a 503 with 'no healthy upstream' description from the API, disabled")
3537
@Test
3638
void shouldCreateGetAndUpdateOnboardIndividualEntity() {
3739
final String randomReference = RandomStringUtils.random(15, true, true);
@@ -51,6 +53,7 @@ void shouldCreateGetAndUpdateOnboardIndividualEntity() {
5153
assertEquals(onboardEntityRequest.getIndividual().getFirstName(), verifyUpdated.getIndividual().getFirstName());
5254
}
5355

56+
@Disabled("Recently giving a 503 with 'no healthy upstream' description from the API, disabled")
5457
@Test
5558
void shouldCreateGetAndUpdateOnboardCompanyEntity() {
5659
final String randomReference = RandomStringUtils.random(15, true, true);
@@ -69,6 +72,7 @@ void shouldUploadAccountsFile() throws URISyntaxException {
6972
validateFileUploadResponse(fileResponse);
7073
}
7174

75+
@Disabled("Recently giving a 503 with 'no healthy upstream' description from the API, disabled")
7276
@Test
7377
void shouldCreateAndRetrievePaymentInstrument() throws URISyntaxException {
7478
final CheckoutApi checkoutApi = getAccountsCheckoutApi();
@@ -90,6 +94,7 @@ void shouldCreateAndRetrievePaymentInstrument() throws URISyntaxException {
9094
}
9195

9296
// Synchronous methods
97+
@Disabled("Recently giving a 503 with 'no healthy upstream' description from the API, disabled")
9398
@Test
9499
void shouldCreateGetAndUpdateOnboardIndividualEntitySync() {
95100
final String randomReference = RandomStringUtils.random(15, true, true);
@@ -110,6 +115,7 @@ void shouldCreateGetAndUpdateOnboardIndividualEntitySync() {
110115
}
111116

112117
@Test
118+
@Disabled("Recently giving a 503 with 'no healthy upstream' description from the API, disabled")
113119
void shouldCreateGetAndUpdateOnboardCompanyEntitySync() {
114120
final String randomReference = RandomStringUtils.random(15, true, true);
115121
final OnboardEntityRequest onboardEntityRequest = buildCompanyEntity(randomReference);
@@ -127,6 +133,7 @@ void shouldUploadAccountsFileSync() throws URISyntaxException {
127133
validateFileUploadResponse(fileResponse);
128134
}
129135

136+
@Disabled("Recently giving a 503 with 'no healthy upstream' description from the API, disabled")
130137
@Test
131138
void shouldCreateAndRetrievePaymentInstrumentSync() throws URISyntaxException {
132139
final CheckoutApi checkoutApi = getAccountsCheckoutApi();

0 commit comments

Comments
 (0)