Skip to content

Commit

Permalink
Adds compiled submitted evidence endpoint. Update Hosted Payment Requ…
Browse files Browse the repository at this point in the history
…est (#396)

* Add disabled_payment_methods in HostedPaymentRequest.java

* Add compiled submitted evidence endpoint to disputes
  • Loading branch information
armando-rodriguez-cko authored Mar 22, 2024
1 parent dbed79a commit 1a422e5
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;

}
2 changes: 2 additions & 0 deletions src/main/java/com/checkout/disputes/DisputesClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public interface DisputesClient {

CompletableFuture<FileDetailsResponse> getFileDetails(String fileId);

CompletableFuture<DisputeCompiledSubmittedEvidenceResponse> getCompiledSubmittedEvidence(String disputeId);

CompletableFuture<SchemeFileResponse> getDisputeSchemeFiles(String disputeId);

}
11 changes: 11 additions & 0 deletions src/main/java/com/checkout/disputes/DisputesClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -104,6 +105,16 @@ public CompletableFuture<FileDetailsResponse> getFileDetails(final String fileId
FileDetailsResponse.class);
}

@Override
public CompletableFuture<DisputeCompiledSubmittedEvidenceResponse> getCompiledSubmittedEvidence(String disputeId) {
validateParams("disputeId", disputeId);
return apiClient.getAsync(
buildPath(DISPUTES_PATH, disputeId, EVIDENCE_PATH, SUBMITTED_PATH),
sdkAuthorization(),
DisputeCompiledSubmittedEvidenceResponse.class
);
}

@Override
public CompletableFuture<SchemeFileResponse> getDisputeSchemeFiles(final String disputeId) {
validateParams("disputeId", disputeId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public final class HostedPaymentRequest {
* Not available on Previous
*/

@SerializedName("disabled_payment_methods")
private List<PaymentSourceType> disabledPaymentMethods;

@SerializedName("processing_channel_id")
private String processingChannelId;

Expand Down
13 changes: 13 additions & 0 deletions src/test/java/com/checkout/disputes/DisputesClientImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<DisputeCompiledSubmittedEvidenceResponse> future = client.getCompiledSubmittedEvidence("dispute_id");

assertNotNull(future.get());
assertEquals(response, future.get());
}

@Test
void shouldSubmitDisputeEvidence() throws ExecutionException, InterruptedException {

Expand Down
6 changes: 6 additions & 0 deletions src/test/java/com/checkout/disputes/DisputesTestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());

}

}

0 comments on commit 1a422e5

Please sign in to comment.