From 1a422e50eae18726bedff078e2f12912b5be6795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armando=20Rodr=C3=ADguez?= <127134616+armando-rodriguez-cko@users.noreply.github.com> Date: Fri, 22 Mar 2024 13:44:48 +0100 Subject: [PATCH] Adds compiled submitted evidence endpoint. Update Hosted Payment Request (#396) * Add disabled_payment_methods in HostedPaymentRequest.java * Add compiled submitted evidence endpoint to disputes --- ...puteCompiledSubmittedEvidenceResponse.java | 19 +++++++++++++++++++ .../com/checkout/disputes/DisputesClient.java | 2 ++ .../checkout/disputes/DisputesClientImpl.java | 11 +++++++++++ .../payments/hosted/HostedPaymentRequest.java | 3 +++ .../disputes/DisputesClientImplTest.java | 13 +++++++++++++ .../com/checkout/disputes/DisputesTestIT.java | 6 ++++++ 6 files changed, 54 insertions(+) create mode 100644 src/main/java/com/checkout/disputes/DisputeCompiledSubmittedEvidenceResponse.java diff --git a/src/main/java/com/checkout/disputes/DisputeCompiledSubmittedEvidenceResponse.java b/src/main/java/com/checkout/disputes/DisputeCompiledSubmittedEvidenceResponse.java new file mode 100644 index 00000000..dd5d0307 --- /dev/null +++ b/src/main/java/com/checkout/disputes/DisputeCompiledSubmittedEvidenceResponse.java @@ -0,0 +1,19 @@ +package com.checkout.disputes; + +import com.checkout.common.Resource; +import com.google.gson.annotations.SerializedName; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Data +@Builder +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +public final class DisputeCompiledSubmittedEvidenceResponse extends Resource { + + @SerializedName("file_id") + private String fileId; + +} diff --git a/src/main/java/com/checkout/disputes/DisputesClient.java b/src/main/java/com/checkout/disputes/DisputesClient.java index e346fac1..731a7087 100644 --- a/src/main/java/com/checkout/disputes/DisputesClient.java +++ b/src/main/java/com/checkout/disputes/DisputesClient.java @@ -25,6 +25,8 @@ public interface DisputesClient { CompletableFuture getFileDetails(String fileId); + CompletableFuture getCompiledSubmittedEvidence(String disputeId); + CompletableFuture getDisputeSchemeFiles(String disputeId); } diff --git a/src/main/java/com/checkout/disputes/DisputesClientImpl.java b/src/main/java/com/checkout/disputes/DisputesClientImpl.java index 6b9b297b..1539875e 100644 --- a/src/main/java/com/checkout/disputes/DisputesClientImpl.java +++ b/src/main/java/com/checkout/disputes/DisputesClientImpl.java @@ -19,6 +19,7 @@ public class DisputesClientImpl extends AbstractClient implements DisputesClient private static final String FILES_PATH = "files"; private static final String ACCEPT_PATH = "accept"; private static final String EVIDENCE_PATH = "evidence"; + private static final String SUBMITTED_PATH = "submitted"; private static final String SCHEME_FILES_PATH = "schemefiles"; public DisputesClientImpl(final ApiClient apiClient, final CheckoutConfiguration configuration, final SdkAuthorizationType sdkAuthorizationType) { @@ -104,6 +105,16 @@ public CompletableFuture getFileDetails(final String fileId FileDetailsResponse.class); } + @Override + public CompletableFuture getCompiledSubmittedEvidence(String disputeId) { + validateParams("disputeId", disputeId); + return apiClient.getAsync( + buildPath(DISPUTES_PATH, disputeId, EVIDENCE_PATH, SUBMITTED_PATH), + sdkAuthorization(), + DisputeCompiledSubmittedEvidenceResponse.class + ); + } + @Override public CompletableFuture getDisputeSchemeFiles(final String disputeId) { validateParams("disputeId", disputeId); diff --git a/src/main/java/com/checkout/payments/hosted/HostedPaymentRequest.java b/src/main/java/com/checkout/payments/hosted/HostedPaymentRequest.java index 61f19f38..7174cee5 100644 --- a/src/main/java/com/checkout/payments/hosted/HostedPaymentRequest.java +++ b/src/main/java/com/checkout/payments/hosted/HostedPaymentRequest.java @@ -84,6 +84,9 @@ public final class HostedPaymentRequest { * Not available on Previous */ + @SerializedName("disabled_payment_methods") + private List disabledPaymentMethods; + @SerializedName("processing_channel_id") private String processingChannelId; diff --git a/src/test/java/com/checkout/disputes/DisputesClientImplTest.java b/src/test/java/com/checkout/disputes/DisputesClientImplTest.java index fc0cc219..5849a59b 100644 --- a/src/test/java/com/checkout/disputes/DisputesClientImplTest.java +++ b/src/test/java/com/checkout/disputes/DisputesClientImplTest.java @@ -123,6 +123,19 @@ void shouldGetDisputeEvidence() throws ExecutionException, InterruptedException assertEquals(response, future.get()); } + @Test + void shouldGetCompiledSubmittedEvidence() throws ExecutionException, InterruptedException { + final DisputeCompiledSubmittedEvidenceResponse response = mock(DisputeCompiledSubmittedEvidenceResponse.class); + + when(apiClient.getAsync("disputes/dispute_id/evidence/submitted", authorization, DisputeCompiledSubmittedEvidenceResponse.class)) + .thenReturn(CompletableFuture.completedFuture(response)); + + final CompletableFuture future = client.getCompiledSubmittedEvidence("dispute_id"); + + assertNotNull(future.get()); + assertEquals(response, future.get()); + } + @Test void shouldSubmitDisputeEvidence() throws ExecutionException, InterruptedException { diff --git a/src/test/java/com/checkout/disputes/DisputesTestIT.java b/src/test/java/com/checkout/disputes/DisputesTestIT.java index 2e2795d5..c34373ba 100644 --- a/src/test/java/com/checkout/disputes/DisputesTestIT.java +++ b/src/test/java/com/checkout/disputes/DisputesTestIT.java @@ -199,6 +199,12 @@ void shouldTestFullDisputesWorkFlow() throws Exception { //Submit your dispute evidence blocking(() -> checkoutApi.disputesClient().submitEvidence(disputeDetails.getId())); + + //Get compiled submitted evidence + final DisputeCompiledSubmittedEvidenceResponse compiledSubmittedEvidenceResponse = blocking(() -> checkoutApi.disputesClient().getCompiledSubmittedEvidence(disputeDetails.getId())); + assertNotNull(compiledSubmittedEvidenceResponse); + assertNotNull(compiledSubmittedEvidenceResponse.getFileId()); + } }