Merge branch 'master_tolag3'

This commit is contained in:
leejunho 2025-07-29 11:28:44 +09:00
commit 440c58329c
2 changed files with 93 additions and 0 deletions

View File

@ -42,6 +42,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
@ -3502,4 +3503,39 @@ public class TestController {
}
@RequestMapping("/uss/ion/test/callNicepay.do")
public String callNicepay(Model model) {
String url = "https://dev.nicepay.co.kr/webapi/sslConnectionTest.jsp";
String mid = "itn180208m"; // 실제 MID 값으로 변경
try {
// RestTemplate 사용
RestTemplate restTemplate = new RestTemplate();
// 헤더 설정
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
// 파라미터 설정
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.add("MID", mid);
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(params, headers);
// POST 요청
ResponseEntity<String> response = restTemplate.postForEntity(url, request, String.class);
// JSP에 전달
model.addAttribute("result", response.getBody());
model.addAttribute("url", url);
model.addAttribute("mid", mid);
} catch (Exception e) {
model.addAttribute("result", "에러 발생: " + e.getMessage());
}
return "uss/ion/test/TestNicePaySSL"; // nicepayResult.jsp로 이동
}
}

View File

@ -0,0 +1,57 @@
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<html lang="ko">
<head>
<title>세금계산서 관리</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div class="contWrap">
<div class="pageTitle">
<div class="pageIcon"><img src="/pb/img/pageTitIcon4.png" alt=""></div>
<h2 class="titType1 c_222222 fwBold">Nicepay SSL 호출 결과</h2>
<p class="tType6 c_999999">Nicepay SSL 호출 결과</p>
</div>
<div class="pageCont">
<!-- 세금계산서 -->
<div class="tableWrap">
<table class="tbType1">
<colgroup>
<col style="width: 40%">
<col style="width: 20%">
<col style="width: 40%">
</colgroup>
<thead>
<tr>
<th>url</th>
<th>mid</th>
<th>결과</th>
</tr>
</thead>
<tbody>
<tr>
<td>
${url}
</td>
<td>
${mid}
</td>
<td>
${result}
</td>
</tr>
</tbody>
</table>
</div>
<div class="btnWrap">
</div>
</div>
</div>
</body>
</html>