adamsaghy commented on code in PR #2633:
URL: https://github.com/apache/fineract/pull/2633#discussion_r990959593


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java:
##########
@@ -50,57 +55,263 @@
 public class LoanTransactionChargebackTest {
 
     private ResponseSpecification responseSpec;
+    private ResponseSpecification responseSpecError;
     private RequestSpecification requestSpec;
+    private LoanTransactionHelper loanTransactionHelper;
+    private final String amountVal = "1000";
+    private LocalDate todaysDate;
+    private String operationDate;
 
     @BeforeEach
     public void setup() {
         Utils.initializeRESTAssured();
         this.requestSpec = new 
RequestSpecBuilder().setContentType(ContentType.JSON).build();
         this.requestSpec.header("Authorization", "Basic " + 
Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
         this.responseSpec = new 
ResponseSpecBuilder().expectStatusCode(200).build();
+        this.responseSpecError = new 
ResponseSpecBuilder().expectStatusCode(503).build();
+        this.loanTransactionHelper = new 
LoanTransactionHelper(this.requestSpec, this.responseSpec);
+
+        this.todaysDate = Utils.getLocalDateOfTenant();
+        this.operationDate = Utils.dateFormatter.format(this.todaysDate);
     }
 
     @Test
     public void applyLoanTransactionChargeback() {
-        final LoanTransactionHelper loanTransactionHelper = new 
LoanTransactionHelper(this.requestSpec, this.responseSpec);
+        // Client and Loan account creation
+        final Integer loanId = createAccounts(15);
+
+        GetLoansLoanIdResponse getLoansLoanIdResponse = 
loanTransactionHelper.getLoan(requestSpec, responseSpec, loanId);
+        assertNotNull(getLoansLoanIdResponse);
+
+        loanTransactionHelper.printRepaymentSchedule(getLoansLoanIdResponse);
+
+        Float amount = Float.valueOf(amountVal);
+        PostLoansLoanIdTransactionsResponse loanIdTransactionsResponse = 
loanTransactionHelper.makeLoanRepayment(operationDate, amount,
+                loanId);
+        assertNotNull(loanIdTransactionsResponse);
+        final Integer transactionId = 
loanIdTransactionsResponse.getResourceId();
+
+        getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, 
responseSpec, loanId);
+        assertNotNull(getLoansLoanIdResponse);
+        loanTransactionHelper.validateLoanStatus(getLoansLoanIdResponse, 
"loanStatusType.closed.obligations.met");
+
+        reviewLoanTransactionRelations(loanId, transactionId, 0);
+
+        final Integer chargebackTransactionId = 
applyChargebackTransaction(loanId, transactionId, "1000.00", 0, responseSpec);
+
+        reviewLoanTransactionRelations(loanId, chargebackTransactionId, 1);

Review Comment:
   Please check whether the outstanding, principal , loan balance amount is 
correct after the chargeback



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to