결제하기 화면 다음 결제시 결제수단 UPDATE 기능추가

This commit is contained in:
itn 2023-08-14 11:49:40 +09:00
parent 4932b8adfe
commit 4e0024044f
7 changed files with 253 additions and 8 deletions

View File

@ -192,6 +192,82 @@ public class MjonPayV2Controller {
return "/web/pay/PayViewV2"; return "/web/pay/PayViewV2";
} }
/**
* 다음 결제시 결제수단 SELECT
* @throws Exception
*/
@RequestMapping(value = "/web/member/pay/selectNextPayMethodAjax.do")
public ModelAndView selectNextPayMethodAjax(MjonPayVO mjonPayVO,
HttpServletRequest request ) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
boolean isSuccess = true;
String msg = "";
String nextPayMethod = "";
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if(userId == null) {
isSuccess = false;
msg = "로그인이 필요합니다.";
}
try {
// 다음 결제시 결제수단 SELECT
nextPayMethod = userManageService.selectNextPayMethod(userId);
}
catch(Exception e) {
isSuccess = false;
msg = e.getMessage();
}
modelAndView.addObject("isSuccess", isSuccess);
modelAndView.addObject("msg", msg);
modelAndView.addObject("nextPayMethod", nextPayMethod);
return modelAndView;
}
/**
* 다음 결제시 결제수단 UPDATE
* @throws Exception
*/
@RequestMapping(value = "/web/member/pay/updateNextPayMethodAjax.do")
public ModelAndView updateNextPayMethodAjax(UserManageVO userManageVO,
HttpServletRequest request ) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
boolean isSuccess = true;
String msg = "";
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if(userId == null) {
isSuccess = false;
msg = "로그인이 필요합니다.";
}
try {
// 다음 결제시 결제수단 SELECT
userManageVO.setMberId(userId);
userManageService.updateNextPayMethod(userManageVO);
}
catch(Exception e) {
isSuccess = false;
msg = e.getMessage();
}
modelAndView.addObject("isSuccess", isSuccess);
modelAndView.addObject("msg", msg);
return modelAndView;
}
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
// //

View File

