diff --git a/src/main/java/com/checkout/reconciliation/previous/ReconciliationClient.java b/src/main/java/com/checkout/reconciliation/previous/ReconciliationClient.java index 33559a5a..4dd6853a 100644 --- a/src/main/java/com/checkout/reconciliation/previous/ReconciliationClient.java +++ b/src/main/java/com/checkout/reconciliation/previous/ReconciliationClient.java @@ -19,7 +19,7 @@ public interface ReconciliationClient { * Statements endpoint * * */ - CompletableFuture getStatementsReportById(String statementId); + CompletableFuture getStatementsReportById(String statementId); /** * More information in: @@ -27,7 +27,7 @@ public interface ReconciliationClient { * Statements endpoint * * */ - CompletableFuture getStatementsReportByIdQuery(String statementId, StatementsQueryFilter filter); + CompletableFuture getStatementsReportByIdQuery(String statementId, StatementsQueryFilter filter); /** * @param targetFile Optional parameter that specifies the path where a file with the content returned is saved. If diff --git a/src/main/java/com/checkout/reconciliation/previous/ReconciliationClientImpl.java b/src/main/java/com/checkout/reconciliation/previous/ReconciliationClientImpl.java index 2aa51a09..ee9fe99d 100644 --- a/src/main/java/com/checkout/reconciliation/previous/ReconciliationClientImpl.java +++ b/src/main/java/com/checkout/reconciliation/previous/ReconciliationClientImpl.java @@ -55,23 +55,23 @@ public CompletableFuture queryStatementsReport(final St } @Override - public CompletableFuture getStatementsReportById(final String statementId) { + public CompletableFuture getStatementsReportById(final String statementId) { validateParams("statementId", statementId); return apiClient.getAsync( buildPath(REPORTING_PATH, STATEMENTS_PATH, statementId, PAYMENTS_PATH), sdkAuthorization(), - StatementReportResponse.class + ReconciliationPaymentReportResponse.class ); } @Override - public CompletableFuture getStatementsReportByIdQuery(final String statementId, final StatementsQueryFilter filter) { + public CompletableFuture getStatementsReportByIdQuery(final String statementId, final StatementsQueryFilter filter) { validateParams("statementId", statementId, "filter", filter); return apiClient.queryAsync( buildPath(REPORTING_PATH, STATEMENTS_PATH, statementId, PAYMENTS_PATH), sdkAuthorization(), filter, - StatementReportResponse.class + ReconciliationPaymentReportResponse.class ); } diff --git a/src/test/java/com/checkout/reconciliation/previous/ReconciliationClientImplTest.java b/src/test/java/com/checkout/reconciliation/previous/ReconciliationClientImplTest.java index e7670f35..acf750ce 100644 --- a/src/test/java/com/checkout/reconciliation/previous/ReconciliationClientImplTest.java +++ b/src/test/java/com/checkout/reconciliation/previous/ReconciliationClientImplTest.java @@ -93,13 +93,13 @@ void shouldQueryStatementsReport() throws ExecutionException, InterruptedExcepti @Test void shouldGetStatementsReportById() throws ExecutionException, InterruptedException { - final StatementReportResponse response = mock(StatementReportResponse.class); + final ReconciliationPaymentReportResponse response = mock(ReconciliationPaymentReportResponse.class); when(apiClient.getAsync(eq("reporting/statements/statement_id/payments"), any(SdkAuthorization.class), - eq(StatementReportResponse.class))) + eq(ReconciliationPaymentReportResponse.class))) .thenReturn(CompletableFuture.completedFuture(response)); - final CompletableFuture future = client.getStatementsReportById("statement_id"); + final CompletableFuture future = client.getStatementsReportById("statement_id"); assertNotNull(future.get()); assertEquals(response, future.get()); @@ -108,13 +108,13 @@ void shouldGetStatementsReportById() throws ExecutionException, InterruptedExcep @Test void shouldGetStatementsReportByIdWithQuery() throws ExecutionException, InterruptedException { final StatementsQueryFilter filter = mock(StatementsQueryFilter.class); - final StatementReportResponse response = mock(StatementReportResponse.class); + final ReconciliationPaymentReportResponse response = mock(ReconciliationPaymentReportResponse.class); when(apiClient.queryAsync(eq("reporting/statements/statement_id/payments"), any(SdkAuthorization.class), eq(filter), - eq(StatementReportResponse.class))) + eq(ReconciliationPaymentReportResponse.class))) .thenReturn(CompletableFuture.completedFuture(response)); - final CompletableFuture future = client.getStatementsReportByIdQuery("statement_id", filter); + final CompletableFuture future = client.getStatementsReportByIdQuery("statement_id", filter); assertNotNull(future.get()); assertEquals(response, future.get()); diff --git a/src/test/java/com/checkout/reconciliation/previous/ReconciliationTestIT.java b/src/test/java/com/checkout/reconciliation/previous/ReconciliationTestIT.java index f7a1b476..23eefd1b 100644 --- a/src/test/java/com/checkout/reconciliation/previous/ReconciliationTestIT.java +++ b/src/test/java/com/checkout/reconciliation/previous/ReconciliationTestIT.java @@ -142,29 +142,18 @@ void shouldQueryStatementsReport() throws ExecutionException, InterruptedExcepti @Disabled("Only works in production") void shouldGetStatementsReportById() throws ExecutionException, InterruptedException { - final StatementReportResponse response = getProductionCheckoutApi().reconciliationClient().getStatementsReportById("statement_id").get(); + final ReconciliationPaymentReportResponse response = getProductionCheckoutApi().reconciliationClient().getStatementsReportById("statement_id").get(); assertNotNull(response); assertNotNull(response.getLinks()); assertTrue(response.getCount() >= 1); - response.getData().forEach(statementData -> { - assertNotNull(statementData.getId()); - assertNotNull(statementData.getPeriodStart()); - assertNotNull(statementData.getPeriodEnd()); - assertNotNull(statementData.getDate()); - assertNotNull(statementData.getPayouts()); - assertNotNull(statementData.getLinks()); - statementData.getPayouts().forEach(payoutStatement -> { - assertNotNull(payoutStatement.getCurrency()); - assertNotNull(payoutStatement.getCarriedForwardAmount()); - assertNotNull(payoutStatement.getCurrentPeriodAmount()); - assertNotNull(payoutStatement.getNetAmount()); - assertNotNull(payoutStatement.getPeriodStart()); - assertNotNull(payoutStatement.getPeriodEnd()); - assertNotNull(payoutStatement.getId()); - assertNotNull(payoutStatement.getStatus()); - assertNotNull(payoutStatement.getPayoutFee()); - assertNotNull(payoutStatement.getLinks()); + response.getData().forEach(PaymentReportData -> { + assertNotNull(PaymentReportData.getId()); + PaymentReportData.getActions().forEach(action -> { + assertNotNull(action.getId()); + action.getBreakdown().forEach(breakdown -> { + assertNotNull(breakdown.getType()); + }); }); }); }