A simple, zero-dependency, library for accessing financial institution information provided by KFTC(금융결제원, 金融決濟院, Korea Financial Telecommunications and Clearings Institute).
Requires 21
for building while the module targets 11
.
<project>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
<maven.compiler.release>${maven.compiler.target}</maven.compiler.release>
<maven.compiler.testSource>21</maven.compiler.testSource>
<maven.compiler.testTarget>${maven.compiler.testSource}</maven.compiler.testTarget>
<maven.compiler.testRelease>${maven.compiler.testTarget}</maven.compiler.testRelease>
</project>
<dependency>
<groupId>com.github.jinahya</groupId>
<artifactId>kftc-financial-institution-info</artifactId>
<!-- Check the badge above for the latest version -->
</dependency>
class Readme1Test {
@Test
void __001() {
final var infoSet = KftcFinancialInstitutionInfoSet.newInstance();
final var info = infoSet.get("001");
assertThat(info).hasValueSatisfying(i -> {
assertThat(i.getCategory()).isSameAs(KftcFinancialInstitutionCategory.BANK);
assertThat(i.getCode()).isEqualTo("001");
assertThat(i.getName()).isEqualTo("한국은행");
assertThat(i.isRepresentative()).isTrue();
});
}
@Test
void __101() {
final var infoSet = KftcFinancialInstitutionInfoSet.newInstance();
final var info = infoSet.get("101");
assertThat(info).hasValueSatisfying(i -> {
assertThat(i.getCategory()).isSameAs(KftcFinancialInstitutionCategory.OTHE);
assertThat(i.getCode()).isEqualTo("101");
assertThat(i.getName()).isEqualTo("한국신용정보원");
assertThat(i.isRepresentative()).isTrue();
});
}
}
class Readme2Test {
@Test
void __3() {
final var infoSet = KftcFinancialInstitutionBranchInfoSet.newInstance();
final var info = infoSet.get("0010003").orElseThrow();
assert Objects.equals(info.getBranchCode(), "0010003");
assert Objects.equals(info.getFinancialInstitutionName(), "한국");
assert Objects.equals(info.getBranchName(), "본부총괄");
assert Objects.equals(info.getPhoneNumber(), "02 759 4114"); // mind multiple spaces
assert Objects.equals(info.getPhoneNumberNormalized(" "), "02 759 4114");
assert Objects.equals(info.getPhoneNumberNormalized("-"), "02-759-4114");
assert Objects.equals(info.getFaxNumber(), "02 759 4060"); // mind multiple spaces
assert Objects.equals(info.getFaxNumberNormalized(" "), "02 759 4060");
assert Objects.equals(info.getFaxNumberNormalized("-"), "02-759-4060");
assert Objects.equals(info.getPostalCode(), "100794");
assert Objects.equals(info.getAddress(), "서울특별시 중구 남대문로 39");
assert Objects.equals(info.getStatus(), "정상");
assert info.getManagingBranchCode() == null;
}
@Test
void __4() {
final var infoSet = KftcFinancialInstitutionBranchInfoSet.newInstance();
final var info = infoSet.get("4920018").orElseThrow();
assert info.getBranchCode().equals("4920018");
assert info.getFinancialInstitutionName().equals("중소벤처기업진흥공단");
assert info.getBranchName().equals("성장융합금융처");
assert info.getPhoneNumber().equals("02 32115603"); // mind multiple spaces
assert info.getPhoneNumberNormalized(" ").equals("02 32115603");
assert info.getPhoneNumberNormalized("").equals("0232115603");
assert info.getFaxNumber().equals("0505047 4412");
assert info.getPostalCode().equals("52851");
assert info.getAddress().equals("경상남도 진주시 동진로 430 (충무공동) 중소벤처기업진흥공단");
assert info.getStatus().equals("정상");
assert info.getManagingBranchCode() == null;
}
}
Those newInstance()
methods, whenever invoked, load data from resources in the classpath. Callers are recommended to (
or should) cache the result.
class KftcService {
// less than two hundreds values
// the set and its values are all immutable and thread-safe
public static final KftcFinancialInstitutionInfoSet INFO_SET
= KftcFinancialInstitutionInfoSet.newInstance();
// more than 20 thousands values!
// do not load at all, if it's not required
public static final KftcFinancialInstitutionBranchInfoSet BRANCH_INFO_SET
= KftcFinancialInstitutionBranchInfoSet.newInstance();
}
You can generate an SQLite database file, while builds, into db/kftc-financial-institution-info.sqlite3
.
$ mvn -Pdb clean test
$ ls -l db
See kftc-financial-institution-info.sqlite3.md for more information.
$ mvn -Pjson test
$ ls -l target/*.json
$ mvn -Pndjson test
$ ls -l target/*.ndjson
Two .proto
files are
prepared. One
is KftcFinancialInstitutionBranchInfoProto.proto
and the other is
KftcFinancialInstitutionInfoProto.proto.
$ sh ./.proto.sh
$ ls -l src/test/java-proto/com/github/jinahya/kftc/financial/institution/info/proto/*ProtoOuterClass.java
$ mvn -Pproto test
$ ls -l target/*.*pb
- 금융회사코드 조회 (금융결재원)