adamsaghy commented on code in PR #2633:
URL: https://github.com/apache/fineract/pull/2633#discussion_r993588863
##########
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:
Sorry, probably i phrased my self poorly. I was meant the actual instalment
(principal, outstanding and loan balance (3 values)) to be checked. However
checking the outstanding loan balance on the summary is good as well, but not
enough to validate complete, proper behaviour
--
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]