galovics commented on a change in pull request #1984:
URL: https://github.com/apache/fineract/pull/1984#discussion_r816872516
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/portfolio/client/command/ClientIdentifierCommand.java
##########
@@ -50,18 +54,30 @@ public String getDocumentKey() {
return this.documentKey;
}
+ public String getdocumentIssueCountry() {
+ return this.documentIssueCountry;
+ }
+
public String getDescription() {
return this.description;
}
- public void validateForCreate() {
+ public void validateForCreate(final JsonCommand command) {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new
DataValidatorBuilder(dataValidationErrors).resource("clientIdentifier");
baseDataValidator.reset().parameter("documentTypeId").value(this.documentTypeId).notNull().integerGreaterThanZero();
baseDataValidator.reset().parameter("documentKey").value(this.documentKey).notBlank();
+ final Long documentTypeId =
command.longValueOfParameterNamed("documentTypeId");
+ if (documentTypeId == 1) {
+ final String documentIssueCountry =
command.stringValueOfParameterNamed("documentIssueCountry");
+ if ("".equals(documentIssueCountry)) {
Review comment:
StringUtils.isBlank could make more sense here. Thoughts?
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientIdentifier.java
##########
@@ -61,17 +64,24 @@ public static ClientIdentifier fromJson(final Client
client, final CodeValue doc
final String documentKey =
command.stringValueOfParameterNamed("documentKey");
final String description =
command.stringValueOfParameterNamed("description");
final String status = command.stringValueOfParameterNamed("status");
- return new ClientIdentifier(client, documentType, documentKey, status,
description);
+
+ String documentIssueCountry = null;
+ if (documentType.label().equals("Passport")) {
Review comment:
Any chance we can extract this magic String to somewhere?
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/portfolio/client/command/ClientIdentifierCommand.java
##########
@@ -50,18 +54,30 @@ public String getDocumentKey() {
return this.documentKey;
}
+ public String getdocumentIssueCountry() {
+ return this.documentIssueCountry;
+ }
+
public String getDescription() {
return this.description;
}
- public void validateForCreate() {
+ public void validateForCreate(final JsonCommand command) {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new
DataValidatorBuilder(dataValidationErrors).resource("clientIdentifier");
baseDataValidator.reset().parameter("documentTypeId").value(this.documentTypeId).notNull().integerGreaterThanZero();
baseDataValidator.reset().parameter("documentKey").value(this.documentKey).notBlank();
+ final Long documentTypeId =
command.longValueOfParameterNamed("documentTypeId");
+ if (documentTypeId == 1) {
Review comment:
Can we somehow make this documentTypeId a non-magic number? Like what
does 1 represent here?
##########
File path:
fineract-provider/src/main/resources/db/changelog/tenant/parts/0006_client_identifier_passport_countrieslist.xml
##########
@@ -0,0 +1,1901 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
+ <changeSet author="fineract" id="1">
+ <addColumn tableName="m_client_identifier">
+ <column name="document_issue_country" type="VARCHAR(50)"/>
+ </addColumn>
+ <dropUniqueConstraint constraintName="unique_identifier_key"
tableName="m_client_identifier"/>
+ <addUniqueConstraint columnNames="document_type_id, document_key,
document_issue_country" constraintName="unique_identity"
tableName="m_client_identifier"/>
+ </changeSet>
+ <changeSet author="fineract" id="2">
+ <insert tableName="m_code">
+ <column name="code_name" value="Countries"/>
+ <column name="is_system_defined" valueBoolean="true"/>
+ </insert>
+ </changeSet>
+ <changeSet author="fineract" id="3">
+ <insert tableName="m_code_value">
+ <column name="code_id" valueNumeric="35"/>
Review comment:
I assume this refers to the inserted m_code row right before this
changeset. If so, then let's define the id of that to make sure it really gets
id 35.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]