|
|
@ -9,8 +9,6 @@ import javax.validation.Validation;
|
|
|
|
import javax.validation.Validator;
|
|
|
|
import javax.validation.Validator;
|
|
|
|
import kr.xit.biz.common.ApiConstants;
|
|
|
|
import kr.xit.biz.common.ApiConstants;
|
|
|
|
import kr.xit.biz.common.ApiConstants.SignguCode;
|
|
|
|
import kr.xit.biz.common.ApiConstants.SignguCode;
|
|
|
|
import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO;
|
|
|
|
|
|
|
|
import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO;
|
|
|
|
|
|
|
|
import kr.xit.biz.ens.model.kakao.KkopayDocAttrDTO.DocumentBinderUuid;
|
|
|
|
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.KkopayDocAttrDTO.Receiver;
|
|
|
|
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkSendReq;
|
|
|
|
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkSendReq;
|
|
|
@ -32,7 +30,7 @@ import kr.xit.core.spring.annotation.TraceLogging;
|
|
|
|
import kr.xit.core.spring.util.ApiWebClientUtil;
|
|
|
|
import kr.xit.core.spring.util.ApiWebClientUtil;
|
|
|
|
import kr.xit.core.support.utils.Checks;
|
|
|
|
import kr.xit.core.support.utils.Checks;
|
|
|
|
import kr.xit.core.support.utils.JsonUtils;
|
|
|
|
import kr.xit.core.support.utils.JsonUtils;
|
|
|
|
import kr.xit.ens.kakao.cmm.CmmKakaoUtils;
|
|
|
|
import kr.xit.ens.kt.cmm.CmmKtMmsUtils;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@ -110,7 +108,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
|
|
|
|
if(Checks.isEmpty(receiver.getBirthday())) Objects.requireNonNull(errors).add("receiver.birthday=받는이 생년월일은 필수입니다.");
|
|
|
|
if(Checks.isEmpty(receiver.getBirthday())) Objects.requireNonNull(errors).add("receiver.birthday=받는이 생년월일은 필수입니다.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!Objects.requireNonNull(errors).isEmpty()) throw BizRuntimeException.create(errors.toString());
|
|
|
|
if(!Objects.requireNonNull(errors).isEmpty()) throw BizRuntimeException.create(errors.toString());
|
|
|
|
return webClient.exchangeKko(HOST + API_SEND[0], HttpMethod.valueOf(API_SEND[1]), JsonUtils.toJson(reqDTO), SendResponse.class, getEnsRlaybsnmDTO(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
return webClient.exchangeKko(HOST + API_SEND[0], HttpMethod.valueOf(API_SEND[1]), JsonUtils.toJson(reqDTO), SendResponse.class, CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -128,7 +126,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
|
|
|
|
final String url = HOST
|
|
|
|
final String url = HOST
|
|
|
|
+ API_VALID_TOKEN[0].replace(DOCUMENT_BINDER_UUID, reqDTO.getDocument_binder_uuid())
|
|
|
|
+ API_VALID_TOKEN[0].replace(DOCUMENT_BINDER_UUID, reqDTO.getDocument_binder_uuid())
|
|
|
|
.replace("{tokens}", reqDTO.getToken());
|
|
|
|
.replace("{tokens}", reqDTO.getToken());
|
|
|
|
return webClient.exchangeKko(url, HttpMethod.valueOf(API_VALID_TOKEN[1]), null, ValidTokenResponse.class, getEnsRlaybsnmDTO(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
return webClient.exchangeKko(url, HttpMethod.valueOf(API_VALID_TOKEN[1]), null, ValidTokenResponse.class, CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -149,7 +147,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
|
|
|
|
final String body = "{\"document\": {\"is_detail_read\": true} }";
|
|
|
|
final String body = "{\"document\": {\"is_detail_read\": true} }";
|
|
|
|
final String url = HOST + API_MODIFY_STATUS[0].replace(DOCUMENT_BINDER_UUID, reqDTO.getDocument_binder_uuid());
|
|
|
|
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, getEnsRlaybsnmDTO(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
webClient.exchangeKko(url, HttpMethod.valueOf(API_MODIFY_STATUS[1]), body, Void.class, CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -170,7 +168,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
|
|
|
|
validate(reqDTO, null);
|
|
|
|
validate(reqDTO, null);
|
|
|
|
|
|
|
|
|
|
|
|
final String url = HOST + API_STATUS[0].replace(DOCUMENT_BINDER_UUID, reqDTO.getDocument_binder_uuid());
|
|
|
|
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, getEnsRlaybsnmDTO(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
return webClient.exchangeKko(url, HttpMethod.valueOf(API_STATUS[1]), null, DocStatusResponse.class, CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -227,7 +225,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
|
|
|
|
throw BizRuntimeException.create(errors.toString());
|
|
|
|
throw BizRuntimeException.create(errors.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return webClient.exchangeKko(HOST + API_BULKSEND[0], HttpMethod.valueOf(API_BULKSEND[1]), JsonUtils.toJson(reqDTO), BulkSendResponses.class, getEnsRlaybsnmDTO(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
return webClient.exchangeKko(HOST + API_BULKSEND[0], HttpMethod.valueOf(API_BULKSEND[1]), JsonUtils.toJson(reqDTO), BulkSendResponses.class, CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -257,7 +255,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
|
|
|
|
if(!errors.isEmpty()) {
|
|
|
|
if(!errors.isEmpty()) {
|
|
|
|
throw BizRuntimeException.create(errors.toString());
|
|
|
|
throw BizRuntimeException.create(errors.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return webClient.exchangeKko(HOST + API_BULKSTATUS[0], HttpMethod.valueOf(API_BULKSTATUS[1]), JsonUtils.toJson(reqDTO), BulkStatusResponses.class, getEnsRlaybsnmDTO(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
return webClient.exchangeKko(HOST + API_BULKSTATUS[0], HttpMethod.valueOf(API_BULKSTATUS[1]), JsonUtils.toJson(reqDTO), BulkStatusResponses.class, CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -269,7 +267,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
|
|
|
|
|
|
|
|
|
|
|
|
// 유효성 검증
|
|
|
|
// 유효성 검증
|
|
|
|
final ValidTokenResponse validTokenRes = webClient.exchangeKko(url, HttpMethod.valueOf(API_VALID_TOKEN[1]), null,
|
|
|
|
final ValidTokenResponse validTokenRes = webClient.exchangeKko(url, HttpMethod.valueOf(API_VALID_TOKEN[1]), null,
|
|
|
|
ValidTokenResponse.class, getEnsRlaybsnmDTO(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
ValidTokenResponse.class, CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
|
|
|
|
|
|
|
|
if(!"USED".equals(validTokenRes.getToken_status())){
|
|
|
|
if(!"USED".equals(validTokenRes.getToken_status())){
|
|
|
|
return ApiResponseDTO.error(validTokenRes.getError_code(), validTokenRes.getError_message());
|
|
|
|
return ApiResponseDTO.error(validTokenRes.getError_code(), validTokenRes.getError_message());
|
|
|
@ -281,7 +279,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
|
|
|
|
|
|
|
|
|
|
|
|
// 정상 : HttpStatus.NO_CONTENT(204) return
|
|
|
|
// 정상 : HttpStatus.NO_CONTENT(204) return
|
|
|
|
// error : body에 error_code, error_message return
|
|
|
|
// error : body에 error_code, error_message return
|
|
|
|
final KkopayErrorDTO errorDTO = webClient.exchangeKko(url2, HttpMethod.valueOf(API_MODIFY_STATUS[1]), body, KkopayErrorDTO.class, getEnsRlaybsnmDTO(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
final KkopayErrorDTO errorDTO = webClient.exchangeKko(url2, HttpMethod.valueOf(API_MODIFY_STATUS[1]), body, KkopayErrorDTO.class, CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
if(errorDTO != null){
|
|
|
|
if(errorDTO != null){
|
|
|
|
return ApiResponseDTO.error(errorDTO.getErrorCode(), errorDTO.getErrorMessage());
|
|
|
|
return ApiResponseDTO.error(errorDTO.getErrorCode(), errorDTO.getErrorMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -308,13 +306,4 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return errList;
|
|
|
|
return errList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private CmmEnsRlaybsnmDTO getEnsRlaybsnmDTO(final String signguCode, final String ffnlgCode){
|
|
|
|
|
|
|
|
return CmmKakaoUtils.getRlaybsnmInfo(
|
|
|
|
|
|
|
|
CmmEnsRequestDTO.builder()
|
|
|
|
|
|
|
|
.signguCode(signguCode)
|
|
|
|
|
|
|
|
.ffnlgCode(ffnlgCode)
|
|
|
|
|
|
|
|
.profile("prod")
|
|
|
|
|
|
|
|
.build());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|