diff --git a/src/main/java/itn/let/mjo/test/web/TestController.java b/src/main/java/itn/let/mjo/test/web/TestController.java index f052cccc..21909ae6 100644 --- a/src/main/java/itn/let/mjo/test/web/TestController.java +++ b/src/main/java/itn/let/mjo/test/web/TestController.java @@ -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; @@ -3501,5 +3502,40 @@ 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 params = new LinkedMultiValueMap<>(); + params.add("MID", mid); + + HttpEntity> request = new HttpEntity<>(params, headers); + + // POST 요청 + ResponseEntity 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로 이동 + } + } diff --git a/src/main/webapp/WEB-INF/jsp/uss/ion/test/TestNicePaySSL.jsp b/src/main/webapp/WEB-INF/jsp/uss/ion/test/TestNicePaySSL.jsp new file mode 100644 index 00000000..f5533101 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/uss/ion/test/TestNicePaySSL.jsp @@ -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"%> + + + + +세금계산서 관리 + + + +
+
+
+

Nicepay SSL 호출 결과

+

Nicepay SSL 호출 결과

+
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
urlmid결과
+ ${url} + + ${mid} + + ${result} +
+
+
+
+
+
+ + + \ No newline at end of file