FINERACT-2181: fix Charges using percentage calculation with min and max gap values
This commit is contained in:
committed by
Adam Saghy
parent
793dcd8e8b
commit
62afd41182
+2
@@ -84,6 +84,8 @@ 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 ChargeData retrieveCharge(@PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId,
|
||||
@Context final UriInfo uriInfo) {
|
||||
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||
|
||||
+9
-2
@@ -19,6 +19,7 @@
|
||||
package org.apache.fineract.portfolio.charge.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -110,6 +111,8 @@ final class ChargesApiResourceSwagger {
|
||||
public GetChargesAppliesToResponse chargeAppliesTo;
|
||||
public GetChargesCalculationTypeResponse chargeCalculationType;
|
||||
public GetChargesPaymentModeResponse chargePaymentMode;
|
||||
public BigDecimal minCap;
|
||||
public BigDecimal maxCap;
|
||||
}
|
||||
|
||||
@Schema(description = "PostChargesRequest")
|
||||
@@ -139,6 +142,10 @@ final class ChargesApiResourceSwagger {
|
||||
public String monthDayFormat;
|
||||
@Schema(example = "false")
|
||||
public boolean penalty;
|
||||
@Schema(example = "23.43")
|
||||
public BigDecimal minCap;
|
||||
@Schema(example = "45.56")
|
||||
public BigDecimal maxCap;
|
||||
}
|
||||
|
||||
@Schema(description = "PostChargesResponse")
|
||||
@@ -196,9 +203,9 @@ final class ChargesApiResourceSwagger {
|
||||
@Schema(example = "1")
|
||||
public Long paymentTypeId;
|
||||
@Schema(example = "10.0")
|
||||
public Double minCap;
|
||||
public BigDecimal minCap;
|
||||
@Schema(example = "120.0")
|
||||
public Double maxCap;
|
||||
public BigDecimal maxCap;
|
||||
}
|
||||
|
||||
@Schema(description = "PutChargesChargeIdResponse")
|
||||
|
||||
+1
-1
@@ -262,7 +262,7 @@ public class Charge extends AbstractPersistableCustom<Long> {
|
||||
}
|
||||
}
|
||||
|
||||
if (isPercentageOfApprovedAmount()) {
|
||||
if (isPercentageOfDisbursementAmount() || isPercentageOfApprovedAmount()) {
|
||||
this.minCap = minCap;
|
||||
this.maxCap = maxCap;
|
||||
}
|
||||
|
||||
+3
@@ -20,6 +20,7 @@ package org.apache.fineract.portfolio.charge.request;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -48,5 +49,7 @@ public class ChargeRequest implements Serializable {
|
||||
private String feeFrequency;
|
||||
private Long paymentTypeId;
|
||||
private Boolean enablePaymentType;
|
||||
private BigDecimal minCap;
|
||||
private BigDecimal maxCap;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user