Skip to content

Commit

Permalink
[PHEE-678] payment detail tc update (#289)
Browse files Browse the repository at this point in the history
* payment detail tc update

* Adding assertion

* Adding assertion
  • Loading branch information
apurbraj authored Jun 5, 2024
1 parent 1c5162f commit abab0a9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.annotation.JsonInclude;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Set;
import lombok.Getter;
Expand All @@ -15,6 +16,12 @@ public class BatchAndSubBatchSummaryResponse {

private String requestId;

private Date startedAt;

private Date completedAt;

private String registeringInstitutionId;

private Long total;

private Long ongoing;
Expand Down Expand Up @@ -54,7 +61,7 @@ public class BatchAndSubBatchSummaryResponse {

private String generatedAt;

private String totalSubBatches;
private Long totalSubBatches;

private Long approvedTransactionCount;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.mifos.integrationtest.common.dto.operationsapp;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
Expand All @@ -12,8 +14,20 @@ public class PaymentBatchDetail {
private String payerFsp;
private String reportGeneratedBy;
private String reportGeneratedAt;
private Date startedAt;
private Date completedAt;
private String registeringInstitutionId;
private String status;
private List<SubBatchSummary> subBatchList;
private List<Instruction> instructionList;
private Long total;
private Long ongoing;
private Long successful;
private Long failed;
private BigDecimal totalAmount;
private BigDecimal pendingAmount;
private BigDecimal successfulAmount;
private BigDecimal failedAmount;
private Long totalInstruction;
private Long totalBatchAmount;
private String clientCorrelationId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.mifos.integrationtest.common.dto.operationsapp;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Set;
import lombok.Getter;
Expand All @@ -14,6 +15,12 @@ public class SubBatchSummary {

private String batchId;

private Date startedAt;

private Date completedAt;

private String registeringInstitutionId;

private String requestId;

private Long total;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ public void iShouldAssertTotalTxnCountAndSuccessfulTxnCountInResponse() {
@And("Total transaction in batch should add up to total transaction in each sub batch")
public void matchTotalSubBatchTxnAndBatchTxnCount() {
assertThat(scenarioScopeState.batchAndSubBatchSummaryResponse).isNotNull();
assertThat(Integer.parseInt(scenarioScopeState.batchAndSubBatchSummaryResponse.getTotalSubBatches())).isGreaterThan(1);
assertThat(Integer.parseInt(String.valueOf(scenarioScopeState.batchAndSubBatchSummaryResponse.getTotalSubBatches())))
.isGreaterThan(1);
long batchTotal = scenarioScopeState.batchAndSubBatchSummaryResponse.getTotal();
long subBatchTotal = 0L;
for (SubBatchSummary subBatchSummary : scenarioScopeState.batchAndSubBatchSummaryResponse.getSubBatchSummaryList()) {
Expand Down Expand Up @@ -708,6 +709,7 @@ public void iCallThePaymentBatchDetailAPIWithExpectedStatusOf(int expectedStatus
logger.info("Batch Payment Detail Response: " + scenarioScopeState.response);
PaymentBatchDetail res = objectMapper.readValue(scenarioScopeState.response, PaymentBatchDetail.class);
assertThat(res.getInstructionList().size()).isEqualTo(totaltxns);
assertThat(res.getSuccessful()).isEqualTo(totaltxns);
});
}

Expand All @@ -729,6 +731,9 @@ public void iShouldAssertTotalTxnCountAndSuccessfulTxnCountInPaymentBatchDetailR
assertThat(scenarioScopeState.paymentBatchDetail).isNotNull();
assertThat(scenarioScopeState.paymentBatchDetail.getSubBatchList().size()).isEqualTo(3);
assertThat(scenarioScopeState.paymentBatchDetail.getInstructionList().size()).isEqualTo(12);
assertThat(scenarioScopeState.paymentBatchDetail.getTotal()).isEqualTo(scenarioScopeState.paymentBatchDetail.getSuccessful());
assertThat(scenarioScopeState.paymentBatchDetail.getStatus().equals("COMPLETED"));
assertThat(scenarioScopeState.paymentBatchDetail.getCompletedAt()).isNotNull();
}

@Then("I should be able to extract response body from callback for batch")
Expand Down

0 comments on commit abab0a9

Please sign in to comment.