obp 클라이언트 작업
This commit is contained in:
@@ -69,4 +69,82 @@ public class KjbProperty {
|
||||
@KjbPropertyValue(key = "kjb.ums.timeout", defaultValue = "10")
|
||||
@Min(1) @Max(30)
|
||||
private int umsTimeout = 10;
|
||||
|
||||
|
||||
@KjbPropertyValue(key = "kjb.obp.url")
|
||||
@Pattern(regexp = "^(https?://[^\\s/$.?#][^\\s]*)|\\s*$", message = "kjb.obp.url 는 유효한 URL 형식이거나 공백이어야 합니다. 예: http://example.com/api")
|
||||
private int obpUrl;
|
||||
|
||||
@KjbPropertyValue(key = "kjb.obp.trust_system.key", defaultValue = "x-obp-trust-system")
|
||||
@NotEmpty
|
||||
private String obpTrustSystemKey = "x-obp-trust-system";
|
||||
|
||||
@KjbPropertyValue(key = "kjb.obp.trust_system.value", defaultValue = "APIMPT-0002-QVBJTVBULTAwMDI=")
|
||||
@NotEmpty
|
||||
private String obpTrustSystemValue = "APIMPT-0002-QVBJTVBULTAwMDI=";
|
||||
|
||||
@KjbPropertyValue(key = "kjb.obp.partner_code.key", defaultValue = "x-obp-partnercode")
|
||||
@NotEmpty
|
||||
private String obpPartnerCodeKey = "x-obp-partnercode";
|
||||
|
||||
@KjbPropertyValue(key = "kjb.obp.partner_code.value", defaultValue = "100001-01")
|
||||
@NotEmpty
|
||||
private String obpPartnerCodeValue = "100001-01";
|
||||
|
||||
|
||||
@KjbPropertyValue(key = "kjb.obp.url.commission", defaultValue = "/api/billing/billing/findBillingForCondition")
|
||||
@NotEmpty
|
||||
private String obpUrlCommission = "/api/billing/billing/findBillingForCondition";
|
||||
|
||||
@KjbPropertyValue(key = "kjb.obp.url.commission_print", defaultValue = "/api/billing/billing/findBillingForCondition/print")
|
||||
@NotEmpty
|
||||
private String obpUrlCommissionPrint = "/api/billing/billing/findBillingForCondition/print";
|
||||
|
||||
@KjbPropertyValue(key = "kjb.obp.url.organization_fmt", defaultValue = "/api/customer/findCustomerByBusinessManRegistrationNo/%s")
|
||||
@NotEmpty
|
||||
private String obpUrlOrganizationFmt = "/api/customer/findCustomerByBusinessManRegistrationNo/%s";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.eactive.ext.kjb.obp;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class KjbObpModule {
|
||||
/**
|
||||
* Trim, 숫자이외 자동 치환
|
||||
* @param bizNo
|
||||
* @return
|
||||
*/
|
||||
public static JsonObject queryOrganization(String bizNo) {
|
||||
bizNo = ObpUtil.onlyDigit(bizNo);
|
||||
|
||||
if (StringUtils.isEmpty(bizNo)) {
|
||||
throw new IllegalArgumentException("BizNo is not empty.");
|
||||
}
|
||||
|
||||
if (bizNo.length() != 10) {
|
||||
throw new IllegalArgumentException("BizNo is not valid.");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
log.info("queryOrganization Test");
|
||||
queryOrganization("123asd123asd123");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.eactive.ext.kjb.obp;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class ObpUtil {
|
||||
static String onlyDigit(String str) {
|
||||
return str == null ? "" :
|
||||
str.chars().filter(Character::isDigit).mapToObj(c -> String.valueOf((char)c)).collect(Collectors.joining());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.eactive.ext.kjb.obp.common;
|
||||
|
||||
import com.eactive.ext.kjb.common.KjbProperty;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class ObpClient {
|
||||
private static ObpClient _instance;
|
||||
|
||||
public synchronized static ObpClient getInstance(KjbProperty kjbProperty) {
|
||||
if (_instance == null) {
|
||||
_instance = new ObpClient(kjbProperty);
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
|
||||
private ObpClient(KjbProperty kjbProperty) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.eactive.ext.kjb.obp.common;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class ObpResponse {
|
||||
private String body;
|
||||
private Map<String, String> headers = new HashMap<>();
|
||||
private int status;
|
||||
}
|
||||
Reference in New Issue
Block a user