Skip to content

Conversation

@armando-rodriguez-cko
Copy link
Contributor

@armando-rodriguez-cko armando-rodriguez-cko commented Dec 10, 2025

This pull request introduces significant enhancements to the SDK's configuration and transport layers, adding support for synchronous API calls and integrating Resilience4j for resilience features like circuit breaking, rate limiting, and retries. It also updates constructors and interfaces to support these new capabilities while maintaining backward compatibility.

Synchronous API support and configuration enhancements

  • Added a synchronous flag and a Resilience4jConfiguration property to AbstractCheckoutSdkBuilder, allowing users to configure synchronous behavior and resilience features when building the SDK client. [1] [2]
  • Updated DefaultCheckoutConfiguration and CheckoutConfiguration to support new synchronous and Resilience4jConfiguration options, including multiple overloaded constructors for backward compatibility. [1] [2] [3] [4] [5]

Synchronous transport and API methods

  • Implemented synchronous transport methods (invokeSync, submitFileSync) in ApacheHttpClientTransport, and added logic to wrap calls with Resilience4j decorators if configured.
  • Extended the ApiClient and ApiClientImpl interfaces/classes with a full set of synchronous HTTP methods (get, post, put, patch, delete, query, etc.), mirroring the existing async API. [1] [2]

Resilience4j integration

  • Integrated Resilience4j components (CircuitBreaker, RateLimiter, Retry) into synchronous transport calls, allowing SDK users to opt-in to advanced resilience features via configuration. [1] [2]

Build tool update

  • Upgraded the Gradle Develocity plugin version from 3.19.2 to 4.2.2 in settings.gradle.

@armando-rodriguez-cko armando-rodriguez-cko marked this pull request as ready for review December 10, 2025 22:09
david-ruiz-cko
david-ruiz-cko previously approved these changes Dec 11, 2025
System.out.println("Asynchronous call time: " + TimeUnit.NANOSECONDS.toMicros(asyncTime) + " microseconds");

// Same return type!
assertTrue(syncResult instanceof CompletableFuture);

Check warning

Code scanning / CodeQL

Useless type test Warning test

There is no need to test whether an instance of
CompletableFuture
is also an instance of
CompletableFuture<>
- it always is.

Copilot Autofix

AI 17 days ago

To fix the problem, simply remove the unnecessary instanceof checks that test if an object is an instance of its declared type. In this specific case, remove the assertions on lines 175 and 176:

assertTrue(syncResult instanceof CompletableFuture);
assertTrue(asyncResult instanceof CompletableFuture);

No replacement is necessary, as both variables are already declared as CompletableFuture<PaymentResponse>, and the remaining comments and outputs explain the differences. Only remove these two lines; do not replace them with other tests, as the type guarantee is enforced by the compiler.


Suggested changeset 1
src/test/java/com/checkout/SynchronousAsyncClientComparisonTest.java

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/test/java/com/checkout/SynchronousAsyncClientComparisonTest.java b/src/test/java/com/checkout/SynchronousAsyncClientComparisonTest.java
--- a/src/test/java/com/checkout/SynchronousAsyncClientComparisonTest.java
+++ b/src/test/java/com/checkout/SynchronousAsyncClientComparisonTest.java
@@ -172,8 +172,6 @@
         System.out.println("Asynchronous call time: " + TimeUnit.NANOSECONDS.toMicros(asyncTime) + " microseconds");
 
         // Same return type!
-        assertTrue(syncResult instanceof CompletableFuture);
-        assertTrue(asyncResult instanceof CompletableFuture);
 
         System.out.println("\nBoth return CompletableFuture<PaymentResponse>");
         System.out.println("Difference: Synchronous executes HTTP call before returning CompletableFuture");
EOF
@@ -172,8 +172,6 @@
System.out.println("Asynchronous call time: " + TimeUnit.NANOSECONDS.toMicros(asyncTime) + " microseconds");

// Same return type!
assertTrue(syncResult instanceof CompletableFuture);
assertTrue(asyncResult instanceof CompletableFuture);

System.out.println("\nBoth return CompletableFuture<PaymentResponse>");
System.out.println("Difference: Synchronous executes HTTP call before returning CompletableFuture");
Copilot is powered by AI and may make mistakes. Always verify output.

// Same return type!
assertTrue(syncResult instanceof CompletableFuture);
assertTrue(asyncResult instanceof CompletableFuture);

Check warning

Code scanning / CodeQL

Useless type test Warning test

There is no need to test whether an instance of
CompletableFuture
is also an instance of
CompletableFuture<>
- it always is.

Copilot Autofix

AI 17 days ago

The best way to fix this problem is to remove the instanceof checks entirely. Specifically, the following lines should be deleted:

175:         assertTrue(syncResult instanceof CompletableFuture);
176:         assertTrue(asyncResult instanceof CompletableFuture);

No replacement is needed, nor is any other kind of assertion or code necessary, because the declared types make the implication explicit. This change should only involve file src/test/java/com/checkout/SynchronousAsyncClientComparisonTest.java, affecting lines 175–176. No other code or imports need to be changed or added.

Suggested changeset 1
src/test/java/com/checkout/SynchronousAsyncClientComparisonTest.java

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/test/java/com/checkout/SynchronousAsyncClientComparisonTest.java b/src/test/java/com/checkout/SynchronousAsyncClientComparisonTest.java
--- a/src/test/java/com/checkout/SynchronousAsyncClientComparisonTest.java
+++ b/src/test/java/com/checkout/SynchronousAsyncClientComparisonTest.java
@@ -172,8 +172,6 @@
         System.out.println("Asynchronous call time: " + TimeUnit.NANOSECONDS.toMicros(asyncTime) + " microseconds");
 
         // Same return type!
-        assertTrue(syncResult instanceof CompletableFuture);
-        assertTrue(asyncResult instanceof CompletableFuture);
 
         System.out.println("\nBoth return CompletableFuture<PaymentResponse>");
         System.out.println("Difference: Synchronous executes HTTP call before returning CompletableFuture");
EOF
@@ -172,8 +172,6 @@
System.out.println("Asynchronous call time: " + TimeUnit.NANOSECONDS.toMicros(asyncTime) + " microseconds");

// Same return type!
assertTrue(syncResult instanceof CompletableFuture);
assertTrue(asyncResult instanceof CompletableFuture);

System.out.println("\nBoth return CompletableFuture<PaymentResponse>");
System.out.println("Difference: Synchronous executes HTTP call before returning CompletableFuture");
Copilot is powered by AI and may make mistakes. Always verify output.
}

@Test
void shouldUpdateCardInstrument() {

Check notice

Code scanning / CodeQL

Missing Override annotation Note test

This method overrides
CardTokenInstrumentsTestIT.shouldUpdateCardInstrument
; it is advisable to add an Override annotation.
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants