From d7845ca4a0f9e92a65d1681eae9172689be6713d Mon Sep 17 00:00:00 2001 From: ijunho Date: Tue, 29 Jul 2025 11:28:15 +0900 Subject: [PATCH] =?UTF-8?q?NICE=ED=8E=98=EC=9D=B4=EB=A8=BC=EC=B8=A0=20?= =?UTF-8?q?=EB=8F=84=EB=A9=94=EC=9D=B8=20=EC=9D=B8=EC=A6=9D=EC=84=9C=20G2?= =?UTF-8?q?=20=ED=86=B5=EC=8B=A0=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../itn/let/mjo/test/web/TestController.java | 36 ++++++++++++ .../jsp/uss/ion/test/TestNicePaySSL.jsp | 57 +++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 src/main/webapp/WEB-INF/jsp/uss/ion/test/TestNicePaySSL.jsp 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