@ -159,6 +159,12 @@ public interface EgovUserManageService {
void updateCrtfcDnValue(UserManageVO userManageVO) throws Exception; void updateCrtfcDnValue(UserManageVO userManageVO) throws Exception;
// 다음 결제시 결제수단 SELECT
public String selectNextPayMethod(String mberId) throws Exception;
// 다음 결제시 결제수단 UPDATE
void updateNextPayMethod(UserManageVO userManageVO) throws Exception;
public int selectAdminDiChk(UserManageVO userManageVO); public int selectAdminDiChk(UserManageVO userManageVO);
public boolean selectUserStatusInfo(String userId) throws Exception; public boolean selectUserStatusInfo(String userId) throws Exception;

View File

@ -206,7 +206,14 @@ public class UserManageVO extends UserDefaultVO{
private String recommendId; // 추천아이디 private String recommendId; // 추천아이디
private String atSmishingYn; // 알림톡 스미싱 의심여부 private String atSmishingYn; // 알림톡 스미싱 의심여부
private String spamYn; private String spamYn;
private String nextPayMethod;
public String getNextPayMethod() {
return nextPayMethod;
}
public void setNextPayMethod(String nextPayMethod) {
this.nextPayMethod = nextPayMethod;
}
public String getSpamYn() { public String getSpamYn() {
return spamYn; return spamYn;
} }

View File

@ -439,6 +439,18 @@ public class EgovUserManageServiceImpl extends EgovAbstractServiceImpl implement
userManageDAO.updateCrtfcDnValue(userManageVO); userManageDAO.updateCrtfcDnValue(userManageVO);
} }
// 다음 결제시 결제수단 SELECT
@Override
public String selectNextPayMethod(String mberId) throws Exception{
return userManageDAO.selectNextPayMethod(mberId);
}
// 다음 결제시 결제수단 UPDATE
@Override
public void updateNextPayMethod(UserManageVO userManageVO) throws Exception{
userManageDAO.updateNextPayMethod(userManageVO);
}
@Override @Override
public int selectAdminDiChk(UserManageVO userManageVO) { public int selectAdminDiChk(UserManageVO userManageVO) {
return userManageDAO.selectAdminDiChk(userManageVO); return userManageDAO.selectAdminDiChk(userManageVO);

View File

@ -228,6 +228,16 @@ public class UserManageDAO extends EgovAbstractDAO{
update("userManageDAO.updateCrtfcDnValue",userManageVO); update("userManageDAO.updateCrtfcDnValue",userManageVO);
} }
// 다음 결제시 결제수단 SELECT
public String selectNextPayMethod(String mberId) throws Exception{
return (String) select("userManageDAO.selectNextPayMethod", mberId);
}
// 다음 결제시 결제수단 UPDATE
public void updateNextPayMethod(UserManageVO userManageVO){
update("userManageDAO.updateNextPayMethod",userManageVO);
}
/** /**
* Admin DI Chk * Admin DI Chk
* @param userManageVO 본인 인증 :: KMS DI -> CRTFC_DN_VALUE * @param userManageVO 본인 인증 :: KMS DI -> CRTFC_DN_VALUE

View File

@ -412,6 +412,21 @@
</update> </update>
<!-- 다음 결제시 결제수단 SELECT -->
<select id="userManageDAO.selectNextPayMethod" parameterClass="String" resultClass="String">
SELECT
IFNULL(NEXT_PAY_METHOD, '') AS nextPayMethod
FROM LETTNGNRLMBER
WHERE MBER_ID = #mberId#
</select>
<!-- 다음 결제시 결제수단 UPDATE -->
<update id="userManageDAO.updateNextPayMethod">
UPDATE LETTNGNRLMBER
SET NEXT_PAY_METHOD = #nextPayMethod#
WHERE MBER_ID = #mberId#
</update>
<select id="userManageDAO.selectAdminDiChk" resultClass="int"> <select id="userManageDAO.selectAdminDiChk" resultClass="int">
SELECT SELECT
count(*) count(*)

View File

@ -28,11 +28,124 @@ $(document).ready(function(){
if (tabType == "2") { if (tabType == "2") {
$("#btnDdedicatedAccount").trigger("click"); $("#btnDdedicatedAccount").trigger("click");
} }
//다음 결제시 결제수단 SELECT
getNextPayMethod();
// 등급제 대상 여부 // 등급제 대상 여부
getMberGrdChk(); getMberGrdChk();
}); });
//다음 결제시 결제수단 SELECT
function getNextPayMethod() {
var nextPayMethod = "";
$.ajax({
type: "POST",
url: "/web/member/pay/selectNextPayMethodAjax.do",
data: {},
dataType:'json',
async: false,
success: function (data) {
if (data.isSuccess) {
if (data.nextPayMethod != '') {
nextPayMethod = data.nextPayMethod;
// 버튼 영역
$(".btn_tab").removeClass("active");
// 금액 영역
$(".area_tabcont").removeClass("on");
if (nextPayMethod == "CARD") {
$(".btn_charge1").addClass("active");
$("#tab2_1").addClass("area_tabcont on");
}
else if (nextPayMethod == "VBANK") {
$(".btn_charge2").addClass("active");
$("#tab2_2").addClass("area_tabcont on");
}
else if (nextPayMethod == "CELLPHONE") {
$(".btn_charge3").addClass("active");
$("#tab2_3").addClass("area_tabcont on");
}
else if (nextPayMethod == "BANK") {
$(".btn_charge4").addClass("active");
$("#tab2_4").addClass("area_tabcont on");
}
else if (nextPayMethod == "NAV") {
$(".btn_charge5").addClass("active");
$("#tab2_5").addClass("area_tabcont on");
}
else if (nextPayMethod == "KKO") {
$(".btn_charge6").addClass("active");
$("#tab2_6").addClass("area_tabcont on");
}
else if (nextPayMethod == "TOS") {
$(".btn_charge7").addClass("active");
$("#tab2_7").addClass("area_tabcont on");
}
else if (nextPayMethod == "PYC") {
$(".btn_charge8").addClass("active");
$("#tab2_8").addClass("area_tabcont on");
}
// 체크박스
$("input:checkbox[id='agree']").prop("checked", true);
}
}
},
error: function (e) {
}
});
}
// 다음 결제시 결제수단 UPDATE
function setNextPayMethod() {
var nextPayMethod = "";
if ($("input:checkbox[id='agree']").is(":checked") == true) {
var $currentTab = $('.area_tab').children('.active').index();
if ($currentTab == 0) {
nextPayMethod = "CARD";
} else if ($currentTab == 1) {
nextPayMethod = "VBANK";
} else if ($currentTab==2) {
nextPayMethod = "CELLPHONE";
} else if ($currentTab==3) {
nextPayMethod = "BANK";
} else {
if ($currentTab == 4) {
nextPayMethod = "NAV"; // 네이버페이
} else if ($currentTab==5) {
nextPayMethod = "KKO"; // 카카오페이
} else if ($currentTab==6) {
nextPayMethod = "TOS"; // 토스페이
} else if ($currentTab==7) {
nextPayMethod = "PYC"; // 페이코
}
}
}
else {
nextPayMethod = "";
}
// 업데이트
$.ajax({
type: "POST",
url: "/web/member/pay/updateNextPayMethodAjax.do",
data: {"nextPayMethod" : nextPayMethod},
dataType:'json',
async: false,
success: function (data) {
if (data.isSuccess) {
}
},
error: function (e) {
}
});
}
//결제수단 상태 체크 //결제수단 상태 체크
function checkPayTypeStatusAjax(payMethod) { function checkPayTypeStatusAjax(payMethod) {
@ -120,6 +233,9 @@ function pgOpenerPopup(){
alert("충전금액을 선택해주세요."); alert("충전금액을 선택해주세요.");
return false; return false;
} }
// 다음 결제시 결제수단 UPDATE
setNextPayMethod();
var payMethod = ""; var payMethod = "";
document.pgForm.action = "/web/member/pay/PayActionAjax.do"; document.pgForm.action = "/web/member/pay/PayActionAjax.do";
@ -414,6 +530,9 @@ function fnNewBankAccount(){
} }
// 다음 결제시 결제수단 UPDATE
setNextPayMethod();
var data = new FormData(document.pgForm); var data = new FormData(document.pgForm);
url = "/web/member/pay/updateVacsAccountUsrIdAjax.do"; url = "/web/member/pay/updateVacsAccountUsrIdAjax.do";
@ -693,10 +812,10 @@ function getMberGrdChk() {
<li class="btn_charge3 btn_tab"><button type="button" onclick="TabTypePay(this,'3');"><i></i>휴대폰결제</button></li> <li class="btn_charge3 btn_tab"><button type="button" onclick="TabTypePay(this,'3');"><i></i>휴대폰결제</button></li>
<li class="btn_charge4 btn_tab"><button type="button" onclick="TabTypePay(this,'4');"><i></i>즉시이체</button></li> <li class="btn_charge4 btn_tab"><button type="button" onclick="TabTypePay(this,'4');"><i></i>즉시이체</button></li>
<li class="btn_charge5 btn_tab simple_pay"><button type="button" onclick="TabTypePay(this,'6');"><i></i></button></li> <li class="btn_charge5 btn_tab simple_pay"><button type="button" onclick="TabTypePay(this,'5');"><i></i></button></li>
<li class="btn_charge6 btn_tab simple_pay"><button type="button" onclick="TabTypePay(this,'7');"><i></i></button></li> <li class="btn_charge6 btn_tab simple_pay"><button type="button" onclick="TabTypePay(this,'6');"><i></i></button></li>
<li class="btn_charge7 btn_tab simple_pay"><button type="button" onclick="TabTypePay(this,'8');"><i></i></button></li> <li class="btn_charge7 btn_tab simple_pay"><button type="button" onclick="TabTypePay(this,'7');"><i></i></button></li>
<li class="btn_charge8 btn_tab simple_pay"><button type="button" onclick="TabTypePay(this,'9');"><i></i></button></li> <li class="btn_charge8 btn_tab simple_pay"><button type="button" onclick="TabTypePay(this,'8');"><i></i></button></li>
</ul> </ul>
<div class="checkbox_wrap"><input type="checkbox" id="agree"><label for="agree">선택한 수단을 다음 충전 시에도 이용합니다.</label></div> <div class="checkbox_wrap"><input type="checkbox" id="agree"><label for="agree">선택한 수단을 다음 충전 시에도 이용합니다.</label></div>
@ -1013,7 +1132,7 @@ function getMberGrdChk() {
<!-- //즉시이체 --> <!-- //즉시이체 -->
<!-- 네이버페이 --> <!-- 네이버페이 -->
<div class="area_tabcont" id="tab2_6"> <div class="area_tabcont" id="tab2_5">
<p class="tType1_title"><img src="/publish/images/simple_small.png" alt="간편결제"> 네이버페이</p> <p class="tType1_title"><img src="/publish/images/simple_small.png" alt="간편결제"> 네이버페이</p>
<table class="tType1"> <table class="tType1">
<colgroup> <colgroup>
@ -1082,7 +1201,7 @@ function getMberGrdChk() {
<!-- //네이버페이 --> <!-- //네이버페이 -->
<!-- 카카오페이 --> <!-- 카카오페이 -->
<div class="area_tabcont current" id="tab2_7"> <div class="area_tabcont current" id="tab2_6">
<!-- 신규계좌발급 시 --> <!-- 신규계좌발급 시 -->
<p class="tType1_title"><img src="/publish/images/simple_small.png" alt="간편결제"> 카카오페이</p> <p class="tType1_title"><img src="/publish/images/simple_small.png" alt="간편결제"> 카카오페이</p>
<table class="tType1"> <table class="tType1">
@ -1151,7 +1270,7 @@ function getMberGrdChk() {
<!-- //카카오페이 --> <!-- //카카오페이 -->
<!-- 토스페이 --> <!-- 토스페이 -->
<div class="area_tabcont current" id="tab2_8"> <div class="area_tabcont current" id="tab2_7">
<p class="tType1_title"><img src="/publish/images/simple_small.png" alt="간편결제"> 토스페이</p> <p class="tType1_title"><img src="/publish/images/simple_small.png" alt="간편결제"> 토스페이</p>
<table class="tType1"> <table class="tType1">
<caption></caption> <caption></caption>
@ -1210,7 +1329,7 @@ function getMberGrdChk() {
<!-- //토스페이 --> <!-- //토스페이 -->
<!-- 페이코 --> <!-- 페이코 -->
<div class="area_tabcont current" id="tab2_9"> <div class="area_tabcont current" id="tab2_8">
<p class="tType1_title"><img src="/publish/images/simple_small.png" alt="간편결제"> PAYCO</p> <p class="tType1_title"><img src="/publish/images/simple_small.png" alt="간편결제"> PAYCO</p>
<table class="tType1"> <table class="tType1">
<caption></caption> <caption></caption>