FINERACT-2243: New command processing - payment type (#5506)

This commit is contained in:
Aleksandar Vidakovic
2026-02-18 08:19:29 -06:00
committed by GitHub
parent 020754bad4
commit 3a842ecb9a
69 changed files with 727 additions and 758 deletions
@@ -223,8 +223,8 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
List<PaymentTypeToGLAccountMapper> paymentTypeToGLAccountMappers = mappings.isEmpty() ? null : new ArrayList<>(); List<PaymentTypeToGLAccountMapper> paymentTypeToGLAccountMappers = mappings.isEmpty() ? null : new ArrayList<>();
for (final ProductToGLAccountMapping mapping : mappings) { for (final ProductToGLAccountMapping mapping : mappings) {
final PaymentTypeData paymentTypeData = PaymentTypeData.instance(mapping.getPaymentType().getId(), final PaymentTypeData paymentTypeData = PaymentTypeData.builder().id(mapping.getPaymentType().getId())
mapping.getPaymentType().getName()); .name(mapping.getPaymentType().getName()).build();
final GLAccountData gLAccountData = new GLAccountData().setId(mapping.getGlAccount().getId()) final GLAccountData gLAccountData = new GLAccountData().setId(mapping.getGlAccount().getId())
.setName(mapping.getGlAccount().getName()).setGlCode(mapping.getGlAccount().getGlCode()); .setName(mapping.getGlAccount().getName()).setGlCode(mapping.getGlAccount().getGlCode());
@@ -647,7 +647,7 @@ public class Charge extends AbstractPersistableCustom<Long> {
PaymentTypeData paymentTypeData = null; PaymentTypeData paymentTypeData = null;
if (this.paymentType != null) { if (this.paymentType != null) {
paymentTypeData = PaymentTypeData.instance(paymentType.getId(), paymentType.getName()); paymentTypeData = PaymentTypeData.builder().id(paymentType.getId()).name(paymentType.getName()).build();
} }
final CurrencyData currency = new CurrencyData(this.currencyCode, null, 0, 0, null, null); final CurrencyData currency = new CurrencyData(this.currencyCode, null, 0, 0, null, null);
+2 -2
View File
@@ -298,12 +298,12 @@ public class CreatePaymentTypeCommandHandler implements NewCommandSourceHandler
@Slf4j @Slf4j
@RequiredArgsConstructor @RequiredArgsConstructor
@Component @Component
public class CreatePaymentTypeCommandHandler implements CommandHandler<CreatePaymentTypeRequest, CreatePaymentTypeResponse> { public class PaymentTypeCreateCommandHandler implements CommandHandler<PaymentTypeCreateRequest, PaymentTypeCreateResponse> {
private final PaymentTypeWriteService paymentTypeWriteService; private final PaymentTypeWriteService paymentTypeWriteService;
@Override @Override
public CreatePaymentTypeResponse handle(Command<CreatePaymentTypeRequest> command) { public PaymentTypeCreateResponse handle(Command<PaymentTypeCreateRequest> command) {
// TODO: refactor business logic service to accept properly typed request objects as input // TODO: refactor business logic service to accept properly typed request objects as input
return paymentTypeWriteService.createPaymentType(command.getPayload()); return paymentTypeWriteService.createPaymentType(command.getPayload());
} }
@@ -29,7 +29,6 @@ import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.infrastructure.accountnumberformat.service.AccountNumberFormatConstants; import org.apache.fineract.infrastructure.accountnumberformat.service.AccountNumberFormatConstants;
import org.apache.fineract.infrastructure.core.domain.ExternalId; import org.apache.fineract.infrastructure.core.domain.ExternalId;
import org.apache.fineract.portfolio.client.api.ClientApiConstants; import org.apache.fineract.portfolio.client.api.ClientApiConstants;
import org.apache.fineract.portfolio.paymenttype.api.PaymentTypeApiResourceConstants;
import org.apache.fineract.portfolio.savings.DepositsApiConstants; import org.apache.fineract.portfolio.savings.DepositsApiConstants;
import org.apache.fineract.portfolio.self.pockets.api.PocketApiConstants; import org.apache.fineract.portfolio.self.pockets.api.PocketApiConstants;
import org.apache.fineract.useradministration.api.PasswordPreferencesApiConstants; import org.apache.fineract.useradministration.api.PasswordPreferencesApiConstants;
@@ -2946,30 +2945,6 @@ public class CommandWrapperBuilder {
return this; return this;
} }
public CommandWrapperBuilder createPaymentType() {
this.actionName = "CREATE";
this.entityName = PaymentTypeApiResourceConstants.ENTITY_NAME;
this.entityId = null;
this.href = "/" + PaymentTypeApiResourceConstants.RESOURCE_NAME;
return this;
}
public CommandWrapperBuilder updatePaymentType(final Long paymentTypeId) {
this.actionName = "UPDATE";
this.entityName = PaymentTypeApiResourceConstants.ENTITY_NAME;
this.entityId = paymentTypeId;
this.href = "/" + PaymentTypeApiResourceConstants.RESOURCE_NAME + paymentTypeId;
return this;
}
public CommandWrapperBuilder deletePaymentType(final Long paymentTypeId) {
this.actionName = "DELETE";
this.entityName = "PAYMENTTYPE";
this.entityId = paymentTypeId;
this.href = "/" + PaymentTypeApiResourceConstants.RESOURCE_NAME + paymentTypeId;
return this;
}
public CommandWrapperBuilder updateExternalServiceProperties(final String externalServiceName) { public CommandWrapperBuilder updateExternalServiceProperties(final String externalServiceName) {
this.actionName = "UPDATE"; this.actionName = "UPDATE";
this.entityName = "EXTERNALSERVICES"; this.entityName = "EXTERNALSERVICES";
@@ -19,11 +19,6 @@
package org.apache.fineract.portfolio.paymenttype.api; package org.apache.fineract.portfolio.paymenttype.api;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
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.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.ws.rs.Consumes; import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DELETE;
@@ -36,17 +31,21 @@ import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.MediaType;
import java.util.List; import java.util.List;
import java.util.function.Supplier;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper; import org.apache.fineract.command.core.CommandPipeline;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; import org.apache.fineract.portfolio.paymenttype.command.PaymentTypeCreateCommand;
import org.apache.fineract.portfolio.paymenttype.command.PaymentTypeDeleteCommand;
import org.apache.fineract.portfolio.paymenttype.command.PaymentTypeUpdateCommand;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateRequest;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateResponse;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.data.request.PaymentTypeRequest; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteRequest;
import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteResponse;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateRequest;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateResponse;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Path("/v1/paymenttypes") @Path("/v1/paymenttypes")
@@ -55,19 +54,15 @@ import org.springframework.stereotype.Component;
@RequiredArgsConstructor @RequiredArgsConstructor
public class PaymentTypeApiResource { public class PaymentTypeApiResource {
private final PlatformSecurityContext securityContext; private final PaymentTypeReadService readPlatformService;
private final CommandPipeline commandPipeline;
private final DefaultToApiJsonSerializer<PaymentTypeData> jsonSerializer; private final DefaultToApiJsonSerializer<PaymentTypeData> jsonSerializer;
private final PaymentTypeReadPlatformService readPlatformService;
private final PortfolioCommandSourceWritePlatformService commandWritePlatformService;
private final PaymentTypeRepositoryWrapper paymentTypeRepositoryWrapper;
@GET @GET
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "Retrieve all Payment Types", description = "Retrieve list of payment types") @Operation(summary = "Retrieve all Payment Types", description = "Retrieve list of payment types")
public List<PaymentTypeData> getAllPaymentTypes( public List<PaymentTypeData> getAllPaymentTypes(@QueryParam("onlyWithCode") final boolean onlyWithCode) {
@QueryParam("onlyWithCode") @Parameter(description = "onlyWithCode") final boolean onlyWithCode) {
securityContext.authenticatedUser().validateHasReadPermission(PaymentTypeApiResourceConstants.ENTITY_NAME);
return onlyWithCode ? readPlatformService.retrieveAllPaymentTypesWithCode() : readPlatformService.retrieveAllPaymentTypes(); return onlyWithCode ? readPlatformService.retrieveAllPaymentTypesWithCode() : readPlatformService.retrieveAllPaymentTypes();
} }
@@ -76,27 +71,22 @@ public class PaymentTypeApiResource {
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "Retrieve a Payment Type", description = "Retrieves a payment type") @Operation(summary = "Retrieve a Payment Type", description = "Retrieves a payment type")
public PaymentTypeData retrieveOnePaymentType( public PaymentTypeData retrieveOnePaymentType(@PathParam("paymentTypeId") final Long paymentTypeId) {
@PathParam("paymentTypeId") @Parameter(description = "paymentTypeId") final Long paymentTypeId) {
securityContext.authenticatedUser().validateHasReadPermission(PaymentTypeApiResourceConstants.ENTITY_NAME);
paymentTypeRepositoryWrapper.findOneWithNotFoundDetection(paymentTypeId);
return readPlatformService.retrieveOne(paymentTypeId); return readPlatformService.retrieveOne(paymentTypeId);
} }
@POST @POST
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Create a Payment Type", description = "Creates a new Payment type\n\n" + "Mandatory Fields: name\n\n" @Operation(summary = "Create a Payment Type", description = "Creates a new Payment type")
+ "Optional Fields: Description, isCashPayment,Position") public PaymentTypeCreateResponse createPaymentType(PaymentTypeCreateRequest request) {
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = PaymentTypeRequest.class))) final var command = new PaymentTypeCreateCommand();
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PostPaymentTypesResponse.class)))
public CommandProcessingResult createPaymentType(@Parameter(hidden = true) PaymentTypeRequest paymentTypeRequest) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().createPaymentType() command.setPayload(request);
.withJson(jsonSerializer.serialize(paymentTypeRequest)).build();
CommandProcessingResult result = commandWritePlatformService.logCommandSource(commandRequest); final Supplier<PaymentTypeCreateResponse> response = commandPipeline.send(command);
return result;
return response.get();
} }
@PUT @PUT
@@ -104,17 +94,18 @@ public class PaymentTypeApiResource {
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Update a Payment Type", description = "Updates a Payment Type") @Operation(summary = "Update a Payment Type", description = "Updates a Payment Type")
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PutPaymentTypesPaymentTypeIdRequest.class))) public PaymentTypeUpdateResponse updatePaymentType(@PathParam("paymentTypeId") final Long paymentTypeId,
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PutPaymentTypesPaymentTypeIdResponse.class))) final PaymentTypeUpdateRequest request) {
public CommandProcessingResult updatePaymentType(
@PathParam("paymentTypeId") @Parameter(description = "paymentTypeId") final Long paymentTypeId,
@Parameter(hidden = true) final String apiRequestBodyAsJson) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().updatePaymentType(paymentTypeId).withJson(apiRequestBodyAsJson) request.setId(paymentTypeId);
.build();
final CommandProcessingResult result = commandWritePlatformService.logCommandSource(commandRequest); final var command = new PaymentTypeUpdateCommand();
return result;
command.setPayload(request);
final Supplier<PaymentTypeUpdateResponse> response = commandPipeline.send(command);
return response.get();
} }
@DELETE @DELETE
@@ -122,15 +113,14 @@ public class PaymentTypeApiResource {
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Delete a Payment Type", description = "Deletes payment type") @Operation(summary = "Delete a Payment Type", description = "Deletes payment type")
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.DeletePaymentTypesPaymentTypeIdResponse.class))) public PaymentTypeDeleteResponse deleteCode(@PathParam("paymentTypeId") final Long paymentTypeId) {
public CommandProcessingResult deleteCode(
@PathParam("paymentTypeId") @Parameter(description = "paymentTypeId") final Long paymentTypeId) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().deletePaymentType(paymentTypeId).build(); final var command = new PaymentTypeDeleteCommand();
final CommandProcessingResult result = commandWritePlatformService.logCommandSource(commandRequest); command.setPayload(PaymentTypeDeleteRequest.builder().id(paymentTypeId).build());
return result; final Supplier<PaymentTypeDeleteResponse> response = commandPipeline.send(command);
return response.get();
} }
} }
@@ -1,43 +0,0 @@
/**
* 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.paymenttype.api;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public final class PaymentTypeApiResourceConstants {
private PaymentTypeApiResourceConstants() {
}
public static final String RESOURCE_NAME = "paymenttype";
public static final String ENTITY_NAME = "PAYMENTTYPE";
public static final String ID = "id";
public static final String NAME = "name";
public static final String DESCRIPTION = "description";
public static final String ISCASHPAYMENT = "isCashPayment";
public static final String POSITION = "position";
public static final String CODE_NAME = "code_name";
public static final String IS_SYSTEM_DEFINED = "system_defined";
static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(ID, NAME, DESCRIPTION, ISCASHPAYMENT));
}
@@ -1,96 +0,0 @@
/**
* 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.paymenttype.api;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* Created by Chirag Gupta on 01/01/18.
*/
public final class PaymentTypeApiResourceSwagger {
private PaymentTypeApiResourceSwagger() {}
@Schema(description = "GetPaymentTypesResponse")
public static final class GetPaymentTypesResponse {
private GetPaymentTypesResponse() {}
@Schema(example = "24")
public Long id;
@Schema(example = "PTC")
public String name;
@Schema(example = "Cash")
public String description;
@Schema(example = "true")
public Boolean isCashPayment;
@Schema(example = "0")
public Integer position;
@Schema(example = "REPAYMENT_REFUND")
public String codeName;
@Schema(example = "false")
public Boolean isSystemDefined;
}
@Schema(description = "PostPaymentTypesResponse")
public static final class PostPaymentTypesResponse {
private PostPaymentTypesResponse() {}
@Schema(example = "1")
public Long resourceId;
}
@Schema(description = "PutPaymentTypesPaymentTypeIdRequest")
public static final class PutPaymentTypesPaymentTypeIdRequest {
private PutPaymentTypesPaymentTypeIdRequest() {}
@Schema(example = "mPay")
public String name;
@Schema(example = "not a cash payment type")
public String description;
@Schema(example = "false")
public Boolean isCashPayment;
@Schema(example = "3")
public Integer position;
@Schema(example = "REPAYMENT_REFUND")
public String codeName;
@Schema(example = "false")
public Boolean isSystemDefined;
}
@Schema(description = "PutPaymentTypesPaymentTypeIdResponse")
public static final class PutPaymentTypesPaymentTypeIdResponse {
private PutPaymentTypesPaymentTypeIdResponse() {}
@Schema(example = "13")
public Long resourceId;
}
@Schema(description = "DeletePaymentTypesPaymentTypeIdResponse")
public static final class DeletePaymentTypesPaymentTypeIdResponse {
private DeletePaymentTypesPaymentTypeIdResponse() {}
@Schema(example = "13")
public Long resourceId;
}
}
@@ -0,0 +1,28 @@
/**
* 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.paymenttype.command;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.fineract.command.core.Command;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateRequest;
@Data
@EqualsAndHashCode(callSuper = true)
public class PaymentTypeCreateCommand extends Command<PaymentTypeCreateRequest> {}
@@ -0,0 +1,28 @@
/**
* 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.paymenttype.command;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.fineract.command.core.Command;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteRequest;
@Data
@EqualsAndHashCode(callSuper = true)
public class PaymentTypeDeleteCommand extends Command<PaymentTypeDeleteRequest> {}
@@ -0,0 +1,28 @@
/**
* 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.paymenttype.command;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.fineract.command.core.Command;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateRequest;
@Data
@EqualsAndHashCode(callSuper = true)
public class PaymentTypeUpdateCommand extends Command<PaymentTypeUpdateRequest> {}
@@ -0,0 +1,56 @@
/**
* 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.paymenttype.data;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.PositiveOrZero;
import jakarta.validation.constraints.Size;
import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PaymentTypeCreateRequest implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@NotBlank(message = "{org.apache.fineract.portfolio.paymenttype.name.not-blank}")
private String name;
@Size(max = 500, message = "{org.apache.fineract.portfolio.paymenttype.description.size}")
private String description;
private Boolean isCashPayment;
@PositiveOrZero(message = "{org.apache.fineract.portfolio.paymenttype.position.positive-or-zero}")
private Long position;
// @JsonProperty("code_name") // TODO: fix this, for backwards compatibility only... leave this for Jackson config
@Size(max = 100, message = "{org.apache.fineract.portfolio.paymenttype.code-name.size}")
private String codeName;
// @JsonProperty("system_defined") // TODO: fix this, for backwards compatibility only... leave this for Jackson
// config
@Builder.Default
@NotNull(message = "{org.apache.fineract.portfolio.is-system-defined.not-null}")
private Boolean isSystemDefined = false;
}
@@ -16,19 +16,23 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.apache.fineract.test.factory; package org.apache.fineract.portfolio.paymenttype.data;
import org.apache.fineract.client.models.PaymentTypeRequest; import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
public final class PaymentTypesRequestFactory { @Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PaymentTypeCreateResponse implements Serializable {
private PaymentTypesRequestFactory() {} @Serial
private static final long serialVersionUID = 1L;
public static PaymentTypeRequest defaultPaymentTypeRequest(String name, String description, Boolean isCashPayment, Integer position) { private Long resourceId;
PaymentTypeRequest request = new PaymentTypeRequest();
request.name(name).description(description).isCashPayment(isCashPayment).position(position);
return request;
}
} }
@@ -18,41 +18,27 @@
*/ */
package org.apache.fineract.portfolio.paymenttype.data; package org.apache.fineract.portfolio.paymenttype.data;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode; import lombok.Builder;
import lombok.Getter; import lombok.Data;
import lombok.Setter; import lombok.NoArgsConstructor;
import lombok.ToString;
@ToString @Builder
@Getter @Data
@Setter @NoArgsConstructor
@EqualsAndHashCode
@AllArgsConstructor @AllArgsConstructor
public class PaymentTypeData implements Serializable { public class PaymentTypeData implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long id; private Long id;
private String name; private String name;
private String description; private String description;
private Boolean isCashPayment; private Boolean isCashPayment;
private Integer position; private Long position;
private String codeName; private String codeName;
private Boolean isSystemDefined; private Boolean isSystemDefined;
public static PaymentTypeData instance(final Long id, final String name, final String description, final Boolean isCashPayment,
final Integer position) {
String codeName = null;
Boolean isSystemDefined = false;
return new PaymentTypeData(id, name, description, isCashPayment, position, codeName, isSystemDefined);
}
public static PaymentTypeData instance(final Long id, final String name) {
String description = null;
Boolean isCashPayment = null;
Integer position = null;
String codeName = null;
Boolean isSystemDefined = false;
return new PaymentTypeData(id, name, description, isCashPayment, position, codeName, isSystemDefined);
}
} }
@@ -1,176 +0,0 @@
/**
* 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.paymenttype.data;
import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.portfolio.paymenttype.api.PaymentTypeApiResourceConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class PaymentTypeDataValidator {
private final FromJsonHelper fromApiJsonHelper;
private static final Set<String> CREATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS = new HashSet<>(
Arrays.asList(PaymentTypeApiResourceConstants.NAME, PaymentTypeApiResourceConstants.DESCRIPTION,
PaymentTypeApiResourceConstants.ISCASHPAYMENT, PaymentTypeApiResourceConstants.POSITION,
PaymentTypeApiResourceConstants.CODE_NAME, PaymentTypeApiResourceConstants.IS_SYSTEM_DEFINED));
private static final Set<String> UPDATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS = new HashSet<>(
Arrays.asList(PaymentTypeApiResourceConstants.NAME, PaymentTypeApiResourceConstants.DESCRIPTION,
PaymentTypeApiResourceConstants.ISCASHPAYMENT, PaymentTypeApiResourceConstants.POSITION,
PaymentTypeApiResourceConstants.CODE_NAME, PaymentTypeApiResourceConstants.IS_SYSTEM_DEFINED));
@Autowired
public PaymentTypeDataValidator(final FromJsonHelper fromApiJsonHelper) {
this.fromApiJsonHelper = fromApiJsonHelper;
}
public void validateForCreate(final String json) {
if (StringUtils.isBlank(json)) {
throw new InvalidJsonException();
}
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CREATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS);
final JsonElement element = this.fromApiJsonHelper.parse(json);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
.resource(PaymentTypeApiResourceConstants.ENTITY_NAME);
if (this.fromApiJsonHelper.parameterExists(PaymentTypeApiResourceConstants.NAME, element)) {
final String name = this.fromApiJsonHelper.extractStringNamed(PaymentTypeApiResourceConstants.NAME, element);
baseDataValidator.reset().parameter(PaymentTypeApiResourceConstants.NAME).value(name).notBlank();
}
if (this.fromApiJsonHelper.parameterExists(PaymentTypeApiResourceConstants.DESCRIPTION, element)) {
final String description = this.fromApiJsonHelper.extractStringNamed(PaymentTypeApiResourceConstants.DESCRIPTION, element);
baseDataValidator.reset().parameter(PaymentTypeApiResourceConstants.DESCRIPTION).value(description).ignoreIfNull()
.notExceedingLengthOf(500);
}
if (this.fromApiJsonHelper.parameterExists(PaymentTypeApiResourceConstants.ISCASHPAYMENT, element)) {
final Boolean isCashPayment = this.fromApiJsonHelper.extractBooleanNamed(PaymentTypeApiResourceConstants.ISCASHPAYMENT,
element);
baseDataValidator.reset().parameter(PaymentTypeApiResourceConstants.ISCASHPAYMENT).value(isCashPayment)
.validateForBooleanValue();
}
if (this.fromApiJsonHelper.parameterExists(PaymentTypeApiResourceConstants.POSITION, element)) {
final Long position = this.fromApiJsonHelper.extractLongNamed(PaymentTypeApiResourceConstants.POSITION, element);
baseDataValidator.reset().parameter(PaymentTypeApiResourceConstants.POSITION).value(position).ignoreIfNull()
.integerZeroOrGreater();
}
if (this.fromApiJsonHelper.parameterExists(PaymentTypeApiResourceConstants.CODE_NAME, element)) {
final String codeName = this.fromApiJsonHelper.extractStringNamed(PaymentTypeApiResourceConstants.CODE_NAME, element);
baseDataValidator.reset().parameter(PaymentTypeApiResourceConstants.CODE_NAME).value(codeName).ignoreIfNull()
.notExceedingLengthOf(100);
}
if (this.fromApiJsonHelper.parameterExists(PaymentTypeApiResourceConstants.IS_SYSTEM_DEFINED, element)) {
final Boolean isSystemDefined = this.fromApiJsonHelper.extractBooleanNamed(PaymentTypeApiResourceConstants.IS_SYSTEM_DEFINED,
element);
baseDataValidator.reset().parameter(PaymentTypeApiResourceConstants.IS_SYSTEM_DEFINED).value(isSystemDefined)
.validateForBooleanValue();
}
throwExceptionIfValidationWarningsExist(dataValidationErrors);
}
private void throwExceptionIfValidationWarningsExist(final List<ApiParameterError> dataValidationErrors) {
if (!dataValidationErrors.isEmpty()) {
//
throw new PlatformApiDataValidationException(dataValidationErrors);
}
}
public void validateForUpdate(final String json) {
if (StringUtils.isBlank(json)) {
throw new InvalidJsonException();
}
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS);
final JsonElement element = this.fromApiJsonHelper.parse(json);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
.resource(PaymentTypeApiResourceConstants.ENTITY_NAME);
if (this.fromApiJsonHelper.parameterExists(PaymentTypeApiResourceConstants.NAME, element)) {
final String name = this.fromApiJsonHelper.extractStringNamed(PaymentTypeApiResourceConstants.NAME, element);
baseDataValidator.reset().parameter(PaymentTypeApiResourceConstants.NAME).value(name);
}
if (this.fromApiJsonHelper.parameterExists(PaymentTypeApiResourceConstants.DESCRIPTION, element)) {
final String description = this.fromApiJsonHelper.extractStringNamed(PaymentTypeApiResourceConstants.DESCRIPTION, element);
baseDataValidator.reset().parameter(PaymentTypeApiResourceConstants.DESCRIPTION).value(description).ignoreIfNull()
.notExceedingLengthOf(500);
}
if (this.fromApiJsonHelper.parameterExists(PaymentTypeApiResourceConstants.ISCASHPAYMENT, element)) {
final Boolean isCashPayment = this.fromApiJsonHelper.extractBooleanNamed(PaymentTypeApiResourceConstants.ISCASHPAYMENT,
element);
baseDataValidator.reset().parameter(PaymentTypeApiResourceConstants.ISCASHPAYMENT).value(isCashPayment)
.validateForBooleanValue();
}
if (this.fromApiJsonHelper.parameterExists(PaymentTypeApiResourceConstants.POSITION, element)) {
final Long position = this.fromApiJsonHelper.extractLongNamed(PaymentTypeApiResourceConstants.POSITION, element);
baseDataValidator.reset().parameter(PaymentTypeApiResourceConstants.POSITION).value(position).ignoreIfNull()
.integerZeroOrGreater();
}
if (this.fromApiJsonHelper.parameterExists(PaymentTypeApiResourceConstants.CODE_NAME, element)) {
final String codeName = this.fromApiJsonHelper.extractStringNamed(PaymentTypeApiResourceConstants.CODE_NAME, element);
baseDataValidator.reset().parameter(PaymentTypeApiResourceConstants.CODE_NAME).value(codeName).ignoreIfNull()
.notExceedingLengthOf(100);
}
if (this.fromApiJsonHelper.parameterExists(PaymentTypeApiResourceConstants.IS_SYSTEM_DEFINED, element)) {
final Boolean isSystemDefined = this.fromApiJsonHelper.extractBooleanNamed(PaymentTypeApiResourceConstants.IS_SYSTEM_DEFINED,
element);
baseDataValidator.reset().parameter(PaymentTypeApiResourceConstants.IS_SYSTEM_DEFINED).value(isSystemDefined)
.validateForBooleanValue();
}
throwExceptionIfValidationWarningsExist(dataValidationErrors);
}
}
@@ -16,15 +16,23 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.apache.fineract.portfolio.paymenttype.data.request; package org.apache.fineract.portfolio.paymenttype.data;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
public record PaymentTypeRequest(String name, String description, Boolean isCashPayment, Integer position, String codeName, @Builder
Boolean isSystemDefined) implements Serializable { @Data
@NoArgsConstructor
@AllArgsConstructor
public class PaymentTypeDeleteRequest implements Serializable {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Long id;
} }
@@ -0,0 +1,38 @@
/**
* 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.paymenttype.data;
import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PaymentTypeDeleteResponse implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long resourceId;
}
@@ -0,0 +1,60 @@
/**
* 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.paymenttype.data;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.PositiveOrZero;
import jakarta.validation.constraints.Size;
import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PaymentTypeUpdateRequest implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Hidden
@NotNull(message = "{org.apache.fineract.portfolio.paymenttype.id.not-null}")
private Long id;
@NotBlank(message = "{org.apache.fineract.portfolio.paymenttype.name.not-blank}")
private String name;
@Size(max = 500, message = "{org.apache.fineract.portfolio.paymenttype.description.size}")
private String description;
private Boolean isCashPayment;
@PositiveOrZero(message = "{org.apache.fineract.portfolio.paymenttype.position.positive-or-zero}")
private Long position;
// @JsonProperty("code_name") // TODO: fix this, for backwards compatibility only... leave this for Jackson config
@Size(max = 100, message = "{org.apache.fineract.portfolio.paymenttype.code-name.size}")
private String codeName;
// @JsonProperty("system_defined") // TODO: fix this, for backwards compatibility only... leave this for Jackson
// config
@Builder.Default
@NotNull(message = "{org.apache.fineract.portfolio.is-system-defined.not-null}")
private Boolean isSystemDefined = false;
}
@@ -0,0 +1,38 @@
/**
* 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.paymenttype.data;
import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PaymentTypeUpdateResponse implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long resourceId;
}
@@ -21,20 +21,17 @@ package org.apache.fineract.portfolio.paymenttype.domain;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.Table; import jakarta.persistence.Table;
import java.util.LinkedHashMap;
import java.util.Map;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
import org.apache.fineract.portfolio.paymenttype.api.PaymentTypeApiResourceConstants;
@Getter @Getter
@Setter @Setter
@Entity @Entity
@Table(name = "m_payment_type") @Table(name = "m_payment_type")
@NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class PaymentType extends AbstractPersistableCustom<Long> { public class PaymentType extends AbstractPersistableCustom<Long> {
@@ -55,38 +52,4 @@ public class PaymentType extends AbstractPersistableCustom<Long> {
@Column(name = "is_system_defined") @Column(name = "is_system_defined")
private Boolean isSystemDefined; private Boolean isSystemDefined;
protected PaymentType() {}
public Map<String, Object> update(final JsonCommand command) {
final Map<String, Object> actualChanges = new LinkedHashMap<>(3);
if (command.isChangeInStringParameterNamed(PaymentTypeApiResourceConstants.NAME, this.name)) {
final String newValue = command.stringValueOfParameterNamed(PaymentTypeApiResourceConstants.NAME);
actualChanges.put(PaymentTypeApiResourceConstants.NAME, newValue);
this.name = StringUtils.defaultIfEmpty(newValue, null);
}
if (command.isChangeInStringParameterNamed(PaymentTypeApiResourceConstants.DESCRIPTION, this.description)) {
final String newDescription = command.stringValueOfParameterNamed(PaymentTypeApiResourceConstants.DESCRIPTION);
actualChanges.put(PaymentTypeApiResourceConstants.DESCRIPTION, newDescription);
this.description = StringUtils.defaultIfEmpty(newDescription, null);
}
if (command.isChangeInBooleanParameterNamed(PaymentTypeApiResourceConstants.ISCASHPAYMENT, this.isCashPayment)) {
final Boolean newCashPaymentType = command.booleanObjectValueOfParameterNamed(PaymentTypeApiResourceConstants.ISCASHPAYMENT);
actualChanges.put(PaymentTypeApiResourceConstants.ISCASHPAYMENT, newCashPaymentType);
this.isCashPayment = newCashPaymentType.booleanValue();
}
if (command.isChangeInLongParameterNamed(PaymentTypeApiResourceConstants.POSITION, this.position)) {
final Long newPosition = command.longValueOfParameterNamed(PaymentTypeApiResourceConstants.POSITION);
actualChanges.put(PaymentTypeApiResourceConstants.POSITION, newPosition);
this.position = newPosition;
}
return actualChanges;
}
} }
@@ -18,27 +18,19 @@
*/ */
package org.apache.fineract.portfolio.paymenttype.domain; package org.apache.fineract.portfolio.paymenttype.domain;
import java.util.List;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.fineract.portfolio.paymenttype.exception.PaymentTypeNotFoundException; import org.apache.fineract.portfolio.paymenttype.exception.PaymentTypeNotFoundException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
// TODO: get rid of this, unnecessarily hides real repository; don't use this outside of payment domain!
@Deprecated(forRemoval = true)
public class PaymentTypeRepositoryWrapper { public class PaymentTypeRepositoryWrapper {
private final PaymentTypeRepository repository; private final PaymentTypeRepository repository;
public List<PaymentType> findAll() {
return this.repository.findAllByOrderByPositionAsc();
}
public List<PaymentType> findAllWithCodeName() {
return this.repository.findAllByCodeNameIsNotNullOrderByPositionAsc();
}
public PaymentType findOneWithNotFoundDetection(final Long id) { public PaymentType findOneWithNotFoundDetection(final Long id) {
return this.repository.findById(id).orElseThrow(() -> new PaymentTypeNotFoundException(id)); return this.repository.findById(id).orElseThrow(() -> new PaymentTypeNotFoundException(id));
} }
} }
@@ -18,29 +18,33 @@
*/ */
package org.apache.fineract.portfolio.paymenttype.handler; package org.apache.fineract.portfolio.paymenttype.handler;
import org.apache.fineract.commands.annotation.CommandType; import io.github.resilience4j.retry.annotation.Retry;
import org.apache.fineract.commands.handler.NewCommandSourceHandler; import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.JsonCommand; import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; import org.apache.fineract.command.core.Command;
import org.apache.fineract.command.core.CommandHandler;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateRequest;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateResponse;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@Service @Slf4j
@CommandType(entity = "PAYMENTTYPE", action = "DELETE") @Component
public class DeletePaymentTypeCommandHandler implements NewCommandSourceHandler { @RequiredArgsConstructor
public class PaymentTypeCreateCommandHandler implements CommandHandler<PaymentTypeCreateRequest, PaymentTypeCreateResponse> {
private final PaymentTypeWriteService paymentTypeWriteService; private final PaymentTypeWriteService paymentTypeWriteService;
@Autowired @Retry(name = "commandPaymentTypeCreate", fallbackMethod = "fallback")
public DeletePaymentTypeCommandHandler(final PaymentTypeWriteService paymentTypeWriteService) { @Override
this.paymentTypeWriteService = paymentTypeWriteService; @Transactional
public PaymentTypeCreateResponse handle(Command<PaymentTypeCreateRequest> command) {
return paymentTypeWriteService.createPaymentType(command.getPayload());
} }
@Override @Override
@Transactional public PaymentTypeCreateResponse fallback(Command<PaymentTypeCreateRequest> command, Throwable t) {
public CommandProcessingResult processCommand(JsonCommand command) { return CommandHandler.super.fallback(command, t);
return this.paymentTypeWriteService.deletePaymentType(command.entityId());
} }
} }
@@ -18,29 +18,33 @@
*/ */
package org.apache.fineract.portfolio.paymenttype.handler; package org.apache.fineract.portfolio.paymenttype.handler;
import org.apache.fineract.commands.annotation.CommandType; import io.github.resilience4j.retry.annotation.Retry;
import org.apache.fineract.commands.handler.NewCommandSourceHandler; import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.JsonCommand; import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; import org.apache.fineract.command.core.Command;
import org.apache.fineract.command.core.CommandHandler;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteRequest;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteResponse;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@Service @Slf4j
@CommandType(entity = "PAYMENTTYPE", action = "CREATE") @Component
public class CreatePaymentTypeCommandHandler implements NewCommandSourceHandler { @RequiredArgsConstructor
public class PaymentTypeDeleteCommandHandler implements CommandHandler<PaymentTypeDeleteRequest, PaymentTypeDeleteResponse> {
private final PaymentTypeWriteService paymentTypeWriteService; private final PaymentTypeWriteService paymentTypeWriteService;
@Autowired @Retry(name = "commandPaymentTypeDelete", fallbackMethod = "fallback")
public CreatePaymentTypeCommandHandler(final PaymentTypeWriteService paymentTypeWriteService) { @Override
this.paymentTypeWriteService = paymentTypeWriteService; @Transactional
public PaymentTypeDeleteResponse handle(Command<PaymentTypeDeleteRequest> command) {
return paymentTypeWriteService.deletePaymentType(command.getPayload());
} }
@Override @Override
@Transactional public PaymentTypeDeleteResponse fallback(Command<PaymentTypeDeleteRequest> command, Throwable t) {
public CommandProcessingResult processCommand(JsonCommand command) { return CommandHandler.super.fallback(command, t);
return this.paymentTypeWriteService.createPaymentType(command);
} }
} }
@@ -18,29 +18,33 @@
*/ */
package org.apache.fineract.portfolio.paymenttype.handler; package org.apache.fineract.portfolio.paymenttype.handler;
import org.apache.fineract.commands.annotation.CommandType; import io.github.resilience4j.retry.annotation.Retry;
import org.apache.fineract.commands.handler.NewCommandSourceHandler; import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.JsonCommand; import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; import org.apache.fineract.command.core.Command;
import org.apache.fineract.command.core.CommandHandler;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateRequest;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateResponse;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@Service @Slf4j
@CommandType(entity = "PAYMENTTYPE", action = "UPDATE") @Component
public class UpdatePaymentTypeCommandHandler implements NewCommandSourceHandler { @RequiredArgsConstructor
public class PaymentTypeUpdateCommandHandler implements CommandHandler<PaymentTypeUpdateRequest, PaymentTypeUpdateResponse> {
private final PaymentTypeWriteService paymentTypeWriteService; private final PaymentTypeWriteService paymentTypeWriteService;
@Autowired @Retry(name = "commandPaymentTypeUpdate", fallbackMethod = "fallback")
public UpdatePaymentTypeCommandHandler(final PaymentTypeWriteService paymentTypeWriteService) { @Override
this.paymentTypeWriteService = paymentTypeWriteService; @Transactional
public PaymentTypeUpdateResponse handle(Command<PaymentTypeUpdateRequest> command) {
return paymentTypeWriteService.updatePaymentType(command.getPayload());
} }
@Override @Override
@Transactional public PaymentTypeUpdateResponse fallback(Command<PaymentTypeUpdateRequest> command, Throwable t) {
public CommandProcessingResult processCommand(JsonCommand command) { return CommandHandler.super.fallback(command, t);
return this.paymentTypeWriteService.updatePaymentType(command.entityId(), command);
} }
} }
@@ -0,0 +1,32 @@
/**
* 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.paymenttype.mapper;
import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateRequest;
import org.apache.fineract.portfolio.paymenttype.domain.PaymentType;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
@Mapper(config = MapstructMapperConfig.class)
public interface PaymentTypeCreateRequestMapper {
@Mapping(ignore = true, target = "id")
PaymentType map(PaymentTypeCreateRequest source);
}
@@ -21,7 +21,7 @@ package org.apache.fineract.portfolio.paymenttype.service;
import java.util.List; import java.util.List;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
public interface PaymentTypeReadPlatformService { public interface PaymentTypeReadService {
List<PaymentTypeData> retrieveAllPaymentTypes(); List<PaymentTypeData> retrieveAllPaymentTypes();
@@ -20,47 +20,44 @@ package org.apache.fineract.portfolio.paymenttype.service;
import java.util.List; import java.util.List;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.domain.PaymentType; import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepository;
import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper; import org.apache.fineract.portfolio.paymenttype.exception.PaymentTypeNotFoundException;
import org.apache.fineract.portfolio.paymenttype.mapper.PaymentTypeMapper; import org.apache.fineract.portfolio.paymenttype.mapper.PaymentTypeMapper;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
@RequiredArgsConstructor @RequiredArgsConstructor
public class PaymentTypeReadPlatformServiceImpl implements PaymentTypeReadPlatformService { public class PaymentTypeReadServiceImpl implements PaymentTypeReadService {
private final PlatformSecurityContext context; private final PaymentTypeRepository repository;
private final PaymentTypeMapper paymentTypeMapper; private final PaymentTypeMapper paymentTypeMapper;
private final PaymentTypeRepositoryWrapper paymentTypeRepository;
@Override @Override
@Cacheable(value = "payment_types", key = "T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('payment_types')") @Cacheable(value = "payment_types", key = "T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('payment_types')")
public List<PaymentTypeData> retrieveAllPaymentTypes() { public List<PaymentTypeData> retrieveAllPaymentTypes() {
// TODO Auto-generated method stub var paymentType = repository.findAllByOrderByPositionAsc();
this.context.authenticatedUser();
List<PaymentType> paymentType = this.paymentTypeRepository.findAll(); return paymentTypeMapper.map(paymentType);
return this.paymentTypeMapper.map(paymentType);
} }
@Override @Override
@Cacheable(value = "paymentTypesWithCode", key = "T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('payment_types')") @Cacheable(value = "paymentTypesWithCode", key = "T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('payment_types')")
public List<PaymentTypeData> retrieveAllPaymentTypesWithCode() { public List<PaymentTypeData> retrieveAllPaymentTypesWithCode() {
// TODO Auto-generated method stub var paymentType = repository.findAllByCodeNameIsNotNullOrderByPositionAsc();
this.context.authenticatedUser();
List<PaymentType> paymentType = this.paymentTypeRepository.findAllWithCodeName(); return paymentTypeMapper.map(paymentType);
return this.paymentTypeMapper.map(paymentType);
} }
@Override @Override
public PaymentTypeData retrieveOne(Long paymentTypeId) { public PaymentTypeData retrieveOne(Long paymentTypeId) {
// TODO Auto-generated method stub final var paymentType = repository.findById(paymentTypeId).orElseThrow(() -> new PaymentTypeNotFoundException(paymentTypeId));
this.context.authenticatedUser();
final PaymentType paymentType = this.paymentTypeRepository.findOneWithNotFoundDetection(paymentTypeId); return paymentTypeMapper.map(paymentType);
return this.paymentTypeMapper.map(paymentType);
} }
/*
* // TODO: do proper jakarta validation to fineract api error mapping private void
* throwExceptionIfValidationWarningsExist(final List<ApiParameterError> dataValidationErrors) { if
* (!dataValidationErrors.isEmpty()) { // throw new PlatformApiDataValidationException(dataValidationErrors); } }
*/
} }
@@ -18,14 +18,18 @@
*/ */
package org.apache.fineract.portfolio.paymenttype.service; package org.apache.fineract.portfolio.paymenttype.service;
import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateRequest;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateResponse;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteRequest;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteResponse;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateRequest;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateResponse;
public interface PaymentTypeWriteService { public interface PaymentTypeWriteService {
CommandProcessingResult createPaymentType(JsonCommand command); PaymentTypeCreateResponse createPaymentType(PaymentTypeCreateRequest request);
CommandProcessingResult updatePaymentType(Long id, JsonCommand command); PaymentTypeUpdateResponse updatePaymentType(PaymentTypeUpdateRequest request);
CommandProcessingResult deletePaymentType(Long id); PaymentTypeDeleteResponse deletePaymentType(PaymentTypeDeleteRequest request);
} }
@@ -18,18 +18,21 @@
*/ */
package org.apache.fineract.portfolio.paymenttype.service; package org.apache.fineract.portfolio.paymenttype.service;
import java.util.Map; import jakarta.validation.Valid;
import java.util.Objects;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.commons.lang3.Strings;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
import org.apache.fineract.infrastructure.core.exception.ErrorHandler; import org.apache.fineract.infrastructure.core.exception.ErrorHandler;
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException; import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
import org.apache.fineract.portfolio.paymenttype.api.PaymentTypeApiResourceConstants; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateRequest;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDataValidator; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateResponse;
import org.apache.fineract.portfolio.paymenttype.domain.PaymentType; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteRequest;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteResponse;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateRequest;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateResponse;
import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepository; import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepository;
import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper; import org.apache.fineract.portfolio.paymenttype.exception.PaymentTypeNotFoundException;
import org.apache.fineract.portfolio.paymenttype.mapper.PaymentTypeCreateRequestMapper;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
@@ -38,55 +41,67 @@ import org.springframework.orm.jpa.JpaSystemException;
public class PaymentTypeWriteServiceImpl implements PaymentTypeWriteService { public class PaymentTypeWriteServiceImpl implements PaymentTypeWriteService {
private final PaymentTypeRepository repository; private final PaymentTypeRepository repository;
private final PaymentTypeRepositoryWrapper repositoryWrapper; private final PaymentTypeCreateRequestMapper createRequestMapper;
private final PaymentTypeDataValidator fromApiJsonDeserializer;
@Override @Override
@CacheEvict(value = "payment_types", key = "T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('payment_types')") @CacheEvict(value = "payment_types", key = "T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('payment_types')")
public CommandProcessingResult createPaymentType(JsonCommand command) { public PaymentTypeCreateResponse createPaymentType(@Valid PaymentTypeCreateRequest request) {
this.fromApiJsonDeserializer.validateForCreate(command.json()); final var paymentType = createRequestMapper.map(request);
String name = command.stringValueOfParameterNamed(PaymentTypeApiResourceConstants.NAME);
String description = command.stringValueOfParameterNamed(PaymentTypeApiResourceConstants.DESCRIPTION);
Boolean isCashPayment = command.booleanObjectValueOfParameterNamed(PaymentTypeApiResourceConstants.ISCASHPAYMENT);
Long position = command.longValueOfParameterNamed(PaymentTypeApiResourceConstants.POSITION);
String codeName = command.stringValueOfParameterNamed(PaymentTypeApiResourceConstants.CODE_NAME);
Boolean isSystemDefined = command.booleanObjectValueOfParameterNamed(PaymentTypeApiResourceConstants.IS_SYSTEM_DEFINED);
if (isSystemDefined == null) {
isSystemDefined = false;
}
PaymentType newPaymentType = new PaymentType(name, description, isCashPayment, position, codeName, isSystemDefined); repository.saveAndFlush(paymentType);
this.repository.saveAndFlush(newPaymentType);
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(newPaymentType.getId()).build(); return PaymentTypeCreateResponse.builder().resourceId(paymentType.getId()).build();
} }
@Override @Override
@CacheEvict(value = "payment_types", key = "T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('payment_types')") @CacheEvict(value = "payment_types", key = "T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('payment_types')")
public CommandProcessingResult updatePaymentType(Long paymentTypeId, JsonCommand command) { @SuppressWarnings("AvoidHidingCauseException")
public PaymentTypeUpdateResponse updatePaymentType(@Valid PaymentTypeUpdateRequest request) {
this.fromApiJsonDeserializer.validateForUpdate(command.json());
final PaymentType paymentType = this.repositoryWrapper.findOneWithNotFoundDetection(paymentTypeId);
final Map<String, Object> changes = paymentType.update(command);
if (!changes.isEmpty()) {
this.repository.save(paymentType);
}
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(command.entityId()).build();
}
@Override
@CacheEvict(value = "payment_types", key = "T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('payment_types')")
public CommandProcessingResult deletePaymentType(Long paymentTypeId) {
final PaymentType paymentType = this.repositoryWrapper.findOneWithNotFoundDetection(paymentTypeId);
try { try {
this.repository.delete(paymentType); final var paymentType = repository.findById(request.getId())
this.repository.flush(); .orElseThrow(() -> new PaymentTypeNotFoundException(request.getId()));
if (!Strings.CS.equals(request.getName(), paymentType.getName())) {
paymentType.setName(request.getName());
}
if (!Strings.CS.equals(request.getDescription(), paymentType.getDescription())) {
paymentType.setDescription(request.getDescription());
}
if (!Strings.CS.equals(request.getCodeName(), paymentType.getCodeName())) {
paymentType.setCodeName(request.getCodeName());
}
if (!Objects.equals(request.getPosition(), paymentType.getPosition())) {
paymentType.setPosition(request.getPosition());
}
if (!Objects.equals(request.getIsCashPayment(), paymentType.getIsCashPayment())) {
paymentType.setIsCashPayment(request.getIsCashPayment());
}
if (!Objects.equals(request.getIsSystemDefined(), paymentType.getIsSystemDefined())) {
paymentType.setIsSystemDefined(request.getIsSystemDefined());
}
repository.saveAndFlush(paymentType);
} catch (final JpaSystemException | DataIntegrityViolationException e) {
throw new PaymentTypeNotFoundException(request.getId());
}
return PaymentTypeUpdateResponse.builder().resourceId(request.getId()).build();
}
@Override
@CacheEvict(value = "payment_types", key = "T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('payment_types')")
public PaymentTypeDeleteResponse deletePaymentType(@Valid PaymentTypeDeleteRequest request) {
final var paymentType = repository.findById(request.getId()).orElseThrow(() -> new PaymentTypeNotFoundException(request.getId()));
try {
repository.delete(paymentType);
repository.flush();
} catch (final JpaSystemException | DataIntegrityViolationException e) { } catch (final JpaSystemException | DataIntegrityViolationException e) {
final Throwable throwable = e.getMostSpecificCause(); final Throwable throwable = e.getMostSpecificCause();
handleDataIntegrityIssues(throwable, e); handleDataIntegrityIssues(throwable, e);
} }
return new CommandProcessingResultBuilder().withEntityId(paymentType.getId()).build();
return PaymentTypeDeleteResponse.builder().resourceId(paymentType.getId()).build();
} }
private void handleDataIntegrityIssues(final Throwable realCause, final Exception dve) { private void handleDataIntegrityIssues(final Throwable realCause, final Exception dve) {
@@ -18,13 +18,11 @@
*/ */
package org.apache.fineract.portfolio.paymenttype.starter; package org.apache.fineract.portfolio.paymenttype.starter;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDataValidator;
import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepository; import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepository;
import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper; import org.apache.fineract.portfolio.paymenttype.mapper.PaymentTypeCreateRequestMapper;
import org.apache.fineract.portfolio.paymenttype.mapper.PaymentTypeMapper; import org.apache.fineract.portfolio.paymenttype.mapper.PaymentTypeMapper;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformServiceImpl; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadServiceImpl;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteServiceImpl; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -35,16 +33,14 @@ import org.springframework.context.annotation.Configuration;
public class PaymentTypeConfiguration { public class PaymentTypeConfiguration {
@Bean @Bean
@ConditionalOnMissingBean(PaymentTypeReadPlatformService.class) @ConditionalOnMissingBean(PaymentTypeReadService.class)
PaymentTypeReadPlatformService paymentTypeReadPlatformService(PlatformSecurityContext context, PaymentTypeMapper paymentTypeMapper, PaymentTypeReadService paymentTypeReadPlatformService(PaymentTypeRepository repository, PaymentTypeMapper mapper) {
PaymentTypeRepositoryWrapper paymentTypeRepositoryWrapper) { return new PaymentTypeReadServiceImpl(repository, mapper);
return new PaymentTypeReadPlatformServiceImpl(context, paymentTypeMapper, paymentTypeRepositoryWrapper);
} }
@Bean @Bean
@ConditionalOnMissingBean(PaymentTypeWriteService.class) @ConditionalOnMissingBean(PaymentTypeWriteService.class)
PaymentTypeWriteService paymentTypeWriteService(PaymentTypeRepository repository, PaymentTypeRepositoryWrapper repositoryWrapper, PaymentTypeWriteService paymentTypeWriteService(PaymentTypeRepository repository, PaymentTypeCreateRequestMapper createRequestMapper) {
PaymentTypeDataValidator fromApiJsonDeserializer) { return new PaymentTypeWriteServiceImpl(repository, createRequestMapper);
return new PaymentTypeWriteServiceImpl(repository, repositoryWrapper, fromApiJsonDeserializer);
} }
} }
@@ -40,19 +40,19 @@ public class DocumentCreateRequest implements Serializable {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@NotNull(message = "{org.apache.fineract.document.xxx.not-null}") @NotNull(message = "{org.apache.fineract.document.entity-type.not-null}")
@Size(max = 50, message = "{org.apache.fineract.document.xxx.not-null}") @Size(max = 50, message = "{org.apache.fineract.document.entity-type.size}")
private String entityType; private String entityType;
@NotNull(message = "{org.apache.fineract.document.xxx.not-null}") @NotNull(message = "{org.apache.fineract.document.entity-id.not-null}")
private Long entityId; private Long entityId;
@Size(max = 250, message = "{org.apache.fineract.document.xxx.not-null}") @Size(max = 250, message = "{org.apache.fineract.document.name.size}")
private String name; private String name;
@Size(max = 250, message = "{org.apache.fineract.document.xxx.not-null}") @Size(max = 250, message = "{org.apache.fineract.document.description.size}")
private String description; private String description;
@Size(max = 250, message = "{org.apache.fineract.document.xxx.not-null}") @Size(max = 250, message = "{org.apache.fineract.document.file-name.size}")
private String fileName; private String fileName;
@NotNull(message = "{org.apache.fineract.document.xxx.not-null}") @NotNull(message = "{org.apache.fineract.document.size.not-null}")
@Min(value = 1, message = "{org.apache.fineract.document.xxx.not-null}") @Min(value = 1, message = "{org.apache.fineract.document.size.min}")
private Long size; private Long size;
private String type; private String type;
@Hidden @Hidden
@@ -40,21 +40,21 @@ public class DocumentUpdateRequest implements Serializable {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@NotNull(message = "{org.apache.fineract.document.xxx.not-null}") @NotNull(message = "{org.apache.fineract.document.id.not-null}")
private Long id; private Long id;
@NotNull(message = "{org.apache.fineract.document.xxx.not-null}") @NotNull(message = "{org.apache.fineract.document.entity-type.not-null}")
@Size(max = 50, message = "{org.apache.fineract.document.xxx.not-null}") @Size(max = 50, message = "{org.apache.fineract.document.entity-type.size}")
private String entityType; private String entityType;
@NotNull(message = "{org.apache.fineract.document.xxx.not-null}") @NotNull(message = "{org.apache.fineract.document.entity-id.not-null}")
private Long entityId; private Long entityId;
@Size(max = 250, message = "{org.apache.fineract.document.xxx.not-null}") @Size(max = 250, message = "{org.apache.fineract.document.name.size}")
private String name; private String name;
@Size(max = 250, message = "{org.apache.fineract.document.xxx.not-null}") @Size(max = 250, message = "{org.apache.fineract.document.description.size}")
private String description; private String description;
@Size(max = 250, message = "{org.apache.fineract.document.xxx.not-null}") @Size(max = 250, message = "{org.apache.fineract.document.file-name.size}")
private String fileName; private String fileName;
@NotNull(message = "{org.apache.fineract.document.xxx.not-null}") @NotNull(message = "{org.apache.fineract.document.size.not-null}")
@Min(value = 1, message = "{org.apache.fineract.document.xxx.not-null}") @Min(value = 1, message = "{org.apache.fineract.document.size.min}")
private Long size; private Long size;
private String type; private String type;
@Hidden @Hidden
@@ -26,9 +26,8 @@ import java.util.Map;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.client.feign.FineractFeignClient; import org.apache.fineract.client.feign.FineractFeignClient;
import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PaymentTypeData; import org.apache.fineract.client.models.PaymentTypeData;
import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.test.factory.PaymentTypesRequestFactory;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -72,14 +71,15 @@ public class PaymentTypeGlobalInitializerStep implements FineractGlobalInitializ
paymentTypeNames.add(PAYMENT_TYPE_REPAYMENT_ADJUSTMENT_REFUND); paymentTypeNames.add(PAYMENT_TYPE_REPAYMENT_ADJUSTMENT_REFUND);
paymentTypeNames.forEach(paymentTypeName -> { paymentTypeNames.forEach(paymentTypeName -> {
boolean paymentTypeExists = paymentTypes.stream().anyMatch(pt -> paymentTypeName.equals(pt.getName())); var paymentTypeExists = paymentTypes.stream().anyMatch(pt -> paymentTypeName.equals(pt.getName()));
if (paymentTypeExists) { if (paymentTypeExists) {
return; return;
} }
Integer position = paymentTypeNames.indexOf(paymentTypeName) + 2; var position = Integer.valueOf(paymentTypeNames.indexOf(paymentTypeName) + 2).longValue();
PaymentTypeRequest postPaymentTypesRequest = PaymentTypesRequestFactory.defaultPaymentTypeRequest(paymentTypeName, var postPaymentTypesRequest = new PaymentTypeCreateRequest().name(paymentTypeName).description(paymentTypeName)
paymentTypeName, false, position); .isCashPayment(false).position(position);
executeVoid(() -> fineractClient.paymentType().createPaymentType(postPaymentTypesRequest, Map.of())); executeVoid(() -> fineractClient.paymentType().createPaymentType(postPaymentTypesRequest, Map.of()));
}); });
@@ -96,8 +96,8 @@ public class LoanTransactionMapperTest {
when(loanTransaction.getLoan().getNetDisbursalAmount()).thenReturn(BigDecimal.valueOf(2000)); when(loanTransaction.getLoan().getNetDisbursalAmount()).thenReturn(BigDecimal.valueOf(2000));
// Setup payment detail mocks // Setup payment detail mocks
when(paymentDetail.toData()).thenReturn(new PaymentDetailData(1L, PaymentTypeData.instance(1L, "Cash"), "accountNumber", when(paymentDetail.toData()).thenReturn(new PaymentDetailData(1L, PaymentTypeData.builder().id(1L).name("Cash").build(),
"checkNumber", "routingCode", "receiptNumber", "bankNumber")); "accountNumber", "checkNumber", "routingCode", "receiptNumber", "bankNumber"));
// When // When
LoanTransactionData result = mapper.mapLoanTransaction(loanTransaction); LoanTransactionData result = mapper.mapLoanTransaction(loanTransaction);
@@ -23,7 +23,7 @@ import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List; import java.util.List;
import org.apache.fineract.portfolio.note.data.NoteData; import org.apache.fineract.portfolio.note.data.NoteData;
import org.apache.fineract.portfolio.paymenttype.api.PaymentTypeApiResourceSwagger.GetPaymentTypesResponse; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
/** /**
* Created by sanyam on 25/7/17. * Created by sanyam on 25/7/17.
@@ -110,7 +110,7 @@ final class JournalEntriesApiResourceSwagger {
@Schema(example = "62") @Schema(example = "62")
public Long id; public Long id;
public GetPaymentTypesResponse paymentType; public PaymentTypeData paymentType;
@Schema(example = "acc123") @Schema(example = "acc123")
public String accountNumber; public String accountNumber;
@Schema(example = "che123") @Schema(example = "che123")
@@ -187,7 +187,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
final Long paymentTypeId = JdbcSupport.getLong(rs, "paymentTypeId"); final Long paymentTypeId = JdbcSupport.getLong(rs, "paymentTypeId");
if (paymentTypeId != null) { if (paymentTypeId != null) {
final String typeName = rs.getString("paymentTypeName"); final String typeName = rs.getString("paymentTypeName");
final PaymentTypeData paymentType = PaymentTypeData.instance(paymentTypeId, typeName); final PaymentTypeData paymentType = PaymentTypeData.builder().id(paymentTypeId).name(typeName).build();
final String accountNumber = rs.getString("accountNumber"); final String accountNumber = rs.getString("accountNumber");
final String checkNumber = rs.getString("checkNumber"); final String checkNumber = rs.getString("checkNumber");
final String routingCode = rs.getString("routingCode"); final String routingCode = rs.getString("routingCode");
@@ -91,7 +91,7 @@ import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService
import org.apache.fineract.portfolio.loanproduct.data.LoanProductData; import org.apache.fineract.portfolio.loanproduct.data.LoanProductData;
import org.apache.fineract.portfolio.loanproduct.service.LoanProductReadPlatformService; import org.apache.fineract.portfolio.loanproduct.service.LoanProductReadPlatformService;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.products.data.ProductData; import org.apache.fineract.portfolio.products.data.ProductData;
import org.apache.fineract.portfolio.products.service.ShareProductReadPlatformService; import org.apache.fineract.portfolio.products.service.ShareProductReadPlatformService;
import org.apache.fineract.portfolio.savings.DepositAccountType; import org.apache.fineract.portfolio.savings.DepositAccountType;
@@ -124,7 +124,7 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
private final CenterReadPlatformService centerReadPlatformService; private final CenterReadPlatformService centerReadPlatformService;
private final GroupReadPlatformService groupReadPlatformService; private final GroupReadPlatformService groupReadPlatformService;
private final FundReadPlatformService fundReadPlatformService; private final FundReadPlatformService fundReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadService paymentTypeReadPlatformService;
private final LoanProductReadPlatformService loanProductReadPlatformService; private final LoanProductReadPlatformService loanProductReadPlatformService;
private final CurrencyReadPlatformService currencyReadPlatformService; private final CurrencyReadPlatformService currencyReadPlatformService;
private final LoanReadPlatformService loanReadPlatformService; private final LoanReadPlatformService loanReadPlatformService;
@@ -142,7 +142,7 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
final OfficeReadPlatformService officeReadPlatformService, final StaffReadPlatformService staffReadPlatformService, final OfficeReadPlatformService officeReadPlatformService, final StaffReadPlatformService staffReadPlatformService,
final ClientReadPlatformService clientReadPlatformService, final CenterReadPlatformService centerReadPlatformService, final ClientReadPlatformService clientReadPlatformService, final CenterReadPlatformService centerReadPlatformService,
final GroupReadPlatformService groupReadPlatformService, final FundReadPlatformService fundReadPlatformService, final GroupReadPlatformService groupReadPlatformService, final FundReadPlatformService fundReadPlatformService,
final PaymentTypeReadPlatformService paymentTypeReadPlatformService, final PaymentTypeReadService paymentTypeReadPlatformService,
final LoanProductReadPlatformService loanProductReadPlatformService, final LoanProductReadPlatformService loanProductReadPlatformService,
final CurrencyReadPlatformService currencyReadPlatformService, final LoanReadPlatformService loanReadPlatformService, final CurrencyReadPlatformService currencyReadPlatformService, final LoanReadPlatformService loanReadPlatformService,
final GLAccountReadPlatformService glAccountReadPlatformService, final GLAccountReadPlatformService glAccountReadPlatformService,
@@ -290,6 +290,13 @@ public class SecurityConfig {
.hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_READ, "READ_IMPORT") .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_READ, "READ_IMPORT")
.requestMatchers(API_MATCHER.matcher(HttpMethod.GET, "/api/*/import/*")) .requestMatchers(API_MATCHER.matcher(HttpMethod.GET, "/api/*/import/*"))
.hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_READ, "READ_IMPORT") .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_READ, "READ_IMPORT")
// payment type
.requestMatchers(API_MATCHER.matcher(HttpMethod.GET, "/api/*/paymenttypes/*"))
.hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_READ, "READ_PAYMENTTYPE")
.requestMatchers(API_MATCHER.matcher(HttpMethod.POST, "/api/*/paymenttypes"))
.hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "UPDATE_PAYMENTTYPE")
.requestMatchers(API_MATCHER.matcher(HttpMethod.POST, "/api/*/paymenttypes"))
.hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "DELETE_PAYMENTTYPE")
.requestMatchers(API_MATCHER.matcher(HttpMethod.POST, "/api/*/twofactor/validate")).fullyAuthenticated() .requestMatchers(API_MATCHER.matcher(HttpMethod.POST, "/api/*/twofactor/validate")).fullyAuthenticated()
.requestMatchers(API_MATCHER.matcher("/api/*/twofactor")).fullyAuthenticated() .requestMatchers(API_MATCHER.matcher("/api/*/twofactor")).fullyAuthenticated()
@@ -371,7 +371,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
final String paymentTypeName = rs.getString("paymentTypeName"); final String paymentTypeName = rs.getString("paymentTypeName");
PaymentTypeData paymentTypeData = null; PaymentTypeData paymentTypeData = null;
if (paymentTypeId != null) { if (paymentTypeId != null) {
paymentTypeData = PaymentTypeData.instance(paymentTypeId, paymentTypeName); paymentTypeData = PaymentTypeData.builder().id(paymentTypeId).name(paymentTypeName).build();
} }
return ChargeData.builder().id(id).name(name).amount(amount).currency(currency).chargeTimeType(chargeTimeType) return ChargeData.builder().id(id).name(name).amount(amount).currency(currency).chargeTimeType(chargeTimeType)
@@ -107,7 +107,7 @@ public class ClientTransactionReadPlatformServiceImpl implements ClientTransacti
final Long paymentTypeId = JdbcSupport.getLong(rs, "paymentType"); final Long paymentTypeId = JdbcSupport.getLong(rs, "paymentType");
if (paymentTypeId != null) { if (paymentTypeId != null) {
final String typeName = rs.getString("paymentTypeName"); final String typeName = rs.getString("paymentTypeName");
final PaymentTypeData paymentType = PaymentTypeData.instance(paymentTypeId, typeName); final PaymentTypeData paymentType = PaymentTypeData.builder().id(paymentTypeId).name(typeName).build();
final String accountNumber = rs.getString("accountNumber"); final String accountNumber = rs.getString("accountNumber");
final String checkNumber = rs.getString("checkNumber"); final String checkNumber = rs.getString("checkNumber");
final String routingCode = rs.getString("routingCode"); final String routingCode = rs.getString("routingCode");
@@ -65,7 +65,7 @@ import org.apache.fineract.portfolio.loanproduct.data.LoanProductData;
import org.apache.fineract.portfolio.meeting.attendance.service.AttendanceDropdownReadPlatformService; import org.apache.fineract.portfolio.meeting.attendance.service.AttendanceDropdownReadPlatformService;
import org.apache.fineract.portfolio.meeting.attendance.service.AttendanceEnumerations; import org.apache.fineract.portfolio.meeting.attendance.service.AttendanceEnumerations;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.savings.data.SavingsProductData; import org.apache.fineract.portfolio.savings.data.SavingsProductData;
import org.apache.fineract.useradministration.domain.AppUser; import org.apache.fineract.useradministration.domain.AppUser;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
@@ -86,7 +86,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
private final AttendanceDropdownReadPlatformService attendanceDropdownReadPlatformService; private final AttendanceDropdownReadPlatformService attendanceDropdownReadPlatformService;
private final MandatorySavingsCollectionsheetExtractor mandatorySavingsExtractor; private final MandatorySavingsCollectionsheetExtractor mandatorySavingsExtractor;
private final CodeValueReadPlatformService codeValueReadPlatformService; private final CodeValueReadPlatformService codeValueReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadService paymentTypeReadPlatformService;
private final CalendarReadPlatformService calendarReadPlatformService; private final CalendarReadPlatformService calendarReadPlatformService;
private final ConfigurationDomainService configurationDomainService; private final ConfigurationDomainService configurationDomainService;
private final CalendarInstanceRepository calendarInstanceRepository; private final CalendarInstanceRepository calendarInstanceRepository;
@@ -98,8 +98,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
final CollectionSheetGenerateCommandFromApiJsonDeserializer collectionSheetGenerateCommandFromApiJsonDeserializer, final CollectionSheetGenerateCommandFromApiJsonDeserializer collectionSheetGenerateCommandFromApiJsonDeserializer,
final CalendarRepositoryWrapper calendarRepositoryWrapper, final CalendarRepositoryWrapper calendarRepositoryWrapper,
final AttendanceDropdownReadPlatformService attendanceDropdownReadPlatformService, final AttendanceDropdownReadPlatformService attendanceDropdownReadPlatformService,
final CodeValueReadPlatformService codeValueReadPlatformService, final CodeValueReadPlatformService codeValueReadPlatformService, final PaymentTypeReadService paymentTypeReadPlatformService,
final PaymentTypeReadPlatformService paymentTypeReadPlatformService,
final CalendarReadPlatformService calendarReadPlatformService, final ConfigurationDomainService configurationDomainService, final CalendarReadPlatformService calendarReadPlatformService, final ConfigurationDomainService configurationDomainService,
final CalendarInstanceRepository calendarInstanceRepository, DatabaseSpecificSQLGenerator sqlGenerator) { final CalendarInstanceRepository calendarInstanceRepository, DatabaseSpecificSQLGenerator sqlGenerator) {
this.context = context; this.context = context;
@@ -40,7 +40,7 @@ import org.apache.fineract.portfolio.meeting.attendance.service.AttendanceDropdo
import org.apache.fineract.portfolio.meeting.service.MeetingWritePlatformService; import org.apache.fineract.portfolio.meeting.service.MeetingWritePlatformService;
import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetailAssembler; import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetailAssembler;
import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService; import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.savings.domain.DepositAccountAssembler; import org.apache.fineract.portfolio.savings.domain.DepositAccountAssembler;
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService; import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -59,7 +59,7 @@ public class CollectionSheetConfiguration {
CollectionSheetGenerateCommandFromApiJsonDeserializer collectionSheetGenerateCommandFromApiJsonDeserializer, CollectionSheetGenerateCommandFromApiJsonDeserializer collectionSheetGenerateCommandFromApiJsonDeserializer,
CalendarRepositoryWrapper calendarRepositoryWrapper, CalendarRepositoryWrapper calendarRepositoryWrapper,
AttendanceDropdownReadPlatformService attendanceDropdownReadPlatformService, AttendanceDropdownReadPlatformService attendanceDropdownReadPlatformService,
CodeValueReadPlatformService codeValueReadPlatformService, PaymentTypeReadPlatformService paymentTypeReadPlatformService, CodeValueReadPlatformService codeValueReadPlatformService, PaymentTypeReadService paymentTypeReadPlatformService,
CalendarReadPlatformService calendarReadPlatformService, ConfigurationDomainService configurationDomainService, CalendarReadPlatformService calendarReadPlatformService, ConfigurationDomainService configurationDomainService,
CalendarInstanceRepository calendarInstanceRepository, DatabaseSpecificSQLGenerator sqlGenerator) { CalendarInstanceRepository calendarInstanceRepository, DatabaseSpecificSQLGenerator sqlGenerator) {
return new CollectionSheetReadPlatformServiceImpl(context, namedParameterJdbcTemplate, centerReadPlatformService, return new CollectionSheetReadPlatformServiceImpl(context, namedParameterJdbcTemplate, centerReadPlatformService,
@@ -79,7 +79,7 @@ import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService
import org.apache.fineract.portfolio.loanaccount.service.reaging.LoanReAgingService; import org.apache.fineract.portfolio.loanaccount.service.reaging.LoanReAgingService;
import org.apache.fineract.portfolio.loanaccount.service.reamortization.LoanReAmortizationService; import org.apache.fineract.portfolio.loanaccount.service.reamortization.LoanReAmortizationService;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -110,7 +110,7 @@ public class LoanTransactionsApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper; private final ApiRequestParameterHelper apiRequestParameterHelper;
private final DefaultToApiJsonSerializer<LoanTransactionData> toApiJsonSerializer; private final DefaultToApiJsonSerializer<LoanTransactionData> toApiJsonSerializer;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadService paymentTypeReadPlatformService;
private final LoanChargePaidByReadService loanChargePaidByReadService; private final LoanChargePaidByReadService loanChargePaidByReadService;
private final LoanReAgingService loanReAgingService; private final LoanReAgingService loanReAgingService;
private final LoanReAmortizationService loanReAmortizationService; private final LoanReAmortizationService loanReAmortizationService;
@@ -149,7 +149,7 @@ import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
import org.apache.fineract.portfolio.loanproduct.service.LoanProductReadPlatformService; import org.apache.fineract.portfolio.loanproduct.service.LoanProductReadPlatformService;
import org.apache.fineract.portfolio.paymentdetail.data.PaymentDetailData; import org.apache.fineract.portfolio.paymentdetail.data.PaymentDetailData;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.useradministration.domain.AppUser; import org.apache.fineract.useradministration.domain.AppUser;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.dao.EmptyResultDataAccessException;
@@ -177,7 +177,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa
private final CalendarReadPlatformService calendarReadPlatformService; private final CalendarReadPlatformService calendarReadPlatformService;
private final StaffReadPlatformService staffReadPlatformService; private final StaffReadPlatformService staffReadPlatformService;
private final PaginationHelper paginationHelper; private final PaginationHelper paginationHelper;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadService paymentTypeReadPlatformService;
private final FloatingRatesReadPlatformService floatingRatesReadPlatformService; private final FloatingRatesReadPlatformService floatingRatesReadPlatformService;
private final LoanUtilService loanUtilService; private final LoanUtilService loanUtilService;
private final ConfigurationDomainService configurationDomainService; private final ConfigurationDomainService configurationDomainService;
@@ -1395,7 +1395,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa
final Long paymentTypeId = JdbcSupport.getLong(rs, "paymentType"); final Long paymentTypeId = JdbcSupport.getLong(rs, "paymentType");
if (paymentTypeId != null) { if (paymentTypeId != null) {
final String typeName = rs.getString("paymentTypeName"); final String typeName = rs.getString("paymentTypeName");
final PaymentTypeData paymentType = PaymentTypeData.instance(paymentTypeId, typeName); final PaymentTypeData paymentType = PaymentTypeData.builder().id(paymentTypeId).name(typeName).build();
final String accountNumber = rs.getString("accountNumber"); final String accountNumber = rs.getString("accountNumber");
final String checkNumber = rs.getString("checkNumber"); final String checkNumber = rs.getString("checkNumber");
final String routingCode = rs.getString("routingCode"); final String routingCode = rs.getString("routingCode");
@@ -176,7 +176,7 @@ import org.apache.fineract.portfolio.loanproduct.service.LoanDropdownReadPlatfor
import org.apache.fineract.portfolio.loanproduct.service.LoanProductReadPlatformService; import org.apache.fineract.portfolio.loanproduct.service.LoanProductReadPlatformService;
import org.apache.fineract.portfolio.note.domain.NoteRepository; import org.apache.fineract.portfolio.note.domain.NoteRepository;
import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService; import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.rate.service.RateAssembler; import org.apache.fineract.portfolio.rate.service.RateAssembler;
import org.apache.fineract.portfolio.repaymentwithpostdatedchecks.domain.PostDatedChecksRepository; import org.apache.fineract.portfolio.repaymentwithpostdatedchecks.domain.PostDatedChecksRepository;
import org.apache.fineract.portfolio.repaymentwithpostdatedchecks.service.RepaymentWithPostDatedChecksAssembler; import org.apache.fineract.portfolio.repaymentwithpostdatedchecks.service.RepaymentWithPostDatedChecksAssembler;
@@ -342,15 +342,14 @@ public class LoanAccountConfiguration {
FundReadPlatformService fundReadPlatformService, ChargeReadPlatformService chargeReadPlatformService, FundReadPlatformService fundReadPlatformService, ChargeReadPlatformService chargeReadPlatformService,
CodeValueReadPlatformService codeValueReadPlatformService, CalendarReadPlatformService calendarReadPlatformService, CodeValueReadPlatformService codeValueReadPlatformService, CalendarReadPlatformService calendarReadPlatformService,
StaffReadPlatformService staffReadPlatformService, PaginationHelper paginationHelper, StaffReadPlatformService staffReadPlatformService, PaginationHelper paginationHelper,
PaymentTypeReadPlatformService paymentTypeReadPlatformService, PaymentTypeReadService paymentTypeReadPlatformService, FloatingRatesReadPlatformService floatingRatesReadPlatformService,
FloatingRatesReadPlatformService floatingRatesReadPlatformService, LoanUtilService loanUtilService, LoanUtilService loanUtilService, ConfigurationDomainService configurationDomainService,
ConfigurationDomainService configurationDomainService, AccountDetailsReadPlatformService accountDetailsReadPlatformService, AccountDetailsReadPlatformService accountDetailsReadPlatformService, ColumnValidator columnValidator,
ColumnValidator columnValidator, DatabaseSpecificSQLGenerator sqlGenerator, DatabaseSpecificSQLGenerator sqlGenerator, DelinquencyReadPlatformService delinquencyReadPlatformService,
DelinquencyReadPlatformService delinquencyReadPlatformService, LoanTransactionRepository loanTransactionRepository, LoanTransactionRepository loanTransactionRepository, LoanChargePaidByReadService loanChargePaidByReadService,
LoanChargePaidByReadService loanChargePaidByReadService, LoanTransactionRelationReadService loanTransactionRelationReadService, LoanTransactionRelationReadService loanTransactionRelationReadService, LoanForeclosureValidator loanForeclosureValidator,
LoanForeclosureValidator loanForeclosureValidator, LoanTransactionMapper loanTransactionMapper, LoanTransactionMapper loanTransactionMapper, LoanTransactionProcessingService loanTransactionProcessingService,
LoanTransactionProcessingService loanTransactionProcessingService, LoanBalanceService loanBalanceService, LoanBalanceService loanBalanceService, LoanCapitalizedIncomeBalanceRepository loanCapitalizedIncomeBalanceRepository,
LoanCapitalizedIncomeBalanceRepository loanCapitalizedIncomeBalanceRepository,
LoanBuyDownFeeBalanceRepository loanBuyDownFeeBalanceRepository, LoanBuyDownFeeBalanceRepository loanBuyDownFeeBalanceRepository,
@Lazy InterestRefundServiceDelegate interestRefundServiceDelegate, LoanMaximumAmountCalculator loanMaximumAmountCalculator, @Lazy InterestRefundServiceDelegate interestRefundServiceDelegate, LoanMaximumAmountCalculator loanMaximumAmountCalculator,
LoanRepaymentScheduleService loanRepaymentScheduleService) { LoanRepaymentScheduleService loanRepaymentScheduleService) {
@@ -109,7 +109,7 @@ import org.apache.fineract.portfolio.loanproduct.productmix.service.ProductMixRe
import org.apache.fineract.portfolio.loanproduct.service.LoanDropdownReadPlatformService; import org.apache.fineract.portfolio.loanproduct.service.LoanDropdownReadPlatformService;
import org.apache.fineract.portfolio.loanproduct.service.LoanProductReadPlatformService; import org.apache.fineract.portfolio.loanproduct.service.LoanProductReadPlatformService;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.rate.data.RateData; import org.apache.fineract.portfolio.rate.data.RateData;
import org.apache.fineract.portfolio.rate.service.RateReadService; import org.apache.fineract.portfolio.rate.service.RateReadService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -165,7 +165,7 @@ public class LoanProductsApiResource {
private final DefaultToApiJsonSerializer<ProductMixData> productMixDataApiJsonSerializer; private final DefaultToApiJsonSerializer<ProductMixData> productMixDataApiJsonSerializer;
private final ProductMixReadPlatformService productMixReadPlatformService; private final ProductMixReadPlatformService productMixReadPlatformService;
private final DropdownReadPlatformService commonDropdownReadPlatformService; private final DropdownReadPlatformService commonDropdownReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadService paymentTypeReadPlatformService;
private final FloatingRatesReadPlatformService floatingRateReadPlatformService; private final FloatingRatesReadPlatformService floatingRateReadPlatformService;
private final RateReadService rateReadService; private final RateReadService rateReadService;
private final ConfigurationDomainService configurationDomainService; private final ConfigurationDomainService configurationDomainService;
@@ -45,7 +45,7 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.savings.DepositAccountType; import org.apache.fineract.portfolio.savings.DepositAccountType;
import org.apache.fineract.portfolio.savings.DepositsApiConstants; import org.apache.fineract.portfolio.savings.DepositsApiConstants;
import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData; import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData;
@@ -63,7 +63,7 @@ public class FixedDepositAccountTransactionsApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper; private final ApiRequestParameterHelper apiRequestParameterHelper;
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService; private final SavingsAccountReadPlatformService savingsAccountReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadService paymentTypeReadPlatformService;
private static final Set<String> FIXED_DEPOSIT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>( private static final Set<String> FIXED_DEPOSIT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList(DepositsApiConstants.idParamName, DepositsApiConstants.accountIdParamName, Arrays.asList(DepositsApiConstants.idParamName, DepositsApiConstants.accountIdParamName,
DepositsApiConstants.accountNoParamName, DepositsApiConstants.currencyParamName, DepositsApiConstants.amountParamName, DepositsApiConstants.accountNoParamName, DepositsApiConstants.currencyParamName, DepositsApiConstants.amountParamName,
@@ -66,7 +66,7 @@ import org.apache.fineract.portfolio.common.service.DropdownReadPlatformService;
import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartData; import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartData;
import org.apache.fineract.portfolio.interestratechart.service.InterestRateChartReadPlatformService; import org.apache.fineract.portfolio.interestratechart.service.InterestRateChartReadPlatformService;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.savings.DepositAccountType; import org.apache.fineract.portfolio.savings.DepositAccountType;
import org.apache.fineract.portfolio.savings.DepositsApiConstants; import org.apache.fineract.portfolio.savings.DepositsApiConstants;
import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodType; import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodType;
@@ -108,7 +108,7 @@ public class FixedDepositProductsApiResource {
private final InterestRateChartReadPlatformService interestRateChartReadPlatformService; private final InterestRateChartReadPlatformService interestRateChartReadPlatformService;
private final DepositsDropdownReadPlatformService depositsDropdownReadPlatformService; private final DepositsDropdownReadPlatformService depositsDropdownReadPlatformService;
private final DropdownReadPlatformService dropdownReadPlatformService; private final DropdownReadPlatformService dropdownReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadService paymentTypeReadPlatformService;
private final TaxReadPlatformService taxReadPlatformService; private final TaxReadPlatformService taxReadPlatformService;
@POST @POST
@@ -52,7 +52,7 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.savings.DepositAccountType; import org.apache.fineract.portfolio.savings.DepositAccountType;
import org.apache.fineract.portfolio.savings.DepositsApiConstants; import org.apache.fineract.portfolio.savings.DepositsApiConstants;
import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData; import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData;
@@ -72,7 +72,7 @@ public class RecurringDepositAccountTransactionsApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper; private final ApiRequestParameterHelper apiRequestParameterHelper;
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService; private final SavingsAccountReadPlatformService savingsAccountReadPlatformService;
private final DepositAccountReadPlatformService depositAccountReadPlatformService; private final DepositAccountReadPlatformService depositAccountReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadService paymentTypeReadPlatformService;
private static final Set<String> FIXED_DEPOSIT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>( private static final Set<String> FIXED_DEPOSIT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList(DepositsApiConstants.idParamName, DepositsApiConstants.accountIdParamName, Arrays.asList(DepositsApiConstants.idParamName, DepositsApiConstants.accountIdParamName,
DepositsApiConstants.accountNoParamName, DepositsApiConstants.currencyParamName, DepositsApiConstants.amountParamName, DepositsApiConstants.accountNoParamName, DepositsApiConstants.currencyParamName, DepositsApiConstants.amountParamName,
@@ -67,7 +67,7 @@ import org.apache.fineract.portfolio.common.service.DropdownReadPlatformService;
import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartData; import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartData;
import org.apache.fineract.portfolio.interestratechart.service.InterestRateChartReadPlatformService; import org.apache.fineract.portfolio.interestratechart.service.InterestRateChartReadPlatformService;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.savings.DepositAccountType; import org.apache.fineract.portfolio.savings.DepositAccountType;
import org.apache.fineract.portfolio.savings.DepositsApiConstants; import org.apache.fineract.portfolio.savings.DepositsApiConstants;
import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodType; import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodType;
@@ -108,7 +108,7 @@ public class RecurringDepositProductsApiResource {
private final InterestRateChartReadPlatformService interestRateChartReadPlatformService; private final InterestRateChartReadPlatformService interestRateChartReadPlatformService;
private final DepositsDropdownReadPlatformService depositsDropdownReadPlatformService; private final DepositsDropdownReadPlatformService depositsDropdownReadPlatformService;
private final DropdownReadPlatformService dropdownReadPlatformService; private final DropdownReadPlatformService dropdownReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadService paymentTypeReadPlatformService;
private final TaxReadPlatformService taxReadPlatformService; private final TaxReadPlatformService taxReadPlatformService;
@POST @POST
@@ -55,7 +55,7 @@ import org.apache.fineract.infrastructure.core.serialization.JsonParserHelper;
import org.apache.fineract.infrastructure.core.service.PagedLocalRequest; import org.apache.fineract.infrastructure.core.service.PagedLocalRequest;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.savings.DepositAccountType; import org.apache.fineract.portfolio.savings.DepositAccountType;
import org.apache.fineract.portfolio.savings.SavingsApiConstants; import org.apache.fineract.portfolio.savings.SavingsApiConstants;
import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData; import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData;
@@ -78,7 +78,7 @@ public class SavingsAccountTransactionsApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper; private final ApiRequestParameterHelper apiRequestParameterHelper;
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService; private final SavingsAccountReadPlatformService savingsAccountReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadService paymentTypeReadPlatformService;
private final SavingsAccountTransactionSearchService transactionsSearchService; private final SavingsAccountTransactionSearchService transactionsSearchService;
private boolean is(final String commandParam, final String commandValue) { private boolean is(final String commandParam, final String commandValue) {
@@ -64,7 +64,7 @@ import org.apache.fineract.organisation.monetary.service.CurrencyReadPlatformSer
import org.apache.fineract.portfolio.charge.data.ChargeData; import org.apache.fineract.portfolio.charge.data.ChargeData;
import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService; import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.savings.SavingsApiConstants; import org.apache.fineract.portfolio.savings.SavingsApiConstants;
import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodType; import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodType;
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationDaysInYearType; import org.apache.fineract.portfolio.savings.SavingsInterestCalculationDaysInYearType;
@@ -96,7 +96,7 @@ public class SavingsProductsApiResource {
private final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService; private final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService;
private final ProductToGLAccountMappingReadPlatformService accountMappingReadPlatformService; private final ProductToGLAccountMappingReadPlatformService accountMappingReadPlatformService;
private final ChargeReadPlatformService chargeReadPlatformService; private final ChargeReadPlatformService chargeReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadService paymentTypeReadPlatformService;
private final TaxReadPlatformService taxReadPlatformService; private final TaxReadPlatformService taxReadPlatformService;
private final ConfigurationDomainService configurationDomainService; private final ConfigurationDomainService configurationDomainService;
@@ -29,7 +29,7 @@ import org.apache.fineract.infrastructure.core.api.JsonQuery;
import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.savings.DepositAccountOnClosureType; import org.apache.fineract.portfolio.savings.DepositAccountOnClosureType;
import org.apache.fineract.portfolio.savings.DepositAccountType; import org.apache.fineract.portfolio.savings.DepositAccountType;
import org.apache.fineract.portfolio.savings.data.DepositAccountData; import org.apache.fineract.portfolio.savings.data.DepositAccountData;
@@ -51,7 +51,7 @@ public class DepositAccountPreMatureCalculationPlatformServiceImpl implements De
private final DepositAccountAssembler depositAccountAssembler; private final DepositAccountAssembler depositAccountAssembler;
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService; private final SavingsAccountReadPlatformService savingsAccountReadPlatformService;
private final ConfigurationDomainService configurationDomainService; private final ConfigurationDomainService configurationDomainService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadService paymentTypeReadPlatformService;
@Transactional @Transactional
@Override @Override
@@ -68,7 +68,7 @@ import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartDat
import org.apache.fineract.portfolio.interestratechart.service.InterestRateChartReadPlatformService; import org.apache.fineract.portfolio.interestratechart.service.InterestRateChartReadPlatformService;
import org.apache.fineract.portfolio.paymentdetail.data.PaymentDetailData; import org.apache.fineract.portfolio.paymentdetail.data.PaymentDetailData;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.savings.DepositAccountOnClosureType; import org.apache.fineract.portfolio.savings.DepositAccountOnClosureType;
import org.apache.fineract.portfolio.savings.DepositAccountType; import org.apache.fineract.portfolio.savings.DepositAccountType;
import org.apache.fineract.portfolio.savings.SavingsAccountTransactionType; import org.apache.fineract.portfolio.savings.SavingsAccountTransactionType;
@@ -127,7 +127,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
private final RecurringAccountDepositTransactionTemplateMapper rdTransactionTemplateMapper = new RecurringAccountDepositTransactionTemplateMapper(); private final RecurringAccountDepositTransactionTemplateMapper rdTransactionTemplateMapper = new RecurringAccountDepositTransactionTemplateMapper();
private final DropdownReadPlatformService dropdownReadPlatformService; private final DropdownReadPlatformService dropdownReadPlatformService;
private final CalendarReadPlatformService calendarReadPlatformService; private final CalendarReadPlatformService calendarReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadService paymentTypeReadPlatformService;
@Override @Override
public Collection<DepositAccountData> retrieveAll(final DepositAccountType depositAccountType, public Collection<DepositAccountData> retrieveAll(final DepositAccountType depositAccountType,
@@ -1160,7 +1160,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
final Long paymentTypeId = JdbcSupport.getLong(rs, PAYMENT_TYPE); final Long paymentTypeId = JdbcSupport.getLong(rs, PAYMENT_TYPE);
if (paymentTypeId != null) { if (paymentTypeId != null) {
final String typeName = rs.getString(PAYMENT_TYPE_NAME); final String typeName = rs.getString(PAYMENT_TYPE_NAME);
final PaymentTypeData paymentType = PaymentTypeData.instance(paymentTypeId, typeName); final PaymentTypeData paymentType = PaymentTypeData.builder().id(paymentTypeId).name(typeName).build();
final String accountNumber = rs.getString(ACCOUNT_NUMBER); final String accountNumber = rs.getString(ACCOUNT_NUMBER);
final String checkNumber = rs.getString(CHECK_NUMBER); final String checkNumber = rs.getString(CHECK_NUMBER);
final String routingCode = rs.getString(ROUTING_CODE); final String routingCode = rs.getString(ROUTING_CODE);
@@ -1165,7 +1165,7 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead
final Long paymentTypeId = JdbcSupport.getLong(rs, "paymentType"); final Long paymentTypeId = JdbcSupport.getLong(rs, "paymentType");
if (paymentTypeId != null) { if (paymentTypeId != null) {
final String typeName = rs.getString("paymentTypeName"); final String typeName = rs.getString("paymentTypeName");
final PaymentTypeData paymentType = PaymentTypeData.instance(paymentTypeId, typeName); final PaymentTypeData paymentType = PaymentTypeData.builder().id(paymentTypeId).name(typeName).build();
final String accountNumber = rs.getString("accountNumber"); final String accountNumber = rs.getString("accountNumber");
final String checkNumber = rs.getString("checkNumber"); final String checkNumber = rs.getString("checkNumber");
final String routingCode = rs.getString("routingCode"); final String routingCode = rs.getString("routingCode");
@@ -67,7 +67,7 @@ import org.apache.fineract.portfolio.interestratechart.service.InterestRateChart
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepository; import org.apache.fineract.portfolio.loanaccount.domain.LoanRepository;
import org.apache.fineract.portfolio.note.domain.NoteRepository; import org.apache.fineract.portfolio.note.domain.NoteRepository;
import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService; import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
import org.apache.fineract.portfolio.savings.data.DepositAccountDataValidator; import org.apache.fineract.portfolio.savings.data.DepositAccountDataValidator;
import org.apache.fineract.portfolio.savings.data.DepositAccountTransactionDataValidator; import org.apache.fineract.portfolio.savings.data.DepositAccountTransactionDataValidator;
import org.apache.fineract.portfolio.savings.data.DepositProductDataValidator; import org.apache.fineract.portfolio.savings.data.DepositProductDataValidator;
@@ -190,7 +190,7 @@ public class SavingsConfiguration {
public DepositAccountPreMatureCalculationPlatformService depositAccountPreMatureCalculationPlatformService( public DepositAccountPreMatureCalculationPlatformService depositAccountPreMatureCalculationPlatformService(
FromJsonHelper fromJsonHelper, DepositAccountTransactionDataValidator depositAccountTransactionDataValidator, FromJsonHelper fromJsonHelper, DepositAccountTransactionDataValidator depositAccountTransactionDataValidator,
DepositAccountAssembler depositAccountAssembler, SavingsAccountReadPlatformService savingsAccountReadPlatformService, DepositAccountAssembler depositAccountAssembler, SavingsAccountReadPlatformService savingsAccountReadPlatformService,
ConfigurationDomainService configurationDomainService, PaymentTypeReadPlatformService paymentTypeReadPlatformService) { ConfigurationDomainService configurationDomainService, PaymentTypeReadService paymentTypeReadPlatformService) {
return new DepositAccountPreMatureCalculationPlatformServiceImpl(fromJsonHelper, depositAccountTransactionDataValidator, return new DepositAccountPreMatureCalculationPlatformServiceImpl(fromJsonHelper, depositAccountTransactionDataValidator,
depositAccountAssembler, savingsAccountReadPlatformService, configurationDomainService, paymentTypeReadPlatformService); depositAccountAssembler, savingsAccountReadPlatformService, configurationDomainService, paymentTypeReadPlatformService);
@@ -207,7 +207,7 @@ public class SavingsConfiguration {
SavingsDropdownReadPlatformService savingsDropdownReadPlatformService, ChargeReadPlatformService chargeReadPlatformService, SavingsDropdownReadPlatformService savingsDropdownReadPlatformService, ChargeReadPlatformService chargeReadPlatformService,
StaffReadPlatformService staffReadPlatformService, DepositsDropdownReadPlatformService depositsDropdownReadPlatformService, StaffReadPlatformService staffReadPlatformService, DepositsDropdownReadPlatformService depositsDropdownReadPlatformService,
SavingsAccountReadPlatformService savingsAccountReadPlatformService, DropdownReadPlatformService dropdownReadPlatformService, SavingsAccountReadPlatformService savingsAccountReadPlatformService, DropdownReadPlatformService dropdownReadPlatformService,
CalendarReadPlatformService calendarReadPlatformService, PaymentTypeReadPlatformService paymentTypeReadPlatformService) { CalendarReadPlatformService calendarReadPlatformService, PaymentTypeReadService paymentTypeReadPlatformService) {
return new DepositAccountReadPlatformServiceImpl(context, jdbcTemplate, chartReadPlatformService, productChartReadPlatformService, return new DepositAccountReadPlatformServiceImpl(context, jdbcTemplate, chartReadPlatformService, productChartReadPlatformService,
paginationParametersDataValidator, sqlGenerator, paginationHelper, clientReadPlatformService, groupReadPlatformService, paginationParametersDataValidator, sqlGenerator, paginationHelper, clientReadPlatformService, groupReadPlatformService,
depositProductReadPlatformService, savingsDropdownReadPlatformService, chargeReadPlatformService, staffReadPlatformService, depositProductReadPlatformService, savingsDropdownReadPlatformService, chargeReadPlatformService, staffReadPlatformService,
@@ -577,6 +577,28 @@ resilience4j.retry.instances.commandImageDelete.enable-exponential-backoff=${FIN
resilience4j.retry.instances.commandImageDelete.exponential-backoff-multiplier=${FINERACT_COMMAND_IMAGE_DELETE_RETRY_EXPONENTIAL_BACKOFF_MULTIPLIER:2} resilience4j.retry.instances.commandImageDelete.exponential-backoff-multiplier=${FINERACT_COMMAND_IMAGE_DELETE_RETRY_EXPONENTIAL_BACKOFF_MULTIPLIER:2}
resilience4j.retry.instances.commandImageDelete.retryExceptions=${FINERACT_COMMAND_IMAGE_DELETE_RETRY_EXCEPTIONS:org.springframework.dao.ConcurrencyFailureException,org.eclipse.persistence.exceptions.OptimisticLockException,jakarta.persistence.OptimisticLockException,org.springframework.orm.jpa.JpaOptimisticLockingFailureException} resilience4j.retry.instances.commandImageDelete.retryExceptions=${FINERACT_COMMAND_IMAGE_DELETE_RETRY_EXCEPTIONS:org.springframework.dao.ConcurrencyFailureException,org.eclipse.persistence.exceptions.OptimisticLockException,jakarta.persistence.OptimisticLockException,org.springframework.orm.jpa.JpaOptimisticLockingFailureException}
# payment type
resilience4j.retry.instances.commandPaymentTypeCreate.max-attempts=${FINERACT_COMMAND_PAYMENT_TYPE_CREATE_RETRY_MAX_ATTEMPTS:3}
resilience4j.retry.instances.commandPaymentTypeCreate.wait-duration=${FINERACT_COMMAND_PAYMENT_TYPE_CREATE_RETRY_WAIT_DURATION:1s}
resilience4j.retry.instances.commandPaymentTypeCreate.enable-exponential-backoff=${FINERACT_COMMAND_PAYMENT_TYPE_CREATE_RETRY_ENABLE_EXPONENTIAL_BACKOFF:true}
resilience4j.retry.instances.commandPaymentTypeCreate.exponential-backoff-multiplier=${FINERACT_COMMAND_PAYMENT_TYPE_CREATE_RETRY_EXPONENTIAL_BACKOFF_MULTIPLIER:2}
resilience4j.retry.instances.commandPaymentTypeCreate.retryExceptions=${FINERACT_COMMAND_PAYMENT_TYPE_CREATE_RETRY_EXCEPTIONS:org.springframework.dao.ConcurrencyFailureException,org.eclipse.persistence.exceptions.OptimisticLockException,jakarta.persistence.OptimisticLockException,org.springframework.orm.jpa.JpaOptimisticLockingFailureException}
resilience4j.retry.instances.commandPaymentTypeUpdate.max-attempts=${FINERACT_COMMAND_PAYMENT_TYPE_UPDATE_RETRY_MAX_ATTEMPTS:3}
resilience4j.retry.instances.commandPaymentTypeUpdate.wait-duration=${FINERACT_COMMAND_PAYMENT_TYPE_UPDATE_RETRY_WAIT_DURATION:1s}
resilience4j.retry.instances.commandPaymentTypeUpdate.enable-exponential-backoff=${FINERACT_COMMAND_PAYMENT_TYPE_UPDATE_RETRY_ENABLE_EXPONENTIAL_BACKOFF:true}
resilience4j.retry.instances.commandPaymentTypeUpdate.exponential-backoff-multiplier=${FINERACT_COMMAND_PAYMENT_TYPE_UPDATE_RETRY_EXPONENTIAL_BACKOFF_MULTIPLIER:2}
resilience4j.retry.instances.commandPaymentTypeUpdate.retryExceptions=${FINERACT_COMMAND_PAYMENT_TYPE_UPDATE_RETRY_EXCEPTIONS:org.springframework.dao.ConcurrencyFailureException,org.eclipse.persistence.exceptions.OptimisticLockException,jakarta.persistence.OptimisticLockException,org.springframework.orm.jpa.JpaOptimisticLockingFailureException}
resilience4j.retry.instances.commandPaymentTypeDelete.max-attempts=${FINERACT_COMMAND_PAYMENT_TYPE_DELETE_RETRY_MAX_ATTEMPTS:3}
resilience4j.retry.instances.commandPaymentTypeDelete.wait-duration=${FINERACT_COMMAND_PAYMENT_TYPE_DELETE_RETRY_WAIT_DURATION:1s}
resilience4j.retry.instances.commandPaymentTypeDelete.enable-exponential-backoff=${FINERACT_COMMAND_PAYMENT_TYPE_DELETE_RETRY_ENABLE_EXPONENTIAL_BACKOFF:true}
resilience4j.retry.instances.commandPaymentTypeDelete.exponential-backoff-multiplier=${FINERACT_COMMAND_PAYMENT_TYPE_DELETE_RETRY_EXPONENTIAL_BACKOFF_MULTIPLIER:2}
resilience4j.retry.instances.commandPaymentTypeDelete.retryExceptions=${FINERACT_COMMAND_PAYMENT_TYPE_DELETE_RETRY_EXCEPTIONS:org.springframework.dao.ConcurrencyFailureException,org.eclipse.persistence.exceptions.OptimisticLockException,jakarta.persistence.OptimisticLockException,org.springframework.orm.jpa.JpaOptimisticLockingFailureException}
# command
fineract.command.enabled=true fineract.command.enabled=true
fineract.command.executor=${FINERACT_COMMAND_EXECUTOR:sync} fineract.command.executor=${FINERACT_COMMAND_EXECUTOR:sync}
fineract.command.ring-buffer-size=${FINERACT_COMMAND_RING_BUFFER_SIZE:1024} fineract.command.ring-buffer-size=${FINERACT_COMMAND_RING_BUFFER_SIZE:1024}
@@ -587,8 +609,6 @@ fineract.command.idempotency-key-header-name=${FINERACT_IDEMPOTENCY_KEY_HEADER_N
fineract.command.file-dead-letter-queue-enabled=${FINERACT_FILE_DEAD_LETTER_QUEUE_ENABLED:false} fineract.command.file-dead-letter-queue-enabled=${FINERACT_FILE_DEAD_LETTER_QUEUE_ENABLED:false}
fineract.command.file-dead-letter-queue-path=${FINERACT_FILE_DEAD_LETTER_QUEUE_PATH:/tmp/fineract-command-audit} fineract.command.file-dead-letter-queue-path=${FINERACT_FILE_DEAD_LETTER_QUEUE_PATH:/tmp/fineract-command-audit}
# command
resilience4j.retry.instances.commandAuditProcessing.max-attempts=${FINERACT_COMMAND_AUDIT_PROCESSING_RETRY_MAX_ATTEMPTS:3} resilience4j.retry.instances.commandAuditProcessing.max-attempts=${FINERACT_COMMAND_AUDIT_PROCESSING_RETRY_MAX_ATTEMPTS:3}
resilience4j.retry.instances.commandAuditProcessing.wait-duration=${FINERACT_COMMAND_AUDIT_PROCESSING_RETRY_WAIT_DURATION:1s} resilience4j.retry.instances.commandAuditProcessing.wait-duration=${FINERACT_COMMAND_AUDIT_PROCESSING_RETRY_WAIT_DURATION:1s}
resilience4j.retry.instances.commandAuditProcessing.enable-exponential-backoff=${FINERACT_COMMAND_AUDIT_PROCESSING_RETRY_ENABLE_EXPONENTIAL_BACKOFF:true} resilience4j.retry.instances.commandAuditProcessing.enable-exponential-backoff=${FINERACT_COMMAND_AUDIT_PROCESSING_RETRY_ENABLE_EXPONENTIAL_BACKOFF:true}
@@ -58,3 +58,24 @@ org.apache.fineract.frequency-type.invalid=The parameter 'frequencyType' must be
org.apache.fineract.portfolio.note.note.size=The parameter 'note' cannot exceed 1000 characters org.apache.fineract.portfolio.note.note.size=The parameter 'note' cannot exceed 1000 characters
org.apache.fineract.portfolio.note.note.not-null=The parameter 'note' cannot be empty org.apache.fineract.portfolio.note.note.not-null=The parameter 'note' cannot be empty
# Document Management
org.apache.fineract.document.id.not-null=The parameter 'id' is mandatory
org.apache.fineract.document.entity-type.not-null=The parameter 'entityType' is mandatory
org.apache.fineract.document.entity-type.size=The parameter 'entityType' cannot exceed 50 characters
org.apache.fineract.document.entity-id.not-null=The parameter 'entityId' is mandatory
org.apache.fineract.document.name.size=The parameter 'name' cannot exceed 250 characters
org.apache.fineract.document.description.size=The parameter 'description' cannot exceed 250 characters
org.apache.fineract.document.file-name.size=The parameter 'fileName' cannot exceed 250 characters
org.apache.fineract.document.size.not-null=The parameter 'size' is mandatory
org.apache.fineract.document.size.min=The parameter 'size' must have a minimum value of 1
# Payment Type
org.apache.fineract.portfolio.paymenttype.id.not-null=The parameter 'id' is mandatory
org.apache.fineract.portfolio.paymenttype.name.not-blank=The parameter 'name' cannot be blank
org.apache.fineract.portfolio.paymenttype.description.size=The parameter 'description' cannot exceed 500 characters
org.apache.fineract.portfolio.paymenttype.position.positive-or-zero=The parameter 'position' must be zero or positive
org.apache.fineract.portfolio.paymenttype.code-name.size=The parameter 'codeName' cannot exceed 100 characters
org.apache.fineract.portfolio.is-system-defined.not-null=The parameter 'isSystemDefined' is mandatory
@@ -40,8 +40,7 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import org.apache.fineract.client.models.PaymentTypeRequest; import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PutGlobalConfigurationsRequest; import org.apache.fineract.client.models.PutGlobalConfigurationsRequest;
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType; import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
import org.apache.fineract.infrastructure.configuration.api.GlobalConfigurationConstants; import org.apache.fineract.infrastructure.configuration.api.GlobalConfigurationConstants;
@@ -2664,10 +2663,10 @@ public class ClientSavingsIntegrationTest {
String name = PaymentTypeHelper.randomNameGenerator("P_T", 5); String name = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15); String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = false; Boolean isCashPayment = false;
Integer position = 1; Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( var paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(name).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeCreateRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId(); Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne); Assertions.assertNotNull(paymentTypeIdOne);
@@ -2688,8 +2687,8 @@ public class ClientSavingsIntegrationTest {
String paymentTypeNameTwo = PaymentTypeHelper.randomNameGenerator("P_T", 5); String paymentTypeNameTwo = PaymentTypeHelper.randomNameGenerator("P_T", 5);
PostPaymentTypesResponse paymentTypesResponseTwo = paymentTypeHelper.createPaymentType( var paymentTypesResponseTwo = paymentTypeHelper.createPaymentType(new PaymentTypeCreateRequest().name(paymentTypeNameTwo)
new PaymentTypeRequest().name(paymentTypeNameTwo).description(description).isCashPayment(isCashPayment).position(position)); .description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdTwo = paymentTypesResponseTwo.getResourceId(); Long paymentTypeIdTwo = paymentTypesResponseTwo.getResourceId();
Assertions.assertNotNull(paymentTypeIdTwo); Assertions.assertNotNull(paymentTypeIdTwo);
@@ -36,8 +36,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import org.apache.fineract.client.models.PaymentTypeRequest; import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.integrationtests.common.ClientHelper; import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.CommonConstants; import org.apache.fineract.integrationtests.common.CommonConstants;
import org.apache.fineract.integrationtests.common.GroupHelper; import org.apache.fineract.integrationtests.common.GroupHelper;
@@ -385,10 +384,10 @@ public class GroupSavingsIntegrationTest {
String name = PaymentTypeHelper.randomNameGenerator("P_T", 5); String name = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15); String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = true; Boolean isCashPayment = true;
Integer position = 1; Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( var paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(name).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeCreateRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeId = paymentTypesResponse.getResourceId(); Long paymentTypeId = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeId); Assertions.assertNotNull(paymentTypeId);
@@ -47,13 +47,12 @@ import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionId
import org.apache.fineract.client.models.JournalEntryTransactionItem; import org.apache.fineract.client.models.JournalEntryTransactionItem;
import org.apache.fineract.client.models.LoanProductChargeData; import org.apache.fineract.client.models.LoanProductChargeData;
import org.apache.fineract.client.models.LoanProductChargeToGLAccountMapper; import org.apache.fineract.client.models.LoanProductChargeToGLAccountMapper;
import org.apache.fineract.client.models.PaymentTypeRequest; import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PostClientsResponse; import org.apache.fineract.client.models.PostClientsResponse;
import org.apache.fineract.client.models.PostLoanProductsRequest; import org.apache.fineract.client.models.PostLoanProductsRequest;
import org.apache.fineract.client.models.PostLoanProductsResponse; import org.apache.fineract.client.models.PostLoanProductsResponse;
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsRequest; import org.apache.fineract.client.models.PostLoansLoanIdTransactionsRequest;
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse; import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.integrationtests.common.BusinessDateHelper; import org.apache.fineract.integrationtests.common.BusinessDateHelper;
import org.apache.fineract.integrationtests.common.ClientHelper; import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.PaymentTypeHelper; import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
@@ -668,10 +667,10 @@ public class LoanAccountChargeOffWithAdvancedPaymentAllocationTest extends BaseL
String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5); String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15); String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = false; Boolean isCashPayment = false;
Integer position = 1; Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( var paymentTypesResponse = paymentTypeHelper.createPaymentType(new PaymentTypeCreateRequest().name(paymentTypeName)
new PaymentTypeRequest().name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position)); .description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId(); Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne); Assertions.assertNotNull(paymentTypeIdOne);
@@ -39,12 +39,11 @@ import org.apache.fineract.client.models.GetLoanPaymentChannelToFundSourceMappin
import org.apache.fineract.client.models.GetLoansLoanIdResponse; import org.apache.fineract.client.models.GetLoansLoanIdResponse;
import org.apache.fineract.client.models.LoanProductChargeData; import org.apache.fineract.client.models.LoanProductChargeData;
import org.apache.fineract.client.models.LoanProductChargeToGLAccountMapper; import org.apache.fineract.client.models.LoanProductChargeToGLAccountMapper;
import org.apache.fineract.client.models.PaymentTypeRequest; import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PostLoanProductsRequest; import org.apache.fineract.client.models.PostLoanProductsRequest;
import org.apache.fineract.client.models.PostLoanProductsResponse; import org.apache.fineract.client.models.PostLoanProductsResponse;
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsRequest; import org.apache.fineract.client.models.PostLoansLoanIdTransactionsRequest;
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse; import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.integrationtests.common.BusinessDateHelper; import org.apache.fineract.integrationtests.common.BusinessDateHelper;
import org.apache.fineract.integrationtests.common.ClientHelper; import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.PaymentTypeHelper; import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
@@ -363,10 +362,10 @@ public class LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest exte
String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5); String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15); String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = false; Boolean isCashPayment = false;
Integer position = 1; Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( var paymentTypesResponse = paymentTypeHelper.createPaymentType(new PaymentTypeCreateRequest().name(paymentTypeName)
new PaymentTypeRequest().name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position)); .description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId(); Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne); Assertions.assertNotNull(paymentTypeIdOne);
@@ -42,12 +42,11 @@ import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionId
import org.apache.fineract.client.models.JournalEntryTransactionItem; import org.apache.fineract.client.models.JournalEntryTransactionItem;
import org.apache.fineract.client.models.LoanProductChargeData; import org.apache.fineract.client.models.LoanProductChargeData;
import org.apache.fineract.client.models.LoanProductChargeToGLAccountMapper; import org.apache.fineract.client.models.LoanProductChargeToGLAccountMapper;
import org.apache.fineract.client.models.PaymentTypeRequest; import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PostLoanProductsRequest; import org.apache.fineract.client.models.PostLoanProductsRequest;
import org.apache.fineract.client.models.PostLoanProductsResponse; import org.apache.fineract.client.models.PostLoanProductsResponse;
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsRequest; import org.apache.fineract.client.models.PostLoansLoanIdTransactionsRequest;
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse; import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.integrationtests.common.ClientHelper; import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.PaymentTypeHelper; import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.Utils;
@@ -1134,10 +1133,10 @@ public class LoanPostChargeOffScenariosTest extends BaseLoanIntegrationTest {
String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5); String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15); String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = false; Boolean isCashPayment = false;
Integer position = 1; Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( var paymentTypesResponse = paymentTypeHelper.createPaymentType(new PaymentTypeCreateRequest().name(paymentTypeName)
new PaymentTypeRequest().name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position)); .description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId(); Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne); Assertions.assertNotNull(paymentTypeIdOne);
@@ -23,11 +23,9 @@ import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import io.restassured.specification.RequestSpecification; import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification; import io.restassured.specification.ResponseSpecification;
import org.apache.fineract.client.models.DeletePaymentTypesPaymentTypeIdResponse; import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PaymentTypeData; import org.apache.fineract.client.models.PaymentTypeData;
import org.apache.fineract.client.models.PaymentTypeRequest; import org.apache.fineract.client.models.PaymentTypeUpdateRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PutPaymentTypesPaymentTypeIdRequest;
import org.apache.fineract.integrationtests.common.PaymentTypeHelper; import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.Utils;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
@@ -55,10 +53,10 @@ public class PaymentTypeIntegrationTest {
String name = PaymentTypeHelper.randomNameGenerator("P_T", 5); String name = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15); String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = true; Boolean isCashPayment = true;
Integer position = 1; Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( var paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(name).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeCreateRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeId = paymentTypesResponse.getResourceId(); Long paymentTypeId = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeId); Assertions.assertNotNull(paymentTypeId);
paymentTypeHelper.verifyPaymentTypeCreatedOnServer(paymentTypeId); paymentTypeHelper.verifyPaymentTypeCreatedOnServer(paymentTypeId);
@@ -72,18 +70,18 @@ public class PaymentTypeIntegrationTest {
String newName = PaymentTypeHelper.randomNameGenerator("P_TU", 5); String newName = PaymentTypeHelper.randomNameGenerator("P_TU", 5);
String newDescription = PaymentTypeHelper.randomNameGenerator("PTU_Desc", 15); String newDescription = PaymentTypeHelper.randomNameGenerator("PTU_Desc", 15);
Boolean isCashPaymentUpdatedValue = false; Boolean isCashPaymentUpdatedValue = false;
Integer newPosition = 2; Long newPosition = 2L;
paymentTypeHelper.updatePaymentType(paymentTypeId, new PutPaymentTypesPaymentTypeIdRequest().name(newName) paymentTypeHelper.updatePaymentType(paymentTypeId, new PaymentTypeUpdateRequest().name(newName).description(newDescription)
.description(newDescription).isCashPayment(isCashPaymentUpdatedValue).position(newPosition)); .isCashPayment(isCashPaymentUpdatedValue).position(newPosition));
PaymentTypeData paymentTypeUpdatedResponse = paymentTypeHelper.retrieveById(paymentTypeId); var paymentTypeUpdatedResponse = paymentTypeHelper.retrieveById(paymentTypeId);
Assertions.assertEquals(newName, paymentTypeUpdatedResponse.getName()); Assertions.assertEquals(newName, paymentTypeUpdatedResponse.getName());
Assertions.assertEquals(newDescription, paymentTypeUpdatedResponse.getDescription()); Assertions.assertEquals(newDescription, paymentTypeUpdatedResponse.getDescription());
Assertions.assertEquals(isCashPaymentUpdatedValue, paymentTypeUpdatedResponse.getIsCashPayment()); Assertions.assertEquals(isCashPaymentUpdatedValue, paymentTypeUpdatedResponse.getIsCashPayment());
Assertions.assertEquals(newPosition, paymentTypeUpdatedResponse.getPosition()); Assertions.assertEquals(newPosition, paymentTypeUpdatedResponse.getPosition());
// Delete // Delete
DeletePaymentTypesPaymentTypeIdResponse responseDelete = paymentTypeHelper.deletePaymentType(paymentTypeId); var responseDelete = paymentTypeHelper.deletePaymentType(paymentTypeId);
Long deletedPaymentTypeId = responseDelete.getResourceId(); Long deletedPaymentTypeId = responseDelete.getResourceId();
Assertions.assertEquals(paymentTypeId, deletedPaymentTypeId); Assertions.assertEquals(paymentTypeId, deletedPaymentTypeId);
ResponseSpecification responseSpecification = new ResponseSpecBuilder().expectStatusCode(404).build(); ResponseSpecification responseSpecification = new ResponseSpecBuilder().expectStatusCode(404).build();
@@ -34,9 +34,8 @@ import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PaymentTypeData; import org.apache.fineract.client.models.PaymentTypeData;
import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.integrationtests.common.ClientHelper; import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.CollateralManagementHelper; import org.apache.fineract.integrationtests.common.CollateralManagementHelper;
import org.apache.fineract.integrationtests.common.PaymentTypeHelper; import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
@@ -138,10 +137,10 @@ public class RepaymentWithPostDatedChecksTest {
String name = "PDC"; String name = "PDC";
String description = PaymentTypeHelper.randomNameGenerator("PDC", 15); String description = PaymentTypeHelper.randomNameGenerator("PDC", 15);
Boolean isCashPayment = false; Boolean isCashPayment = false;
Integer position = 1; Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( var paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(name).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeCreateRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeId = paymentTypesResponse.getResourceId(); Long paymentTypeId = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeId); Assertions.assertNotNull(paymentTypeId);
paymentTypeHelper.verifyPaymentTypeCreatedOnServer(paymentTypeId); paymentTypeHelper.verifyPaymentTypeCreatedOnServer(paymentTypeId);
@@ -41,12 +41,11 @@ import org.apache.fineract.client.models.GetLoanProductsProductIdResponse;
import org.apache.fineract.client.models.GetLoansLoanIdResponse; import org.apache.fineract.client.models.GetLoansLoanIdResponse;
import org.apache.fineract.client.models.LoanProductChargeData; import org.apache.fineract.client.models.LoanProductChargeData;
import org.apache.fineract.client.models.LoanProductChargeToGLAccountMapper; import org.apache.fineract.client.models.LoanProductChargeToGLAccountMapper;
import org.apache.fineract.client.models.PaymentTypeRequest; import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PostLoanProductsRequest; import org.apache.fineract.client.models.PostLoanProductsRequest;
import org.apache.fineract.client.models.PostLoanProductsResponse; import org.apache.fineract.client.models.PostLoanProductsResponse;
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse; import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse;
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsTransactionIdRequest; import org.apache.fineract.client.models.PostLoansLoanIdTransactionsTransactionIdRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PutGlobalConfigurationsRequest; import org.apache.fineract.client.models.PutGlobalConfigurationsRequest;
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType; import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
import org.apache.fineract.infrastructure.configuration.api.GlobalConfigurationConstants; import org.apache.fineract.infrastructure.configuration.api.GlobalConfigurationConstants;
@@ -211,10 +210,10 @@ public class UndoRepaymentWithDownPaymentIntegrationTest extends BaseLoanIntegra
String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5); String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15); String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = false; Boolean isCashPayment = false;
Integer position = 1; Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( var paymentTypesResponse = paymentTypeHelper.createPaymentType(new PaymentTypeCreateRequest().name(paymentTypeName)
new PaymentTypeRequest().name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position)); .description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId(); Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne); Assertions.assertNotNull(paymentTypeIdOne);
@@ -41,8 +41,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.apache.fineract.client.models.PaymentTypeRequest; import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.infrastructure.bulkimport.constants.LoanConstants; import org.apache.fineract.infrastructure.bulkimport.constants.LoanConstants;
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants; import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
import org.apache.fineract.integrationtests.bulkimport.importhandler.LocalContentStorageUtil; import org.apache.fineract.integrationtests.bulkimport.importhandler.LocalContentStorageUtil;
@@ -168,8 +167,8 @@ public class LoanImportHandlerTest {
String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5); String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String paymentTypeDescription = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15); String paymentTypeDescription = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( var paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(paymentTypeName).description(paymentTypeDescription).isCashPayment(true).position(1)); new PaymentTypeCreateRequest().name(paymentTypeName).description(paymentTypeDescription).isCashPayment(true).position(1L));
Long outcome_payment_creation = paymentTypesResponse.getResourceId(); Long outcome_payment_creation = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(outcome_payment_creation, "Could not create payment type"); Assertions.assertNotNull(outcome_payment_creation, "Could not create payment type");
@@ -26,8 +26,7 @@ import io.restassured.specification.ResponseSpecification;
import jakarta.ws.rs.core.HttpHeaders; import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.MediaType;
import java.io.IOException; import java.io.IOException;
import org.apache.fineract.client.models.PaymentTypeRequest; import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants; import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
import org.apache.fineract.integrationtests.common.ClientHelper; import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.GroupHelper; import org.apache.fineract.integrationtests.common.GroupHelper;
@@ -93,9 +92,9 @@ public class LoanWorkbookPopulatorTest {
String name = PaymentTypeHelper.randomNameGenerator("P_T", 5); String name = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15); String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = true; Boolean isCashPayment = true;
Integer position = 1; Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( var paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(name).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeCreateRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
Long outcome_payment_creation = paymentTypesResponse.getResourceId(); Long outcome_payment_creation = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(outcome_payment_creation, "Could not create payment type"); Assertions.assertNotNull(outcome_payment_creation, "Could not create payment type");
@@ -26,12 +26,12 @@ import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification; import io.restassured.specification.ResponseSpecification;
import java.util.List; import java.util.List;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.client.models.DeletePaymentTypesPaymentTypeIdResponse; import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PaymentTypeCreateResponse;
import org.apache.fineract.client.models.PaymentTypeData; import org.apache.fineract.client.models.PaymentTypeData;
import org.apache.fineract.client.models.PaymentTypeRequest; import org.apache.fineract.client.models.PaymentTypeDeleteResponse;
import org.apache.fineract.client.models.PostPaymentTypesResponse; import org.apache.fineract.client.models.PaymentTypeUpdateRequest;
import org.apache.fineract.client.models.PutPaymentTypesPaymentTypeIdRequest; import org.apache.fineract.client.models.PaymentTypeUpdateResponse;
import org.apache.fineract.client.models.PutPaymentTypesPaymentTypeIdResponse;
import org.apache.fineract.client.util.Calls; import org.apache.fineract.client.util.Calls;
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
@@ -50,7 +50,7 @@ public final class PaymentTypeHelper {
return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.getAllPaymentTypes(onlyWithCode)); return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.getAllPaymentTypes(onlyWithCode));
} }
public PostPaymentTypesResponse createPaymentType(final PaymentTypeRequest paymentTypeRequest) { public PaymentTypeCreateResponse createPaymentType(final PaymentTypeCreateRequest paymentTypeRequest) {
log.info("---------------------------------CREATING A PAYMENT TYPE---------------------------------------------"); log.info("---------------------------------CREATING A PAYMENT TYPE---------------------------------------------");
return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.createPaymentType(paymentTypeRequest)); return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.createPaymentType(paymentTypeRequest));
} }
@@ -80,14 +80,14 @@ public final class PaymentTypeHelper {
return new Gson().fromJson(jsonData, new TypeToken<PaymentTypeDomain>() {}.getType()); return new Gson().fromJson(jsonData, new TypeToken<PaymentTypeDomain>() {}.getType());
} }
public PutPaymentTypesPaymentTypeIdResponse updatePaymentType(final Long paymentTypeId, public PaymentTypeUpdateResponse updatePaymentType(final Long paymentTypeId,
PutPaymentTypesPaymentTypeIdRequest putPaymentTypesPaymentTypeIdRequest) { PaymentTypeUpdateRequest putPaymentTypesPaymentTypeIdRequest) {
log.info("-------------------------------UPDATING PAYMENT TYPE-------------------------------------------"); log.info("-------------------------------UPDATING PAYMENT TYPE-------------------------------------------");
return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.updatePaymentType(paymentTypeId, return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.updatePaymentType(paymentTypeId,
putPaymentTypesPaymentTypeIdRequest)); putPaymentTypesPaymentTypeIdRequest));
} }
public DeletePaymentTypesPaymentTypeIdResponse deletePaymentType(final Long paymentTypeId) { public PaymentTypeDeleteResponse deletePaymentType(final Long paymentTypeId) {
log.info("-------------------------------DELETING PAYMENT TYPE-------------------------------------------"); log.info("-------------------------------DELETING PAYMENT TYPE-------------------------------------------");
return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.deleteCode1(paymentTypeId)); return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.deleteCode1(paymentTypeId));
} }
@@ -23,9 +23,8 @@ import static io.restassured.RestAssured.given;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.fineract.client.models.AccountTransferRequest; import org.apache.fineract.client.models.AccountTransferRequest;
import org.apache.fineract.client.models.ChargeRequest; import org.apache.fineract.client.models.ChargeRequest;
import org.apache.fineract.client.models.PaymentTypeRequest; import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PostChargesResponse; import org.apache.fineract.client.models.PostChargesResponse;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PostSavingsAccountsResponse; import org.apache.fineract.client.models.PostSavingsAccountsResponse;
import org.apache.fineract.client.models.PostSavingsAccountsSavingsAccountIdChargesRequest; import org.apache.fineract.client.models.PostSavingsAccountsSavingsAccountIdChargesRequest;
import org.apache.fineract.client.models.PostSavingsAccountsSavingsAccountIdChargesResponse; import org.apache.fineract.client.models.PostSavingsAccountsSavingsAccountIdChargesResponse;
@@ -109,9 +108,9 @@ public class AccountTransferWithdrawalFeeTest extends BaseSavingsIntegrationTest
public void testFromSavingsToSavingsAccountTransferWithPaymentTypeWithdrawalFee() { public void testFromSavingsToSavingsAccountTransferWithPaymentTypeWithdrawalFee() {
// Create Payment Type // Create Payment Type
final PaymentTypeHelper paymentTypeHelper = new PaymentTypeHelper(); final PaymentTypeHelper paymentTypeHelper = new PaymentTypeHelper();
final PostPaymentTypesResponse paymentTypeResponse = paymentTypeHelper final var paymentTypeResponse = paymentTypeHelper
.createPaymentType(new PaymentTypeRequest().name("Bank Transfer " + System.currentTimeMillis()) .createPaymentType(new PaymentTypeCreateRequest().name("Bank Transfer " + System.currentTimeMillis())
.description("Payment via bank transfer").isCashPayment(false).position(1)); .description("Payment via bank transfer").isCashPayment(false).position(1L));
final Long paymentTypeId = paymentTypeResponse.getResourceId(); final Long paymentTypeId = paymentTypeResponse.getResourceId();
// Create withdrawal fee charge WITH payment type binding // Create withdrawal fee charge WITH payment type binding