From d8f483ab45ba80c3bef01e9941a5b7ba2fd0cce9 Mon Sep 17 00:00:00 2001 From: Adam Saghy Date: Sun, 24 Jul 2022 23:14:45 +0200 Subject: [PATCH] Refactor Client to support auditable fields --- .../core/api/OffsetDateTimeAdapter.java | 43 ++++++ .../InternalClientInformationApiResource.java | 87 +++++++++++ .../portfolio/client/domain/Client.java | 31 ++-- .../ClientReadPlatformServiceImpl.java | 4 +- .../db/changelog/tenant/changelog-tenant.xml | 1 + .../tenant/parts/0020_add_audit_entries.xml | 141 ++++++++++++++++++ .../ClientAuditingIntegrationTest.java | 132 ++++++++++++++++ .../integrationtests/common/ClientHelper.java | 9 +- .../useradministration/users/UserHelper.java | 2 +- 9 files changed, 424 insertions(+), 26 deletions(-) create mode 100644 fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/OffsetDateTimeAdapter.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/InternalClientInformationApiResource.java create mode 100644 fineract-provider/src/main/resources/db/changelog/tenant/parts/0020_add_audit_entries.xml create mode 100644 integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientAuditingIntegrationTest.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/OffsetDateTimeAdapter.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/OffsetDateTimeAdapter.java new file mode 100644 index 000000000..c98f5610d --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/OffsetDateTimeAdapter.java @@ -0,0 +1,43 @@ +/** + * 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.infrastructure.core.api; + +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.lang.reflect.Type; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Serializer for Java Offset Date Time {@link OffsetDateTime} that returns the date in ISO-8601 Offset date time format + */ +public class OffsetDateTimeAdapter implements JsonSerializer { + + @Override + @SuppressWarnings("unused") + public JsonElement serialize(final OffsetDateTime dateTime, final Type typeOfSrc, final JsonSerializationContext context) { + JsonElement object = null; + if (dateTime != null) { + object = new JsonPrimitive(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(dateTime)); + } + return object; + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/InternalClientInformationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/InternalClientInformationApiResource.java new file mode 100644 index 000000000..f302abefe --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/InternalClientInformationApiResource.java @@ -0,0 +1,87 @@ +/** + * 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.client.api; + +import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.CREATED_BY; +import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.CREATED_DATE; +import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.LAST_MODIFIED_BY; +import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.LAST_MODIFIED_DATE; + +import java.util.HashMap; +import java.util.Map; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.UriInfo; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper; +import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; +import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer; +import org.apache.fineract.portfolio.client.domain.Client; +import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.stereotype.Component; + +//@Profile("test") +@Component +@Path("/internal/client") +@RequiredArgsConstructor +@Slf4j +public class InternalClientInformationApiResource implements InitializingBean { + + private final ClientRepositoryWrapper clientRepositoryWrapper; + private final ToApiJsonSerializer toApiJsonSerializer; + private final ApiRequestParameterHelper apiRequestParameterHelper; + + @Override + public void afterPropertiesSet() { + log.warn("------------------------------------------------------------"); + log.warn(" "); + log.warn("DO NOT USE THIS IN PRODUCTION!"); + log.warn("Internal client services mode is enabled"); + log.warn("DO NOT USE THIS IN PRODUCTION!"); + log.warn(" "); + log.warn("------------------------------------------------------------"); + + } + + @GET + @Path("{clientId}/audit") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + public String getClientAuditFields(@Context final UriInfo uriInfo, @PathParam("clientId") Long clientId) { + log.warn("------------------------------------------------------------"); + log.warn(" "); + log.warn("Fetching client with {}", clientId); + log.warn(" "); + log.warn("------------------------------------------------------------"); + + final Client client = clientRepositoryWrapper.findOneWithNotFoundDetection(clientId); + Map auditFields = new HashMap<>( + Map.of(CREATED_BY, client.getCreatedBy().orElse(null), CREATED_DATE, client.getCreatedDate().orElse(null), LAST_MODIFIED_BY, + client.getLastModifiedBy().orElse(null), LAST_MODIFIED_DATE, client.getLastModifiedDate().orElse(null))); + final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); + return this.toApiJsonSerializer.serialize(settings, auditFields); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/Client.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/Client.java index c092ef970..059c88f66 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/Client.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/Client.java @@ -44,7 +44,7 @@ import org.apache.fineract.infrastructure.codes.domain.CodeValue; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.ApiParameterError; import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder; -import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; +import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom; import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException; import org.apache.fineract.infrastructure.core.service.DateUtils; import org.apache.fineract.infrastructure.documentmanagement.domain.Image; @@ -59,7 +59,7 @@ import org.apache.fineract.useradministration.domain.AppUser; @Entity @Table(name = "m_client", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "account_no_UNIQUE"), // @UniqueConstraint(columnNames = { "mobile_no" }, name = "mobile_no_UNIQUE") }) -public final class Client extends AbstractPersistableCustom { +public class Client extends AbstractAuditableWithUTCDateTimeCustom { @Column(name = "account_no", length = 20, unique = true, nullable = false) private String accountNumber; @@ -180,16 +180,14 @@ public final class Client extends AbstractPersistableCustom { @Column(name = "submittedon_date", nullable = true) private LocalDate submittedOnDate; - @ManyToOne(optional = true, fetch = FetchType.LAZY) - @JoinColumn(name = "submittedon_userid", nullable = true) - private AppUser submittedBy; + // Deprecated since common Auditable fields were introduced. Columns and data left untouched to help migration. - @Column(name = "updated_on", nullable = true) - private LocalDate updatedOnDate; + // @Column(name = "updated_on", nullable = true) + // private LocalDate updatedOnDate; - @ManyToOne(optional = true, fetch = FetchType.LAZY) - @JoinColumn(name = "updated_by", nullable = true) - private AppUser updatedBy; + // @ManyToOne(optional = true, fetch = FetchType.LAZY) + // @JoinColumn(name = "updated_by", nullable = true) + // private AppUser updatedBy; @ManyToOne(optional = true, fetch = FetchType.LAZY) @JoinColumn(name = "activatedon_userid", nullable = true) @@ -270,9 +268,7 @@ public final class Client extends AbstractPersistableCustom { savingsAccountId, dataOfBirth, gender, clientType, clientClassification, legalForm, isStaff); } - Client() { - this.setLegalForm(null); - } + protected Client() {} private Client(final AppUser currentUser, final ClientStatus status, final Office office, final Group clientParentGroup, final String accountNo, final String firstname, final String middlename, final String lastname, final String fullname, @@ -289,7 +285,6 @@ public final class Client extends AbstractPersistableCustom { } this.submittedOnDate = submittedOnDate; - this.submittedBy = currentUser; this.status = status.getValue(); this.office = office; @@ -969,8 +964,6 @@ public final class Client extends AbstractPersistableCustom { this.rejectionReason = rejectionReason; this.rejectionDate = rejectionDate; this.rejectedBy = currentUser; - this.updatedBy = currentUser; - this.updatedOnDate = rejectionDate; this.status = ClientStatus.REJECTED.getValue(); } @@ -979,8 +972,6 @@ public final class Client extends AbstractPersistableCustom { this.withdrawalReason = withdrawalReason; this.withdrawalDate = withdrawalDate; this.withdrawnBy = currentUser; - this.updatedBy = currentUser; - this.updatedOnDate = withdrawalDate; this.status = ClientStatus.WITHDRAWN.getValue(); } @@ -990,8 +981,6 @@ public final class Client extends AbstractPersistableCustom { this.closureReason = null; this.reactivateDate = reactivateDate; this.reactivatedBy = currentUser; - this.updatedBy = currentUser; - this.updatedOnDate = reactivateDate; this.status = ClientStatus.PENDING.getValue(); } @@ -999,8 +988,6 @@ public final class Client extends AbstractPersistableCustom { public void reOpened(AppUser currentUser, LocalDate reopenedDate) { this.reopenedDate = reopenedDate; this.reopenedBy = currentUser; - this.updatedBy = currentUser; - this.updatedOnDate = reopenedDate; this.status = ClientStatus.PENDING.getValue(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientReadPlatformServiceImpl.java index 4c8525e5a..5804fb96f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientReadPlatformServiceImpl.java @@ -430,7 +430,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService sqlBuilder.append("left join m_savings_product sp on sp.id = c.default_savings_product "); sqlBuilder.append("left join m_office transferToOffice on transferToOffice.id = c.transfer_to_office_id "); - sqlBuilder.append("left join m_appuser sbu on sbu.id = c.submittedon_userid "); + sqlBuilder.append("left join m_appuser sbu on sbu.id = c.created_by "); sqlBuilder.append("left join m_appuser acu on acu.id = c.activatedon_userid "); sqlBuilder.append("left join m_appuser clu on clu.id = c.closedon_userid "); sqlBuilder.append("left join m_code_value cv on cv.id = c.gender_cv_id "); @@ -618,7 +618,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService builder.append("left join m_staff s on s.id = c.staff_id "); builder.append("left join m_savings_product sp on sp.id = c.default_savings_product "); builder.append("left join m_office transferToOffice on transferToOffice.id = c.transfer_to_office_id "); - builder.append("left join m_appuser sbu on sbu.id = c.submittedon_userid "); + builder.append("left join m_appuser sbu on sbu.id = c.created_by "); builder.append("left join m_appuser acu on acu.id = c.activatedon_userid "); builder.append("left join m_appuser clu on clu.id = c.closedon_userid "); builder.append("left join m_code_value cv on cv.id = c.gender_cv_id "); diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml index e4954526c..25e775ef4 100644 --- a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml +++ b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml @@ -39,4 +39,5 @@ + diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0020_add_audit_entries.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0020_add_audit_entries.xml new file mode 100644 index 000000000..779bd1da2 --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0020_add_audit_entries.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + report_name = 'Loan payments received (Active Loans)' + + + + report_name = 'Loan payments received (Overdue Loans)' + + + + + + report_name = 'Loan payments received (Active Loans)' + + + + report_name = 'Loan payments received (Overdue Loans)' + + + diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientAuditingIntegrationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientAuditingIntegrationTest.java new file mode 100644 index 000000000..145c5b96b --- /dev/null +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientAuditingIntegrationTest.java @@ -0,0 +1,132 @@ +/** + * 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.integrationtests; + +import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.CREATED_BY; +import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.CREATED_DATE; +import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.LAST_MODIFIED_BY; +import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.LAST_MODIFIED_DATE; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import io.restassured.builder.RequestSpecBuilder; +import io.restassured.builder.ResponseSpecBuilder; +import io.restassured.http.ContentType; +import io.restassured.specification.RequestSpecification; +import io.restassured.specification.ResponseSpecification; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.Map; +import org.apache.fineract.integrationtests.common.ClientHelper; +import org.apache.fineract.integrationtests.common.Utils; +import org.apache.fineract.integrationtests.common.organisation.StaffHelper; +import org.apache.fineract.integrationtests.useradministration.users.UserHelper; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ClientAuditingIntegrationTest { + + private static final Logger LOG = LoggerFactory.getLogger(ClientAuditingIntegrationTest.class); + private ResponseSpecification responseSpec; + private RequestSpecification requestSpec; + private ClientHelper clientHelper; + + @BeforeEach + public void setup() { + Utils.initializeRESTAssured(); + this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); + this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey()); + + this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); + this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); + } + + @Test + public void checkAuditDates() throws InterruptedException { + final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); + String username = Utils.randomNameGenerator("user", 8); + final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, 1, staffId, username, "resourceId"); + OffsetDateTime now = OffsetDateTime.now(ZoneId.of("Asia/Kolkata")); + // Testing in minutes precision, but still need to take care around the end of the actual minute + if (now.getSecond() > 56) { + Thread.sleep(5000); + now = OffsetDateTime.now(ZoneId.of("Asia/Kolkata")); + } + LOG.info("-------------------------Creating Client---------------------------"); + + final Integer clientID = ClientHelper.createClientPending(requestSpec, responseSpec); + ClientHelper.verifyClientCreatedOnServer(requestSpec, responseSpec, clientID); + Map auditFieldsResponse = ClientHelper.getClientAuditFields(requestSpec, responseSpec, clientID, ""); + + OffsetDateTime createdDate = OffsetDateTime.parse((String) auditFieldsResponse.get(CREATED_DATE), + DateTimeFormatter.ISO_OFFSET_DATE_TIME); + + OffsetDateTime lastModifiedDate = OffsetDateTime.parse((String) auditFieldsResponse.get(LAST_MODIFIED_DATE), + DateTimeFormatter.ISO_OFFSET_DATE_TIME); + + LOG.info("-------------------------Check Audit dates---------------------------"); + assertEquals(1, auditFieldsResponse.get(CREATED_BY)); + assertEquals(1, auditFieldsResponse.get(LAST_MODIFIED_BY)); + assertEquals(now.getYear(), createdDate.getYear()); + assertEquals(now.getMonth(), createdDate.getMonth()); + assertEquals(now.getDayOfMonth(), createdDate.getDayOfMonth()); + assertEquals(now.getHour(), createdDate.getHour()); + assertEquals(now.getMinute(), createdDate.getMinute()); + + assertEquals(now.getYear(), lastModifiedDate.getYear()); + assertEquals(now.getMonth(), lastModifiedDate.getMonth()); + assertEquals(now.getDayOfMonth(), lastModifiedDate.getDayOfMonth()); + assertEquals(now.getHour(), lastModifiedDate.getHour()); + assertEquals(now.getMinute(), lastModifiedDate.getMinute()); + + LOG.info("-------------------------Modify Client with System user---------------------------"); + this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); + this.requestSpec.header("Authorization", + "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey(username, "password")); + + this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); + this.clientHelper.activateClient(clientID); + auditFieldsResponse = ClientHelper.getClientAuditFields(requestSpec, responseSpec, clientID, ""); + + createdDate = OffsetDateTime.parse((String) auditFieldsResponse.get(CREATED_DATE), DateTimeFormatter.ISO_OFFSET_DATE_TIME); + + lastModifiedDate = OffsetDateTime.parse((String) auditFieldsResponse.get(LAST_MODIFIED_DATE), + DateTimeFormatter.ISO_OFFSET_DATE_TIME); + + LOG.info("-------------------------Check Audit dates---------------------------"); + assertEquals(1, auditFieldsResponse.get(CREATED_BY)); + assertEquals(now.getYear(), createdDate.getYear()); + assertEquals(now.getMonth(), createdDate.getMonth()); + assertEquals(now.getDayOfMonth(), createdDate.getDayOfMonth()); + assertEquals(now.getHour(), createdDate.getHour()); + assertEquals(now.getMinute(), createdDate.getMinute()); + + now = OffsetDateTime.now(ZoneId.of("Asia/Kolkata")); + + assertEquals(userId, auditFieldsResponse.get(LAST_MODIFIED_BY)); + assertEquals(now.getYear(), lastModifiedDate.getYear()); + assertEquals(now.getMonth(), lastModifiedDate.getMonth()); + assertEquals(now.getDayOfMonth(), lastModifiedDate.getDayOfMonth()); + assertEquals(now.getHour(), lastModifiedDate.getHour()); + assertEquals(now.getMinute(), lastModifiedDate.getMinute()); + } + +} diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ClientHelper.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ClientHelper.java index ba6ec8cf6..63d2bf5d3 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ClientHelper.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ClientHelper.java @@ -346,6 +346,13 @@ public class ClientHelper { return Utils.performServerGet(requestSpec, responseSpec, GET_CLIENT_URL, jsonReturn); } + public static HashMap getClientAuditFields(final RequestSpecification requestSpec, + final ResponseSpecification responseSpec, final Integer clientId, final String jsonReturn) { + final String GET_CLIENT_URL = "/fineract-provider/api/v1/internal/client/" + clientId + "/audit?" + Utils.TENANT_IDENTIFIER; + log.info("---------------------------------GET A CLIENT ENTITY AUDIT FIELDS---------------------------------------------"); + return Utils.performServerGet(requestSpec, responseSpec, GET_CLIENT_URL, jsonReturn); + } + /* Client status is a map.So adding SuppressWarnings */ @SuppressWarnings("unchecked") public static HashMap getClientStatus(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, @@ -435,7 +442,7 @@ public class ClientHelper { } - private String getActivateClientAsJSON(String date) { + private static String getActivateClientAsJSON(String date) { final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.LOCALE); map.put("dateFormat", CommonConstants.DATE_FORMAT); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/useradministration/users/UserHelper.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/useradministration/users/UserHelper.java index 1a86dca53..e00851245 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/useradministration/users/UserHelper.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/useradministration/users/UserHelper.java @@ -86,7 +86,7 @@ public final class UserHelper { private static String getTestCreateUserAsJSON(int roleId, int staffId, String username) { return "{ \"username\": \"" + username + "\", \"firstname\": \"Test\", \"lastname\": \"User\", \"email\": \"whatever@mifos.org\"," + " \"officeId\": \"1\", \"staffId\": " + "\"" + staffId + "\",\"roles\": [\"" + roleId - + "\"], \"sendPasswordToEmail\": false}"; + + "\"], \"sendPasswordToEmail\": false, \"password\": \"password\"," + " \"repeatPassword\": \"password\"}"; } private static String getTestUpdateUserAsJSON(String username) {