FINERACT-2169: Upgrade charge api to dto;
This commit is contained in:
committed by
Adam Saghy
parent
b698d7247b
commit
2f5ae610d1
+27
-64
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.charge.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
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;
|
||||
@@ -38,10 +37,7 @@ import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.UriInfo;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
@@ -52,6 +48,7 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.portfolio.charge.data.ChargeData;
|
||||
import org.apache.fineract.portfolio.charge.request.ChargeRequest;
|
||||
import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -63,12 +60,6 @@ import org.springframework.stereotype.Component;
|
||||
@RequiredArgsConstructor
|
||||
public class ChargesApiResource {
|
||||
|
||||
private static final Set<String> CHARGES_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "amount", "currency", "penalty",
|
||||
"active", "chargeAppliesTo", "chargeTimeType", "chargeCalculationType", "chargeCalculationTypeOptions",
|
||||
"chargeAppliesToOptions", "chargeTimeTypeOptions", "currencyOptions", "loanChargeCalculationTypeOptions",
|
||||
"loanChargeTimeTypeOptions", "savingsChargeCalculationTypeOptions", "savingsChargeTimeTypeOptions", "incomeAccount",
|
||||
"clientChargeCalculationTypeOptions", "clientChargeTimeTypeOptions"));
|
||||
|
||||
private static final String RESOURCE_NAME_FOR_PERMISSIONS = "CHARGE";
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -82,16 +73,9 @@ public class ChargesApiResource {
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Operation(summary = "Retrieve Charges", description = "Returns the list of defined charges.\n" + "\n" + "Example Requests:\n" + "\n"
|
||||
+ "charges")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ChargesApiResourceSwagger.GetChargesResponse.class)))) })
|
||||
public String retrieveAllCharges(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||
|
||||
final Collection<ChargeData> charges = this.readPlatformService.retrieveAllCharges();
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, charges, CHARGES_DATA_PARAMETERS);
|
||||
public List<ChargeData> retrieveAllCharges() {
|
||||
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||
return readPlatformService.retrieveAllCharges();
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -100,22 +84,18 @@ public class ChargesApiResource {
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Operation(summary = "Retrieve a Charge", description = "Returns the details of a defined Charge.\n" + "\n" + "Example Requests:\n"
|
||||
+ "\n" + "charges/1")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.GetChargesResponse.class))) })
|
||||
public String retrieveCharge(@PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId,
|
||||
public ChargeData retrieveCharge(@PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId,
|
||||
@Context final UriInfo uriInfo) {
|
||||
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
|
||||
ChargeData charge = this.readPlatformService.retrieveCharge(chargeId);
|
||||
ChargeData charge = readPlatformService.retrieveCharge(chargeId);
|
||||
if (settings.isTemplate()) {
|
||||
final ChargeData templateData = this.readPlatformService.retrieveNewChargeDetails();
|
||||
final ChargeData templateData = readPlatformService.retrieveNewChargeDetails();
|
||||
charge = ChargeData.withTemplate(charge, templateData);
|
||||
}
|
||||
|
||||
return this.toApiJsonSerializer.serialize(settings, charge, CHARGES_DATA_PARAMETERS);
|
||||
return charge;
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -124,32 +104,22 @@ public class ChargesApiResource {
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Operation(summary = "Retrieve Charge Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n"
|
||||
+ "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "Example Request:\n" + "\n" + "charges/template\n")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.GetChargesTemplateResponse.class))) })
|
||||
public String retrieveNewChargeDetails(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||
|
||||
final ChargeData charge = this.readPlatformService.retrieveNewChargeDetails();
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, charge, CHARGES_DATA_PARAMETERS);
|
||||
public ChargeData retrieveNewChargeDetails() {
|
||||
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||
return readPlatformService.retrieveNewChargeDetails();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Operation(summary = "Create/Define a Charge", description = "Define a new charge that can later be associated with loans and savings through their respective product definitions or directly on each account instance.")
|
||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.PostChargesRequest.class)))
|
||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = ChargeRequest.class)))
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.PostChargesResponse.class))) })
|
||||
public String createCharge(@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createCharge().withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
public CommandProcessingResult createCharge(@Parameter(hidden = true) ChargeRequest chargeRequest) {
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createCharge()
|
||||
.withJson(toApiJsonSerializer.serialize(chargeRequest)).build();
|
||||
return commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
}
|
||||
|
||||
@PUT
|
||||
@@ -157,17 +127,14 @@ public class ChargesApiResource {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Operation(summary = "Update a Charge", description = "Updates the details of a Charge.")
|
||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.PutChargesChargeIdRequest.class)))
|
||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = ChargeRequest.class)))
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.PutChargesChargeIdResponse.class))) })
|
||||
public String updateCharge(@PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId,
|
||||
@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCharge(chargeId).withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
public CommandProcessingResult updateCharge(@PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId,
|
||||
@Parameter(hidden = true) ChargeRequest chargeRequest) {
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCharge(chargeId)
|
||||
.withJson(toApiJsonSerializer.serialize(chargeRequest)).build();
|
||||
return commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@@ -176,12 +143,8 @@ public class ChargesApiResource {
|
||||
@Operation(summary = "Delete a Charge", description = "Deletes a Charge.")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.DeleteChargesChargeIdResponse.class))) })
|
||||
public String deleteCharge(@PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId) {
|
||||
|
||||
public CommandProcessingResult deleteCharge(@PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId) {
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteCharge(chargeId).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
return commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
}
|
||||
}
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* 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.charge.request;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class ChargeRequest implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer chargeAppliesTo;
|
||||
private String name;
|
||||
private String currencyCode;
|
||||
private Integer chargeTimeType;
|
||||
private Integer chargeCalculationType;
|
||||
private Double amount;
|
||||
private Boolean active;
|
||||
private Boolean penalty;
|
||||
private Integer chargePaymentMode;
|
||||
private String monthDayFormat;
|
||||
private String locale;
|
||||
private String feeOnMonthDay;
|
||||
private String feeInterval;
|
||||
private String feeFrequency;
|
||||
private Long paymentTypeId;
|
||||
private Boolean enablePaymentType;
|
||||
|
||||
}
|
||||
+14
-15
@@ -18,16 +18,15 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.charge.service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.portfolio.charge.data.ChargeData;
|
||||
import org.apache.fineract.portfolio.charge.domain.ChargeTimeType;
|
||||
|
||||
public interface ChargeReadPlatformService {
|
||||
|
||||
Collection<ChargeData> retrieveAllCharges();
|
||||
List<ChargeData> retrieveAllCharges();
|
||||
|
||||
Collection<ChargeData> retrieveAllChargesForCurrency(String currencyCode);
|
||||
List<ChargeData> retrieveAllChargesForCurrency(String currencyCode);
|
||||
|
||||
ChargeData retrieveCharge(Long chargeId);
|
||||
|
||||
@@ -38,14 +37,14 @@ public interface ChargeReadPlatformService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Collection<ChargeData> retrieveAllChargesApplicableToClients();
|
||||
List<ChargeData> retrieveAllChargesApplicableToClients();
|
||||
|
||||
/**
|
||||
* Returns all Fees (excluding penalties) applicable for loans
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Collection<ChargeData> retrieveLoanApplicableFees();
|
||||
List<ChargeData> retrieveLoanApplicableFees();
|
||||
|
||||
/**
|
||||
* Returns all charges applicable for a given loan account
|
||||
@@ -63,14 +62,14 @@ public interface ChargeReadPlatformService {
|
||||
* Excludes Given List of Charge Types from the response
|
||||
* @return
|
||||
*/
|
||||
Collection<ChargeData> retrieveLoanProductApplicableCharges(Long loanProductId, ChargeTimeType[] excludeChargeTimes);
|
||||
List<ChargeData> retrieveLoanProductApplicableCharges(Long loanProductId, ChargeTimeType[] excludeChargeTimes);
|
||||
|
||||
/**
|
||||
* Returns all Penalties applicable for loans
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Collection<ChargeData> retrieveLoanApplicablePenalties();
|
||||
List<ChargeData> retrieveLoanApplicablePenalties();
|
||||
|
||||
/**
|
||||
* Returns all Charges associated with a given Loan Product
|
||||
@@ -78,7 +77,7 @@ public interface ChargeReadPlatformService {
|
||||
* @param loanProductId
|
||||
* @return
|
||||
*/
|
||||
Collection<ChargeData> retrieveLoanProductCharges(Long loanProductId);
|
||||
List<ChargeData> retrieveLoanProductCharges(Long loanProductId);
|
||||
|
||||
/**
|
||||
* Returns all charges applicable for a given loan product
|
||||
@@ -88,7 +87,7 @@ public interface ChargeReadPlatformService {
|
||||
* Filters based on the type of the charge to be returned
|
||||
* @return
|
||||
*/
|
||||
Collection<ChargeData> retrieveLoanProductCharges(Long loanProductId, ChargeTimeType chargeTime);
|
||||
List<ChargeData> retrieveLoanProductCharges(Long loanProductId, ChargeTimeType chargeTime);
|
||||
|
||||
/**
|
||||
* Returns all charges applicable for savings
|
||||
@@ -96,14 +95,14 @@ public interface ChargeReadPlatformService {
|
||||
* @param feeChargesOnly
|
||||
* @return
|
||||
*/
|
||||
Collection<ChargeData> retrieveSavingsProductApplicableCharges(boolean feeChargesOnly);
|
||||
List<ChargeData> retrieveSavingsProductApplicableCharges(boolean feeChargesOnly);
|
||||
|
||||
/**
|
||||
* Returns all penalties applicable for savings
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Collection<ChargeData> retrieveSavingsApplicablePenalties();
|
||||
List<ChargeData> retrieveSavingsApplicablePenalties();
|
||||
|
||||
/**
|
||||
* Returns all charges applicable for a given savings product
|
||||
@@ -111,15 +110,15 @@ public interface ChargeReadPlatformService {
|
||||
* @param savingsProductId
|
||||
* @return
|
||||
*/
|
||||
Collection<ChargeData> retrieveSavingsProductCharges(Long savingsProductId);
|
||||
List<ChargeData> retrieveSavingsProductCharges(Long savingsProductId);
|
||||
|
||||
/** Retrieve savings account charges **/
|
||||
Collection<ChargeData> retrieveSavingsAccountApplicableCharges(Long savingsId);
|
||||
List<ChargeData> retrieveSavingsAccountApplicableCharges(Long savingsId);
|
||||
|
||||
/**
|
||||
* Returns charge definitions which are applicable for shares
|
||||
*/
|
||||
Collection<ChargeData> retrieveSharesApplicableCharges();
|
||||
List<ChargeData> retrieveSharesApplicableCharges();
|
||||
|
||||
Collection<ChargeData> retrieveShareProductCharges(Long shareProductId);
|
||||
List<ChargeData> retrieveShareProductCharges(Long shareProductId);
|
||||
}
|
||||
|
||||
+18
-18
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.test.initializer.global;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.client.models.PostChargesRequest;
|
||||
import org.apache.fineract.client.models.ChargeRequest;
|
||||
import org.apache.fineract.client.models.PostChargesResponse;
|
||||
import org.apache.fineract.client.services.ChargesApi;
|
||||
import org.apache.fineract.test.data.ChargeCalculationType;
|
||||
@@ -74,52 +74,52 @@ public class ChargeGlobalInitializerStep implements FineractGlobalInitializerSte
|
||||
@Override
|
||||
public void initialize() throws Exception {
|
||||
// Loan - % late (overdue) fee
|
||||
PostChargesRequest requestLoanPercentLate = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_PERCENTAGE_LATE_FEE,
|
||||
ChargeRequest requestLoanPercentLate = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_PERCENTAGE_LATE_FEE,
|
||||
CHARGE_TIME_TYPE_OVERDUE_FEES, CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, CHARGE_AMOUNT_OVERDUE_PERCENTAGE, true, true);
|
||||
Response<PostChargesResponse> responseLoanPercentLate = chargesApi.createCharge(requestLoanPercentLate).execute();
|
||||
TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_PERCENT_LATE_CREATE_RESPONSE, responseLoanPercentLate);
|
||||
|
||||
// Loan - % processing fee
|
||||
PostChargesRequest requestLoanPercentProcessing = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN,
|
||||
CHARGE_LOAN_PERCENTAGE_PROCESSING_FEE, CHARGE_TIME_TYPE_SPECIFIED_DUE_DATE,
|
||||
CHARGE_CALCULATION_TYPE_PERCENTAGE_LOAN_AMOUNT_PLUS_INTEREST, CHARGE_AMOUNT_PERCENTAGE, true, false);
|
||||
ChargeRequest requestLoanPercentProcessing = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_PERCENTAGE_PROCESSING_FEE,
|
||||
CHARGE_TIME_TYPE_SPECIFIED_DUE_DATE, CHARGE_CALCULATION_TYPE_PERCENTAGE_LOAN_AMOUNT_PLUS_INTEREST, CHARGE_AMOUNT_PERCENTAGE,
|
||||
true, false);
|
||||
Response<PostChargesResponse> responseLoanPercentProcessing = chargesApi.createCharge(requestLoanPercentProcessing).execute();
|
||||
TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_PERCENT_PROCESSING_CREATE_RESPONSE, responseLoanPercentProcessing);
|
||||
|
||||
// Loan - fixed late (overdue) fee
|
||||
PostChargesRequest requestLoanFixedLate = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_FIXED_LATE_FEE,
|
||||
ChargeRequest requestLoanFixedLate = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_FIXED_LATE_FEE,
|
||||
CHARGE_TIME_TYPE_OVERDUE_FEES, CHARGE_CALCULATION_TYPE_FLAT, CHARGE_AMOUNT_FLAT, true, true);
|
||||
Response<PostChargesResponse> responseLoanFixedLate = chargesApi.createCharge(requestLoanFixedLate).execute();
|
||||
TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_FIXED_LATE_CREATE_RESPONSE, responseLoanFixedLate);
|
||||
|
||||
// Loan - fixed returned payment fee
|
||||
PostChargesRequest requestLoanFixedReturnedPayment = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN,
|
||||
ChargeRequest requestLoanFixedReturnedPayment = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN,
|
||||
CHARGE_LOAN_FIXED_RETURNED_PAYMENT_FEE, CHARGE_TIME_TYPE_SPECIFIED_DUE_DATE, CHARGE_CALCULATION_TYPE_FLAT,
|
||||
CHARGE_AMOUNT_FLAT, true, false);
|
||||
Response<PostChargesResponse> responseLoanFixedReturnedPayment = chargesApi.createCharge(requestLoanFixedReturnedPayment).execute();
|
||||
TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_FIXED_RETURNED_PAYMENT_CREATE_RESPONSE, responseLoanFixedReturnedPayment);
|
||||
|
||||
// Loan - snooze fee
|
||||
PostChargesRequest requestLoanSnooze = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_SNOOZE_FEE,
|
||||
ChargeRequest requestLoanSnooze = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_SNOOZE_FEE,
|
||||
CHARGE_TIME_TYPE_SPECIFIED_DUE_DATE, CHARGE_CALCULATION_TYPE_FLAT, CHARGE_AMOUNT_FLAT, true, false);
|
||||
Response<PostChargesResponse> responseLoanSnooze = chargesApi.createCharge(requestLoanSnooze).execute();
|
||||
TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_SNOOZE_FEE_CREATE_RESPONSE, responseLoanSnooze);
|
||||
|
||||
// Loan - NSF fee
|
||||
PostChargesRequest requestLoanNsf = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_NSF_FEE,
|
||||
ChargeRequest requestLoanNsf = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_NSF_FEE,
|
||||
CHARGE_TIME_TYPE_SPECIFIED_DUE_DATE, CHARGE_CALCULATION_TYPE_FLAT, CHARGE_AMOUNT_FLAT, true, true);
|
||||
Response<PostChargesResponse> responseLoanNsf = chargesApi.createCharge(requestLoanNsf).execute();
|
||||
TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_NSF_FEE_CREATE_RESPONSE, responseLoanNsf);
|
||||
|
||||
// Loan - Disbursement % fee
|
||||
PostChargesRequest requestLoanDisbursePercent = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_DISBURSEMENT_PERCENT_FEE,
|
||||
ChargeRequest requestLoanDisbursePercent = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_DISBURSEMENT_PERCENT_FEE,
|
||||
CHARGE_TIME_TYPE_DISBURSEMENT, CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, CHARGE_AMOUNT_DISBURSEMENT_PERCENTAGE, true,
|
||||
false);
|
||||
Response<PostChargesResponse> responseLoanDisbursePercent = chargesApi.createCharge(requestLoanDisbursePercent).execute();
|
||||
TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_DISBURSEMENET_FEE_CREATE_RESPONSE, responseLoanDisbursePercent);
|
||||
|
||||
// Loan - Tranche Disbursement % fee
|
||||
PostChargesRequest requestLoanTrancheDisbursePercent = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN,
|
||||
ChargeRequest requestLoanTrancheDisbursePercent = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN,
|
||||
CHARGE_LOAN_TRANCHE_DISBURSEMENT_PERCENT_FEE, CHARGE_TIME_TYPE_TRANCHE_DISBURSEMENT,
|
||||
CHARGE_CALCULATION_TYPE_PERCENTAGE_DISBURSEMENT_AMOUNT, CHARGE_AMOUNT_DISBURSEMENT_PERCENTAGE, true, false);
|
||||
Response<PostChargesResponse> responseLoanTrancheDisbursePercent = chargesApi.createCharge(requestLoanTrancheDisbursePercent)
|
||||
@@ -127,14 +127,14 @@ public class ChargeGlobalInitializerStep implements FineractGlobalInitializerSte
|
||||
TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_DISBURSEMENET_FEE_CREATE_RESPONSE, responseLoanTrancheDisbursePercent);
|
||||
|
||||
// Loan - Installment % fee
|
||||
PostChargesRequest requestLoanInstallmentPercent = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN,
|
||||
CHARGE_LOAN_INSTALLMENT_PERCENT_FEE, CHARGE_TIME_TYPE_INSTALLMENT,
|
||||
CHARGE_CALCULATION_TYPE_PERCENTAGE_LOAN_AMOUNT_PLUS_INTEREST, CHARGE_AMOUNT_INSTALLMENT_PERCENTAGE, true, false);
|
||||
ChargeRequest requestLoanInstallmentPercent = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_INSTALLMENT_PERCENT_FEE,
|
||||
CHARGE_TIME_TYPE_INSTALLMENT, CHARGE_CALCULATION_TYPE_PERCENTAGE_LOAN_AMOUNT_PLUS_INTEREST,
|
||||
CHARGE_AMOUNT_INSTALLMENT_PERCENTAGE, true, false);
|
||||
Response<PostChargesResponse> responseLoanInstallmentPercent = chargesApi.createCharge(requestLoanInstallmentPercent).execute();
|
||||
TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_INSTALLMENT_FEE_CREATE_RESPONSE, responseLoanInstallmentPercent);
|
||||
|
||||
// Loan - % late (overdue) fee amount+interest
|
||||
PostChargesRequest requestLoanPercentAmountPlusInterestLate = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN,
|
||||
ChargeRequest requestLoanPercentAmountPlusInterestLate = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN,
|
||||
CHARGE_LOAN_PERCENTAGE_LATE_FEE_AMOUNT_PLUS_INTEREST, CHARGE_TIME_TYPE_OVERDUE_FEES,
|
||||
CHARGE_CALCULATION_TYPE_PERCENTAGE_LOAN_AMOUNT_PLUS_INTEREST, CHARGE_AMOUNT_OVERDUE_PERCENTAGE, true, true);
|
||||
Response<PostChargesResponse> responseLoanPercentAmountPlusInterestLate = chargesApi
|
||||
@@ -143,15 +143,15 @@ public class ChargeGlobalInitializerStep implements FineractGlobalInitializerSte
|
||||
responseLoanPercentAmountPlusInterestLate);
|
||||
|
||||
// Client - fixed fee
|
||||
PostChargesRequest requestClientFixed = defaultChargesRequest(CHARGE_APPLIES_TO_CLIENT, CHARGE_CLIENT_FIXED_FEE,
|
||||
ChargeRequest requestClientFixed = defaultChargesRequest(CHARGE_APPLIES_TO_CLIENT, CHARGE_CLIENT_FIXED_FEE,
|
||||
CHARGE_TIME_TYPE_SPECIFIED_DUE_DATE, CHARGE_CALCULATION_TYPE_FLAT, CHARGE_AMOUNT_FLAT, true, false);
|
||||
Response<PostChargesResponse> responseClientFixed = chargesApi.createCharge(requestClientFixed).execute();
|
||||
TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_CLIENT_FIXED_FEE_CREATE_RESPONSE, responseClientFixed);
|
||||
}
|
||||
|
||||
public static PostChargesRequest defaultChargesRequest(Enum<ChargeProductAppliesTo> appliesTo, String name, Integer chargeTimeType,
|
||||
public static ChargeRequest defaultChargesRequest(Enum<ChargeProductAppliesTo> appliesTo, String name, Integer chargeTimeType,
|
||||
Integer chargeCalculationType, Double amount, Boolean isActive, Boolean isPenalty) throws Exception {
|
||||
PostChargesRequest request = new PostChargesRequest();
|
||||
ChargeRequest request = new ChargeRequest();
|
||||
Integer chargeAppliesTo;
|
||||
|
||||
if (appliesTo.equals(ChargeProductAppliesTo.CLIENT)) {
|
||||
|
||||
+14
-14
@@ -71,7 +71,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
|
||||
@Override
|
||||
@Cacheable(value = "charges", key = "T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('ch')")
|
||||
public Collection<ChargeData> retrieveAllCharges() {
|
||||
public List<ChargeData> retrieveAllCharges() {
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
|
||||
String sql = "select " + rm.chargeSchema() + " where c.is_deleted=false ";
|
||||
@@ -84,7 +84,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveAllChargesForCurrency(String currencyCode) {
|
||||
public List<ChargeData> retrieveAllChargesForCurrency(String currencyCode) {
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
|
||||
String sql = "select " + rm.chargeSchema() + " where c.is_deleted=false and c.currency_code= ? ";
|
||||
@@ -155,7 +155,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveLoanProductCharges(final Long loanProductId) {
|
||||
public List<ChargeData> retrieveLoanProductCharges(final Long loanProductId) {
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
|
||||
String sql = "select " + rm.loanProductChargeSchema() + " where c.is_deleted=false and c.is_active=true and plc.product_loan_id=? ";
|
||||
@@ -166,7 +166,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveLoanProductCharges(final Long loanProductId, final ChargeTimeType chargeTime) {
|
||||
public List<ChargeData> retrieveLoanProductCharges(final Long loanProductId, final ChargeTimeType chargeTime) {
|
||||
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
|
||||
@@ -178,7 +178,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveLoanApplicableFees() {
|
||||
public List<ChargeData> retrieveLoanApplicableFees() {
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
Object[] params = new Object[] { ChargeAppliesTo.LOAN.getValue() };
|
||||
String sql = "select " + rm.chargeSchema()
|
||||
@@ -225,7 +225,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveLoanProductApplicableCharges(final Long loanProductId, ChargeTimeType[] excludeChargeTimes) {
|
||||
public List<ChargeData> retrieveLoanProductApplicableCharges(final Long loanProductId, ChargeTimeType[] excludeChargeTimes) {
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
StringBuilder excludeClause = new StringBuilder("");
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
@@ -242,7 +242,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveLoanApplicablePenalties() {
|
||||
public List<ChargeData> retrieveLoanApplicablePenalties() {
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
|
||||
String sql = "select " + rm.chargeSchema()
|
||||
@@ -386,7 +386,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveSavingsProductApplicableCharges(final boolean feeChargesOnly) {
|
||||
public List<ChargeData> retrieveSavingsProductApplicableCharges(final boolean feeChargesOnly) {
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
|
||||
String sql = "select " + rm.chargeSchema() + " where c.is_deleted=false and c.is_active=true and c.charge_applies_to_enum=? ";
|
||||
@@ -401,7 +401,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveSavingsApplicablePenalties() {
|
||||
public List<ChargeData> retrieveSavingsApplicablePenalties() {
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
|
||||
String sql = "select " + rm.chargeSchema()
|
||||
@@ -412,7 +412,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveSavingsProductCharges(final Long savingsProductId) {
|
||||
public List<ChargeData> retrieveSavingsProductCharges(final Long savingsProductId) {
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
|
||||
String sql = "select " + rm.savingsProductChargeSchema()
|
||||
@@ -423,7 +423,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveShareProductCharges(final Long shareProductId) {
|
||||
public List<ChargeData> retrieveShareProductCharges(final Long shareProductId) {
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
|
||||
String sql = "select " + rm.shareProductChargeSchema() + " where c.is_deleted=false and c.is_active=true and mspc.product_id=? ";
|
||||
@@ -433,7 +433,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveSavingsAccountApplicableCharges(Long savingsAccountId) {
|
||||
public List<ChargeData> retrieveSavingsAccountApplicableCharges(Long savingsAccountId) {
|
||||
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
|
||||
@@ -446,7 +446,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveAllChargesApplicableToClients() {
|
||||
public List<ChargeData> retrieveAllChargesApplicableToClients() {
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
String sql = "select " + rm.chargeSchema() + " where c.is_deleted=false and c.is_active=true and c.charge_applies_to_enum=? ";
|
||||
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
|
||||
@@ -456,7 +456,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveSharesApplicableCharges() {
|
||||
public List<ChargeData> retrieveSharesApplicableCharges() {
|
||||
final ChargeMapper rm = new ChargeMapper();
|
||||
String sql = "select " + rm.chargeSchema() + " where c.is_deleted=false and c.is_active=true and c.charge_applies_to_enum=? ";
|
||||
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
|
||||
|
||||
+4
-4
@@ -24,8 +24,8 @@ import java.math.BigDecimal;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.client.models.ChargeRequest;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdResponse;
|
||||
import org.apache.fineract.client.models.PostChargesRequest;
|
||||
import org.apache.fineract.client.models.PostChargesResponse;
|
||||
import org.apache.fineract.client.models.PostClientsResponse;
|
||||
import org.apache.fineract.client.models.PostLoanProductsResponse;
|
||||
@@ -63,9 +63,9 @@ public class AccrualsOnLoanClosureTest extends BaseLoanIntegrationTest {
|
||||
Assertions.assertNotNull(loanId);
|
||||
disburseLoan(loanId, BigDecimal.valueOf(disbursementAmount), disbursementDate);
|
||||
|
||||
penaltyResponse = chargesHelper.createCharges(new PostChargesRequest().active(true).chargeTimeType(2).chargeAppliesTo(1)
|
||||
.chargeCalculationType(1).penalty(true).amount(20.0).currencyCode("USD").locale("en").chargePaymentMode(0)
|
||||
.name(Utils.randomStringGenerator("PENALTY_", 6)));
|
||||
penaltyResponse = chargesHelper.createCharges(
|
||||
new ChargeRequest().active(true).chargeTimeType(2).chargeAppliesTo(1).chargeCalculationType(1).penalty(true).amount(20.0)
|
||||
.currencyCode("USD").locale("en").chargePaymentMode(0).name(Utils.randomStringGenerator("PENALTY_", 6)));
|
||||
runAt(startDate, () -> {
|
||||
globalConfigurationHelper.updateGlobalConfiguration(CHARGE_ACCRUAL_DATE,
|
||||
new PutGlobalConfigurationsRequest().stringValue("submitted-date"));
|
||||
|
||||
+4
-4
@@ -56,6 +56,7 @@ import java.util.UUID;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountType;
|
||||
import org.apache.fineract.client.models.AllowAttributeOverrides;
|
||||
import org.apache.fineract.client.models.BusinessDateRequest;
|
||||
import org.apache.fineract.client.models.ChargeRequest;
|
||||
import org.apache.fineract.client.models.GetJournalEntriesTransactionIdResponse;
|
||||
import org.apache.fineract.client.models.GetLoanTransactionRelation;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdLoanTransactionRelation;
|
||||
@@ -65,7 +66,6 @@ import org.apache.fineract.client.models.GetLoansLoanIdSummary;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdTransactions;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse;
|
||||
import org.apache.fineract.client.models.JournalEntryTransactionItem;
|
||||
import org.apache.fineract.client.models.PostChargesRequest;
|
||||
import org.apache.fineract.client.models.PostChargesResponse;
|
||||
import org.apache.fineract.client.models.PostClientsRequest;
|
||||
import org.apache.fineract.client.models.PostClientsResponse;
|
||||
@@ -5472,13 +5472,13 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest {
|
||||
.name(Utils.uniqueRandomStringGenerator("UNIQUE_PENALTY_INCOME" + Calendar.getInstance().getTimeInMillis(), 5))
|
||||
.usage(1));
|
||||
|
||||
PostChargesResponse penaltyCharge = CHARGES_HELPER.createCharges(new PostChargesRequest().penalty(true).amount(10.0)
|
||||
PostChargesResponse penaltyCharge = CHARGES_HELPER.createCharges(new ChargeRequest().penalty(true).amount(10.0)
|
||||
.chargeCalculationType(ChargeCalculationType.FLAT.getValue())
|
||||
.chargeTimeType(ChargeTimeType.SPECIFIED_DUE_DATE.getValue()).chargePaymentMode(ChargePaymentMode.REGULAR.getValue())
|
||||
.currencyCode("USD").name(Utils.randomStringGenerator("PENALTY_" + Calendar.getInstance().getTimeInMillis(), 5))
|
||||
.chargeAppliesTo(1).locale("en").active(true));
|
||||
|
||||
PostChargesResponse feeCharge = CHARGES_HELPER.createCharges(new PostChargesRequest().penalty(false).amount(9.0)
|
||||
PostChargesResponse feeCharge = CHARGES_HELPER.createCharges(new ChargeRequest().penalty(false).amount(9.0)
|
||||
.chargeCalculationType(ChargeCalculationType.FLAT.getValue())
|
||||
.chargeTimeType(ChargeTimeType.SPECIFIED_DUE_DATE.getValue()).chargePaymentMode(ChargePaymentMode.REGULAR.getValue())
|
||||
.currencyCode("USD").name(Utils.randomStringGenerator("FEE_" + Calendar.getInstance().getTimeInMillis(), 5))
|
||||
@@ -6964,7 +6964,7 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest {
|
||||
PostLoanProductsRequest loanProductsRequest = createOnePeriod30DaysLongNoInterestPeriodicAccrualProduct();
|
||||
final PostLoanProductsResponse loanProductResponse = LOAN_PRODUCT_HELPER.createLoanProduct(loanProductsRequest);
|
||||
LOG.info("-----------------------------------CREATE CHARGES-----------------------------------------");
|
||||
PostChargesResponse penaltyCharge = CHARGES_HELPER.createCharges(new PostChargesRequest().penalty(true).amount(10.0)
|
||||
PostChargesResponse penaltyCharge = CHARGES_HELPER.createCharges(new ChargeRequest().penalty(true).amount(10.0)
|
||||
.chargeCalculationType(ChargeCalculationType.FLAT.getValue())
|
||||
.chargeTimeType(ChargeTimeType.SPECIFIED_DUE_DATE.getValue()).chargePaymentMode(ChargePaymentMode.REGULAR.getValue())
|
||||
.currencyCode("USD").name(Utils.randomStringGenerator("PENALTY_" + Calendar.getInstance().getTimeInMillis(), 5))
|
||||
|
||||
+2
-2
@@ -36,8 +36,8 @@ import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.client.models.BusinessDateRequest;
|
||||
import org.apache.fineract.client.models.ChargeRequest;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdResponse;
|
||||
import org.apache.fineract.client.models.PostChargesRequest;
|
||||
import org.apache.fineract.client.models.PostChargesResponse;
|
||||
import org.apache.fineract.client.models.PostClientsResponse;
|
||||
import org.apache.fineract.client.models.PostLoansLoanIdChargesRequest;
|
||||
@@ -439,7 +439,7 @@ public class LoanSpecificDueDateChargeAfterMaturityTest extends BaseLoanIntegrat
|
||||
BUSINESS_DATE_HELPER.updateBusinessDate(new BusinessDateRequest().type(BusinessDateType.BUSINESS_DATE.getName())
|
||||
.date("01 September 2023").dateFormat(DATETIME_PATTERN).locale("en"));
|
||||
|
||||
PostChargesResponse penaltyCharge = CHARGES_HELPER.createCharges(new PostChargesRequest().penalty(true).amount(10.0)
|
||||
PostChargesResponse penaltyCharge = CHARGES_HELPER.createCharges(new ChargeRequest().penalty(true).amount(10.0)
|
||||
.chargeCalculationType(ChargeCalculationType.FLAT.getValue())
|
||||
.chargeTimeType(ChargeTimeType.SPECIFIED_DUE_DATE.getValue()).chargePaymentMode(ChargePaymentMode.REGULAR.getValue())
|
||||
.currencyCode("USD").name(Utils.randomStringGenerator("PENALTY_" + Calendar.getInstance().getTimeInMillis(), 5))
|
||||
|
||||
+3
-3
@@ -36,12 +36,12 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import org.apache.fineract.client.models.AdvancedPaymentData;
|
||||
import org.apache.fineract.client.models.AllowAttributeOverrides;
|
||||
import org.apache.fineract.client.models.ChargeData;
|
||||
import org.apache.fineract.client.models.ChargeRequest;
|
||||
import org.apache.fineract.client.models.ChargeToGLAccountMapper;
|
||||
import org.apache.fineract.client.models.GetLoanFeeToIncomeAccountMappings;
|
||||
import org.apache.fineract.client.models.GetLoanPaymentChannelToFundSourceMappings;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdResponse;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdStatus;
|
||||
import org.apache.fineract.client.models.PostChargesRequest;
|
||||
import org.apache.fineract.client.models.PostChargesResponse;
|
||||
import org.apache.fineract.client.models.PostClientsResponse;
|
||||
import org.apache.fineract.client.models.PostLoanProductsRequest;
|
||||
@@ -1551,7 +1551,7 @@ public class LoanTransactionAccrualActivityPostingTest extends BaseLoanIntegrati
|
||||
|
||||
private void chargeFee(Long loanId, Double amount, String dueDate) {
|
||||
LOG.info("Charge FEE amount {} dueDate {}", amount, dueDate);
|
||||
PostChargesResponse feeCharge = chargesHelper.createCharges(new PostChargesRequest().penalty(false).amount(9.0)
|
||||
PostChargesResponse feeCharge = chargesHelper.createCharges(new ChargeRequest().penalty(false).amount(9.0)
|
||||
.chargeCalculationType(ChargeCalculationType.FLAT.getValue()).chargeTimeType(ChargeTimeType.SPECIFIED_DUE_DATE.getValue())
|
||||
.chargePaymentMode(ChargePaymentMode.REGULAR.getValue()).currencyCode("USD")
|
||||
.name(Utils.randomStringGenerator("FEE_" + Calendar.getInstance().getTimeInMillis(), 5)).chargeAppliesTo(1).locale("en")
|
||||
@@ -1565,7 +1565,7 @@ public class LoanTransactionAccrualActivityPostingTest extends BaseLoanIntegrati
|
||||
|
||||
private void chargePenalty(Long loanId, Double amount, String dueDate) {
|
||||
LOG.info("Charge PENALTY amount {} dueDate {}", amount, dueDate);
|
||||
PostChargesResponse penaltyCharge = chargesHelper.createCharges(new PostChargesRequest().penalty(true).amount(10.0)
|
||||
PostChargesResponse penaltyCharge = chargesHelper.createCharges(new ChargeRequest().penalty(true).amount(10.0)
|
||||
.chargeCalculationType(ChargeCalculationType.FLAT.getValue()).chargeTimeType(ChargeTimeType.SPECIFIED_DUE_DATE.getValue())
|
||||
.chargePaymentMode(ChargePaymentMode.REGULAR.getValue()).currencyCode("USD")
|
||||
.name(Utils.randomStringGenerator("PENALTY_" + Calendar.getInstance().getTimeInMillis(), 5)).chargeAppliesTo(1).locale("en")
|
||||
|
||||
+3
-3
@@ -41,10 +41,10 @@ import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.client.models.AdvancedPaymentData;
|
||||
import org.apache.fineract.client.models.BusinessDateRequest;
|
||||
import org.apache.fineract.client.models.ChargeRequest;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdLoanChargeData;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdResponse;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse;
|
||||
import org.apache.fineract.client.models.PostChargesRequest;
|
||||
import org.apache.fineract.client.models.PostChargesResponse;
|
||||
import org.apache.fineract.client.models.PostClientsResponse;
|
||||
import org.apache.fineract.client.models.PostLoanProductsRequest;
|
||||
@@ -1619,7 +1619,7 @@ public class LoanTransactionInterestPaymentWaiverTest extends BaseLoanIntegratio
|
||||
}
|
||||
|
||||
private void chargeFee(Long loanId, Double amount, String dueDate) {
|
||||
PostChargesResponse feeCharge = chargesHelper.createCharges(new PostChargesRequest().penalty(false).amount(9.0)
|
||||
PostChargesResponse feeCharge = chargesHelper.createCharges(new ChargeRequest().penalty(false).amount(9.0)
|
||||
.chargeCalculationType(ChargeCalculationType.FLAT.getValue()).chargeTimeType(ChargeTimeType.SPECIFIED_DUE_DATE.getValue())
|
||||
.chargePaymentMode(ChargePaymentMode.REGULAR.getValue()).currencyCode("USD")
|
||||
.name(Utils.randomStringGenerator("FEE_" + Calendar.getInstance().getTimeInMillis(), 5)).chargeAppliesTo(1).locale("en")
|
||||
@@ -1632,7 +1632,7 @@ public class LoanTransactionInterestPaymentWaiverTest extends BaseLoanIntegratio
|
||||
}
|
||||
|
||||
private void chargePenalty(Long loanId, Double amount, String dueDate) {
|
||||
PostChargesResponse penaltyCharge = chargesHelper.createCharges(new PostChargesRequest().penalty(true).amount(10.0)
|
||||
PostChargesResponse penaltyCharge = chargesHelper.createCharges(new ChargeRequest().penalty(true).amount(10.0)
|
||||
.chargeCalculationType(ChargeCalculationType.FLAT.getValue()).chargeTimeType(ChargeTimeType.SPECIFIED_DUE_DATE.getValue())
|
||||
.chargePaymentMode(ChargePaymentMode.REGULAR.getValue()).currencyCode("USD")
|
||||
.name(Utils.randomStringGenerator("PENALTY_" + Calendar.getInstance().getTimeInMillis(), 5)).chargeAppliesTo(1).locale("en")
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import org.apache.fineract.client.models.PostChargesRequest;
|
||||
import org.apache.fineract.client.models.ChargeRequest;
|
||||
import org.apache.fineract.client.models.PostChargesResponse;
|
||||
import org.apache.fineract.client.util.Calls;
|
||||
import org.apache.fineract.client.util.JSON;
|
||||
@@ -807,7 +807,7 @@ public final class ChargesHelper {
|
||||
|
||||
}
|
||||
|
||||
public PostChargesResponse createCharges(PostChargesRequest request) {
|
||||
public PostChargesResponse createCharges(ChargeRequest request) {
|
||||
return Calls.ok(FineractClientHelper.getFineractClient().charges.createCharge(request));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user