diff --git a/mens-api/src/main/java/kr/xit/ens/kakao/cmm/CmmKakaoUtils.java b/mens-api/src/main/java/kr/xit/ens/kakao/cmm/CmmKakaoUtils.java
new file mode 100644
index 0000000..5dbd00e
--- /dev/null
+++ b/mens-api/src/main/java/kr/xit/ens/kakao/cmm/CmmKakaoUtils.java
@@ -0,0 +1,46 @@
+package kr.xit.ens.kakao.cmm;
+
+import egovframework.com.cmm.EgovMessageSource;
+import kr.xit.biz.cmm.service.ICmmEnsCacheService;
+import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO;
+import kr.xit.core.exception.BizRuntimeException;
+import kr.xit.core.spring.util.ApiSpringUtils;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.commons.lang3.ObjectUtils;
+
+/**
+ *
+ * description :
+ *
+ * packageName : kr.xit.ens.kakao.cmm
+ * fileName : CmmKakaoUtils
+ * author : limju
+ * date : 2023-09-19
+ * ======================================================================
+ * 변경일 변경자 변경 내용
+ * ----------------------------------------------------------------------
+ * 2023-09-19 limju 최초 생성
+ *
+ *
+ */
+
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class CmmKakaoUtils {
+ private static final EgovMessageSource messageSource = ApiSpringUtils.getMessageSource();
+ private static final ICmmEnsCacheService cacheService = ApiSpringUtils.getCmmEnsCacheService();
+
+ /**
+ * KT MMS 인증 정보 조회
+ * @return
+ */
+ public static CmmEnsRlaybsnmDTO getRlaybsnmInfo(final String signguCode, final String ffnlgCode) {
+ final CmmEnsRlaybsnmDTO dto = cacheService.getRlaybsnmInfoCache(signguCode, ffnlgCode);
+ if(ObjectUtils.isEmpty(dto)) throw BizRuntimeException.create(messageSource.getMessage("fail.api.rlaybsnm.info"));
+ cacheService.logCache();
+
+ return dto;
+ }
+
+
+}
diff --git a/mens-api/src/main/java/kr/xit/ens/kakao/service/AsyncKkopayEltrcDocService.java b/mens-api/src/main/java/kr/xit/ens/kakao/service/AsyncKkopayEltrcDocService.java
index 9297b5a..dc1b8b7 100644
--- a/mens-api/src/main/java/kr/xit/ens/kakao/service/AsyncKkopayEltrcDocService.java
+++ b/mens-api/src/main/java/kr/xit/ens/kakao/service/AsyncKkopayEltrcDocService.java
@@ -27,6 +27,7 @@ import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.spring.util.ApiWebClientUtil;
import kr.xit.core.support.utils.Checks;
import kr.xit.core.support.utils.JsonUtils;
+import kr.xit.ens.kakao.cmm.CmmKakaoUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
@@ -108,7 +109,7 @@ public class AsyncKkopayEltrcDocService extends EgovAbstractServiceImpl implemen
if(Objects.requireNonNull(errors).size() > 0) throw BizRuntimeException.create(errors.toString());
return CompletableFuture.supplyAsync(() ->
- webClient.exchangeKko(HOST + API_SEND[0], HttpMethod.valueOf(API_SEND[1]), JsonUtils.toJson(reqDTO), SendResponse.class))
+ webClient.exchangeKko(HOST + API_SEND[0], HttpMethod.valueOf(API_SEND[1]), JsonUtils.toJson(reqDTO), SendResponse.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode())))
.handle((r, e) -> {
if(e != null){
return webClient.sendError(e);
@@ -135,7 +136,7 @@ public class AsyncKkopayEltrcDocService extends EgovAbstractServiceImpl implemen
.replace("{tokens}", reqDTO.getToken());
return CompletableFuture.supplyAsync(() ->
- webClient.exchangeKko(url, HttpMethod.valueOf(API_VALID_TOKEN[1]), null, ValidTokenResponse.class))
+ webClient.exchangeKko(url, HttpMethod.valueOf(API_VALID_TOKEN[1]), null, ValidTokenResponse.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode())))
.handle((r, e) -> {
if(e != null){
return webClient.sendError(e);
@@ -165,7 +166,7 @@ public class AsyncKkopayEltrcDocService extends EgovAbstractServiceImpl implemen
final String url = HOST + API_MODIFY_STATUS[0].replace(DOCUMENT_BINDER_UUID, reqDTO.getDocument_binder_uuid());
return CompletableFuture.supplyAsync(() ->
- webClient.exchangeKko(url, HttpMethod.valueOf(API_MODIFY_STATUS[1]), body, Void.class))
+ webClient.exchangeKko(url, HttpMethod.valueOf(API_MODIFY_STATUS[1]), body, Void.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode())))
.handle((r, e) -> {
if(e != null){
return webClient.sendError(e);
@@ -194,7 +195,7 @@ public class AsyncKkopayEltrcDocService extends EgovAbstractServiceImpl implemen
final String url = HOST + API_STATUS[0].replace(DOCUMENT_BINDER_UUID, reqDTO.getDocument_binder_uuid());
return CompletableFuture.supplyAsync(() ->
- webClient.exchangeKko(url, HttpMethod.valueOf(API_STATUS[1]), null, DocStatusResponse.class))
+ webClient.exchangeKko(url, HttpMethod.valueOf(API_STATUS[1]), null, DocStatusResponse.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode())))
.handle((r, e) -> {
if(e != null){
return webClient.sendError(e);
@@ -216,7 +217,7 @@ public class AsyncKkopayEltrcDocService extends EgovAbstractServiceImpl implemen
@Async("asyncExecutor")
public CompletableFuture> requestSendBulk(final BulkSendRequests reqDTO) {
return CompletableFuture.supplyAsync(() ->
- webClient.exchangeKko(HOST + API_BULKSEND[0], HttpMethod.valueOf(API_BULKSEND[1]), JsonUtils.toJson(reqDTO), BulkSendResponses.class))
+ webClient.exchangeKko(HOST + API_BULKSEND[0], HttpMethod.valueOf(API_BULKSEND[1]), JsonUtils.toJson(reqDTO), BulkSendResponses.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode())))
.handle((r, e) -> {
if(e != null){
return webClient.sendError(e);
@@ -255,7 +256,7 @@ public class AsyncKkopayEltrcDocService extends EgovAbstractServiceImpl implemen
}
return CompletableFuture.supplyAsync(() ->
- webClient.exchangeKko(HOST + API_BULKSTATUS[0], HttpMethod.valueOf(API_BULKSTATUS[1]), JsonUtils.toJson(reqDTO), BulkStatusResponses.class))
+ webClient.exchangeKko(HOST + API_BULKSTATUS[0], HttpMethod.valueOf(API_BULKSTATUS[1]), JsonUtils.toJson(reqDTO), BulkStatusResponses.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode())))
.handle((r, e) -> {
if(e != null){
return webClient.sendError(e);
diff --git a/mens-api/src/main/java/kr/xit/ens/kakao/service/KkopayEltrcDocService.java b/mens-api/src/main/java/kr/xit/ens/kakao/service/KkopayEltrcDocService.java
index e2d694b..a4d60f4 100644
--- a/mens-api/src/main/java/kr/xit/ens/kakao/service/KkopayEltrcDocService.java
+++ b/mens-api/src/main/java/kr/xit/ens/kakao/service/KkopayEltrcDocService.java
@@ -8,8 +8,6 @@ import java.util.stream.Collectors;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
-
-import kr.xit.biz.ens.model.kakao.KkopayErrorDTO;
import kr.xit.biz.ens.model.kakao.KkopayDocAttrDTO.DocumentBinderUuid;
import kr.xit.biz.ens.model.kakao.KkopayDocAttrDTO.Receiver;
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkSendReq;
@@ -24,12 +22,14 @@ import kr.xit.biz.ens.model.kakao.KkopayDocDTO.SendRequest;
import kr.xit.biz.ens.model.kakao.KkopayDocDTO.SendResponse;
import kr.xit.biz.ens.model.kakao.KkopayDocDTO.ValidTokenRequest;
import kr.xit.biz.ens.model.kakao.KkopayDocDTO.ValidTokenResponse;
+import kr.xit.biz.ens.model.kakao.KkopayErrorDTO;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.spring.util.ApiWebClientUtil;
import kr.xit.core.support.utils.Checks;
import kr.xit.core.support.utils.JsonUtils;
+import kr.xit.ens.kakao.cmm.CmmKakaoUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -107,7 +107,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
if(Checks.isEmpty(receiver.getBirthday())) Objects.requireNonNull(errors).add("receiver.birthday=받는이 생년월일은 필수입니다.");
}
if(Objects.requireNonNull(errors).size() > 0) throw BizRuntimeException.create(errors.toString());
- return webClient.exchangeKko(HOST + API_SEND[0], HttpMethod.valueOf(API_SEND[1]), JsonUtils.toJson(reqDTO), SendResponse.class);
+ return webClient.exchangeKko(HOST + API_SEND[0], HttpMethod.valueOf(API_SEND[1]), JsonUtils.toJson(reqDTO), SendResponse.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
}
/**
@@ -125,7 +125,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
final String url = HOST
+ API_VALID_TOKEN[0].replace(DOCUMENT_BINDER_UUID, reqDTO.getDocument_binder_uuid())
.replace("{tokens}", reqDTO.getToken());
- return webClient.exchangeKko(url, HttpMethod.valueOf(API_VALID_TOKEN[1]), null, ValidTokenResponse.class);
+ return webClient.exchangeKko(url, HttpMethod.valueOf(API_VALID_TOKEN[1]), null, ValidTokenResponse.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
}
/**
@@ -146,7 +146,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
final String body = "{\"document\": {\"is_detail_read\": true} }";
final String url = HOST + API_MODIFY_STATUS[0].replace(DOCUMENT_BINDER_UUID, reqDTO.getDocument_binder_uuid());
- webClient.exchangeKko(url, HttpMethod.valueOf(API_MODIFY_STATUS[1]), body, Void.class);
+ webClient.exchangeKko(url, HttpMethod.valueOf(API_MODIFY_STATUS[1]), body, Void.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
}
/**
@@ -167,7 +167,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
validate(reqDTO, null);
final String url = HOST + API_STATUS[0].replace(DOCUMENT_BINDER_UUID, reqDTO.getDocument_binder_uuid());
- return webClient.exchangeKko(url, HttpMethod.valueOf(API_STATUS[1]), null, DocStatusResponse.class);
+ return webClient.exchangeKko(url, HttpMethod.valueOf(API_STATUS[1]), null, DocStatusResponse.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
}
/**
@@ -225,7 +225,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
throw BizRuntimeException.create(errors.toString());
}
- return webClient.exchangeKko(HOST + API_BULKSEND[0], HttpMethod.valueOf(API_BULKSEND[1]), JsonUtils.toJson(reqDTO), BulkSendResponses.class);
+ return webClient.exchangeKko(HOST + API_BULKSEND[0], HttpMethod.valueOf(API_BULKSEND[1]), JsonUtils.toJson(reqDTO), BulkSendResponses.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
}
/**
@@ -255,7 +255,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
if(errors.size() > 0) {
throw BizRuntimeException.create(errors.toString());
}
- return webClient.exchangeKko(HOST + API_BULKSTATUS[0], HttpMethod.valueOf(API_BULKSTATUS[1]), JsonUtils.toJson(reqDTO), BulkStatusResponses.class);
+ return webClient.exchangeKko(HOST + API_BULKSTATUS[0], HttpMethod.valueOf(API_BULKSTATUS[1]), JsonUtils.toJson(reqDTO), BulkStatusResponses.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
}
@Override
@@ -266,7 +266,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
// 유효성 검증
final ValidTokenResponse validTokenRes = webClient.exchangeKko(url, HttpMethod.valueOf(API_VALID_TOKEN[1]), null,
- ValidTokenResponse.class);
+ ValidTokenResponse.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
if(!"USED".equals(validTokenRes.getToken_status())){
return ApiResponseDTO.error(validTokenRes.getError_code(), validTokenRes.getError_message());
@@ -278,7 +278,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
// 정상 : HttpStatus.NO_CONTENT(204) return
// error : body에 error_code, error_message return
- final KkopayErrorDTO errorDTO = webClient.exchangeKko(url2, HttpMethod.valueOf(API_MODIFY_STATUS[1]), body, KkopayErrorDTO.class);
+ final KkopayErrorDTO errorDTO = webClient.exchangeKko(url2, HttpMethod.valueOf(API_MODIFY_STATUS[1]), body, KkopayErrorDTO.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
if(errorDTO != null){
return ApiResponseDTO.error(errorDTO.getErrorCode(), errorDTO.getErrorMessage());
}
diff --git a/mens-api/src/main/java/kr/xit/ens/kakao/web/KkopayEltrcDocController.java b/mens-api/src/main/java/kr/xit/ens/kakao/web/KkopayEltrcDocController.java
index 540fb7b..ad15bd3 100644
--- a/mens-api/src/main/java/kr/xit/ens/kakao/web/KkopayEltrcDocController.java
+++ b/mens-api/src/main/java/kr/xit/ens/kakao/web/KkopayEltrcDocController.java
@@ -13,7 +13,6 @@ import kr.xit.core.model.ApiResponseDTO;
import kr.xit.ens.kakao.service.IKkopayEltrcDocService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -40,9 +39,6 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/api/ens/kakao/v1")
public class KkopayEltrcDocController {
- @Value("${contract.kakao.token}")
- private String accessToken;
-
private final IKkopayEltrcDocService service;
/**
@@ -56,27 +52,33 @@ public class KkopayEltrcDocController {
@Operation(summary = "문서발송 요청", description = "카카오페이 전자문서 서버로 문서발송 처리를 요청")
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
@Content(mediaType = "application/json", examples = {
- @ExampleObject(value = "{\"document\": {\n"
- + " \"title\": \"문서 제목\",\n"
- + " \"read_expired_sec\": 3600,\n"
- + " \"hash\": \"6EFE827AC88914DE471C621AE\",\n"
- + " \"common_categories\": [\n"
- + " \"NOTICE\"\n"
- + " ],\n"
- + " \"receiver\": {\n"
- + " \"phone_number\": \"01093414345\",\n"
- + " \"name\": \"김지호\",\n"
- + " \"birthday\": \"19831218\",\n"
- + " \"is_required_verify_name\": false\n"
- + " },\n"
- + " \"property\": {\n"
- + " \"link\": \"http://ip:8081/api/kakaopay/v1/ott\",\n"
- + " \"cs_number\": \"02-123-4567\",\n"
- + " \"cs_name\": \"콜센터\",\n"
- + " \"payload\": \"payload 파라미터 입니다.\",\n"
- + " \"message\": \"해당 안내문은 다음과 같습니다.\"\n"
- + " }\n"
- + " }}")
+ @ExampleObject(value = """
+ {
+ "document": {
+ "title": "문서 제목",
+ "read_expired_sec": 3600,
+ "hash": "6EFE827AC88914DE471C621AE",
+ "common_categories": [
+ "NOTICE"
+ ],
+ "receiver": {
+ "phone_number": "01093414345",
+ "name": "김지호",
+ "birthday": "19831218",
+ "is_required_verify_name": false
+ },
+ "property": {
+ "link": "http://ip:8081/api/kakaopay/v1/ott",
+ "cs_number": "02-123-4567",
+ "cs_name": "콜센터",
+ "payload": "payload 파라미터 입니다.",
+ "message": "해당 안내문은 다음과 같습니다."
+ }
+ },
+ "signguCode": "88328",
+ "ffnlgCode": "11"
+ }
+ """)
})
})
@PostMapping(value = "/documents", produces = MediaType.APPLICATION_JSON_VALUE)
diff --git a/mens-api/src/main/resources/config/application-ens.yml b/mens-api/src/main/resources/config/application-ens.yml
index 5b3f556..9d86447 100644
--- a/mens-api/src/main/resources/config/application-ens.yml
+++ b/mens-api/src/main/resources/config/application-ens.yml
@@ -14,8 +14,8 @@ contract:
kakao:
bulk-max-cnt: 10
host: https://docs-gw.kakaopay.com
- token: dd394da7f66211eb9cbe46e139ceffc2
- uuid: CON-41ef0535f67211ebbdedd2e6ed332381
+# token: dd394da7f66211eb9cbe46e139ceffc2
+# uuid: CON-41ef0535f67211ebbdedd2e6ed332381
api:
send: /v1/documents;POST
validToken: /v1/{document_binder_uuid}/tokens/{tokens};GET
diff --git a/mens-api/src/main/resources/egovframework/messages/message-api.properties b/mens-api/src/main/resources/egovframework/messages/message-api.properties
index b497115..92a31b6 100644
--- a/mens-api/src/main/resources/egovframework/messages/message-api.properties
+++ b/mens-api/src/main/resources/egovframework/messages/message-api.properties
@@ -5,4 +5,4 @@ fail.api.nice.info=NICE \uC778\uC99D \uC815\uBCF4\uB97C \uCC3E\uC744 \uC218 \uC5
fail.api.nice.revoke.token=\uD1A0\uD070(NICE) \uD3D0\uAE30\uC5D0 \uC2E4\uD328\uD558\uC600\uC2B5\uB2C8\uB2E4
fail.api.nice.invalid.tranId=NICE \uC778\uC99D \uC694\uCCAD\uC5D0 \uC2E4\uD328\uD558\uC600\uC2B5\uB2C8\uB2E4(TRAN_ID \uBD88\uC77C\uCE58)
-fail.api.kt.info=KT \uC778\uC99D \uC815\uBCF4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+fail.api.rlaybsnm.info=\uBB38\uC11C\uC911\uACC4\uC790 \uC778\uC99D \uC815\uBCF4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
diff --git a/mens-core/src/main/java/kr/xit/biz/ens/model/kakao/KkopayDocAttrDTO.java b/mens-core/src/main/java/kr/xit/biz/ens/model/kakao/KkopayDocAttrDTO.java
index 5c78d64..1de2a79 100644
--- a/mens-core/src/main/java/kr/xit/biz/ens/model/kakao/KkopayDocAttrDTO.java
+++ b/mens-core/src/main/java/kr/xit/biz/ens/model/kakao/KkopayDocAttrDTO.java
@@ -6,13 +6,13 @@ import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.Digits;
import javax.validation.constraints.Size;
-import kr.xit.core.model.IApiResponse;
import kr.xit.biz.common.ApiConstants;
+import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO;
+import kr.xit.core.model.IApiResponse;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
-import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;
/**
@@ -188,7 +188,7 @@ public class KkopayDocAttrDTO {
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
- public static class DocumentBinderUuid implements IApiResponse {
+ public static class DocumentBinderUuid extends CmmEnsRequestDTO implements IApiResponse {
/**
* 카카오페이 문서식별번호(max:40) - 필수
*/
diff --git a/mens-core/src/main/java/kr/xit/biz/ens/model/kakao/KkopayDocBulkDTO.java b/mens-core/src/main/java/kr/xit/biz/ens/model/kakao/KkopayDocBulkDTO.java
index 9cbe2c8..60a2317 100644
--- a/mens-core/src/main/java/kr/xit/biz/ens/model/kakao/KkopayDocBulkDTO.java
+++ b/mens-core/src/main/java/kr/xit/biz/ens/model/kakao/KkopayDocBulkDTO.java
@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.Size;
+import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -35,7 +36,7 @@ public class KkopayDocBulkDTO extends KkopayDocAttrDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
- public static class BulkSendRequests {
+ public static class BulkSendRequests extends CmmEnsRequestDTO {
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
@Valid
private List documents;
@@ -126,7 +127,7 @@ public class KkopayDocBulkDTO extends KkopayDocAttrDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
- public static class BulkStatusRequests {
+ public static class BulkStatusRequests extends CmmEnsRequestDTO {
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
@Valid
private List document_binder_uuids;
diff --git a/mens-core/src/main/java/kr/xit/biz/ens/model/kakao/KkopayDocDTO.java b/mens-core/src/main/java/kr/xit/biz/ens/model/kakao/KkopayDocDTO.java
index b751f57..57d7284 100644
--- a/mens-core/src/main/java/kr/xit/biz/ens/model/kakao/KkopayDocDTO.java
+++ b/mens-core/src/main/java/kr/xit/biz/ens/model/kakao/KkopayDocDTO.java
@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.Valid;
import javax.validation.constraints.Digits;
import javax.validation.constraints.Size;
+import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO;
import kr.xit.core.model.IApiResponse;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -38,7 +39,7 @@ public class KkopayDocDTO extends KkopayDocAttrDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
- public static class SendRequest {
+ public static class SendRequest extends CmmEnsRequestDTO {
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
@Valid
private RequestSend document;
@@ -90,7 +91,7 @@ public class KkopayDocDTO extends KkopayDocAttrDTO {
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
- public static class ValidTokenRequest extends DocumentBinderUuid{
+ public static class ValidTokenRequest extends DocumentBinderUuid {
/**
* 카카오페이 전자문서 서버에서 생성한 토큰(max:50) : 필수
*/
@@ -98,6 +99,13 @@ public class KkopayDocDTO extends KkopayDocAttrDTO {
@NotEmpty(message = "카카오페이 전자문서 서버 토큰은 필수입니다(max:50)")
@Length(max = 50)
private String token;
+
+// /**
+// * 카카오페이 문서식별번호(max:40) - 필수
+// */
+// @Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "카카오페이 문서식별번호(max:40)", example = "BIN-ff806328863311ebb61432ac599d6150")
+// @Size(min = 1, max = 40, message = "카카오페이 문서식별번호는 필수입니다(max:40)")
+// private String document_binder_uuid;
}
//-----------------------------------------------------------------------------------------
diff --git a/mens-core/src/main/java/kr/xit/core/spring/util/ApiWebClientUtil.java b/mens-core/src/main/java/kr/xit/core/spring/util/ApiWebClientUtil.java
index 6a6aa3a..5a84564 100644
--- a/mens-core/src/main/java/kr/xit/core/spring/util/ApiWebClientUtil.java
+++ b/mens-core/src/main/java/kr/xit/core/spring/util/ApiWebClientUtil.java
@@ -16,7 +16,6 @@ import kr.xit.core.spring.util.error.ServerError;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
@@ -53,14 +52,15 @@ import reactor.core.publisher.Mono;
@Component
@RequiredArgsConstructor
public class ApiWebClientUtil {
- @Value("${contract.kakao.token:}")
- private String kkoAccessToken;
- @Value("${contract.kakao.uuid:}")
- private String kkoContractUuid;
-
private static final String AUTH_TYPE_BEARER = "Bearer";
private final WebClientConfig webClientConfig;
+ private enum EnsDIV{
+ KKO,
+ KT,
+ PPLUS
+ };
+
public T get(final String url, final Class responseDtoClass, Map headerMap) {
return webClientConfig.webClient().method(HttpMethod.GET)
.uri(url)
@@ -86,21 +86,22 @@ public class ApiWebClientUtil {
.block();
}
- public T exchangeKko(final String url, final HttpMethod method, final Object body, final Class rtnClzz) {
+ public T exchangeKko(final String url, final HttpMethod method, final Object body, final Class rtnClzz, final CmmEnsRlaybsnmDTO ensDTO) {
+
Map map = new HashMap<>();
map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
map.put(HttpHeaders.AUTHORIZATION,
- String.format("%s %s", Constants.JwtToken.GRANT_TYPE.getCode(), kkoAccessToken));
- map.put(Constants.HeaderName.UUID.getCode(), kkoContractUuid);
+ String.format("%s %s", Constants.JwtToken.GRANT_TYPE.getCode(), ensDTO.getKakaoAccessToken()));
+ map.put(Constants.HeaderName.UUID.getCode(), ensDTO.getKakaoContractUuid());
return exchange(url, method, body, rtnClzz, map);
}
- public T exchangeKt(final String url, final HttpMethod method, final Object body, final Class rtnClzz, final CmmEnsRlaybsnmDTO ktMnsInfo) {
+ public T exchangeKt(final String url, final HttpMethod method, final Object body, final Class rtnClzz, final CmmEnsRlaybsnmDTO ensDTO) {
final Map headerMap = new HashMap<>();
headerMap.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
- headerMap.put(HttpHeaders.AUTHORIZATION, String.format("%s %s", AUTH_TYPE_BEARER, ktMnsInfo.getKtAccessToken()));
- headerMap.put("client-id", ktMnsInfo.getKtClientId());
+ headerMap.put(HttpHeaders.AUTHORIZATION, String.format("%s %s", AUTH_TYPE_BEARER, ensDTO.getKtAccessToken()));
+ headerMap.put("client-id", ensDTO.getKtClientId());
headerMap.put("client-tp", "10");
return exchange(url, method, body, rtnClzz, headerMap);
@@ -205,6 +206,28 @@ public class ApiWebClientUtil {
return ErrorParse.extractError(e.getCause());
}
+// private Map getHeaderMap(final EnsDIV ensDIV, final CmmEnsRlaybsnmDTO ensDTO){
+// Map map = new HashMap<>();
+//
+// switch(ensDIV){
+// case KKO:
+// map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
+// map.put(HttpHeaders.AUTHORIZATION,
+// String.format("%s %s", Constants.JwtToken.GRANT_TYPE.getCode(), ensDTO.getKakaoAccessToken()));
+// map.put(Constants.HeaderName.UUID.getCode(), ensDTO.getKakaoContractUuid());
+// break;
+// case KT:
+// map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
+// map.put(HttpHeaders.AUTHORIZATION, String.format("%s %s", AUTH_TYPE_BEARER, ensDTO.getKtAccessToken()));
+// map.put("client-id", ensDTO.getKtClientId());
+// map.put("client-tp", "10");
+// break;
+// default:
+// throw BizRuntimeException.create("서비스 불가한 문서중계자 입니다");
+// }
+// return map;
+// }
+
private URI createUrl(final String endPoint, final String... value) {
return UriComponentsBuilder.fromUriString(endPoint)
.build(value);
@@ -218,7 +241,7 @@ public class ApiWebClientUtil {
return headers;
}
- ExchangeFilterFunction errorHandler() {
+ private ExchangeFilterFunction errorHandler() {
return ExchangeFilterFunction.ofResponseProcessor(clientResponse -> {
HttpStatus status = clientResponse.statusCode();