|
|
@ -8,8 +8,6 @@ import java.util.stream.Collectors;
|
|
|
|
import javax.validation.ConstraintViolation;
|
|
|
|
import javax.validation.ConstraintViolation;
|
|
|
|
import javax.validation.Validation;
|
|
|
|
import javax.validation.Validation;
|
|
|
|
import javax.validation.Validator;
|
|
|
|
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.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;
|
|
|
@ -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.SendResponse;
|
|
|
|
import kr.xit.biz.ens.model.kakao.KkopayDocDTO.ValidTokenRequest;
|
|
|
|
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.KkopayDocDTO.ValidTokenResponse;
|
|
|
|
|
|
|
|
import kr.xit.biz.ens.model.kakao.KkopayErrorDTO;
|
|
|
|
import kr.xit.core.exception.BizRuntimeException;
|
|
|
|
import kr.xit.core.exception.BizRuntimeException;
|
|
|
|
import kr.xit.core.model.ApiResponseDTO;
|
|
|
|
import kr.xit.core.model.ApiResponseDTO;
|
|
|
|
import kr.xit.core.spring.annotation.TraceLogging;
|
|
|
|
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 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;
|
|
|
@ -107,7 +107,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).size() > 0) throw BizRuntimeException.create(errors.toString());
|
|
|
|
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
|
|
|
|
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);
|
|
|
|
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 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);
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
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());
|
|
|
|
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) {
|
|
|
|
if(errors.size() > 0) {
|
|
|
|
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);
|
|
|
|
return webClient.exchangeKko(HOST + API_BULKSTATUS[0], HttpMethod.valueOf(API_BULKSTATUS[1]), JsonUtils.toJson(reqDTO), BulkStatusResponses.class, CmmKakaoUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -266,7 +266,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);
|
|
|
|
ValidTokenResponse.class, CmmKakaoUtils.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());
|
|
|
@ -278,7 +278,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);
|
|
|
|
final KkopayErrorDTO errorDTO = webClient.exchangeKko(url2, HttpMethod.valueOf(API_MODIFY_STATUS[1]), body, KkopayErrorDTO.class, CmmKakaoUtils.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());
|
|
|
|
}
|
|
|
|
}
|
|
|
|