Added reschedule loans api resource to Fineract Client and batch; minor swagger polishing
This commit is contained in:
committed by
Arnold Gálovics
parent
b21cdf59b1
commit
87204d5a8a
+2
@@ -102,6 +102,8 @@ public class CommandStrategyProvider {
|
||||
"approveLoanCommandStrategy");
|
||||
this.commandStrategies.put(CommandContext.resource("loans\\/\\d+\\?command=disburse").method("POST").build(),
|
||||
"disburseLoanCommandStrategy");
|
||||
this.commandStrategies.put(CommandContext.resource("rescheduleloans").method("POST").build(),
|
||||
"createLoanRescheduleRequestCommandStrategy");
|
||||
this.commandStrategies.put(CommandContext.resource("rescheduleloans\\/\\d+\\?command=approve").method("POST").build(),
|
||||
"approveLoanRescheduleCommandStrategy");
|
||||
this.commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/transactions\\/\\d+").method("GET").build(),
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.batch.command.internal;
|
||||
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.portfolio.loanaccount.rescheduleloan.api.RescheduleLoansApiResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Implements {@link CommandStrategy} and applies a new reschedule loan request on an existing loan. It passes the
|
||||
* contents of the body from the BatchRequest to {@link RescheduleLoansApiResource} and gets back the response. This
|
||||
* class will also catch any errors raised by {@link RescheduleLoansApiResource} and map those errors to appropriate
|
||||
* status codes in BatchResponse.
|
||||
*
|
||||
* @see CommandStrategy
|
||||
* @see BatchRequest
|
||||
* @see BatchResponse
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class CreateLoanRescheduleRequestCommandStrategy implements CommandStrategy {
|
||||
|
||||
private final RescheduleLoansApiResource rescheduleLoansApiResource;
|
||||
|
||||
@Override
|
||||
public BatchResponse execute(BatchRequest request, @SuppressWarnings("unused") UriInfo uriInfo) {
|
||||
|
||||
final BatchResponse response = new BatchResponse();
|
||||
final String responseBody;
|
||||
|
||||
response.setRequestId(request.getRequestId());
|
||||
response.setHeaders(request.getHeaders());
|
||||
|
||||
// Calls 'createLoanRescheduleRequest' function from
|
||||
// 'RescheduleLoansApiResource' to create a reschedule request on an existing loan
|
||||
responseBody = rescheduleLoansApiResource.createLoanRescheduleRequest(request.getBody());
|
||||
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after savings is successfully
|
||||
// applied
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -320,7 +320,8 @@ final class ClientsApiResourceSwagger {
|
||||
public List<PostClientsDatatable> datatables;
|
||||
@Schema(description = "Address requests")
|
||||
public List<PostClientsAddressRequest> address;
|
||||
|
||||
@Schema(example = "test@test.com")
|
||||
public String emailAddress;
|
||||
}
|
||||
|
||||
@Schema(description = "PostClientsResponse")
|
||||
|
||||
+487
-122
@@ -291,44 +291,44 @@ final class LoansApiResourceSwagger {
|
||||
public Double principalDue;
|
||||
@Schema(example = "200.000000")
|
||||
public Double principalPaid;
|
||||
@Schema(example = "0")
|
||||
public Long principalWrittenOff;
|
||||
@Schema(example = "0.000000")
|
||||
public Double principalWrittenOff;
|
||||
@Schema(example = "20.000000")
|
||||
public Double principalOutstanding;
|
||||
@Schema(example = "20.000000")
|
||||
public Double principalLoanBalanceOutstanding;
|
||||
@Schema(example = "0")
|
||||
public Long interestOriginalDue;
|
||||
@Schema(example = "0")
|
||||
public Long interestDue;
|
||||
@Schema(example = "0")
|
||||
public Long interestPaid;
|
||||
@Schema(example = "0")
|
||||
public Long interestWaived;
|
||||
@Schema(example = "0")
|
||||
public Long interestWrittenOff;
|
||||
@Schema(example = "0")
|
||||
public Long interestOutstanding;
|
||||
@Schema(example = "0")
|
||||
public Long feeChargesDue;
|
||||
@Schema(example = "20")
|
||||
public Long feeChargesPaid;
|
||||
@Schema(example = "20")
|
||||
public Long feeChargesWaived;
|
||||
@Schema(example = "20")
|
||||
public Long feeChargesWrittenOff;
|
||||
@Schema(example = "20")
|
||||
public Long feeChargesOutstanding;
|
||||
@Schema(example = "20")
|
||||
public Long penaltyChargesDue;
|
||||
@Schema(example = "20")
|
||||
public Long penaltyChargesPaid;
|
||||
@Schema(example = "20")
|
||||
public Long penaltyChargesWaived;
|
||||
@Schema(example = "20")
|
||||
public Long penaltyChargesWrittenOff;
|
||||
@Schema(example = "20")
|
||||
public Long penaltyChargesOutstanding;
|
||||
@Schema(example = "0.000000")
|
||||
public Double interestOriginalDue;
|
||||
@Schema(example = "0.000000")
|
||||
public Double interestDue;
|
||||
@Schema(example = "0.000000")
|
||||
public Double interestPaid;
|
||||
@Schema(example = "0.000000")
|
||||
public Double interestWaived;
|
||||
@Schema(example = "0.000000")
|
||||
public Double interestWrittenOff;
|
||||
@Schema(example = "0.000000")
|
||||
public Double interestOutstanding;
|
||||
@Schema(example = "0.000000")
|
||||
public Double feeChargesDue;
|
||||
@Schema(example = "20.000000")
|
||||
public Double feeChargesPaid;
|
||||
@Schema(example = "20.000000")
|
||||
public Double feeChargesWaived;
|
||||
@Schema(example = "20.000000")
|
||||
public Double feeChargesWrittenOff;
|
||||
@Schema(example = "20.000000")
|
||||
public Double feeChargesOutstanding;
|
||||
@Schema(example = "20.000000")
|
||||
public Double penaltyChargesDue;
|
||||
@Schema(example = "20.000000")
|
||||
public Double penaltyChargesPaid;
|
||||
@Schema(example = "20.000000")
|
||||
public Double penaltyChargesWaived;
|
||||
@Schema(example = "20.000000")
|
||||
public Double penaltyChargesWrittenOff;
|
||||
@Schema(example = "20.000000")
|
||||
public Double penaltyChargesOutstanding;
|
||||
@Schema(example = "20.000000")
|
||||
public Double totalOriginalDueForPeriod;
|
||||
@Schema(example = "20.000000")
|
||||
@@ -337,20 +337,48 @@ final class LoansApiResourceSwagger {
|
||||
public Double totalPaidForPeriod;
|
||||
@Schema(example = "20.000000")
|
||||
public Double totalPaidInAdvanceForPeriod;
|
||||
@Schema(example = "20")
|
||||
public Long totalPaidLateForPeriod;
|
||||
@Schema(example = "20")
|
||||
public Long totalWaivedForPeriod;
|
||||
@Schema(example = "20")
|
||||
public Long totalWrittenOffForPeriod;
|
||||
@Schema(example = "20.000000")
|
||||
public Double totalPaidLateForPeriod;
|
||||
@Schema(example = "20.000000")
|
||||
public Double totalWaivedForPeriod;
|
||||
@Schema(example = "20.000000")
|
||||
public Double totalWrittenOffForPeriod;
|
||||
@Schema(example = "200.000000")
|
||||
public Double totalOutstandingForPeriod;
|
||||
@Schema(example = "20")
|
||||
public Long totalActualCostOfLoanForPeriod;
|
||||
@Schema(example = "20.000000")
|
||||
public Double totalActualCostOfLoanForPeriod;
|
||||
@Schema(example = "200.000000")
|
||||
public Double totalInstallmentAmountForPeriod;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdDisbursementDetails {
|
||||
|
||||
private GetLoansLoanIdDisbursementDetails() {}
|
||||
|
||||
@Schema(example = "71")
|
||||
public Integer id;
|
||||
@Schema(example = "[2022, 07, 01]")
|
||||
public LocalDate expectedDisbursementDate;
|
||||
@Schema(example = "[2022, 07, 01]")
|
||||
public LocalDate actualDisbursementDate;
|
||||
@Schema(example = "22000.000000")
|
||||
public Double principal;
|
||||
@Schema(example = "22000.000000")
|
||||
public Double netDisbursalAmount;
|
||||
@Schema(example = "1")
|
||||
public String loanChargeId;
|
||||
@Schema(example = "22000.000000")
|
||||
public Double chargeAmount;
|
||||
@Schema(example = "22000.000000")
|
||||
public Double waivedChargeAmount;
|
||||
@Schema(example = "dd MMMM yyyy")
|
||||
public String dateFormat;
|
||||
@Schema(example = "de_DE")
|
||||
public String locale;
|
||||
@Schema(example = "some note")
|
||||
public String note;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdSummary {
|
||||
|
||||
private GetLoansLoanIdSummary() {}
|
||||
@@ -370,20 +398,6 @@ final class LoansApiResourceSwagger {
|
||||
public Long accountNo;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdDisbursementDetails {
|
||||
|
||||
private GetLoansLoanIdDisbursementDetails() {}
|
||||
|
||||
@Schema(example = "71")
|
||||
public Integer id;
|
||||
@Schema(example = "[2013, 11, 1]")
|
||||
public LocalDate expectedDisbursementDate;
|
||||
@Schema(example = "22000.000000")
|
||||
public Float principal;
|
||||
@Schema(example = "22000.000000")
|
||||
public Float approvedPrincipal;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdOverdueCharges {
|
||||
|
||||
private GetLoansLoanIdOverdueCharges() {}
|
||||
@@ -457,78 +471,84 @@ final class LoansApiResourceSwagger {
|
||||
}
|
||||
|
||||
public GetLoansLoanIdCurrency currency;
|
||||
@Schema(example = "1000000")
|
||||
public Long principalDisbursed;
|
||||
@Schema(example = "0")
|
||||
public Long principalPaid;
|
||||
@Schema(example = "0")
|
||||
public Long principalWrittenOff;
|
||||
@Schema(example = "1000000")
|
||||
public Long principalOutstanding;
|
||||
@Schema(example = "833333.3")
|
||||
@Schema(example = "1000000.000000")
|
||||
public Double principalDisbursed;
|
||||
@Schema(example = "0.000000")
|
||||
public Double principalPaid;
|
||||
@Schema(example = "0.000000")
|
||||
public Double principalWrittenOff;
|
||||
@Schema(example = "1000000.000000")
|
||||
public Double principalOutstanding;
|
||||
@Schema(example = "833333.300000")
|
||||
public Double principalOverdue;
|
||||
@Schema(example = "240000")
|
||||
public Long interestCharged;
|
||||
@Schema(example = "0")
|
||||
public Long interestPaid;
|
||||
@Schema(example = "0")
|
||||
public Long interestWaived;
|
||||
@Schema(example = "0")
|
||||
public Long interestWrittenOff;
|
||||
@Schema(example = "240000")
|
||||
public Long interestOutstanding;
|
||||
@Schema(example = "200000")
|
||||
public Long interestOverdue;
|
||||
@Schema(example = "18000")
|
||||
public Long feeChargesCharged;
|
||||
@Schema(example = "0")
|
||||
public Long feeChargesDueAtDisbursementCharged;
|
||||
@Schema(example = "0")
|
||||
public Long feeChargesPaid;
|
||||
@Schema(example = "0")
|
||||
public Long feeChargesWaived;
|
||||
@Schema(example = "0")
|
||||
public Long feeChargesWrittenOff;
|
||||
@Schema(example = "18000")
|
||||
public Long feeChargesOutstanding;
|
||||
@Schema(example = "15000")
|
||||
public Long feeChargesOverdue;
|
||||
@Schema(example = "0")
|
||||
public Long penaltyChargesCharged;
|
||||
@Schema(example = "0")
|
||||
public Long penaltyChargesPaid;
|
||||
@Schema(example = "0")
|
||||
public Long penaltyChargesWaived;
|
||||
@Schema(example = "0")
|
||||
public Long penaltyChargesWrittenOff;
|
||||
@Schema(example = "0")
|
||||
public Long penaltyChargesOutstanding;
|
||||
@Schema(example = "0")
|
||||
public Long penaltyChargesOverdue;
|
||||
@Schema(example = "1258000")
|
||||
public Long totalExpectedRepayment;
|
||||
@Schema(example = "0")
|
||||
public Long totalRepayment;
|
||||
@Schema(example = "258000")
|
||||
public Long totalExpectedCostOfLoan;
|
||||
@Schema(example = "0")
|
||||
public Long totalCostOfLoan;
|
||||
@Schema(example = "0")
|
||||
public Long totalWaived;
|
||||
@Schema(example = "0")
|
||||
public Long totalWrittenOff;
|
||||
@Schema(example = "1258000")
|
||||
public Long totalOutstanding;
|
||||
@Schema(example = "1048333.3")
|
||||
@Schema(example = "240000.000000")
|
||||
public Double interestCharged;
|
||||
@Schema(example = "0.000000")
|
||||
public Double interestPaid;
|
||||
@Schema(example = "0.000000")
|
||||
public Double interestWaived;
|
||||
@Schema(example = "0.000000")
|
||||
public Double interestWrittenOff;
|
||||
@Schema(example = "240000.000000")
|
||||
public Double interestOutstanding;
|
||||
@Schema(example = "200000.000000")
|
||||
public Double interestOverdue;
|
||||
@Schema(example = "18000.000000")
|
||||
public Double feeChargesCharged;
|
||||
@Schema(example = "0.000000")
|
||||
public Double feeChargesDueAtDisbursementCharged;
|
||||
@Schema(example = "0.000000")
|
||||
public Double feeChargesPaid;
|
||||
@Schema(example = "0.000000")
|
||||
public Double feeChargesWaived;
|
||||
@Schema(example = "0.000000")
|
||||
public Double feeChargesWrittenOff;
|
||||
@Schema(example = "18000.000000")
|
||||
public Double feeChargesOutstanding;
|
||||
@Schema(example = "15000.000000")
|
||||
public Double feeChargesOverdue;
|
||||
@Schema(example = "0.000000")
|
||||
public Double penaltyChargesCharged;
|
||||
@Schema(example = "0.000000")
|
||||
public Double penaltyChargesPaid;
|
||||
@Schema(example = "0.000000")
|
||||
public Double penaltyChargesWaived;
|
||||
@Schema(example = "0.000000")
|
||||
public Double penaltyChargesWrittenOff;
|
||||
@Schema(example = "0.000000")
|
||||
public Double penaltyChargesOutstanding;
|
||||
@Schema(example = "0.000000")
|
||||
public Double penaltyChargesOverdue;
|
||||
@Schema(example = "1258000.000000")
|
||||
public Double totalExpectedRepayment;
|
||||
@Schema(example = "0.000000")
|
||||
public Double totalRepayment;
|
||||
@Schema(example = "258000.000000")
|
||||
public Double totalExpectedCostOfLoan;
|
||||
@Schema(example = "0.000000")
|
||||
public Double totalCostOfLoan;
|
||||
@Schema(example = "0.000000")
|
||||
public Double totalWaived;
|
||||
@Schema(example = "0.000000")
|
||||
public Double totalWrittenOff;
|
||||
@Schema(example = "1258000.000000")
|
||||
public Double totalOutstanding;
|
||||
@Schema(example = "1048333.30000")
|
||||
public Double totalOverdue;
|
||||
@Schema(example = "2456.30000")
|
||||
public Double totalRecovered;
|
||||
@Schema(example = "[2012, 5, 10]")
|
||||
public LocalDate overdueSinceDate;
|
||||
@Schema(example = "1")
|
||||
public Long writeoffReasonId;
|
||||
@Schema(example = "reason")
|
||||
public String writeoffReason;
|
||||
public GetLoansLoanIdLinkedAccount linkedAccount;
|
||||
public Set<GetLoansLoanIdDisbursementDetails> disbursementDetails;
|
||||
@Schema(example = "1100.000000")
|
||||
public Float fixedEmiAmount;
|
||||
@Schema(example = "35000")
|
||||
public Long maxOutstandingLoanBalance;
|
||||
public Double fixedEmiAmount;
|
||||
@Schema(example = "35000.000000")
|
||||
public Double maxOutstandingLoanBalance;
|
||||
@Schema(example = "false")
|
||||
public Boolean canDisburse;
|
||||
public Set<GetLoansLoanIdEmiVariations> emiAmountVariations;
|
||||
@@ -539,6 +559,343 @@ final class LoansApiResourceSwagger {
|
||||
public Set<GetLoansLoanIdOverdueCharges> overdueCharges;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdPaymentType {
|
||||
|
||||
private GetLoansLoanIdPaymentType() {}
|
||||
|
||||
@Schema(example = "11")
|
||||
public Integer id;
|
||||
@Schema(example = "Cash")
|
||||
public String name;
|
||||
@Schema(example = "Cash Payment")
|
||||
public String description;
|
||||
@Schema(example = "true")
|
||||
public Boolean isCashPayment;
|
||||
@Schema(example = "0")
|
||||
public Long position;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdTransactions {
|
||||
|
||||
private GetLoansLoanIdTransactions() {}
|
||||
|
||||
static final class GetLoansLoanIdLoanTransactionEnumData {
|
||||
|
||||
private GetLoansLoanIdLoanTransactionEnumData() {}
|
||||
|
||||
@Schema(example = "1")
|
||||
public Long id;
|
||||
@Schema(example = "loanTransactionType.repayment")
|
||||
public String code;
|
||||
@Schema(example = "2")
|
||||
public String value;
|
||||
|
||||
@Schema(example = "false")
|
||||
public boolean disbursement;
|
||||
@Schema(example = "false")
|
||||
public boolean repaymentAtDisbursement;
|
||||
@Schema(example = "true")
|
||||
public boolean repayment;
|
||||
@Schema(example = "false")
|
||||
public boolean merchantIssuedRefund;
|
||||
@Schema(example = "false")
|
||||
public boolean payoutRefund;
|
||||
@Schema(example = "false")
|
||||
public boolean goodwillCredit;
|
||||
@Schema(example = "false")
|
||||
public boolean contra;
|
||||
@Schema(example = "false")
|
||||
public boolean waiveInterest;
|
||||
@Schema(example = "false")
|
||||
public boolean waiveCharges;
|
||||
@Schema(example = "false")
|
||||
public boolean accrual;
|
||||
@Schema(example = "false")
|
||||
public boolean writeOff;
|
||||
@Schema(example = "false")
|
||||
public boolean recoveryRepayment;
|
||||
@Schema(example = "false")
|
||||
public boolean initiateTransfer;
|
||||
@Schema(example = "false")
|
||||
public boolean approveTransfer;
|
||||
@Schema(example = "false")
|
||||
public boolean withdrawTransfer;
|
||||
@Schema(example = "false")
|
||||
public boolean rejectTransfer;
|
||||
@Schema(example = "false")
|
||||
public boolean chargePayment;
|
||||
@Schema(example = "false")
|
||||
public boolean refund;
|
||||
@Schema(example = "false")
|
||||
public boolean refundForActiveLoans;
|
||||
@Schema(example = "false")
|
||||
public boolean creditBalanceRefund;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdPaymentDetailData {
|
||||
|
||||
private GetLoansLoanIdPaymentDetailData() {}
|
||||
|
||||
@Schema(example = "62")
|
||||
public Integer id;
|
||||
public GetLoansLoanIdPaymentType paymentType;
|
||||
@Schema(example = "acc123")
|
||||
public String accountNumber;
|
||||
@Schema(example = "che123")
|
||||
public String checkNumber;
|
||||
@Schema(example = "rou123")
|
||||
public String routingCode;
|
||||
@Schema(example = "rec123")
|
||||
public String receiptNumber;
|
||||
@Schema(example = "ban123")
|
||||
public String bankNumber;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdLoanChargePaidByData {
|
||||
|
||||
private GetLoansLoanIdLoanChargePaidByData() {}
|
||||
|
||||
@Schema(example = "11")
|
||||
public Long id;
|
||||
@Schema(example = "100.000000")
|
||||
public Double amount;
|
||||
@Schema(example = "9679")
|
||||
public Integer installmentNumber;
|
||||
@Schema(example = "1")
|
||||
public Long chargeId;
|
||||
@Schema(example = "636")
|
||||
public Long transactionId;
|
||||
@Schema(example = "name")
|
||||
public String name;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdCodeValueData {
|
||||
|
||||
private GetLoansLoanIdCodeValueData() {}
|
||||
|
||||
@Schema(example = "1")
|
||||
public Long id;
|
||||
@Schema(example = "code name")
|
||||
public String name;
|
||||
@Schema(example = "0")
|
||||
public Integer position;
|
||||
@Schema(example = "code description")
|
||||
public String description;
|
||||
@Schema(example = "true")
|
||||
public Boolean active;
|
||||
@Schema(example = "false")
|
||||
public Boolean mandatory;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdLoanRepaymentScheduleInstallmentData {
|
||||
|
||||
private GetLoansLoanIdLoanRepaymentScheduleInstallmentData() {}
|
||||
|
||||
@Schema(example = "1")
|
||||
public Long id;
|
||||
@Schema(example = "11")
|
||||
public Integer installmentId;
|
||||
@Schema(example = "[2022, 07, 01]")
|
||||
public LocalDate date;
|
||||
@Schema(example = "100.000000")
|
||||
public BigDecimal amount;
|
||||
}
|
||||
|
||||
@Schema(example = "1")
|
||||
public Long id;
|
||||
@Schema(example = "1")
|
||||
public Long officeId;
|
||||
@Schema(example = "Head Office")
|
||||
public String officeName;
|
||||
@Schema(description = "Transaction type")
|
||||
public GetLoansLoanIdLoanTransactionEnumData type;
|
||||
@Schema(example = "[2022, 07, 01]")
|
||||
public LocalDate date;
|
||||
@Schema(description = "Currency")
|
||||
public GetLoansLoanIdCurrency currency;
|
||||
@Schema(description = "Payment detail")
|
||||
public GetLoansLoanIdPaymentDetailData paymentDetailData;
|
||||
@Schema(example = "100.000000")
|
||||
public Double amount;
|
||||
@Schema(example = "100.000000")
|
||||
public Double netDisbursalAmount;
|
||||
@Schema(example = "100.000000")
|
||||
public Double principalPortion;
|
||||
@Schema(example = "100.000000")
|
||||
public Double interestPortion;
|
||||
@Schema(example = "100.000000")
|
||||
public Double feeChargesPortion;
|
||||
@Schema(example = "100.000000")
|
||||
public Double penaltyChargesPortion;
|
||||
@Schema(example = "100.000000")
|
||||
public Double overpaymentPortion;
|
||||
@Schema(example = "100.000000")
|
||||
public Double unrecognizedIncomePortion;
|
||||
@Schema(example = "3")
|
||||
public String externalId;
|
||||
@Schema(example = "100.000000")
|
||||
public Double fixedEmiAmount;
|
||||
@Schema(example = "100.000000")
|
||||
public Double outstandingLoanBalance;
|
||||
@Schema(example = "[2022, 07, 01]")
|
||||
public LocalDate submittedOnDate;
|
||||
public boolean manuallyReversed;
|
||||
@Schema(example = "[2022, 07, 01]")
|
||||
public LocalDate possibleNextRepaymentDate;
|
||||
@Schema(description = "List of GetLoansLoanIdLoanChargePaidByData")
|
||||
public List<GetLoansLoanIdLoanChargePaidByData> loanChargePaidByList;
|
||||
@Schema(description = "List of GetLoansLoanIdPaymentType")
|
||||
public List<GetLoansLoanIdPaymentType> paymentTypeOptions;
|
||||
@Schema(description = "List of GetLoansLoanIdCodeValueData")
|
||||
public List<GetLoansLoanIdCodeValueData> writeOffReasonOptions;
|
||||
@Schema(example = "4")
|
||||
public Integer numberOfRepayments;
|
||||
@Schema(example = "dd MMMM yyyy")
|
||||
public String dateFormat;
|
||||
@Schema(example = "de_DE")
|
||||
public String locale;
|
||||
@Schema(example = "100.000000")
|
||||
public Double transactionAmount;
|
||||
@Schema(example = "[2022, 07, 01]")
|
||||
public LocalDate transactionDate;
|
||||
@Schema(example = "101")
|
||||
public Long paymentTypeId;
|
||||
@Schema(example = "acct123")
|
||||
public String accountNumber;
|
||||
@Schema(example = "10001")
|
||||
public Integer checkNumber;
|
||||
@Schema(example = "6337")
|
||||
public Integer routingCode;
|
||||
@Schema(example = "67863")
|
||||
public Integer receiptNumber;
|
||||
@Schema(example = "34645568")
|
||||
public Integer bankNumber;
|
||||
@Schema(example = "7327")
|
||||
public Long accountId;
|
||||
@Schema(example = "repayment")
|
||||
public String transactionType;
|
||||
@Schema(description = "List of GetLoansLoanIdLoanRepaymentScheduleInstallmentData")
|
||||
public List<GetLoansLoanIdLoanRepaymentScheduleInstallmentData> loanRepaymentScheduleInstallments;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdLoanChargeData {
|
||||
|
||||
private GetLoansLoanIdLoanChargeData() {}
|
||||
|
||||
static final class GetLoansLoanIdEnumOptionData {
|
||||
|
||||
private GetLoansLoanIdEnumOptionData() {}
|
||||
|
||||
@Schema(example = "2")
|
||||
public Long id;
|
||||
@Schema(example = "chargeTimeType.specifiedDueDate")
|
||||
public String code;
|
||||
@Schema(example = "Specified due date")
|
||||
public String value;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdLoanInstallmentChargeData {
|
||||
|
||||
private GetLoansLoanIdLoanInstallmentChargeData() {}
|
||||
|
||||
@Schema(example = "2")
|
||||
public Integer installmentNumber;
|
||||
@Schema(example = "[2022, 07, 01]")
|
||||
public LocalDate dueDate;
|
||||
@Schema(example = "13.560000")
|
||||
public Double amount;
|
||||
@Schema(example = "13.560000")
|
||||
public Double amountOutstanding;
|
||||
@Schema(example = "13.560000")
|
||||
public Double amountWaived;
|
||||
@Schema(example = "false")
|
||||
public boolean paid;
|
||||
@Schema(example = "false")
|
||||
public boolean waived;
|
||||
@Schema(example = "13.560000")
|
||||
public Double amountAccrued;
|
||||
@Schema(example = "13.560000")
|
||||
public Double amountUnrecognized;
|
||||
}
|
||||
|
||||
@Schema(example = "3")
|
||||
public Long id;
|
||||
@Schema(example = "5")
|
||||
public Long chargeId;
|
||||
@Schema(example = "snooze fee")
|
||||
public String name;
|
||||
@Schema(description = "Enum option data")
|
||||
public GetLoansLoanIdEnumOptionData chargeTimeType;
|
||||
@Schema(example = "[2022, 07, 01]")
|
||||
public LocalDate dueDate;
|
||||
@Schema(description = "Enum option data")
|
||||
public GetLoansLoanIdEnumOptionData chargeCalculationType;
|
||||
@Schema(example = "3.400000")
|
||||
public Double percentage;
|
||||
@Schema(example = "13.560000")
|
||||
public Double amountPercentageAppliedTo;
|
||||
@Schema(description = "currency")
|
||||
public GetLoansLoanIdCurrency currency;
|
||||
@Schema(example = "102.000000")
|
||||
public Double amount;
|
||||
@Schema(example = "12.000000")
|
||||
public Double amountPaid;
|
||||
@Schema(example = "14.000000")
|
||||
public Double amountWaived;
|
||||
@Schema(example = "102.000000")
|
||||
public Double amountWrittenOff;
|
||||
@Schema(example = "102.000000")
|
||||
public Double amountOutstanding;
|
||||
@Schema(example = "102.000000")
|
||||
public Double amountOrPercentage;
|
||||
@Schema(example = "false")
|
||||
public boolean penalty;
|
||||
@Schema(description = "Enum option data")
|
||||
public GetLoansLoanIdEnumOptionData chargePaymentMode;
|
||||
@Schema(example = "false")
|
||||
public boolean paid;
|
||||
@Schema(example = "false")
|
||||
public boolean waived;
|
||||
@Schema(example = "false")
|
||||
public boolean chargePayable;
|
||||
@Schema(example = "3")
|
||||
public Long loanId;
|
||||
@Schema(example = "30.000000")
|
||||
public Double minCap;
|
||||
@Schema(example = "30.000000")
|
||||
public Double maxCap;
|
||||
@Schema(description = "List of GetLoansLoanIdLoanInstallmentChargeData")
|
||||
public List<GetLoansLoanIdLoanInstallmentChargeData> installmentChargeData;
|
||||
@Schema(example = "30.000000")
|
||||
private Double amountAccrued;
|
||||
@Schema(example = "30.000000")
|
||||
private Double amountUnrecognized;
|
||||
@Schema(example = "3ert3453")
|
||||
private String externalId;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdCollectionData {
|
||||
|
||||
private GetLoansLoanIdCollectionData() {}
|
||||
|
||||
@Schema(example = "100.000000")
|
||||
public Double availableDisbursementAmount;
|
||||
@Schema(example = "12")
|
||||
public Integer pastDueDays;
|
||||
@Schema(example = "[2022, 07, 01]")
|
||||
public LocalDate nextPaymentDueDate;
|
||||
@Schema(example = "4")
|
||||
public Integer delinquentDays;
|
||||
@Schema(example = "[2022, 07, 01]")
|
||||
public LocalDate delinquentDate;
|
||||
@Schema(example = "100.000000")
|
||||
public Double delinquentAmount;
|
||||
@Schema(example = "[2022, 07, 01]")
|
||||
public LocalDate lastPaymentDate;
|
||||
@Schema(example = "100.000000")
|
||||
public Double lastPaymentAmount;
|
||||
}
|
||||
|
||||
@Schema(example = "1")
|
||||
public Long id;
|
||||
@Schema(example = "000000001")
|
||||
@@ -566,7 +923,7 @@ final class LoansApiResourceSwagger {
|
||||
public String loanOfficerName;
|
||||
public GetLoansLoanIdLoanType loanType;
|
||||
public GetLoansLoanIdCurrency currency;
|
||||
@Schema(example = "1000000")
|
||||
@Schema(example = "1000000.00")
|
||||
public BigDecimal principal;
|
||||
@Schema(example = "1000.000000")
|
||||
public Double approvedPrincipal;
|
||||
@@ -595,6 +952,14 @@ final class LoansApiResourceSwagger {
|
||||
public GetLoansLoanIdTimeline timeline;
|
||||
public GetLoansLoanIdSummary summary;
|
||||
public GetLoansLoanIdRepaymentSchedule repaymentSchedule;
|
||||
@Schema(description = "Set of GetLoansLoanIdDisbursementDetails")
|
||||
public Set<GetLoansLoanIdTransactions> transactions;
|
||||
@Schema(description = "Set of GetLoansLoanIdDisbursementDetails")
|
||||
public Set<GetLoansLoanIdDisbursementDetails> disbursementDetails;
|
||||
@Schema(description = "Delinquent data")
|
||||
public GetLoansLoanIdCollectionData delinquent;
|
||||
@Schema(description = "Set of charges")
|
||||
public Set<GetLoansLoanIdLoanChargeData> charges;
|
||||
}
|
||||
|
||||
@Schema(description = "GetLoansResponse")
|
||||
|
||||
+24
@@ -18,6 +18,13 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.loanaccount.rescheduleloan.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -86,6 +93,9 @@ public class RescheduleLoansApiResource {
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Operation(summary = "Retrieve all reschedule loan reasons", description = "Retrieve all reschedule loan reasons as a template")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RescheduleLoansApiResourceSwagger.GetRescheduleReasonsTemplateResponse.class))) })
|
||||
public String retrieveTemplate(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.platformSecurityContext.authenticatedUser().validateHasReadPermission(RescheduleLoansApiConstants.ENTITY_NAME);
|
||||
@@ -102,6 +112,9 @@ public class RescheduleLoansApiResource {
|
||||
@Path("{scheduleId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Operation(summary = "Retrieve loan reschedule request by schedule id", description = "Retrieve loan reschedule request by schedule id")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RescheduleLoansApiResourceSwagger.GetLoanRescheduleRequestResponse.class))) })
|
||||
public String readLoanRescheduleRequest(@Context final UriInfo uriInfo, @PathParam("scheduleId") final Long scheduleId,
|
||||
@QueryParam("command") final String command) {
|
||||
this.platformSecurityContext.authenticatedUser().validateHasReadPermission(RescheduleLoansApiConstants.ENTITY_NAME);
|
||||
@@ -123,6 +136,10 @@ public class RescheduleLoansApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Operation(summary = "Create loan reschedule request", description = "Create a loan reschedule request.")
|
||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = String.class)), description = "{\"submittedOnDate\": \"05/02/2022\",\"rescheduleFromDate\": \"05/02/2022\",\"rescheduleReasonId\": 67,\"adjustedDueDate\": \"07/01/2022\",\"loanId\": \"18\",\"dateFormat\": \"MM/dd/yyyy\",\"locale\": \"en\"}")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RescheduleLoansApiResourceSwagger.PostCreateRescheduleLoansResponse.class))) })
|
||||
public String createLoanRescheduleRequest(final String apiRequestBodyAsJson) {
|
||||
final CommandWrapper commandWrapper = new CommandWrapperBuilder()
|
||||
.createLoanRescheduleRequest(RescheduleLoansApiConstants.ENTITY_NAME).withJson(apiRequestBodyAsJson).build();
|
||||
@@ -136,6 +153,10 @@ public class RescheduleLoansApiResource {
|
||||
@Path("{scheduleId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Operation(summary = "Update loan reschedule request", description = "Update a loan reschedule request by either approving/rejecting it.")
|
||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = String.class)), description = "{\"approvedOnDate\": \"05/02/2022\",\"dateFormat\": \"MM/dd/yyyy\",\"locale\": \"en\"}")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RescheduleLoansApiResourceSwagger.PostUpdateRescheduleLoansResponse.class))) })
|
||||
public String updateLoanRescheduleRequest(@PathParam("scheduleId") final Long scheduleId, @QueryParam("command") final String command,
|
||||
final String apiRequestBodyAsJson) {
|
||||
CommandWrapper commandWrapper = null;
|
||||
@@ -175,6 +196,9 @@ public class RescheduleLoansApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Operation(summary = "Retrieve all reschedule requests", description = "Retrieve all reschedule requests.")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = RescheduleLoansApiResourceSwagger.GetLoanRescheduleRequestResponse.class)))) })
|
||||
public String retrieveAllRescheduleRequest(@Context final UriInfo uriInfo, @QueryParam("command") final String command) {
|
||||
|
||||
this.platformSecurityContext.authenticatedUser().validateHasReadPermission(RescheduleLoansApiConstants.ENTITY_NAME);
|
||||
|
||||
+221
@@ -0,0 +1,221 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.portfolio.loanaccount.rescheduleloan.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Reschedule Loans Api Resource Swagger.
|
||||
*/
|
||||
final class RescheduleLoansApiResourceSwagger {
|
||||
|
||||
private RescheduleLoansApiResourceSwagger() {}
|
||||
|
||||
@Schema(description = "GetRescheduleReasonsTemplateResponse")
|
||||
public static final class GetRescheduleReasonsTemplateResponse {
|
||||
|
||||
private GetRescheduleReasonsTemplateResponse() {}
|
||||
|
||||
static final class GetRescheduleReasonsAllowedTypes {
|
||||
|
||||
private GetRescheduleReasonsAllowedTypes() {}
|
||||
|
||||
@Schema(example = "1")
|
||||
public Integer id;
|
||||
@Schema(example = "reason")
|
||||
public String name;
|
||||
@Schema(example = "0")
|
||||
public Integer position;
|
||||
@Schema(example = "description")
|
||||
public String description;
|
||||
@Schema(example = "true")
|
||||
public Boolean active;
|
||||
@Schema(example = "false")
|
||||
public Boolean mandatory;
|
||||
}
|
||||
|
||||
public Set<GetRescheduleReasonsAllowedTypes> rescheduleReasons;
|
||||
}
|
||||
|
||||
@Schema(description = "GetLoanRescheduleRequestResponse")
|
||||
public static final class GetLoanRescheduleRequestResponse {
|
||||
|
||||
private GetLoanRescheduleRequestResponse() {}
|
||||
|
||||
static final class GetLoanRescheduleRequestStatus {
|
||||
|
||||
private GetLoanRescheduleRequestStatus() {}
|
||||
|
||||
@Schema(example = "100")
|
||||
public Integer id;
|
||||
@Schema(example = "loanStatusType.submitted.and.pending.approval")
|
||||
public String code;
|
||||
@Schema(example = "Submitted and pending approval")
|
||||
public String value;
|
||||
@Schema(example = "true")
|
||||
public Boolean pendingApproval;
|
||||
@Schema(example = "false")
|
||||
public Boolean approved;
|
||||
@Schema(example = "false")
|
||||
public Boolean rejected;
|
||||
}
|
||||
|
||||
static final class RescheduleReasonsCodeValue {
|
||||
|
||||
private RescheduleReasonsCodeValue() {}
|
||||
|
||||
@Schema(example = "1")
|
||||
public Integer id;
|
||||
@Schema(example = "reason")
|
||||
public String name;
|
||||
@Schema(example = "true")
|
||||
public Boolean active;
|
||||
@Schema(example = "false")
|
||||
public Boolean mandatory;
|
||||
}
|
||||
|
||||
static final class RescheduleReasonsTimeline {
|
||||
|
||||
private RescheduleReasonsTimeline() {}
|
||||
|
||||
@Schema(example = "[2014, 5, 1]")
|
||||
public LocalDate submittedOnDate;
|
||||
@Schema(example = "mifos")
|
||||
public String submittedByUsername;
|
||||
@Schema(example = "App")
|
||||
public String submittedByFirstname;
|
||||
@Schema(example = "Administrator")
|
||||
public String submittedByLastname;
|
||||
@Schema(example = "[2014, 5, 1]")
|
||||
public LocalDate approvedOnDate;
|
||||
@Schema(example = "mifos")
|
||||
public String approvedByUsername;
|
||||
@Schema(example = "App")
|
||||
public String approvedByFirstname;
|
||||
@Schema(example = "Administrator")
|
||||
public String approvedByLastname;
|
||||
}
|
||||
|
||||
static final class LoanTermTypeOptions {
|
||||
|
||||
private LoanTermTypeOptions() {}
|
||||
|
||||
@Schema(example = "2")
|
||||
public Integer id;
|
||||
@Schema(example = "loanTermType.dueDate")
|
||||
public String code;
|
||||
@Schema(example = "dueDate")
|
||||
public String value;
|
||||
}
|
||||
|
||||
static final class LoanTermVariationsData {
|
||||
|
||||
private LoanTermVariationsData() {}
|
||||
|
||||
@Schema(example = "1")
|
||||
public Integer id;
|
||||
public LoanTermTypeOptions termType;
|
||||
@Schema(example = "[2022, 5, 1]")
|
||||
public LocalDate termVariationApplicableFrom;
|
||||
@Schema(example = "100.00")
|
||||
public BigDecimal decimalValue;
|
||||
@Schema(example = "[2022, 5, 2]")
|
||||
public LocalDate dateValue;
|
||||
@Schema(example = "true")
|
||||
public Boolean isSpecificToInstallment;
|
||||
@Schema(example = "true")
|
||||
public Boolean isProcessed;
|
||||
|
||||
}
|
||||
|
||||
@Schema(example = "1")
|
||||
public Integer id;
|
||||
@Schema(example = "18")
|
||||
public Integer loanId;
|
||||
@Schema(example = "15")
|
||||
public Integer clientId;
|
||||
@Schema(example = "clientName")
|
||||
public String clientName;
|
||||
@Schema(example = "000000018")
|
||||
public String loanAccountNumber;
|
||||
|
||||
public GetLoanRescheduleRequestStatus statusEnum;
|
||||
|
||||
@Schema(example = "1")
|
||||
public Integer rescheduleFromInstallment;
|
||||
@Schema(example = "[2022, 5, 1]")
|
||||
public LocalDate rescheduleFromDate;
|
||||
@Schema(example = "false")
|
||||
public Boolean recalculateInterest;
|
||||
public RescheduleReasonsCodeValue rescheduleReasonCodeValue;
|
||||
public RescheduleReasonsTimeline timeline;
|
||||
@Schema(example = "rescheduleReasonComment")
|
||||
public String rescheduleReasonComment;
|
||||
public Set<LoanTermVariationsData> loanTermVariationsData;
|
||||
}
|
||||
|
||||
@Schema(description = "PostCreateRescheduleLoansResponse ")
|
||||
public static final class PostCreateRescheduleLoansResponse {
|
||||
|
||||
private PostCreateRescheduleLoansResponse() {}
|
||||
|
||||
@Schema(example = "1")
|
||||
public Long officeId;
|
||||
@Schema(example = "12")
|
||||
public Long clientId;
|
||||
@Schema(example = "18")
|
||||
public Long loanId;
|
||||
@Schema(example = "12")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@Schema(description = "PostUpdateRescheduleLoansResponse ")
|
||||
public static final class PostUpdateRescheduleLoansResponse {
|
||||
|
||||
private PostUpdateRescheduleLoansResponse() {}
|
||||
|
||||
static final class PostUpdateRescheduleLoanChanges {
|
||||
|
||||
private PostUpdateRescheduleLoanChanges() {}
|
||||
|
||||
@Schema(example = "en")
|
||||
public String locale;
|
||||
@Schema(example = "en")
|
||||
public String dateFormat;
|
||||
@Schema(example = "05/02/2022")
|
||||
public String approvedOnDate;
|
||||
@Schema(example = "1")
|
||||
public Long approvedByUserId;
|
||||
}
|
||||
|
||||
@Schema(example = "1")
|
||||
public Long officeId;
|
||||
@Schema(example = "12")
|
||||
public Long clientId;
|
||||
@Schema(example = "18")
|
||||
public Long loanId;
|
||||
@Schema(example = "12")
|
||||
public Long resourceId;
|
||||
public PostUpdateRescheduleLoanChanges changes;
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -2332,7 +2332,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
public CollectionData retrieveLoanCollectionData(Long loanId) {
|
||||
final CollectionDataMapper mapper = new CollectionDataMapper(sqlGenerator);
|
||||
String sql = "select " + mapper.schema();
|
||||
CollectionData collectionData = this.jdbcTemplate.queryForObject(sql, mapper, loanId); // NOSONAR
|
||||
CollectionData collectionData = this.jdbcTemplate.queryForObject(sql, mapper, loanId, loanId); // NOSONAR
|
||||
return collectionData;
|
||||
}
|
||||
|
||||
@@ -2363,7 +2363,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
sqlBuilder.append(
|
||||
"left join (select lt.loan_id, lt.transaction_date as transactionDate, lt.amount as amount from m_loan_transaction lt ");
|
||||
sqlBuilder.append(
|
||||
"where lt.is_reversed = false and lt.transaction_type_enum=2 order by lt.transaction_date desc limit 1) lre on lre.loan_id = l.id ");
|
||||
"where lt.loan_id =? and lt.is_reversed = false and lt.transaction_type_enum=2 order by lt.transaction_date desc limit 1) lre on lre.loan_id = l.id ");
|
||||
sqlBuilder.append("where l.id=? ");
|
||||
return sqlBuilder.toString();
|
||||
}
|
||||
|
||||
+82
-66
@@ -228,10 +228,26 @@ final class SelfLoansApiResourceSwagger {
|
||||
public Integer id;
|
||||
@Schema(example = "[2013, 11, 1]")
|
||||
public LocalDate expectedDisbursementDate;
|
||||
@Schema(example = "[2022, 07, 01]")
|
||||
public LocalDate actualDisbursementDate;
|
||||
@Schema(example = "22000.000000")
|
||||
public Float principal;
|
||||
public Double principal;
|
||||
@Schema(example = "22000.000000")
|
||||
public Double netDisbursalAmount;
|
||||
@Schema(example = "1")
|
||||
public String loanChargeId;
|
||||
@Schema(example = "22000.000000")
|
||||
public Double chargeAmount;
|
||||
@Schema(example = "22000.000000")
|
||||
public Double waivedChargeAmount;
|
||||
@Schema(example = "22000.000000")
|
||||
public Float approvedPrincipal;
|
||||
@Schema(example = "dd MMMM yyyy")
|
||||
public String dateFormat;
|
||||
@Schema(example = "de_DE")
|
||||
public String locale;
|
||||
@Schema(example = "some note")
|
||||
public String note;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdOverdueCharges {
|
||||
@@ -337,78 +353,78 @@ final class SelfLoansApiResourceSwagger {
|
||||
}
|
||||
|
||||
public GetLoansLoanIdCurrency currency;
|
||||
@Schema(example = "1000000")
|
||||
public Long principalDisbursed;
|
||||
@Schema(example = "0")
|
||||
public Long principalPaid;
|
||||
@Schema(example = "0")
|
||||
public Long principalWrittenOff;
|
||||
@Schema(example = "1000000")
|
||||
public Long principalOutstanding;
|
||||
@Schema(example = "833333.3")
|
||||
@Schema(example = "1000000.000000")
|
||||
public Double principalDisbursed;
|
||||
@Schema(example = "0.000000")
|
||||
public Double principalPaid;
|
||||
@Schema(example = "0.000000")
|
||||
public Double principalWrittenOff;
|
||||
@Schema(example = "1000000.000000")
|
||||
public Double principalOutstanding;
|
||||
@Schema(example = "833333.300000")
|
||||
public Double principalOverdue;
|
||||
@Schema(example = "240000")
|
||||
public Long interestCharged;
|
||||
@Schema(example = "0")
|
||||
public Long interestPaid;
|
||||
@Schema(example = "0")
|
||||
public Long interestWaived;
|
||||
@Schema(example = "0")
|
||||
public Long interestWrittenOff;
|
||||
@Schema(example = "240000")
|
||||
public Long interestOutstanding;
|
||||
@Schema(example = "200000")
|
||||
public Long interestOverdue;
|
||||
@Schema(example = "18000")
|
||||
public Long feeChargesCharged;
|
||||
@Schema(example = "0")
|
||||
public Long feeChargesDueAtDisbursementCharged;
|
||||
@Schema(example = "0")
|
||||
public Long feeChargesPaid;
|
||||
@Schema(example = "0")
|
||||
public Long feeChargesWaived;
|
||||
@Schema(example = "0")
|
||||
public Long feeChargesWrittenOff;
|
||||
@Schema(example = "18000")
|
||||
public Long feeChargesOutstanding;
|
||||
@Schema(example = "15000")
|
||||
public Long feeChargesOverdue;
|
||||
@Schema(example = "0")
|
||||
public Long penaltyChargesCharged;
|
||||
@Schema(example = "0")
|
||||
public Long penaltyChargesPaid;
|
||||
@Schema(example = "0")
|
||||
public Long penaltyChargesWaived;
|
||||
@Schema(example = "0")
|
||||
public Long penaltyChargesWrittenOff;
|
||||
@Schema(example = "0")
|
||||
public Long penaltyChargesOutstanding;
|
||||
@Schema(example = "0")
|
||||
public Long penaltyChargesOverdue;
|
||||
@Schema(example = "1258000")
|
||||
public Long totalExpectedRepayment;
|
||||
@Schema(example = "0")
|
||||
public Long totalRepayment;
|
||||
@Schema(example = "258000")
|
||||
public Long totalExpectedCostOfLoan;
|
||||
@Schema(example = "0")
|
||||
public Long totalCostOfLoan;
|
||||
@Schema(example = "0")
|
||||
public Long totalWaived;
|
||||
@Schema(example = "0")
|
||||
public Long totalWrittenOff;
|
||||
@Schema(example = "1258000")
|
||||
public Long totalOutstanding;
|
||||
@Schema(example = "1048333.3")
|
||||
@Schema(example = "240000.000000")
|
||||
public Double interestCharged;
|
||||
@Schema(example = "0.000000")
|
||||
public Double interestPaid;
|
||||
@Schema(example = "0.000000")
|
||||
public Double interestWaived;
|
||||
@Schema(example = "0.000000")
|
||||
public Double interestWrittenOff;
|
||||
@Schema(example = "240000.000000")
|
||||
public Double interestOutstanding;
|
||||
@Schema(example = "200000.000000")
|
||||
public Double interestOverdue;
|
||||
@Schema(example = "18000.000000")
|
||||
public Double feeChargesCharged;
|
||||
@Schema(example = "0.000000")
|
||||
public Double feeChargesDueAtDisbursementCharged;
|
||||
@Schema(example = "0.000000")
|
||||
public Double feeChargesPaid;
|
||||
@Schema(example = "0.000000")
|
||||
public Double feeChargesWaived;
|
||||
@Schema(example = "0.000000")
|
||||
public Double feeChargesWrittenOff;
|
||||
@Schema(example = "18000.000000")
|
||||
public Double feeChargesOutstanding;
|
||||
@Schema(example = "15000.000000")
|
||||
public Double feeChargesOverdue;
|
||||
@Schema(example = "0.000000")
|
||||
public Double penaltyChargesCharged;
|
||||
@Schema(example = "0.000000")
|
||||
public Double penaltyChargesPaid;
|
||||
@Schema(example = "0.000000")
|
||||
public Double penaltyChargesWaived;
|
||||
@Schema(example = "0.000000")
|
||||
public Double penaltyChargesWrittenOff;
|
||||
@Schema(example = "0.000000")
|
||||
public Double penaltyChargesOutstanding;
|
||||
@Schema(example = "0.000000")
|
||||
public Double penaltyChargesOverdue;
|
||||
@Schema(example = "1258000.000000")
|
||||
public Double totalExpectedRepayment;
|
||||
@Schema(example = "0.000000")
|
||||
public Double totalRepayment;
|
||||
@Schema(example = "258000.000000")
|
||||
public Double totalExpectedCostOfLoan;
|
||||
@Schema(example = "0.000000")
|
||||
public Double totalCostOfLoan;
|
||||
@Schema(example = "0.000000")
|
||||
public Double totalWaived;
|
||||
@Schema(example = "0.000000")
|
||||
public Double totalWrittenOff;
|
||||
@Schema(example = "1258000.000000")
|
||||
public Double totalOutstanding;
|
||||
@Schema(example = "1048333.30000")
|
||||
public Double totalOverdue;
|
||||
@Schema(example = "[2012, 5, 10]")
|
||||
public LocalDate overdueSinceDate;
|
||||
public GetLoansLoanIdLinkedAccount linkedAccount;
|
||||
public Set<GetLoansLoanIdDisbursementDetails> disbursementDetails;
|
||||
@Schema(example = "1100.000000")
|
||||
public Float fixedEmiAmount;
|
||||
@Schema(example = "35000")
|
||||
public Long maxOutstandingLoanBalance;
|
||||
public Double fixedEmiAmount;
|
||||
@Schema(example = "35000.000000")
|
||||
public Double maxOutstandingLoanBalance;
|
||||
@Schema(example = "false")
|
||||
public Boolean canDisburse;
|
||||
public Set<GetLoansLoanIdEmiVariations> emiAmountVariations;
|
||||
|
||||
+3
@@ -32,6 +32,7 @@ import org.apache.fineract.batch.command.internal.ApproveLoanRescheduleCommandSt
|
||||
import org.apache.fineract.batch.command.internal.CollectChargesCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.CreateChargeCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.CreateClientCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.CreateLoanRescheduleRequestCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.CreateTransactionLoanCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.GetDatatableEntryByAppTableIdCommandStrategy;
|
||||
@@ -77,6 +78,8 @@ public class CommandStrategyProviderTest {
|
||||
mock(ApproveLoanCommandStrategy.class)),
|
||||
Arguments.of("loans/123?command=disburse", HttpMethod.POST, "disburseLoanCommandStrategy",
|
||||
mock(DisburseLoanCommandStrategy.class)),
|
||||
Arguments.of("rescheduleloans", HttpMethod.POST, "createLoanRescheduleRequestCommandStrategy",
|
||||
mock(CreateLoanRescheduleRequestCommandStrategy.class)),
|
||||
Arguments.of("rescheduleloans/123?command=approve", HttpMethod.POST, "approveLoanRescheduleCommandStrategy",
|
||||
mock(ApproveLoanRescheduleCommandStrategy.class)),
|
||||
Arguments.of("loans/123/transactions/123", HttpMethod.GET, "getTransactionByIdCommandStrategy",
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.batch.command.internal;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import javax.ws.rs.HttpMethod;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.portfolio.loanaccount.rescheduleloan.api.RescheduleLoansApiResource;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
/**
|
||||
* Test class fpr {@link CreateLoanRescheduleRequestCommandStrategy}.
|
||||
*/
|
||||
public class CreateLoanRescheduleRequestCommandStrategyTest {
|
||||
|
||||
/**
|
||||
* Test {@link CreateLoanRescheduleRequestCommandStrategy#execute} happy path scenario.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteSuccessScenario() {
|
||||
final TestContext testContext = new TestContext();
|
||||
final BatchRequest batchRequest = getBatchRequest();
|
||||
final String responseBody = "myResponseBody";
|
||||
|
||||
when(testContext.rescheduleLoansApiResource.createLoanRescheduleRequest(batchRequest.getBody())).thenReturn(responseBody);
|
||||
|
||||
BatchResponse batchResponse = testContext.subjectToTest.execute(batchRequest, testContext.uriInfo);
|
||||
|
||||
assertEquals(HttpStatus.SC_OK, batchResponse.getStatusCode());
|
||||
assertSame(responseBody, batchResponse.getBody());
|
||||
assertEquals(batchRequest.getRequestId(), batchResponse.getRequestId());
|
||||
assertEquals(batchRequest.getHeaders(), batchResponse.getHeaders());
|
||||
|
||||
verify(testContext.rescheduleLoansApiResource).createLoanRescheduleRequest(batchRequest.getBody());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a request with the given loan id and command value.
|
||||
*
|
||||
*
|
||||
* @return BatchRequest
|
||||
*/
|
||||
private BatchRequest getBatchRequest() {
|
||||
|
||||
final BatchRequest br = new BatchRequest();
|
||||
String relativeUrl = "rescheduleloans";
|
||||
|
||||
br.setRequestId(Long.valueOf(RandomStringUtils.randomNumeric(5)));
|
||||
br.setRelativeUrl(relativeUrl);
|
||||
br.setMethod(HttpMethod.POST);
|
||||
br.setReference(Long.valueOf(RandomStringUtils.randomNumeric(5)));
|
||||
br.setBody("{}");
|
||||
|
||||
return br;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private test context class used since testng runs in parallel to avoid state between tests
|
||||
*/
|
||||
private static class TestContext {
|
||||
|
||||
/**
|
||||
* Mock URI info.
|
||||
*/
|
||||
@Mock
|
||||
private UriInfo uriInfo;
|
||||
|
||||
/**
|
||||
* Mock reschedule loans API resource.
|
||||
*/
|
||||
@Mock
|
||||
private RescheduleLoansApiResource rescheduleLoansApiResource;
|
||||
|
||||
/**
|
||||
* The {@link CreateLoanRescheduleRequestCommandStrategy} under test.
|
||||
*/
|
||||
private final CreateLoanRescheduleRequestCommandStrategy subjectToTest;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
TestContext() {
|
||||
MockitoAnnotations.openMocks(this);
|
||||
subjectToTest = new CreateLoanRescheduleRequestCommandStrategy(rescheduleLoansApiResource);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user