Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds compiled submitted evidence endpoint. Update Hosted Payment Request #396

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
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)
Dismissed Show dismissed Hide dismissed
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());

}

}
Loading