forked from FITER1/fineract-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/FBR-335: Buro check integration (#224)
Co-authored-by: Julius Peter Oketayot <[email protected]>
- Loading branch information
1 parent
7e42871
commit d7876df
Showing
9 changed files
with
237 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...ava/org/apache/fineract/organisation/prequalification/domain/BuroCheckClassification.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* 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.organisation.prequalification.domain; | ||
|
||
import java.util.Arrays; | ||
import java.util.Objects; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import org.apache.fineract.infrastructure.core.data.EnumOptionData; | ||
|
||
@AllArgsConstructor | ||
@Getter | ||
public enum BuroCheckClassification { | ||
|
||
CLASSIFICATION_X(0, "Sin Categoria", "buro.check.classification.grey"), CLASSIFICATION_A(1, "A", | ||
"buro.check.classification.green"), CLASSIFICATION_B(2, "B", "buro.check.classification.yellow"), CLASSIFICATION_C(3, "C", | ||
"buro.check.classification.orange"), CLASSIFICATION_D(4, "D", "buro.check.classification.red"); | ||
|
||
private final Integer id; | ||
private final String letter; | ||
private final String color; | ||
|
||
public static BuroCheckClassification fromInt(final Integer id) { | ||
return Arrays.stream(values()).filter(classification -> Objects.equals(classification.id, id)).findFirst() | ||
.orElse(BuroCheckClassification.CLASSIFICATION_X); | ||
} | ||
|
||
public static BuroCheckClassification fromLetter(final String letter) { | ||
return Arrays.stream(values()).filter(classification -> Objects.equals(classification.letter, letter)).findFirst() | ||
.orElse(BuroCheckClassification.CLASSIFICATION_X); | ||
} | ||
|
||
public static BuroCheckClassification fromColor(final String color) { | ||
return Arrays.stream(values()).filter(classification -> Objects.equals(classification.color, color)).findFirst() | ||
.orElse(BuroCheckClassification.CLASSIFICATION_X); | ||
} | ||
|
||
public static EnumOptionData status(final Integer statusInt) { | ||
BuroCheckClassification buroCheckClassification = BuroCheckClassification.fromInt(statusInt); | ||
return new EnumOptionData(buroCheckClassification.id.longValue(), buroCheckClassification.letter, buroCheckClassification.color); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
...a/org/apache/fineract/organisation/prequalification/exception/DpiBuroChequeException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* 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.organisation.prequalification.exception; | ||
|
||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException; | ||
|
||
/** | ||
* A {@link RuntimeException} thrown when client is already blacklisted. | ||
*/ | ||
public class DpiBuroChequeException extends AbstractPlatformResourceNotFoundException { | ||
|
||
public DpiBuroChequeException(final String dpi) { | ||
super("error.msg.group.prequalification.dpi.not.found", "DPI with " + dpi + " buro check not found!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...ain/resources/db/changelog/tenant/commands/insert_buro_check_external_service_configs.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
-- | ||
-- 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. | ||
-- | ||
|
||
-- liquibase formatted sql | ||
-- changeset fineract:1 | ||
-- MySQL dump 10.13 Distrib 5.1.60, for Win32 (ia32) | ||
-- | ||
-- Host: localhost Database: fineract_default | ||
-- ------------------------------------------------------ | ||
-- Server version 5.1.60-community | ||
|
||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | ||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | ||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | ||
/*!40101 SET NAMES UTF8MB4 */; | ||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; | ||
/*!40103 SET TIME_ZONE='+00:00' */; | ||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; | ||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | ||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | ||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; | ||
|
||
INSERT INTO c_external_service (name) | ||
VALUES('DPI_BURO_CHECK'); | ||
|
||
INSERT INTO c_external_service_properties | ||
(name, value, external_service_id) | ||
VALUES('dpiBuroCheckApiHost', '###############', (SELECT id FROM c_external_service WHERE name='DPI_BURO_CHECK')); | ||
|
||
INSERT INTO c_external_service_properties | ||
(name, value, external_service_id) | ||
VALUES('dpiBuroCheckApiUsername', '###############', (SELECT id FROM c_external_service WHERE name='DPI_BURO_CHECK')); | ||
|
||
|
||
INSERT INTO c_external_service_properties | ||
(name, value, external_service_id) | ||
VALUES('dpiBuroCheckApiPassword', '###############', (SELECT id FROM c_external_service WHERE name='DPI_BURO_CHECK')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters