feat: Nice CI API 반영

dev
gitea-관리자 1 year ago
parent 3b2458d6cd
commit ba715b954d

@ -1,5 +1,7 @@
package kr.xit.ens.support.nice.service;
import kr.xit.biz.ens.model.nice.NiceCiDTO.PublickeyRequest;
import kr.xit.biz.ens.model.nice.NiceCiDTO.PublickeyResponse;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenRequest;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenResponse;
@ -19,6 +21,20 @@ import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenResponse;
* </pre>
*/
public interface INiceCiService {
//--------------------------------------------------------------------------------
// 기관용 Token
//--------------------------------------------------------------------------------
TokenResponse generateToken(final TokenRequest reqDTO);
TokenResponse revokeToken(final String token);
//--------------------------------------------------------------------------------
// 기관용 Token
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// 공개키(Publickey)
//--------------------------------------------------------------------------------
PublickeyResponse requestPublickey(final PublickeyRequest reqDTO);
//--------------------------------------------------------------------------------
// 공개키(Publickey)
//--------------------------------------------------------------------------------
}

@ -0,0 +1,193 @@
package kr.xit.ens.support.nice.service;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import kr.xit.biz.ens.model.nice.NiceCiDTO.PublickeyRequest;
import kr.xit.biz.ens.model.nice.NiceCiDTO.PublickeyResDataBody;
import kr.xit.biz.ens.model.nice.NiceCiDTO.PublickeyResponse;
import kr.xit.biz.ens.model.nice.NiceCiDTO.ResponseDataHeader;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenRequest;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenResDataBody;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenResponse;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.spring.util.ApiWebClientUtil;
import lombok.RequiredArgsConstructor;
import org.apache.logging.log4j.util.Base64Util;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.support.nice.service
* fileName : NiceCiService
* author : limju
* date : 2023-09-06
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-09-06 limju
*
* </pre>
*/
//FIXME : client_id, client_secret, access_token DB 처리후 반영 필요
@RequiredArgsConstructor
@Service
public class NiceCiDummyTestService extends EgovAbstractServiceImpl {
@Value("${contract.nice.host}")
private String HOST;
@Value("${contract.nice.client-id}")
private String CLIENT_ID;
@Value("${contract.nice.client-secret}")
private String CLIENT_SECRET;
@Value("${contract.nice.api.generate-token}")
private String API_GENERATE_TOKEN;
@Value("${contract.nice.api.revoke-token}")
private String API_REVOKE_TOKEN;
@Value("${contract.nice.api.publickey}")
private String API_PUBLICKEY;
@Value("${contract.nice.api.symmetrickey}")
private String API_SYMMETRICKEY;
@Value("${contract.nice.api.ci}")
private String API_CI;
private static final String AUTH_TYPE_BASIC = "Basic";
private static final String AUTH_TYPE_BEARER = "bearer";
private static final Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
private final ApiWebClientUtil webClient;
//--------------------------------------------------------------------------------
// 기관용 Token
//--------------------------------------------------------------------------------
/**
*
* @param reqDTO
* @return
*/
@TraceLogging
public TokenResponse generateToken(final TokenRequest reqDTO){
validate(reqDTO);
Map<String,String> map = new HashMap<>();
map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
map.put(HttpHeaders.AUTHORIZATION, String.format("%s %s", AUTH_TYPE_BASIC, Base64Util.encode(String.format("%s:%s", this.CLIENT_ID, this.CLIENT_SECRET))));
return TokenResponse.builder()
.dataHeader(ResponseDataHeader.builder()
.gw_rslt_cd("1200")
.gw_rslt_cd("오류없음")
.build())
.dataBody(TokenResDataBody.builder()
.access_token("ff5e27fe-8b5d-49db-ab1e-0ccf07de6ac1")
.token_type("bearer")
.expires_in(1.57698305E9)
.scope("default")
.build())
.build();
}
/**
* <pre>
* Authorization : Basic + Base64Encoding(access_token:current_timestamp:client_id)
* - access_token : access_token
* - client_id : access_token client_id
* - current_timestamp
* Date currentDate = new Date();
* long current_timestamp = currentDate.getTime() /1000
* @param token
* @return
* </pre>
*/
@TraceLogging
public TokenResponse revokeToken(final String token){
return webClient.exchange(
HOST + API_GENERATE_TOKEN,
HttpMethod.POST,
null,
TokenResponse.class,
getHeaderMap(MediaType.APPLICATION_FORM_URLENCODED_VALUE, AUTH_TYPE_BASIC));
}
//--------------------------------------------------------------------------------
// 기관용 Token
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// 공개키(Publickey)
//--------------------------------------------------------------------------------
public PublickeyResponse requestPublickey(final PublickeyRequest reqDTO) {
validate(reqDTO);
return PublickeyResponse.builder()
.dataHeader(ResponseDataHeader.builder()
.gw_rslt_cd("1200")
.gw_rslt_msg("오류없음")
.tran_id(reqDTO.getDataHeader().getTran_id())
.cnty_id(reqDTO.getDataHeader().getCnty_id())
.build())
.dataBody(PublickeyResDataBody.builder()
.rsp_cd("P000")
.rsp_msg("")
.result_cd("000")
.site_code("AAAA==")
.key_version("20210121ca8c1612-2c2d-IPaa-aad1-xxxxxxxxxxxx")
.public_key("MIIBIjANBgkqhkiG9w0BAQEFAA.....JJxwIDAQAB...")
.valid_dtim("20220121181550")
.build())
.build();
}
//--------------------------------------------------------------------------------
// 공개키(Publickey)
//--------------------------------------------------------------------------------
//-------------------------------------------------------------------------------
private Map<String,String> getHeaderMap(final String contentType, final String type){
Map<String,String> map = new HashMap<>();
map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
map.put(
HttpHeaders.AUTHORIZATION,
String.format("%s %s",
type,
Base64Util.encode(
String.format("%s:%s:%s",
"accessToken",
(new Date().getTime() / 1000),
this.CLIENT_ID)
)
)
);
return map;
}
private static <T> void validate(T t) {
Set<ConstraintViolation<T>> list = validator.validate(t);
if (list.size() > 0) {
List<String> errors = list.stream()
.map(row -> String.format("%s=%s", row.getPropertyPath(), row.getMessageTemplate()))
.collect(Collectors.toList());
throw BizRuntimeException.create(
list.stream()
.map(row -> String.format("%s=%s", row.getPropertyPath(), row.getMessageTemplate()))
.collect(Collectors.toList()).toString());
}
}
}

@ -4,12 +4,26 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkSendResponses;
import kr.xit.biz.ens.model.nice.NiceCiDTO.PublickeyRequest;
import kr.xit.biz.ens.model.nice.NiceCiDTO.PublickeyResponse;
import kr.xit.biz.ens.model.nice.NiceCiDTO.ResponseDataHeader;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenRequest;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenResDataBody;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenResponse;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.spring.util.ApiWebClientUtil;
import kr.xit.core.support.utils.JsonUtils;
import lombok.RequiredArgsConstructor;
@ -39,6 +53,7 @@ import org.springframework.util.MultiValueMap;
*
* </pre>
*/
//FIXME : client_id, client_secret, access_token DB 처리후 반영 필요
@RequiredArgsConstructor
@Service
public class NiceCiService extends EgovAbstractServiceImpl implements INiceCiService {
@ -59,13 +74,35 @@ public class NiceCiService extends EgovAbstractServiceImpl implements INiceCiSer
@Value("${contract.nice.api.ci}")
private String API_CI;
private static final String AUTH_TYPE_BASIC = "Basic";
private static final String AUTH_TYPE_BEARER = "bearer";
private static final Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
private final ApiWebClientUtil webClient;
//--------------------------------------------------------------------------------
// 기관용 Token
//--------------------------------------------------------------------------------
/**
*
* @param reqDTO
* @return
*/
@Override
@TraceLogging
public TokenResponse generateToken(final TokenRequest reqDTO){
return webClient.exchange(HOST + API_GENERATE_TOKEN, HttpMethod.POST, JsonUtils.toJson(reqDTO), TokenResponse.class, getHeaderMap());
validate(reqDTO);
Map<String,String> map = new HashMap<>();
map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
map.put(HttpHeaders.AUTHORIZATION, String.format("%s %s", AUTH_TYPE_BASIC, Base64Util.encode(String.format("%s:%s", this.CLIENT_ID, this.CLIENT_SECRET))));
return webClient.exchange(HOST + API_GENERATE_TOKEN, HttpMethod.POST, JsonUtils.toJson(reqDTO), TokenResponse.class, map);
}
/**
* <pre>
* Authorization : Basic + Base64Encoding(access_token:current_timestamp:client_id)
* - access_token : access_token
* - client_id : access_token client_id
@ -74,22 +111,76 @@ public class NiceCiService extends EgovAbstractServiceImpl implements INiceCiSer
* long current_timestamp = currentDate.getTime() /1000
* @param token
* @return
* </pre>
*/
@Override
@TraceLogging
public TokenResponse revokeToken(final String token){
Map<String,String> map = new HashMap<>();
map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
map.put(HttpHeaders.AUTHORIZATION, String.format("Basic %s", Base64Util.encode(String.format("%s:%s:%s", token, (new Date().getTime() / 1000), this.CLIENT_SECRET))));
return webClient.exchange(HOST + API_GENERATE_TOKEN, HttpMethod.POST, null, TokenResponse.class, getHeaderMap());
//validate(reqDTO, null);
return webClient.exchange(
HOST + API_GENERATE_TOKEN,
HttpMethod.POST,
null,
TokenResponse.class,
getHeaderMap(MediaType.APPLICATION_FORM_URLENCODED_VALUE, AUTH_TYPE_BASIC));
}
//--------------------------------------------------------------------------------
// 기관용 Token
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// 공개키(Publickey)
//--------------------------------------------------------------------------------
@Override
@TraceLogging
public PublickeyResponse requestPublickey(final PublickeyRequest reqDTO) {
validate(reqDTO);
return webClient.exchange(
HOST + API_GENERATE_TOKEN,
HttpMethod.POST,
null,
PublickeyResponse.class,
getHeaderMap(MediaType.APPLICATION_JSON_VALUE, AUTH_TYPE_BEARER));
}
//--------------------------------------------------------------------------------
// 공개키(Publickey)
//--------------------------------------------------------------------------------
//-------------------------------------------------------------------------------
private Map<String,String> getHeaderMap(){
private Map<String,String> getHeaderMap(final String contentType, final String type){
Map<String,String> map = new HashMap<>();
map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
map.put(HttpHeaders.AUTHORIZATION, String.format("Basic %s", Base64Util.encode(String.format("%s:%s", this.CLIENT_ID, this.CLIENT_SECRET))));
map.put(
HttpHeaders.AUTHORIZATION,
String.format("%s %s",
type,
Base64Util.encode(
String.format("%s:%s:%s",
"accessToken",
(new Date().getTime() / 1000),
this.CLIENT_ID)
)
)
);
return map;
}
private static <T> void validate(T t) {
Set<ConstraintViolation<T>> list = validator.validate(t);
if (list.size() > 0) {
List<String> errors = list.stream()
.map(row -> String.format("%s=%s", row.getPropertyPath(), row.getMessageTemplate()))
.collect(Collectors.toList());
throw BizRuntimeException.create(
list.stream()
.map(row -> String.format("%s=%s", row.getPropertyPath(), row.getMessageTemplate()))
.collect(Collectors.toList()).toString());
}
}
}

@ -1,8 +1,11 @@
package kr.xit.ens.support.nice.web;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.tags.Tag;
import kr.xit.biz.ens.model.kakao.KkopayDocDTO.ValidTokenRequest;
import kr.xit.biz.ens.model.nice.NiceCiDTO.PublickeyRequest;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenRequest;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.ens.support.nice.service.INiceCiService;
@ -36,6 +39,9 @@ import org.springframework.web.bind.annotation.RestController;
public class NiceCiController {
private final INiceCiService service;
//--------------------------------------------------------------------------------
// 기관용 Token
//--------------------------------------------------------------------------------
@Operation(summary = "기관용 토큰 발급 요청", description = "기관용 토큰 발급 요청")
@PostMapping(value = "/generateToken", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> generateToken(
@ -51,4 +57,43 @@ public class NiceCiController {
) {
return ApiResponseDTO.success(service.revokeToken(accessToken));
}
//--------------------------------------------------------------------------------
// 기관용 Token
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// 공개키(Publickey)
//--------------------------------------------------------------------------------
/**
*
* @param reqDTO
* @return
*/
/*@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
@Content(mediaType = "application/json", examples = {
@ExampleObject(value = """
{
"dataHeader": {
"TRAN_ID": "20201119140000",
"CNTY_ID": "kr"
},
"dataBody": {
"req_dtim": "2023090612122259"
}
}
""")
})
})*/
@Operation(summary = "공개키 요청", description = "공개키 요청")
@PostMapping(value = "/requestPublickey", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> requestPublickey(
@RequestBody final PublickeyRequest reqDTO
) {
return ApiResponseDTO.success(service.requestPublickey(reqDTO));
}
//--------------------------------------------------------------------------------
// 공개키(Publickey)
//--------------------------------------------------------------------------------
}

@ -0,0 +1,112 @@
package kr.xit.ens.support.nice.web;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import kr.xit.biz.ens.model.nice.NiceCiDTO.PublickeyRequest;
import kr.xit.biz.ens.model.nice.NiceCiDTO.ResponseDataHeader;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenRequest;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenResDataBody;
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenResponse;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.support.utils.JsonUtils;
import kr.xit.ens.support.nice.service.INiceCiService;
import kr.xit.ens.support.nice.service.NiceCiDummyTestService;
import kr.xit.ens.support.nice.service.NiceCiService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.support.nice.web
* fileName : NiceCiDummyTestController
* author : limju
* date : 2023-09-06
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-09-06 limju
*
* </pre>
*/
@Slf4j
@Tag(name = "NiceCiDummyTestController", description = "Nice CI Dummy Test")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/api/nice/test")
public class NiceCiDummyTestController {
private final NiceCiDummyTestService service;
private static final Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
//--------------------------------------------------------------------------------
// 기관용 Token
//--------------------------------------------------------------------------------
@Operation(summary = "기관용 토큰 발급 요청", description = "기관용 토큰 발급 요청")
@PostMapping(value = "/generateToken", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> generateToken(
@RequestBody final TokenRequest reqDTO
) {
return ApiResponseDTO.success(service.generateToken(reqDTO));
}
@Operation(summary = "기관용 토큰 폐기", description = "기관용 토큰 폐기")
@PostMapping(value = "/revokeToken", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> revokeToken(
@RequestParam final String accessToken
) {
return ApiResponseDTO.success(service.revokeToken(accessToken));
}
//--------------------------------------------------------------------------------
// 기관용 Token
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// 공개키(Publickey)
//--------------------------------------------------------------------------------
/*@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
@Content(mediaType = "application/json", examples = {
@ExampleObject(value = """
{
"dataHeader": {
"TRAN_ID": "20201119140000",
"CNTY_ID": "kr"
},
"dataBody": {
"req_dtim": "2023090612122259"
}
}
""")
})
})*/
@Operation(summary = "공개키 요청", description = "공개키 요청")
@PostMapping(value = "/requestPublickey", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> requestPublickey(
@RequestBody final PublickeyRequest reqDTO
) {
return ApiResponseDTO.success(service.requestPublickey(reqDTO));
}
//--------------------------------------------------------------------------------
// 공개키(Publickey)
//--------------------------------------------------------------------------------
}

@ -39,6 +39,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

@ -1,13 +1,20 @@
package kr.xit.biz.ens.model.nice;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import kr.xit.core.model.IApiResponse;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Builder.Default;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@ -42,22 +49,24 @@ public class NiceCiDTO {
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class TokenRequest {
/**
* default
*/
@Default
@Schema(requiredMode = RequiredMode.REQUIRED, title = "scope", example = "default")
@NotBlank(message = "scope는 필수입니다")
private String scope;
@Size(min = 1, message = "scope는 필수입니다")
private String scope = "default";
/**
* clinet_credentials
*/
@Default
@Schema(requiredMode = RequiredMode.REQUIRED, title = "grant_type", example = "clinet_credentials")
@NotBlank(message = "grant_type은 필수입니다")
private String grant_type;
@Size(min = 1, message = "grant_type은 필수입니다")
private String grant_type = "clinet_credentials";
}
/**
@ -75,9 +84,11 @@ public class NiceCiDTO {
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class TokenResponse implements IApiResponse {
@Schema(requiredMode = RequiredMode.REQUIRED)
@Valid
private ResponseDataHeader dataHeader;
@Schema(requiredMode = RequiredMode.REQUIRED)
@Valid
private TokenResDataBody dataBody;
}
@ -95,13 +106,14 @@ public class NiceCiDTO {
public static class TokenRevokeResponse implements IApiResponse {
@Schema(requiredMode = RequiredMode.REQUIRED)
@Valid
private ResponseDataHeader dataHeader;
}
/**
* dataBody
*/
@Schema(name = "TokenResDataBody", description = "TokenResponse dataBody DTO")
@Schema(name = "TokenResDataBody", description = "기관용 토큰 발급 요청 응답 dataBody DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@ -118,7 +130,6 @@ public class NiceCiDTO {
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "사용자 엑세스 토큰 값", example = " ")
@NotBlank
private String access_token;
/**
@ -126,15 +137,13 @@ public class NiceCiDTO {
* bearer
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "token_type", example = "bearer")
@NotBlank
private String token_type;
/**
* access () : token
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "access 토큰 만료 시간(초)", example = "1.57698305E9")
@NotBlank
private int expires_in;
private double expires_in;
/**
* <pre>
@ -143,7 +152,6 @@ public class NiceCiDTO {
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "요청한 scope 값", example = "default")
@NotBlank
private String scope;
//-----------------------------------------------------------------------
@ -154,7 +162,6 @@ public class NiceCiDTO {
* true or false
*/
@Schema(requiredMode = RequiredMode.AUTO)
@NotBlank
private boolean result;
}
//--------------------------------------------------------------------------------
@ -178,13 +185,12 @@ public class NiceCiDTO {
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class PublickeyRequest {
@Schema(requiredMode = RequiredMode.REQUIRED)
@Valid
private RequestDataHeader dataHeader;
/**
* clinet_credentials
*/
@Schema(requiredMode = RequiredMode.REQUIRED)
private PublickeyReqDataBody grant_type;
@Valid
private PublickeyReqDataBody dataBody;
}
/**
@ -200,16 +206,18 @@ public class NiceCiDTO {
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class PublickeyResponse implements IApiResponse {
@Schema(requiredMode = RequiredMode.REQUIRED)
@Valid
private ResponseDataHeader dataHeader;
@Schema(requiredMode = RequiredMode.REQUIRED)
@Valid
private PublickeyResDataBody dataBody;
}
/**
* Request dataHeader
*/
@Schema(name = "PublickeyReqDataBody", description = "Publickey Request DataBody DTO")
@Schema(name = "PublickeyReqDataBody", description = "공개키 요청 dataBody DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@ -220,11 +228,11 @@ public class NiceCiDTO {
* (YYYYMMDDHH24MISS)
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "공개키 요청일시", example = "2023090612122259")
@Size(min = 14, max = 14, message = "요청일시(req_dtim)는 필수 입니다(14자리)")
@Size(min = 16, max = 16, message = "요청일시(req_dtim)는 필수 입니다(16자리)")
private String req_dtim;
}
@Schema(name = "PublickeyResDataBody", description = "Publickey Response dataBody DTO")
@Schema(name = "PublickeyResDataBody", description = "공개키 요청 응답 dataBody DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@ -234,7 +242,7 @@ public class NiceCiDTO {
/**
* dataBody (P000 , ) : 8
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "정상처리여부", example = "P000")
@Schema(requiredMode = RequiredMode.REQUIRED, title = "정상처리 여부", example = "P000")
private String rsp_cd;
/**
@ -243,7 +251,7 @@ public class NiceCiDTO {
* 200
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "res_msg", example = " ")
@Schema(requiredMode = RequiredMode.REQUIRED, title = "상세 메세지", example = " ")
private String rsp_msg;
/**
@ -255,7 +263,7 @@ public class NiceCiDTO {
* - 0099:
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "res_msg", example = "0000")
@Schema(requiredMode = RequiredMode.AUTO, title = "상세 결과코드", example = "0000")
private String result_cd;
/**
@ -263,7 +271,7 @@ public class NiceCiDTO {
* : 16
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "사이트코드", example = " ")
@Schema(requiredMode = RequiredMode.AUTO, title = "사이트 코드", example = " ")
private String site_code;
/**
@ -271,7 +279,7 @@ public class NiceCiDTO {
* : 50
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "공개키버전", example = " ")
@Schema(requiredMode = RequiredMode.AUTO, title = "공개키 버전", example = " ")
private String key_version;
/**
@ -287,14 +295,20 @@ public class NiceCiDTO {
* (YYYYMMDDHH24MISS) : 14
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "공개키만료일시", example = "0000")
@Schema(requiredMode = RequiredMode.AUTO, title = "공개키 만료일시", example = " ")
private String valid_dtim;
}
//--------------------------------------------------------------------------------
// 공개키 : publickey
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// 대칭키 : publickey
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// 공개키 : publickey
//--------------------------------------------------------------------------------
@ -302,13 +316,14 @@ public class NiceCiDTO {
/**
* Request dataHeader
*/
@Schema(name = "RequestDataHeader", description = "RequestDataHeader dataHeader DTO")
@Schema(name = "RequestDataHeader", description = "Nice CI request dataHeader(공통)")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class RequestDataHeader {
/**
* <pre>
* TRAN_ID : return
@ -316,22 +331,24 @@ public class NiceCiDTO {
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "TRAN_ID", example = "20230906120000")
@Max(value = 24, message = "TRAN_ID는 24자를 넘을 수 없습니다.")
private String TRAN_ID;
@Size(min = 0, max = 24, message = "TRAN_ID는 24자를 넘을 수 없습니다.")
@JsonProperty("TRAN_ID")
private String tran_id;
/**
* CNTY_ID : return
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "CNTY_ID", example = "kr")
@Max(value = 2, message = "CNTY_ID는 2자를 넘을 수 없습니다.")
private String CNTY_ID;
@Size(min = 0, max = 2, message = "CNTY_ID는 2자를 넘을 수 없습니다.")
@JsonProperty("CNTY_ID")
private String cnty_id;
}
/**
* Response dataHeader
*/
@Schema(name = "ResponseDataHeader", description = "ResponseDataHeader dataHeader DTO")
@Schema(name = "ResponseDataHeader", description = "Nice CI Response dataHeader(공통)")
@Data
@NoArgsConstructor
@AllArgsConstructor
@ -345,15 +362,17 @@ public class NiceCiDTO {
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "응답코드", example = "1200")
@NotBlank
private String GW_RSLT_CD;
@Size(min = 1, max = 8)
@JsonProperty("GW_RSLT_CD")
private String gw_rslt_cd;
/**
* : 200
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "응답메세지", example = "오류없음")
@Size(min = 1, max = 200)
private String GW_RSLT_MSG;
@JsonProperty("GW_RSLT_MSG")
private String gw_rslt_msg;
/**
* <pre>
@ -361,8 +380,9 @@ public class NiceCiDTO {
* : 24
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "TRAN_ID", example = "20230906120000")
private String TRAN_ID;
@Schema(requiredMode = RequiredMode.AUTO, title = "TRAN_ID", example = " ")
@JsonProperty("TRAN_ID")
private String tran_id;
/**
* <pre>
@ -370,8 +390,9 @@ public class NiceCiDTO {
* 2
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "CNTY_ID", example = "kr")
private String CNTY_ID;
@Schema(requiredMode = RequiredMode.AUTO, title = "CNTY_ID", example = " ")
@JsonProperty("CNTY_ID")
private String cnty_id;
}

Loading…
Cancel
Save