FINERACT-2169: Apply dto for payment type api and upgrade swagger doc;

This commit is contained in:
viktorpavlenko
2025-03-14 18:17:41 +00:00
committed by Adam Saghy
parent 707fe3d0e5
commit e1aa632ccc
20 changed files with 108 additions and 138 deletions
@@ -20,7 +20,6 @@ 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.Parameter;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.parameters.RequestBody;
@@ -36,20 +35,17 @@ import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam; import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces; import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.UriInfo; import java.util.List;
import java.util.Collection;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper; import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder; import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
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.data.request.PaymentTypeRequest;
import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper; import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -64,26 +60,16 @@ public class PaymentTypeApiResource {
private final DefaultToApiJsonSerializer<PaymentTypeData> jsonSerializer; private final DefaultToApiJsonSerializer<PaymentTypeData> jsonSerializer;
private final PaymentTypeReadPlatformService readPlatformService; private final PaymentTypeReadPlatformService readPlatformService;
private final PortfolioCommandSourceWritePlatformService commandWritePlatformService; private final PortfolioCommandSourceWritePlatformService commandWritePlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PaymentTypeRepositoryWrapper paymentTypeRepositoryWrapper; 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")
@ApiResponses({ public List<PaymentTypeData> getAllPaymentTypes(
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.GetPaymentTypesResponse.class)))) })
public String getAllPaymentTypes(@Context final UriInfo uriInfo,
@QueryParam("onlyWithCode") @Parameter(description = "onlyWithCode") final boolean onlyWithCode) { @QueryParam("onlyWithCode") @Parameter(description = "onlyWithCode") final boolean onlyWithCode) {
this.securityContext.authenticatedUser().validateHasReadPermission(PaymentTypeApiResourceConstants.ENTITY_NAME); securityContext.authenticatedUser().validateHasReadPermission(PaymentTypeApiResourceConstants.ENTITY_NAME);
Collection<PaymentTypeData> paymentTypes = null; return onlyWithCode ? readPlatformService.retrieveAllPaymentTypesWithCode() : readPlatformService.retrieveAllPaymentTypes();
if (onlyWithCode) {
paymentTypes = this.readPlatformService.retrieveAllPaymentTypesWithCode();
} else {
paymentTypes = this.readPlatformService.retrieveAllPaymentTypes();
}
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.jsonSerializer.serialize(settings, paymentTypes, PaymentTypeApiResourceConstants.RESPONSE_DATA_PARAMETERS);
} }
@GET @GET
@@ -91,15 +77,11 @@ 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")
@ApiResponses({ public PaymentTypeData retrieveOnePaymentType(
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.GetPaymentTypesPaymentTypeIdResponse.class))) }) @PathParam("paymentTypeId") @Parameter(description = "paymentTypeId") final Long paymentTypeId) {
public String retrieveOnePaymentType(@PathParam("paymentTypeId") @Parameter(description = "paymentTypeId") final Long paymentTypeId, securityContext.authenticatedUser().validateHasReadPermission(PaymentTypeApiResourceConstants.ENTITY_NAME);
@Context final UriInfo uriInfo) { paymentTypeRepositoryWrapper.findOneWithNotFoundDetection(paymentTypeId);
this.securityContext.authenticatedUser().validateHasReadPermission(PaymentTypeApiResourceConstants.ENTITY_NAME); return readPlatformService.retrieveOne(paymentTypeId);
this.paymentTypeRepositoryWrapper.findOneWithNotFoundDetection(paymentTypeId);
final PaymentTypeData paymentTypes = this.readPlatformService.retrieveOne(paymentTypeId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.jsonSerializer.serialize(settings, paymentTypes, PaymentTypeApiResourceConstants.RESPONSE_DATA_PARAMETERS);
} }
@POST @POST
@@ -107,16 +89,16 @@ public class PaymentTypeApiResource {
@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\n\n" + "Mandatory Fields: name\n\n"
+ "Optional Fields: Description, isCashPayment,Position") + "Optional Fields: Description, isCashPayment,Position")
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PostPaymentTypesRequest.class))) @RequestBody(required = true, content = @Content(schema = @Schema(implementation = PaymentTypeRequest.class)))
@ApiResponses({ @ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PostPaymentTypesResponse.class))) }) @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PostPaymentTypesResponse.class))) })
public String createPaymentType(@Parameter(hidden = true) final String apiRequestBodyAsJson) { public CommandProcessingResult createPaymentType(@Parameter(hidden = true) PaymentTypeRequest paymentTypeRequest) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().createPaymentType().withJson(apiRequestBodyAsJson).build(); final CommandWrapper commandRequest = new CommandWrapperBuilder().createPaymentType()
.withJson(jsonSerializer.serialize(paymentTypeRequest)).build();
final CommandProcessingResult result = this.commandWritePlatformService.logCommandSource(commandRequest); CommandProcessingResult result = commandWritePlatformService.logCommandSource(commandRequest);
return result;
return this.jsonSerializer.serialize(result);
} }
@PUT @PUT
@@ -127,15 +109,15 @@ public class PaymentTypeApiResource {
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PutPaymentTypesPaymentTypeIdRequest.class))) @RequestBody(required = true, content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PutPaymentTypesPaymentTypeIdRequest.class)))
@ApiResponses({ @ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PutPaymentTypesPaymentTypeIdResponse.class))) }) @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PutPaymentTypesPaymentTypeIdResponse.class))) })
public String updatePaymentType(@PathParam("paymentTypeId") @Parameter(description = "paymentTypeId") final Long paymentTypeId, public CommandProcessingResult updatePaymentType(
@PathParam("paymentTypeId") @Parameter(description = "paymentTypeId") final Long paymentTypeId,
@Parameter(hidden = true) final String apiRequestBodyAsJson) { @Parameter(hidden = true) final String apiRequestBodyAsJson) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().updatePaymentType(paymentTypeId).withJson(apiRequestBodyAsJson) final CommandWrapper commandRequest = new CommandWrapperBuilder().updatePaymentType(paymentTypeId).withJson(apiRequestBodyAsJson)
.build(); .build();
final CommandProcessingResult result = this.commandWritePlatformService.logCommandSource(commandRequest); final CommandProcessingResult result = commandWritePlatformService.logCommandSource(commandRequest);
return result;
return this.jsonSerializer.serialize(result);
} }
@DELETE @DELETE
@@ -145,13 +127,14 @@ public class PaymentTypeApiResource {
@Operation(summary = "Delete a Payment Type", description = "Deletes payment type") @Operation(summary = "Delete a Payment Type", description = "Deletes payment type")
@ApiResponses({ @ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.DeletePaymentTypesPaymentTypeIdResponse.class))) }) @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.DeletePaymentTypesPaymentTypeIdResponse.class))) })
public String deleteCode(@PathParam("paymentTypeId") @Parameter(description = "paymentTypeId") final Long paymentTypeId) { public CommandProcessingResult deleteCode(
@PathParam("paymentTypeId") @Parameter(description = "paymentTypeId") final Long paymentTypeId) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().deletePaymentType(paymentTypeId).build(); final CommandWrapper commandRequest = new CommandWrapperBuilder().deletePaymentType(paymentTypeId).build();
final CommandProcessingResult result = this.commandWritePlatformService.logCommandSource(commandRequest); final CommandProcessingResult result = commandWritePlatformService.logCommandSource(commandRequest);
return this.jsonSerializer.serialize(result); return result;
} }
} }
@@ -48,46 +48,6 @@ public final class PaymentTypeApiResourceSwagger {
public Boolean isSystemDefined; public Boolean isSystemDefined;
} }
@Schema(description = "GetPaymentTypesPaymentTypeIdResponse")
public static final class GetPaymentTypesPaymentTypeIdResponse {
private GetPaymentTypesPaymentTypeIdResponse() {}
@Schema(example = "13")
public Long id;
@Schema(example = "cash")
public String name;
@Schema(example = "cash Payment")
public String description;
@Schema(example = "true")
public Boolean isCashPayment;
@Schema(example = "1")
public Integer position;
@Schema(example = "REPAYMENT_REFUND")
public String codeName;
@Schema(example = "false")
public Boolean isSystemDefined;
}
@Schema(description = "PostPaymentTypesRequest")
public static final class PostPaymentTypesRequest {
private PostPaymentTypesRequest() {}
@Schema(example = "cash")
public String name;
@Schema(example = "cash payment type")
public String description;
@Schema(example = "true")
public Boolean isCashPayment;
@Schema(example = "1")
public Integer position;
@Schema(example = "REPAYMENT_REFUND")
public String codeName;
@Schema(example = "false")
public Boolean isSystemDefined;
}
@Schema(description = "PostPaymentTypesResponse") @Schema(description = "PostPaymentTypesResponse")
public static final class PostPaymentTypesResponse { public static final class PostPaymentTypesResponse {
@@ -0,0 +1,30 @@
/**
* 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.request;
import java.io.Serial;
import java.io.Serializable;
public record PaymentTypeRequest(String name, String description, Boolean isCashPayment, Integer position, String codeName,
Boolean isSystemDefined) implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
}
@@ -18,14 +18,14 @@
*/ */
package org.apache.fineract.portfolio.paymenttype.service; package org.apache.fineract.portfolio.paymenttype.service;
import java.util.Collection; 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 PaymentTypeReadPlatformService {
Collection<PaymentTypeData> retrieveAllPaymentTypes(); List<PaymentTypeData> retrieveAllPaymentTypes();
Collection<PaymentTypeData> retrieveAllPaymentTypesWithCode(); List<PaymentTypeData> retrieveAllPaymentTypesWithCode();
PaymentTypeData retrieveOne(Long paymentTypeId); PaymentTypeData retrieveOne(Long paymentTypeId);
@@ -18,7 +18,6 @@
*/ */
package org.apache.fineract.portfolio.paymenttype.service; package org.apache.fineract.portfolio.paymenttype.service;
import java.util.Collection;
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.infrastructure.security.service.PlatformSecurityContext;
@@ -37,7 +36,7 @@ public class PaymentTypeReadPlatformServiceImpl implements PaymentTypeReadPlatfo
@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 Collection<PaymentTypeData> retrieveAllPaymentTypes() { public List<PaymentTypeData> retrieveAllPaymentTypes() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
this.context.authenticatedUser(); this.context.authenticatedUser();
@@ -47,7 +46,7 @@ public class PaymentTypeReadPlatformServiceImpl implements PaymentTypeReadPlatfo
@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 Collection<PaymentTypeData> retrieveAllPaymentTypesWithCode() { public List<PaymentTypeData> retrieveAllPaymentTypesWithCode() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
this.context.authenticatedUser(); this.context.authenticatedUser();
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.client.models.GetPaymentTypesResponse; import org.apache.fineract.client.models.PaymentTypeData;
import org.apache.fineract.client.services.PaymentTypeApi; import org.apache.fineract.client.services.PaymentTypeApi;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -40,13 +40,13 @@ public class PaymentTypeResolver {
try { try {
String paymentTypeName = paymentType.getName(); String paymentTypeName = paymentType.getName();
log.debug("Resolving payment type by name [{}]", paymentTypeName); log.debug("Resolving payment type by name [{}]", paymentTypeName);
Response<List<GetPaymentTypesResponse>> response = paymentTypeApi.getAllPaymentTypes(false).execute(); Response<List<PaymentTypeData>> response = paymentTypeApi.getAllPaymentTypes(false).execute();
if (!response.isSuccessful()) { if (!response.isSuccessful()) {
throw new IllegalStateException("Unable to get payment types. Status code was HTTP " + response.code()); throw new IllegalStateException("Unable to get payment types. Status code was HTTP " + response.code());
} }
List<GetPaymentTypesResponse> paymentTypesResponses = response.body(); List<PaymentTypeData> paymentTypesResponses = response.body();
GetPaymentTypesResponse foundPtr = paymentTypesResponses.stream().filter(ptr -> paymentTypeName.equals(ptr.getName())).findAny() PaymentTypeData foundPtr = paymentTypesResponses.stream().filter(ptr -> paymentTypeName.equals(ptr.getName())).findAny()
.orElseThrow(() -> new IllegalArgumentException("Payment type [%s] not found".formatted(paymentTypeName))); .orElseThrow(() -> new IllegalArgumentException("Payment type [%s] not found".formatted(paymentTypeName)));
return foundPtr.getId(); return foundPtr.getId();
@@ -18,15 +18,14 @@
*/ */
package org.apache.fineract.test.factory; package org.apache.fineract.test.factory;
import org.apache.fineract.client.models.PostPaymentTypesRequest; import org.apache.fineract.client.models.PaymentTypeRequest;
public final class PaymentTypesRequestFactory { public final class PaymentTypesRequestFactory {
private PaymentTypesRequestFactory() {} private PaymentTypesRequestFactory() {}
public static PostPaymentTypesRequest defaultPaymentTypeRequest(String name, String description, Boolean isCashPayment, public static PaymentTypeRequest defaultPaymentTypeRequest(String name, String description, Boolean isCashPayment, Integer position) {
Integer position) { PaymentTypeRequest request = new PaymentTypeRequest();
PostPaymentTypesRequest request = new PostPaymentTypesRequest();
request.name(name).description(description).isCashPayment(isCashPayment).position(position); request.name(name).description(description).isCashPayment(isCashPayment).position(position);
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.fineract.client.models.PostPaymentTypesRequest; import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.services.PaymentTypeApi; import org.apache.fineract.client.services.PaymentTypeApi;
import org.apache.fineract.test.factory.PaymentTypesRequestFactory; import org.apache.fineract.test.factory.PaymentTypesRequestFactory;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
@@ -59,7 +59,7 @@ public class PaymentTypeGlobalInitializerStep implements FineractGlobalInitializ
paymentTypes.forEach(paymentType -> { paymentTypes.forEach(paymentType -> {
Integer position = paymentTypes.indexOf(paymentType) + 2; Integer position = paymentTypes.indexOf(paymentType) + 2;
PostPaymentTypesRequest postPaymentTypesRequest = PaymentTypesRequestFactory.defaultPaymentTypeRequest(paymentType, paymentType, PaymentTypeRequest postPaymentTypesRequest = PaymentTypesRequestFactory.defaultPaymentTypeRequest(paymentType, paymentType,
false, position); false, position);
try { try {
@@ -40,7 +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.PostPaymentTypesRequest; import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse; 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;
@@ -2664,7 +2664,7 @@ public class ClientSavingsIntegrationTest {
Integer position = 1; Integer position = 1;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PostPaymentTypesRequest().name(name).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId(); Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne); Assertions.assertNotNull(paymentTypeIdOne);
@@ -2685,8 +2685,8 @@ public class ClientSavingsIntegrationTest {
String paymentTypeNameTwo = PaymentTypeHelper.randomNameGenerator("P_T", 5); String paymentTypeNameTwo = PaymentTypeHelper.randomNameGenerator("P_T", 5);
PostPaymentTypesResponse paymentTypesResponseTwo = paymentTypeHelper.createPaymentType(new PostPaymentTypesRequest() PostPaymentTypesResponse paymentTypesResponseTwo = paymentTypeHelper.createPaymentType(
.name(paymentTypeNameTwo).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeRequest().name(paymentTypeNameTwo).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdTwo = paymentTypesResponseTwo.getResourceId(); Long paymentTypeIdTwo = paymentTypesResponseTwo.getResourceId();
Assertions.assertNotNull(paymentTypeIdTwo); Assertions.assertNotNull(paymentTypeIdTwo);
@@ -35,7 +35,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.PostPaymentTypesRequest; import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse; 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;
@@ -318,7 +318,7 @@ public class GroupSavingsIntegrationTest {
Integer position = 1; Integer position = 1;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PostPaymentTypesRequest().name(name).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeId = paymentTypesResponse.getResourceId(); Long paymentTypeId = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeId); Assertions.assertNotNull(paymentTypeId);
@@ -48,12 +48,12 @@ import org.apache.fineract.client.models.GetLoanTransactionRelation;
import org.apache.fineract.client.models.GetLoansLoanIdResponse; import org.apache.fineract.client.models.GetLoansLoanIdResponse;
import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse; import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse;
import org.apache.fineract.client.models.JournalEntryTransactionItem; import org.apache.fineract.client.models.JournalEntryTransactionItem;
import org.apache.fineract.client.models.PaymentTypeRequest;
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.PostPaymentTypesRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse; 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;
@@ -671,8 +671,8 @@ public class LoanAccountChargeOffWithAdvancedPaymentAllocationTest extends BaseL
Boolean isCashPayment = false; Boolean isCashPayment = false;
Integer position = 1; Integer position = 1;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(new PostPaymentTypesRequest() PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
.name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeRequest().name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId(); Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne); Assertions.assertNotNull(paymentTypeIdOne);
@@ -40,11 +40,11 @@ import org.apache.fineract.client.models.ChargeToGLAccountMapper;
import org.apache.fineract.client.models.GetLoanFeeToIncomeAccountMappings; import org.apache.fineract.client.models.GetLoanFeeToIncomeAccountMappings;
import org.apache.fineract.client.models.GetLoanPaymentChannelToFundSourceMappings; import org.apache.fineract.client.models.GetLoanPaymentChannelToFundSourceMappings;
import org.apache.fineract.client.models.GetLoansLoanIdResponse; import org.apache.fineract.client.models.GetLoansLoanIdResponse;
import org.apache.fineract.client.models.PaymentTypeRequest;
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.PostPaymentTypesRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse; 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;
@@ -363,8 +363,8 @@ public class LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest exte
Boolean isCashPayment = false; Boolean isCashPayment = false;
Integer position = 1; Integer position = 1;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(new PostPaymentTypesRequest() PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
.name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeRequest().name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId(); Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne); Assertions.assertNotNull(paymentTypeIdOne);
@@ -43,11 +43,11 @@ import org.apache.fineract.client.models.GetLoanTransactionRelation;
import org.apache.fineract.client.models.GetLoansLoanIdResponse; import org.apache.fineract.client.models.GetLoansLoanIdResponse;
import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse; import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse;
import org.apache.fineract.client.models.JournalEntryTransactionItem; import org.apache.fineract.client.models.JournalEntryTransactionItem;
import org.apache.fineract.client.models.PaymentTypeRequest;
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.PostPaymentTypesRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse; 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;
@@ -1137,8 +1137,8 @@ public class LoanPostChargeOffScenariosTest extends BaseLoanIntegrationTest {
Boolean isCashPayment = false; Boolean isCashPayment = false;
Integer position = 1; Integer position = 1;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(new PostPaymentTypesRequest() PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
.name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeRequest().name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId(); Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne); Assertions.assertNotNull(paymentTypeIdOne);
@@ -24,8 +24,8 @@ 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.DeletePaymentTypesPaymentTypeIdResponse;
import org.apache.fineract.client.models.GetPaymentTypesPaymentTypeIdResponse; import org.apache.fineract.client.models.PaymentTypeData;
import org.apache.fineract.client.models.PostPaymentTypesRequest; import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse; import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PutPaymentTypesPaymentTypeIdRequest; import org.apache.fineract.client.models.PutPaymentTypesPaymentTypeIdRequest;
import org.apache.fineract.integrationtests.common.PaymentTypeHelper; import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
@@ -58,11 +58,11 @@ public class PaymentTypeIntegrationTest {
Integer position = 1; Integer position = 1;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PostPaymentTypesRequest().name(name).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeRequest().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);
GetPaymentTypesPaymentTypeIdResponse paymentTypeResponse = paymentTypeHelper.retrieveById(paymentTypeId); PaymentTypeData paymentTypeResponse = paymentTypeHelper.retrieveById(paymentTypeId);
Assertions.assertEquals(name, paymentTypeResponse.getName()); Assertions.assertEquals(name, paymentTypeResponse.getName());
Assertions.assertEquals(description, paymentTypeResponse.getDescription()); Assertions.assertEquals(description, paymentTypeResponse.getDescription());
Assertions.assertEquals(isCashPayment, paymentTypeResponse.getIsCashPayment()); Assertions.assertEquals(isCashPayment, paymentTypeResponse.getIsCashPayment());
@@ -76,7 +76,7 @@ public class PaymentTypeIntegrationTest {
paymentTypeHelper.updatePaymentType(paymentTypeId, new PutPaymentTypesPaymentTypeIdRequest().name(newName) paymentTypeHelper.updatePaymentType(paymentTypeId, new PutPaymentTypesPaymentTypeIdRequest().name(newName)
.description(newDescription).isCashPayment(isCashPaymentUpdatedValue).position(newPosition)); .description(newDescription).isCashPayment(isCashPaymentUpdatedValue).position(newPosition));
GetPaymentTypesPaymentTypeIdResponse paymentTypeUpdatedResponse = paymentTypeHelper.retrieveById(paymentTypeId); PaymentTypeData 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());
@@ -34,8 +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.GetPaymentTypesPaymentTypeIdResponse; import org.apache.fineract.client.models.PaymentTypeData;
import org.apache.fineract.client.models.PostPaymentTypesRequest; import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse; 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;
@@ -141,11 +141,11 @@ public class RepaymentWithPostDatedChecksTest {
Integer position = 1; Integer position = 1;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PostPaymentTypesRequest().name(name).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeRequest().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);
GetPaymentTypesPaymentTypeIdResponse paymentTypeResponse = paymentTypeHelper.retrieveById(paymentTypeId); PaymentTypeData paymentTypeResponse = paymentTypeHelper.retrieveById(paymentTypeId);
Assertions.assertEquals(name, paymentTypeResponse.getName()); Assertions.assertEquals(name, paymentTypeResponse.getName());
// Repay for the installment 1 using post dated check // Repay for the installment 1 using post dated check
@@ -42,11 +42,11 @@ import org.apache.fineract.client.models.GetLoanFeeToIncomeAccountMappings;
import org.apache.fineract.client.models.GetLoanPaymentChannelToFundSourceMappings; import org.apache.fineract.client.models.GetLoanPaymentChannelToFundSourceMappings;
import org.apache.fineract.client.models.GetLoanProductsProductIdResponse; 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.PaymentTypeRequest;
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.PostPaymentTypesRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse; 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;
@@ -212,8 +212,8 @@ public class UndoRepaymentWithDownPaymentIntegrationTest extends BaseLoanIntegra
Boolean isCashPayment = false; Boolean isCashPayment = false;
Integer position = 1; Integer position = 1;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(new PostPaymentTypesRequest() PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
.name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeRequest().name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId(); Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne); Assertions.assertNotNull(paymentTypeIdOne);
@@ -41,7 +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.PostPaymentTypesRequest; import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse; 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;
@@ -168,7 +168,7 @@ public class LoanImportHandlerTest {
String paymentTypeDescription = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15); String paymentTypeDescription = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PostPaymentTypesRequest().name(paymentTypeName).description(paymentTypeDescription).isCashPayment(true).position(1)); new PaymentTypeRequest().name(paymentTypeName).description(paymentTypeDescription).isCashPayment(true).position(1));
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,7 +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.PostPaymentTypesRequest; import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse; 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;
@@ -95,7 +95,7 @@ public class LoanWorkbookPopulatorTest {
Boolean isCashPayment = true; Boolean isCashPayment = true;
Integer position = 1; Integer position = 1;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType( PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PostPaymentTypesRequest().name(name).description(description).isCashPayment(isCashPayment).position(position)); new PaymentTypeRequest().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");
@@ -27,9 +27,8 @@ 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.DeletePaymentTypesPaymentTypeIdResponse;
import org.apache.fineract.client.models.GetPaymentTypesPaymentTypeIdResponse; import org.apache.fineract.client.models.PaymentTypeData;
import org.apache.fineract.client.models.GetPaymentTypesResponse; import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse; import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PutPaymentTypesPaymentTypeIdRequest; import org.apache.fineract.client.models.PutPaymentTypesPaymentTypeIdRequest;
import org.apache.fineract.client.models.PutPaymentTypesPaymentTypeIdResponse; import org.apache.fineract.client.models.PutPaymentTypesPaymentTypeIdResponse;
@@ -46,25 +45,25 @@ public final class PaymentTypeHelper {
private static final String PAYMENTTYPE_URL = "/fineract-provider/api/v1/paymenttypes"; private static final String PAYMENTTYPE_URL = "/fineract-provider/api/v1/paymenttypes";
private static final String CREATE_PAYMENTTYPE_URL = PAYMENTTYPE_URL + "?" + Utils.TENANT_IDENTIFIER; private static final String CREATE_PAYMENTTYPE_URL = PAYMENTTYPE_URL + "?" + Utils.TENANT_IDENTIFIER;
public List<GetPaymentTypesResponse> getAllPaymentTypes(final Boolean onlyWithCode) { public List<PaymentTypeData> getAllPaymentTypes(final Boolean onlyWithCode) {
log.info("-------------------------------GETTING ALL PAYMENT TYPES-------------------------------------------"); log.info("-------------------------------GETTING ALL PAYMENT TYPES-------------------------------------------");
return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.getAllPaymentTypes(onlyWithCode)); return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.getAllPaymentTypes(onlyWithCode));
} }
public PostPaymentTypesResponse createPaymentType(final PostPaymentTypesRequest postPaymentTypesRequest) { public PostPaymentTypesResponse createPaymentType(final PaymentTypeRequest paymentTypeRequest) {
log.info("---------------------------------CREATING A PAYMENT TYPE---------------------------------------------"); log.info("---------------------------------CREATING A PAYMENT TYPE---------------------------------------------");
return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.createPaymentType(postPaymentTypesRequest)); return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.createPaymentType(paymentTypeRequest));
} }
public void verifyPaymentTypeCreatedOnServer(final Long generatedPaymentTypeID) { public void verifyPaymentTypeCreatedOnServer(final Long generatedPaymentTypeID) {
log.info("-------------------------------CHECK PAYMENT DETAILS-------------------------------------------"); log.info("-------------------------------CHECK PAYMENT DETAILS-------------------------------------------");
GetPaymentTypesPaymentTypeIdResponse response = Calls PaymentTypeData response = Calls
.ok(FineractClientHelper.getFineractClient().paymentTypes.retrieveOnePaymentType(generatedPaymentTypeID)); .ok(FineractClientHelper.getFineractClient().paymentTypes.retrieveOnePaymentType(generatedPaymentTypeID));
Long responsePaymentTypeID = response.getId(); Long responsePaymentTypeID = response.getId();
assertEquals(generatedPaymentTypeID, responsePaymentTypeID, "ERROR IN CREATING THE PAYMENT TYPE"); assertEquals(generatedPaymentTypeID, responsePaymentTypeID, "ERROR IN CREATING THE PAYMENT TYPE");
} }
public GetPaymentTypesPaymentTypeIdResponse retrieveById(final Long paymentTypeId) { public PaymentTypeData retrieveById(final Long paymentTypeId) {
log.info("-------------------------------GETTING PAYMENT TYPE-------------------------------------------"); log.info("-------------------------------GETTING PAYMENT TYPE-------------------------------------------");
return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.retrieveOnePaymentType(paymentTypeId)); return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.retrieveOnePaymentType(paymentTypeId));
} }
@@ -62,7 +62,7 @@ import org.apache.fineract.client.models.GetLoansLoanIdSummary;
import org.apache.fineract.client.models.GetLoansLoanIdTransactions; import org.apache.fineract.client.models.GetLoansLoanIdTransactions;
import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTemplateResponse; import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTemplateResponse;
import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse; import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse;
import org.apache.fineract.client.models.GetPaymentTypesResponse; import org.apache.fineract.client.models.PaymentTypeData;
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.PostLoansDelinquencyActionRequest; import org.apache.fineract.client.models.PostLoansDelinquencyActionRequest;
@@ -2687,7 +2687,7 @@ public class LoanTransactionHelper {
@Deprecated(forRemoval = true) @Deprecated(forRemoval = true)
public Long applyChargebackTransaction(final Integer loanId, final Long transactionId, final String amount, public Long applyChargebackTransaction(final Integer loanId, final Long transactionId, final String amount,
final Integer paymentTypeIdx, ResponseSpecification responseSpec) { final Integer paymentTypeIdx, ResponseSpecification responseSpec) {
List<GetPaymentTypesResponse> paymentTypeList = paymentTypeHelper.getAllPaymentTypes(false); List<PaymentTypeData> paymentTypeList = paymentTypeHelper.getAllPaymentTypes(false);
assertTrue(!paymentTypeList.isEmpty()); assertTrue(!paymentTypeList.isEmpty());
final String payload = createChargebackPayload(amount, paymentTypeList.get(paymentTypeIdx).getId()); final String payload = createChargebackPayload(amount, paymentTypeList.get(paymentTypeIdx).getId());