From 0c2be2d1d226e1a784ef7f5d909b3f65bfe598ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B2=BD=EC=88=99?= Date: Mon, 30 Mar 2026 18:35:06 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=B0=EC=A0=9C=20-=20=ED=82=A4=EC=9B=80?= =?UTF-8?q?=EA=B2=B0=EC=A0=9C=20=EC=A0=81=EC=9A=A9=202=EC=B0=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ordr/ordr/service/BOOrdrService.java | 673 ++++++------------ .../ordr/controller/OrdrController.java | 165 ++++- .../WEB-INF/views/sopmal/ordr/MbrPurchsC.jsp | 240 ++++++- .../views/sopmal/ordr/OrdrReqstKiwoomPayR.jsp | 85 +-- 4 files changed, 620 insertions(+), 543 deletions(-) diff --git a/src/main/java/com/wb/domainserver/domain/gcone/ordr/ordr/service/BOOrdrService.java b/src/main/java/com/wb/domainserver/domain/gcone/ordr/ordr/service/BOOrdrService.java index 03da28b9..2dd59e22 100644 --- a/src/main/java/com/wb/domainserver/domain/gcone/ordr/ordr/service/BOOrdrService.java +++ b/src/main/java/com/wb/domainserver/domain/gcone/ordr/ordr/service/BOOrdrService.java @@ -120,18 +120,12 @@ public class BOOrdrService{ @Autowired private BOSiteService boSiteService; - @Autowired - private BOGoodsService boGoodsService; - @Autowired private BOMssageService mssageService; @Autowired private BOMbrMapper mbrMapper; - @Autowired - private BOMaMtngMapper mtmgMapper; - @Autowired private BOSelngprufService selngprufService; @@ -150,13 +144,10 @@ public class BOOrdrService{ @Autowired private BOSubsvcService subsvcService; - @Autowired - private PropertyService propertyService; - /** * 주문 전체 목록 조회 - * @param vo(mbrInnb) + * @param ordrSrchVO * @return List */ public Map> selectBOAllOrdrListInqire(BOOrdrSrchVO ordrSrchVO) { @@ -169,7 +160,6 @@ public class BOOrdrService{ && ordrSrchVO.getSrchOrdrSttusCds().length > 0) { for(String srchOrdrSttusCd : ordrSrchVO.getSrchOrdrSttusCds()){ ordrSrchVO.setSrchOrdrSttusCd(srchOrdrSttusCd); - //resultMap.put("resultList"+ordrSrchVO.getSrchOrdrSttusCd(),mapper.selectBOAllOrdrListInqire(ordrSrchVO)); } } log.debug("resultMap : {}", resultMap); @@ -178,7 +168,7 @@ public class BOOrdrService{ /** * 기본배송지 유무 조회 - * @param crmDlvylcVO + * @param map * @return Map */ public String selectBOdftDlvylcAt(DataMap map){ @@ -197,12 +187,7 @@ public class BOOrdrService{ try { // 기존 기본배송지 N 처리 mapper.updateBODftDlvylcAt(crmDlvylcVO); - // 기본배송지 수정 - /*int result = mapper.updateBOdftDlvylcAtUpdt(crmDlvylcVO); - // 배송지 등록 결과 massage에 담음 - if (result > 0) { - message.put("result", "자주쓰는 배송지 등록 성공"); - }*/ + } catch (WnbtRestException wre){ throw new WnbtRestException(wre.getMessage()); } catch (Exception e){ @@ -213,7 +198,7 @@ public class BOOrdrService{ /** * 기본 배송지 설정 - * @param BOCrmDlvylcVO + * @param crmDlvylcVO */ public Map updateBODftDlvylcAtYset(BOCrmDlvylcVO crmDlvylcVO){ Map message = new HashMap<>(); @@ -248,7 +233,7 @@ public class BOOrdrService{ /** * 최근 배송지 목록 조회 - * @param BOCrmDlvylcVO + * @param crmDlvylcVO * @return List */ public List selectBORecentDlvylcListInqire(BOCrmDlvylcVO crmDlvylcVO) { @@ -266,7 +251,7 @@ public class BOOrdrService{ /** * 회원 자주쓰는 배송지 상세 조회 - * @param vo(adbkInnb) + * @param crmDlvylcVO * @return BOCrmDlvylcVO */ public BOCrmDlvylcVO selectBODlvylcUpdtPopupForm(BOCrmDlvylcVO crmDlvylcVO) { @@ -283,7 +268,7 @@ public class BOOrdrService{ /** * 자주쓰는 배송지 등록 - * @param BOCrmDlvylcVO + * @param crmDlvylcVO * @return Integer */ public Map insertBODlvylcRegist(BOCrmDlvylcVO crmDlvylcVO) { @@ -302,7 +287,7 @@ public class BOOrdrService{ /** * 자주쓰는 배송지 삭제 - * @param BOCrmDlvylcVO + * @param crmDlvylcVO * @return Map */ public Map deleteBODlvylc(BOCrmDlvylcVO crmDlvylcVO) { @@ -320,7 +305,7 @@ public class BOOrdrService{ } /** * 자주쓰는 배송지 수정 - * @param BOCrmDlvylcVO + * @param crmDlvylcVO * @return Map */ public Map updateBODlvylc(BOCrmDlvylcVO crmDlvylcVO) { @@ -338,7 +323,7 @@ public class BOOrdrService{ } /** * 기본 배송지 체크 시 다른 배송지 N으로 수정 - * @param BOCrmDlvylcVO + * @param crmDlvylc */ public void updateBODftDlvylcAt(BOCrmDlvylcVO crmDlvylc) { mapper.updateBODftDlvylcAt(crmDlvylc); @@ -569,33 +554,6 @@ public class BOOrdrService{ // 주문 상태 업데이트 orderCommService.commonOrderSttusCdUpdt(orderVO, currOrdrSttusCd); -// try { -// orderCommService.commonOrderSttusCdUpdt(orderVO, currOrdrSttusCd); -// } catch(Exception e) { -// -// } - -// purchsMapper.updateOrdrSttusCdByFmOrder(orderVO); // FM_ORDER 주문 상태 수정 -// -// purchsMapper.updateOrdrSttusCdByFmOrderItemOption(orderVO); // FM_ORDER_ITEM_OPTION 주문 상태 수정 -// -// purchsMapper.updateOrdrSttusCdByFmOrderShipping(orderVO); // FM_ORDER_SHIPPING 주문 상태 수정 - - -// if (StringUtils.hasText(currOrdrSttusCd) && StringUtils.hasText(ordrSttusCd)) { -// if (Integer.parseInt(currOrdrSttusCd) > Integer.parseInt(ordrSttusCd) || "95".equals(ordrSttusCd)) { -//// BOOrderLogVO logVO = new BOOrderLogVO(); -// -// logVO.setOrdrInnb(new BigInteger(ordrInnb)); -// logVO.setSopmalCd(ordrVO.getSopmalCd()); -// logVO.setLogDvCd("01"); -// logVO.setDvCd("02"); -// logVO.setLogSj("되돌리기 [" + currOrdrSttusCdNm + " => " + ordrSttusCdNm + "]"); -// -// purchsMapper.insertOrderLog(logVO); -// } -// } - if ("25".equals(ordrSttusCd)) { purchsMapper.updateOrderSetleComptAt(orderVO); } @@ -858,22 +816,6 @@ public class BOOrdrService{ * @return DataMap */ public Map selectBOSetleCanclRefndRegist(BOOrdrVO ordrVO) { - /* - DataMap ordrDtl = mapper.selectOrdrDtl(ordrVO); - - List ordrGoodsList = mapper.selectCanclPaymentGoodsList(ordrVO); - - int totOrdrQy = ordrGoodsList.stream().mapToInt(obj -> (int) obj.get("ordrQy")).sum(); - - DataMap content = new DataMap() {{ - put("ordrDtl", ordrDtl); - put("ordrGoodsList", ordrGoodsList); - put("totOrdrQy", totOrdrQy); - }}; - return content; - */ - - Map content = new HashMap<>(); BOOrdrDlvyVO ordrDlvyVO = new BOOrdrDlvyVO(); @@ -905,7 +847,7 @@ public class BOOrdrService{ log.debug("여러곳 배송 환불 상품 목록 : {}", shippingList); - List returnResnList = mapper.selectReturnResnList(ordrDlvyVO); + //List returnResnList = mapper.selectReturnResnList(ordrDlvyVO); // 공통코드 호출 BOMaComncdVO bOMaComncdVO = new BOMaComncdVO(); @@ -1031,7 +973,7 @@ public class BOOrdrService{ /** * 관리자 > 주문 > 주문 로그 등록 - * @param BOOrderLogVO + * @param logVO * @return void */ public void updateDlvylcInfoLogRegist(BOOrderLogVO logVO) { @@ -2839,8 +2781,6 @@ public class BOOrdrService{ spbkVO.setMbrId(ordrVO.getMbrId()); - - //구매하기 상품 조회 spbkVO.setCartDvCd("02"); List goodsList02 = mapper.selectSpbkGoodsList(spbkVO); @@ -3430,10 +3370,6 @@ public class BOOrdrService{ LinkedHashMap shippingMap = (LinkedHashMap) param.get("shipping"); -// String ordrAdressZip = StringUtil.isNullToString(param.get("dlvylcZip")); -// String dlvylcAreaCd = (String) param.get("dlvylcAreaCd"); -// String prefcd = (String) param.get("prefcd"); - String ordrAdressZip = StringUtil.isNullToString(shippingMap != null ? shippingMap.get("dlvylcZip") : ""); String dlvylcAreaCd = StringUtil.isNullToString(shippingMap != null ? shippingMap.get("dlvylcAreaCd") : ""); String prefcd = StringUtil.isNullToString(shippingMap != null ? shippingMap.get("prefcd") : ""); @@ -3867,6 +3803,11 @@ public class BOOrdrService{ return orderService.insertMngrOrdrRegist(param, MemberJwtContextHolder.getMemberInfo()); } + + /* =============================================== + 무통장 결제 정보 등록 + ================================================== */ + /** * 사용자 > 상품 > 구매/결제 > 회원구매하기 > 무통장 결제 정보 등록 * @param payVO @@ -3936,55 +3877,6 @@ public class BOOrdrService{ purchsMapper.updateOrderSetleNoBank(orderSetleVO); -// purchsMapper.updateOrdrSttusCdByFmOrder(orderVO); // FM_ORDER 주문 상태 수정 -// -// purchsMapper.updateOrdrSttusCdByFmOrderItemOption(orderVO); // FM_ORDER_ITEM_OPTION 주문 상태 수정 -// -// purchsMapper.updateOrdrSttusCdByFmOrderShipping(orderVO); // FM_ORDER_SHIPPING 주문 상태 수정 -// -// -// // 2. 쿠폰 사용 처리 =============================================================== -// try { -// BODwldCouponVO dwldCouponVO = new BODwldCouponVO(); -// dwldCouponVO.setSopmalCd(payVO.getSopmalCd()); -// dwldCouponVO.setOrdrInnb(payVO.getOrderId()); -// couponService.updateBOUseCouponProcs(dwldCouponVO); -// } catch (Exception e) { -// log.debug("사용 쿠폰 처리 실패", e.getMessage()); -// throw new WnbtRestException("쿠폰 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// -// // 3.사용 마일리지 조회 및 할인 차감 ================================================= -// BOMlgVO mlgVO = purchsMapper.selectOrdrMlgUse(orderVO); -// if (mlgVO != null) { -// BigDecimal accmlmnyAmt = mlgVO.getAccmlmnyAmt(); -// -// if (0 < accmlmnyAmt.intValue()) { -// try { -// mlgService.insertBOMlgUse(mlgVO); -// } catch (Exception e) { -// log.debug("사용 마일리지 처리 실패", e.getMessage()); -// throw new WnbtRestException("마일리지 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// } -// } -// -// // 4. (2025-06-20 CJH 추가) 사용 GC 머니 차감 ================================================= -// BOCashVO cashVO = purchsMapper.selectOrdrCashMlgUse(payVO); -// log.debug("캐쉬 VO : {}", cashVO); -// if (cashVO != null) { -// BigDecimal accmlmnyAmt = cashVO.getAccmlmnyAmt(); -// -// if (0 < accmlmnyAmt.intValue()) { -// try { -// mlgService.insertBOCashUse(cashVO); // 사용 마일리지 할인 차감 -// } catch (Exception e) { -// log.debug("사용 충전형 마일리지 처리 실패", e.getMessage()); -// throw new WnbtRestException("GC 머니 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// } -// } - try { selectBOOrdrMssageSndngProcs(orderVO); } catch (Exception e) { @@ -4008,6 +3900,11 @@ public class BOOrdrService{ return content; } + + /* =============================================== + KCP 결제 정보 등록 + ================================================== */ + /** * 사용자 > 상품 > 구매/결제 > 회원구매하기 > KCP 거래등록 정보 조회 * @param param @@ -4071,63 +3968,15 @@ public class BOOrdrService{ orderVO.setOrdrSttusCd("25"); // 주문상태코드(25:결제확인) } -// // 1-1. FM_ORDER 주문 상태 수정 ================================================== -// purchsMapper.updateOrdrSttusCdByFmOrder(orderVO); -// // 1-2. FM_ORDER_ITEM_OPTION 주문 상태 수정 ===================================== -// purchsMapper.updateOrdrSttusCdByFmOrderItemOption(orderVO); -// // 1-3. FM_ORDER_SHIPPING 주문 상태 수정 ======================================== -// purchsMapper.updateOrdrSttusCdByFmOrderShipping(orderVO); } // 주문 공통 전처리 ( 상태체크, 상태변경, 마일리지, 쿠폰, GC머니 ) orderCommService.commonOrderPreProcess(payVO, orderVO); -// // 2. 쿠폰 사용 처리 =============================================================== -// try { -// BODwldCouponVO dwldCouponVO = new BODwldCouponVO(); -// dwldCouponVO.setSopmalCd(payVO.getSopmalCd()); -// dwldCouponVO.setOrdrInnb(payVO.getOrderId()); -// couponService.updateBOUseCouponProcs(dwldCouponVO); -// } catch (Exception e) { -// log.debug("사용 쿠폰 처리 실패", e.getMessage()); -// throw new WnbtRestException("쿠폰 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// -// // 3.사용 마일리지 조회 및 할인 차감 ================================================= -// BOMlgVO mlgVO = purchsMapper.selectOrdrMlgUse(orderVO); -// if (mlgVO != null) { -// BigDecimal accmlmnyAmt = mlgVO.getAccmlmnyAmt(); -// -// if (0 < accmlmnyAmt.intValue()) { -// try { -// mlgService.insertBOMlgUse(mlgVO); -// } catch (Exception e) { -// log.debug("사용 마일리지 처리 실패", e.getMessage()); -// throw new WnbtRestException("마일리지 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// } -// } -// -// // 4. (2025-06-20 CJH 추가) 사용 GC 머니 차감 ================================================= -// BOCashVO cashVO = purchsMapper.selectOrdrCashMlgUse(payVO); -// log.debug("캐쉬 VO : {}", cashVO); -// if (cashVO != null) { -// BigDecimal accmlmnyAmt = cashVO.getAccmlmnyAmt(); -// -// if (0 < accmlmnyAmt.intValue()) { -// try { -// mlgService.insertBOCashUse(cashVO); // 사용 마일리지 할인 차감 -// } catch (Exception e) { -// log.debug("사용 충전형 마일리지 처리 실패", e.getMessage()); -// throw new WnbtRestException("GC 머니 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// } -// } - - + /* =============================================== + 결제 API + ================================================== */ Map kcpMap = payService.insertKcpPay(payVO); - - if (!CollectionUtils.isEmpty(kcpMap)) { String response = StringUtil.isNullToString(kcpMap.get("response")); Map resultMap = new ObjectMapper().readValue(response, Map.class); @@ -4148,23 +3997,6 @@ public class BOOrdrService{ orderPgLogVO.setEscwAt(resultMap.get("escw_yn") != null ? resultMap.get("escw_yn").toString() : "N"); orderPgLogVO.setDelngAmt(resultMap.get("amount") != null ? new BigDecimal(resultMap.get("amount").toString()) : BigDecimal.valueOf(0)); - // 금액 검증 - PG사 결제 승인전 하고 있음 - /*BOOrdrVO paramVO = new BOOrdrVO(); - paramVO.setSopmalCd(payVO.getSopMalCd()); - paramVO.setOrdrInnb(payVO.getOrderId()); - DataMap ordrMap = mapper.selectOrdrGoodsDtllTot(paramVO); - if (!CollectionUtils.isEmpty(resultMap)) { - BigDecimal setleAmt = (BigDecimal) ordrMap.get("setleAmt"); - BigDecimal amount = new BigDecimal((String) resultMap.get("amount")); - - if (setleAmt.intValue() == amount.intValue()) { - orderPgLogVO.setDelngAmt(amount); - } else { - insertSetleFailLog(payVO.getSopMalCd(), payVO.getOrderId(), "000", "KCP 결제 실패 [결제 금액 매칭 오류]"); // 결제 실패 로그 등록 - throw new WnbtRestException("KCP 결제 실패 [결제 금액 매칭 오류]"); - } - }*/ - log.debug("orderPgLogVO1===={}",orderPgLogVO); if ("01".equals(payVO.getSetleTyCd()) || "10".equals(payVO.getSetleTyCd())) { //카드/간편결제카드(01), 페이코(10) @@ -4410,6 +4242,10 @@ public class BOOrdrService{ // } + /* =============================================== + TOSS 결제 정보 등록 + ================================================== */ + /** * 사용자 > 상품 > 구매/결제 > 회원구매하기 > TOSS 결제 정보 등록 * @param payVO @@ -4465,60 +4301,10 @@ public class BOOrdrService{ // 주문 공통 전처리 ( 상태체크, 상태변경, 마일리지, 쿠폰, GC머니 ) orderCommService.commonOrderPreProcess(payVO, orderVO); -// // 1-1. FM_ORDER 주문 상태 수정 ============================================== -// purchsMapper.updateOrdrSttusCdByFmOrder(orderVO); -// // 1-2. FM_ORDER_ITEM_OPTION 주문 상태 수정 ===================================== -// purchsMapper.updateOrdrSttusCdByFmOrderItemOption(orderVO); -// // 1-3. FM_ORDER_SHIPPING 주문 상태 수정 ======================================== -// purchsMapper.updateOrdrSttusCdByFmOrderShipping(orderVO); -// -// -// // 2. 쿠폰 사용 처리 =============================================================== -// try { -// BODwldCouponVO dwldCouponVO = new BODwldCouponVO(); -// dwldCouponVO.setSopmalCd(payVO.getSopmalCd()); -// dwldCouponVO.setOrdrInnb(payVO.getOrderId()); -// couponService.updateBOUseCouponProcs(dwldCouponVO); -// } catch (Exception e) { -// log.debug("사용 쿠폰 처리 실패", e.getMessage()); -// throw new WnbtRestException("쿠폰 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// -// // 3.사용 마일리지 조회 및 할인 차감 ================================================= -// BOMlgVO mlgVO = purchsMapper.selectOrdrMlgUse(orderVO); -// if (mlgVO != null) { -// BigDecimal accmlmnyAmt = mlgVO.getAccmlmnyAmt(); -// -// if (0 < accmlmnyAmt.intValue()) { -// try { -// mlgService.insertBOMlgUse(mlgVO); -// } catch (Exception e) { -// log.debug("사용 마일리지 처리 실패", e.getMessage()); -// throw new WnbtRestException("마일리지 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// } -// } -// -// // 4. (2025-06-20 CJH 추가) 사용 GC 머니 차감 ================================================= -// BOCashVO cashVO = purchsMapper.selectOrdrCashMlgUse(payVO); -// log.debug("캐쉬 VO : {}", cashVO); -// if (cashVO != null) { -// BigDecimal accmlmnyAmt = cashVO.getAccmlmnyAmt(); -// -// if (0 < accmlmnyAmt.intValue()) { -// try { -// mlgService.insertBOCashUse(cashVO); // 사용 마일리지 할인 차감 -// } catch (Exception e) { -// log.debug("사용 충전형 마일리지 처리 실패", e.getMessage()); -// throw new WnbtRestException("GC 머니 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// } -// } - - + /* =============================================== + 결제 API + ================================================== */ Map tossPayMap = payService.insertTossPay(payVO); - - if (!CollectionUtils.isEmpty(tossPayMap)) { String response = StringUtil.isNullToString(tossPayMap.get("response")); Map resultMap = new ObjectMapper().readValue(response, Map.class); @@ -4556,24 +4342,6 @@ public class BOOrdrService{ orderPgLogVO.setVirtlAcntVrifyKy(StringUtil.isNullToString(rctMap.get("url"))); } - // 금액 검증 - PG사 결제 승인전 하고 있음 - /*BOOrdrVO ordrVO = new BOOrdrVO(); - ordrVO.setSopmalCd(payVO.getSopmalCd()); - ordrVO.setOrdrInnb(payVO.getOrderId()); - DataMap ordrMap = mapper.selectOrdrGoodsDtllTot(ordrVO); - if (!CollectionUtils.isEmpty(resultMap)) { - BigDecimal setleAmt = (BigDecimal) ordrMap.get("setleAmt"); - BigDecimal totalAmount = BigDecimal.valueOf((int) resultMap.get("totalAmount")); - - if (setleAmt.intValue() == totalAmount.intValue()) { - orderPgLogVO.setDelngAmt(totalAmount); - } else { - insertSetleFailLog(payVO.getSopmalCd(), payVO.getOrderId(), "0000", "토스 결제 실패 [결제 금액 매칭 오류]"); // 결제 실패 로그 등록 - - throw new WnbtRestException("토스 결제 실패 [결제 금액 매칭 오류]"); - } - }*/ - if ("01".equals(payVO.getSetleTyCd()) || "10".equals(payVO.getSetleTyCd())) { // 카드(01), 페이코(10) LinkedHashMap cartMap = (LinkedHashMap) resultMap.get("card"); //카드결제(일반카드, 간편결제카드, 간편결제카드+적립식) @@ -4855,6 +4623,9 @@ public class BOOrdrService{ // } + /* =============================================== + TOSSPAY 결제 정보 등록 + ================================================== */ /** * 사용자 > 상품 > 구매/결제 > 회원구매하기 > TOSSPAY 결제 정보 등록 @@ -4871,17 +4642,6 @@ public class BOOrdrService{ } - /** - * 주문 후 장바구니 비우기 - * @param orderVO - */ - @Transactional(propagation = Propagation.REQUIRES_NEW) - public void deleteBOCart(BOOrderVO orderVO) throws Exception { - purchsMapper.deleteCart(orderVO); - } - - - /** * 사용자 > 상품 > 구매/결제 > 회원구매하기 > TOSSPAY 결제 정보 등록 * @param payVO @@ -4916,62 +4676,11 @@ public class BOOrdrService{ // 주문 공통 전처리 ( 상태체크, 상태변경, 마일리지, 쿠폰, GC머니 ) orderCommService.commonOrderPreProcess(payVO, orderVO); -// -// // 1-1. FM_ORDER 주문 상태 수정 ============================================== -// purchsMapper.updateOrdrSttusCdByFmOrder(orderVO); -// // 1-2. FM_ORDER_ITEM_OPTION 주문 상태 수정 ================================== -// purchsMapper.updateOrdrSttusCdByFmOrderItemOption(orderVO); -// // 1-3. FM_ORDER_SHIPPING 주문 상태 수정 ===================================== -// purchsMapper.updateOrdrSttusCdByFmOrderShipping(orderVO); -// -// // 2. 쿠폰 사용 처리 ========================================================== -// try { -// BODwldCouponVO dwldCouponVO = new BODwldCouponVO(); -// dwldCouponVO.setSopmalCd(payVO.getSopmalCd()); -// dwldCouponVO.setOrdrInnb(payVO.getOrderId()); -// couponService.updateBOUseCouponProcs(dwldCouponVO); -// } catch (Exception e) { -// log.debug("사용 쿠폰 처리 실패", e.getMessage()); -// throw new WnbtRestException("쿠폰 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// -// // 3.사용 마일리지 조회 및 할인 차감 ============================================= -// BOMlgVO mlgVO = purchsMapper.selectOrdrMlgUse(orderVO); -// if (mlgVO != null) { -// BigDecimal accmlmnyAmt = mlgVO.getAccmlmnyAmt(); -// -// if (0 < accmlmnyAmt.intValue()) { -// try { -// mlgService.insertBOMlgUse(mlgVO); // 사용 마일리지 할인 차감 -// } catch (Exception e) { -// log.debug("사용 마일리지 처리 실패", e.getMessage()); -// throw new WnbtRestException("마일리지 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// } -// } -// -// // 4. (2025-06-20 CJH 추가) 사용 GC 머니 차감 ================================================= -// BOCashVO cashVO = purchsMapper.selectOrdrCashMlgUse(payVO); -// log.debug("캐쉬 VO : {}", cashVO); -// if (cashVO != null) { -// BigDecimal accmlmnyAmt = cashVO.getAccmlmnyAmt(); -// -// if (0 < accmlmnyAmt.intValue()) { -// try { -// mlgService.insertBOCashUse(cashVO); // 사용 마일리지 할인 차감 -// } catch (Exception e) { -// log.debug("사용 충전형 마일리지 처리 실패", e.getMessage()); -// throw new WnbtRestException("GC 머니 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// } -// } /* =============================================== 5. 결제 API ================================================== */ Map tossPayMap = payService.insertTossPay(payVO); - - if (!CollectionUtils.isEmpty(tossPayMap)) { String response = StringUtil.isNullToString(tossPayMap.get("response")); Map resultMap = new ObjectMapper().readValue(response, Map.class); @@ -5210,6 +4919,10 @@ public class BOOrdrService{ // } + /* =============================================== + KCP 카드 수기 결제 정보 등록 + ================================================== */ + /** * 사용자 > 상품 > 구매/결제 > 회원구매하기 > KCP 카드 수기 결제 정보 등록 * @param payVO @@ -5260,59 +4973,10 @@ public class BOOrdrService{ // 주문 공통 전처리 ( 상태체크, 상태변경, 마일리지, 쿠폰, GC머니 ) orderCommService.commonOrderPreProcess(payVO, orderVO); -// // 1-1. FM_ORDER 주문 상태 수정 ============================================== -// purchsMapper.updateOrdrSttusCdByFmOrder(orderVO); -// // 1-2. FM_ORDER_ITEM_OPTION 주문 상태 수정 ===================================== -// purchsMapper.updateOrdrSttusCdByFmOrderItemOption(orderVO); -// // 1-3. FM_ORDER_SHIPPING 주문 상태 수정 ======================================== -// purchsMapper.updateOrdrSttusCdByFmOrderShipping(orderVO); -// -// -// // 2. 쿠폰 사용 처리 =============================================================== -// try { -// BODwldCouponVO dwldCouponVO = new BODwldCouponVO(); -// dwldCouponVO.setSopmalCd(payVO.getSopmalCd()); -// dwldCouponVO.setOrdrInnb(payVO.getOrderId()); -// couponService.updateBOUseCouponProcs(dwldCouponVO); -// } catch (Exception e) { -// log.debug("사용 쿠폰 처리 실패", e.getMessage()); -// throw new WnbtRestException("쿠폰 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// -// // 3.사용 마일리지 조회 및 할인 차감 ================================================= -// BOMlgVO mlgVO = purchsMapper.selectOrdrMlgUse(orderVO); -// if (mlgVO != null) { -// BigDecimal accmlmnyAmt = mlgVO.getAccmlmnyAmt(); -// -// if (0 < accmlmnyAmt.intValue()) { -// try { -// mlgService.insertBOMlgUse(mlgVO); -// } catch (Exception e) { -// log.debug("사용 마일리지 처리 실패", e.getMessage()); -// throw new WnbtRestException("마일리지 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// } -// } -// -// // 4. (2025-06-20 CJH 추가) 사용 GC 머니 차감 ================================================= -// BOCashVO cashVO = purchsMapper.selectOrdrCashMlgUse(payVO); -// log.debug("캐쉬 VO : {}", cashVO); -// if (cashVO != null) { -// BigDecimal accmlmnyAmt = cashVO.getAccmlmnyAmt(); -// -// if (0 < accmlmnyAmt.intValue()) { -// try { -// mlgService.insertBOCashUse(cashVO); // 사용 마일리지 할인 차감 -// } catch (Exception e) { -// log.debug("사용 충전형 마일리지 처리 실패", e.getMessage()); -// throw new WnbtRestException("GC 머니 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// } -// } - - + /* =============================================== + 결제 API + ================================================== */ Map kcpMap = payService.insertKcpPayKeyin(payVO); - if (!CollectionUtils.isEmpty(kcpMap)) { String response = StringUtil.isNullToString(kcpMap.get("response")); Map resultMap = new ObjectMapper().readValue(response, Map.class); @@ -5326,24 +4990,6 @@ public class BOOrdrService{ orderPgLogVO.setEscwAt(resultMap.get("escw_yn") != null ? resultMap.get("escw_yn").toString() : "N"); orderPgLogVO.setDelngAmt(resultMap.get("amount") != null ? new BigDecimal(resultMap.get("amount").toString()) : BigDecimal.valueOf(0)); - // 금액 검증 - PG사 결제 승인전 하고 있음 - /*BOOrdrVO paramVO = new BOOrdrVO(); - paramVO.setSopmalCd(payVO.getSopmalCd()); - paramVO.setOrdrInnb(payVO.getOrderId()); - DataMap ordrMap = mapper.selectOrdrGoodsDtllTot(paramVO); - - if (!CollectionUtils.isEmpty(resultMap)) { - BigDecimal setleAmt = (BigDecimal) ordrMap.get("setleAmt"); - BigDecimal amount = new BigDecimal((String) resultMap.get("amount")); - - if (setleAmt.intValue() == amount.intValue()) { - orderPgLogVO.setDelngAmt(amount); - } else { - insertSetleFailLog(payVO.getSopmalCd(), payVO.getOrderId(), "0000", "KCP 결제 실패 [결제 금액 매칭 오류]"); // 결제 실패 로그 등록 - throw new WnbtRestException("KCP 결제 실패 [결제 금액 매칭 오류]"); - } - }*/ - orderPgLogVO.setApvlnb(StringUtil.isNullToString(resultMap.get("app_no"))); orderPgLogVO.setCardCmpnyCd(StringUtil.isNullToString(resultMap.get("card_cd"))); orderPgLogVO.setCardCmpnyNm(StringUtil.isNullToString(resultMap.get("card_name"))); @@ -5519,6 +5165,9 @@ public class BOOrdrService{ // } + /* =============================================== + TOSS 카드 수기 결제 정보 등록 + ================================================== */ /** * 사용자 > 상품 > 구매/결제 > 회원구매하기 > TOSS 카드 수기 결제 정보 등록 @@ -5568,59 +5217,10 @@ public class BOOrdrService{ // 주문 공통 전처리 ( 상태체크, 상태변경, 마일리지, 쿠폰, GC머니 ) orderCommService.commonOrderPreProcess(payVO, orderVO); -// // 1-1. FM_ORDER 주문 상태 수정 ============================================== -// purchsMapper.updateOrdrSttusCdByFmOrder(orderVO); -// // 1-2. FM_ORDER_ITEM_OPTION 주문 상태 수정 ================================== -// purchsMapper.updateOrdrSttusCdByFmOrderItemOption(orderVO); -// // 1-3. FM_ORDER_SHIPPING 주문 상태 수정 ===================================== -// purchsMapper.updateOrdrSttusCdByFmOrderShipping(orderVO); -// -// // 2. 쿠폰 사용 처리 =============================================================== -// try { -// BODwldCouponVO dwldCouponVO = new BODwldCouponVO(); -// dwldCouponVO.setSopmalCd(payVO.getSopmalCd()); -// dwldCouponVO.setOrdrInnb(payVO.getOrderId()); -// couponService.updateBOUseCouponProcs(dwldCouponVO); -// } catch (Exception e) { -// log.debug("사용 쿠폰 처리 실패", e.getMessage()); -// throw new WnbtRestException("쿠폰 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// -// // 3.사용 마일리지 조회 및 할인 차감 ================================================= -// BOMlgVO mlgVO = purchsMapper.selectOrdrMlgUse(orderVO); -// if (mlgVO != null) { -// BigDecimal accmlmnyAmt = mlgVO.getAccmlmnyAmt(); -// -// if (0 < accmlmnyAmt.intValue()) { -// try { -// mlgService.insertBOMlgUse(mlgVO); -// } catch (Exception e) { -// log.debug("사용 마일리지 처리 실패", e.getMessage()); -// throw new WnbtRestException("마일리지 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// } -// } -// -// // 4. (2025-06-20 CJH 추가) 사용 GC 머니 차감 ================================================= -// BOCashVO cashVO = purchsMapper.selectOrdrCashMlgUse(payVO); -// log.debug("캐쉬 VO : {}", cashVO); -// if (cashVO != null) { -// BigDecimal accmlmnyAmt = cashVO.getAccmlmnyAmt(); -// -// if (0 < accmlmnyAmt.intValue()) { -// try { -// mlgService.insertBOCashUse(cashVO); // 사용 마일리지 할인 차감 -// } catch (Exception e) { -// log.debug("사용 충전형 마일리지 처리 실패", e.getMessage()); -// throw new WnbtRestException("GC 머니 사용에 실패했습니다.\n관리자에게 문의하시기 바랍니다."); -// } -// } -// } - - + /* =============================================== + 결제 API + ================================================== */ Map tossPayMap = payService.insertTossPayKeyin(payVO); - - if (!CollectionUtils.isEmpty(tossPayMap)) { String response = StringUtil.isNullToString(tossPayMap.get("response")); Map resultMap = new ObjectMapper().readValue(response, Map.class); @@ -5653,27 +5253,6 @@ public class BOOrdrService{ orderPgLogVO.setVirtlAcntVrifyKy(StringUtil.isNullToString(rctMap.get("url"))); } - // 금액 검증 - PG사 결제 승인전 하고 있음 - /*BOOrdrVO paramVO = new BOOrdrVO(); - - paramVO.setSopmalCd(payVO.getSopmalCd()); - paramVO.setOrdrInnb(payVO.getOrderId()); - - DataMap ordrMap = mapper.selectOrdrGoodsDtllTot(paramVO); - - if (!CollectionUtils.isEmpty(resultMap)) { - BigDecimal setleAmt = (BigDecimal) ordrMap.get("setleAmt"); - BigDecimal totalAmount = BigDecimal.valueOf((int) resultMap.get("totalAmount")); - - if (setleAmt.intValue() == totalAmount.intValue()) { - orderPgLogVO.setDelngAmt(totalAmount); - } else { - insertSetleFailLog(payVO.getSopmalCd(), payVO.getOrderId(), "0000", "토스 결제 실패 [결제 금액 매칭 오류]"); // 결제 실패 로그 등록 - - throw new WnbtRestException("토스 결제 실패 [결제 금액 매칭 오류]"); - } - }*/ - LinkedHashMap cartMap = (LinkedHashMap) resultMap.get("card"); if (!CollectionUtils.isEmpty(resultMap)) { @@ -5856,6 +5435,145 @@ public class BOOrdrService{ // } + /* =============================================== + KIWOOM 결제 정보 등록 + ================================================== */ + + /** + * 사용자 > 상품 > 구매/결제 > 회원구매하기 > KIWOOM 결제 정보 등록 + * @param payVO + * @return Map + */ + @Transactional + public Map insertKiwoomSetle(BOPayVO payVO) throws Exception { + Map message = new HashMap<>() ; + + message = insertKiwoomSetle1(payVO); // 결제 관련 처리 + + return message; + } + + + /** + * 사용자 > 상품 > 구매/결제 > 회원구매하기 > KIWOOM 결제 정보 등록 + * @param payVO + * @return Map + */ + @Transactional + public Map insertKiwoomSetle1(BOPayVO payVO) throws Exception { + + boolean payResult = true; + Map content = new HashMap<>(); + BOOrderPgLogVO orderPgLogVO = new BOOrderPgLogVO(); + + orderPgLogVO.setOrdrInnb(new BigInteger(payVO.getOrderId())); + orderPgLogVO.setSopmalCd(payVO.getSopmalCd()); + orderPgLogVO.setPgCmpnyNm(payVO.getPgCmpnyNm()); + orderPgLogVO.setSetlerNm(payVO.getSetlerNm()); + orderPgLogVO.setSetleMthCd(payVO.getSetleTyCd()); + + try{ + + // 1. 주문상태 수정 ===================================================== + BOOrderVO orderVO = new BOOrderVO(); + orderVO.setSopmalCd(payVO.getSopmalCd()); + orderVO.setOrdrInnb(new BigInteger(payVO.getOrderId())); + orderVO.setOrdrSttusCd("25"); // 주문상태코드(25:결제확인) + + if (StringUtils.hasText(payVO.getMbrInnb())) { + orderVO.setMbrInnb(new BigInteger(payVO.getMbrInnb())); + } + + // 주문 공통 전처리 ( 상태체크, 상태변경, 마일리지, 쿠폰, GC머니 ) + orderCommService.commonOrderPreProcess(payVO, orderVO); + + /* =============================================== + 결제 API >> DB select로 진행함 + ================================================== */ + // todo :: api 연결이 아닌 db셀렉트로 변경. + DataMap kiwoomPayMap = mapper.selectKiwoomPgApiLog(payVO);//payService.insertTossPayKeyin(payVO); + + log.info("insertKiwoomSetle service kiwoomPayMap ::: {}", kiwoomPayMap); + + if (!CollectionUtils.isEmpty(kiwoomPayMap)) { + String response = StringUtil.isNullToString(kiwoomPayMap.get("rsltParam")); + log.info("insertKiwoomSetle service kiwoomPayMap_response ::: {}", response); + Map resultMap = new ObjectMapper().readValue(response, Map.class); + + if (!CollectionUtils.isEmpty(resultMap)) { + + /* =============================================== + 5. FM_ORDER_PG_LOG 등록값 셋팅 + ================================================== */ + orderPgLogVO.setDelngNb(StringUtil.isNullToString(resultMap.get("DAOUTRX"))); // 거래번호 (결제키) + orderPgLogVO.setConfmDt(selectDateFormat(StringUtil.isNullToString(resultMap.get("SETTDATE")))); // 승인일시 + orderPgLogVO.setApvlnb(StringUtil.isNullToString(resultMap.get("AUTHNO"))); //승인번호 + orderPgLogVO.setCardCmpnyCd(StringUtil.isNullToString(resultMap.get("CARDCODE"))); //카드사코드 + orderPgLogVO.setCardCmpnyNm(StringUtil.isNullToString(bOMaComncdService.selectBOCommcdDetail("KIWOOM_CARD_CD",orderPgLogVO.getCardCmpnyCd()))); //카드사명 + orderPgLogVO.setNintrAt((boolean) resultMap.get("NOINTFLAG") ? "Y" : "N"); //무이자여부 + orderPgLogVO.setInstlmtMtCnt(resultMap.get("INSTALL") != null ? Integer.parseInt(resultMap.get("INSTALL").toString()):0); //할부개월수 + + // todo ::: 주문금액을 api테이블과 넘어온 값이랑 비교해야 처리필요 + //if(!CollectionUtils.isEmpty(resultMap)) {} else { + // throw new WnbtRestException("토스 결제 실패 [결제 금액 매칭 오류]"); + // } + orderPgLogVO.setDelngAmt(resultMap.get("AMOUNT") != null ? new BigDecimal(resultMap.get("AMOUNT").toString()) : BigDecimal.valueOf(0)); + + orderPgLogVO.setEscwAt("N"); // 에스크로여부 + orderPgLogVO.setVirtlAcntVrifyKy(""); //매출증빙영수증URL + orderPgLogVO.setRsltMssageCn("0000"); + orderPgLogVO.setRsltCd("정상처리-카드거래"); + + // 6. FM_ORDER_SETLE 수정 ============================================== + BOOrderSetleVO orderSetleVO = new BOOrderSetleVO(); + orderSetleVO.setSopmalCd(payVO.getSopmalCd()); + orderSetleVO.setOrdrInnb(new BigInteger(payVO.getOrderId())); + orderSetleVO.setPgInnb(orderPgLogVO.getDelngNb()); + orderSetleVO.setCredtcardApvlnb(orderPgLogVO.getApvlnb()); + orderSetleVO.setSetleTyCd(payVO.getSetleTyCd()); + //orderSetleVO.setSetleMid(StringUtil.isNullToString(mapper.selectBOSopSetleMidKeyInqire(payVO))); // 쇼핑몰 결제 MID(상점키) 조회 + orderSetleVO.setSetleMid("CTS18056"); //todo : paylink 관련 정리 후 db형으로 바꿈 + + log.info("insertKiwoomSetle service kiwoomPayMap_orderSetleVO ::: {}", orderSetleVO); + + purchsMapper.updateOrderSetle(orderSetleVO); + + log.info("insertKiwoomSetle service kiwoomPayMap_orderSetleVO end::: "); + + content.put("status", "0"); + content.put("message", "키움 결제 정보 등록을 완료 하였습니다."); + } + } else { + throw new WnbtRestException("키움 결제 수신 정보를 찾을 수 없어 결제가 실패하였습니다.\n관리자에게 문의하시기 바랍니다."); + } + + try { + selectBOOrdrMssageSndngProcs(orderVO); + } catch (Exception e) { + log.debug("{} 메시지 발송 실패", payVO.getOrderId()); + } + + } catch (WnbtRestException wre) { + log.error("insertKiwoomSetle1 WnbtRestException : ", wre); + payResult = false; + throw wre; + } catch (Exception wre) { + log.error("insertKiwoomSetle1 Exception : ", wre); + payResult = false; + throw wre; + } finally { + log.info("insertKiwoomSetle1 order finally !!!!! {} ", payVO.getOrderId()); + // FM_ORDER_PG_LOG 등록 + ordrLogService.insertBOOrderPgLog(orderPgLogVO); + // 주문 로그 + ordrLogService.insertSetleOrderLog(payVO, payResult, "0000", "키움 결제 실패 [결제 정보 NULL]"); + } + + + return content; + } + + /** @@ -6023,6 +5741,17 @@ public class BOOrdrService{ return message; } + + /** + * 주문 후 장바구니 비우기 + * @param orderVO + */ + @Transactional(propagation = Propagation.REQUIRES_NEW) + public void deleteBOCart(BOOrderVO orderVO) throws Exception { + purchsMapper.deleteCart(orderVO); + } + + /** * 사용자 > 상품 > 구매/결제 > 회원구매하기 > 주문완료 정보 조회 * @param ordrVO @@ -6714,7 +6443,7 @@ public class BOOrdrService{ /** * 사용자 > 상품 > 상품상세 > 기존 장바구니 상품정보 삭제 - * @param goodsVOList + * @param spbkVO * @return Map */ @Transactional @@ -7201,7 +6930,7 @@ public class BOOrdrService{ /** * 배송지 조회 - * @param payVO + * @param vo */ public DataMap selectBOOrdrDlvylc(BOOrdrShippingVO vo) { DataMap map = new DataMap(); @@ -7600,7 +7329,7 @@ public class BOOrdrService{ /** * 주문 메세지 처리 - * @param payVO + * @param orderVO * @return */ public void selectBOOrdrMssageSndngProcs (BOOrderVO orderVO) throws Exception { diff --git a/src/main/java/com/wb/domainserver/domain/sopmal/ordr/controller/OrdrController.java b/src/main/java/com/wb/domainserver/domain/sopmal/ordr/controller/OrdrController.java index e1917dfa..50e1b2e3 100644 --- a/src/main/java/com/wb/domainserver/domain/sopmal/ordr/controller/OrdrController.java +++ b/src/main/java/com/wb/domainserver/domain/sopmal/ordr/controller/OrdrController.java @@ -32,6 +32,7 @@ import com.wb.domainserver.domain.gcone.ordr.ordr.service.BOOrdrService; import com.wb.domainserver.domain.gcone.ordr.ordr.vo.BOCrmDlvylcVO; import com.wb.domainserver.domain.gcone.ordr.ordr.vo.BOOrdrVO; import com.wb.domainserver.domain.gcone.ordr.ordr.vo.BOSpbkVO; +import com.wb.domainserver.domain.gcone.ordr.pay.service.BOPayService; import com.wb.domainserver.domain.gcone.ordr.pay.vo.BOPayVO; import com.wb.domainserver.domain.gcone.promtn.coupon.service.BOCouponService; import com.wb.domainserver.domain.gcone.setup.dlvygrp.service.BODlvygrpService; @@ -133,6 +134,8 @@ public class OrdrController { private BOPurchsService boPurchsService; @Autowired private BOSubsvcService subsvcService; + @Autowired + private BOPayService payService; /* #################################### 사용자 > 상품 > 구매/결제 > 회원구매하기 시작 @@ -834,7 +837,9 @@ public class OrdrController { String pgCmpnyNm = setle.getPgCmpnyNm(); String setleTyCd = setle.getSetleTyCd(); - if ("gcpay".equals(pgCmpnyNm)) { + if ("kiwoom".equals(pgCmpnyNm)) { + url = "sopmal/ordr/OrdrReqstKiwoomPayR"; + } else if ("gcpay".equals(pgCmpnyNm)) { url = "sopmal/ordr/OrdrReqstGcpayPayR"; } else if ("kcp".equals(pgCmpnyNm)) { if ("sopmal_m".equals(deviceType)) { @@ -1182,19 +1187,6 @@ public class OrdrController { payVO.setSetlerNm(request.getParameter("buyr_name")); - //에스크로 정보추가 - /*payVO.setEscwUsed(request.getParameter("escw_used")); - payVO.setPayMod(request.getParameter("pay_mod")); - payVO.setRcvrName(request.getParameter("rcvr_name")); - payVO.setRcvrTel1(request.getParameter("rcvr_tel1")); - payVO.setRcvrTel2(request.getParameter("rcvr_tel2")); - payVO.setRcvrZipx(request.getParameter("rcvr_zipx")); - payVO.setRcvrAdd1(request.getParameter("rcvr_add1")); - payVO.setRcvrAdd2(request.getParameter("rcvr_add2")); - payVO.setDeliTerm(request.getParameter("deli_term")); - payVO.setBaskCntx(request.getParameter("bask_cntx")); - payVO.setGoodInfo(request.getParameter("good_info"));*/ - log.debug("payVO => {} ", new Gson().toJson(payVO)); String resCd = request.getParameter("res_cd"); @@ -1392,6 +1384,151 @@ public class OrdrController { return "sopmal/ordr/OrdrRspnsTossPayR"; } + + /** + * 키움 결제 연계 전 getEnc 값 받아오기 + * @return PayKiwoomSucsC.jsp + * @author 이경숙 + */ + @Policy(AuthPolicy.RESTRICTED) + @ResponseBody + @RequestMapping(value="/kiwoomPayGetEnc") + public Map selectKiwoomGetEnc(HttpServletRequest request) throws Exception { + + BOPayVO payVO = new BOPayVO(); + + log.debug("kiwoomPayGetEnc = {}"); + + //String eucKrStr = new String(utf8Str.getBytes("UTF-8"), "EUC-KR"); + //String utf8Str = new String(eucKrStr.getBytes("EUC-KR"), "UTF-8"); + //request.setCharacterEncoding("EUC-KR"); + + payVO.setCpId(request.getParameter("CPID")); + payVO.setPayMethod(request.getParameter("PAYMETHOD")); + payVO.setOrderId(request.getParameter("ORDERNO")); + payVO.setType(request.getParameter("TYPE")); + payVO.setAmount(request.getParameter("AMOUNT")); + + Map message; + String sopmalCd = payVO.getSopmalCd(); + try { + message = payService.insertKiwoomPay(payVO); + + } catch (Exception e) { + message = new HashMap<>() {{ + put("response", "결제를 실패하였습니다.\n관리자에게 문의하시기 바랍니다."); + }}; + } + + + log.info("insertKiwoomPay step5 ::: {}", message.get("KIWOOM_ENC")); + + //model.addAttribute("message", message); + //return "sopmal/ordr/PayKiwoomSucsC"; + + return message; + } + + + /** + * 사용자 > 상품 > 구매/결제 > 회원구매하기 > 키움 결제 정보 등록 + * @param model + * @param request + * @return OrdrRspnsKiwoomPayR.jsp + */ + @Policy(AuthPolicy.RESTRICTED) + @RequestMapping(value="/insertKiwoomSetle") + public String insertKiwoomSetle(ModelMap model, HttpServletRequest request) { + BOPayVO payVO = new BOPayVO(); + + payVO.setOrderId(request.getParameter("orderId")); + payVO.setAmount(request.getParameter("setleAmt")); + payVO.setSopmalCd(request.getParameter("sopmalCd")); + payVO.setMbrInnb(request.getParameter("mbrInnb")); + payVO.setMbrId(request.getParameter("mbrId")); + payVO.setSesionId(request.getParameter("sesionId")); + payVO.setPgCmpnyNm(request.getParameter("pgCmpnyNm")); + payVO.setSetleTyCd(request.getParameter("setleTyCd")); + payVO.setSetlerNm(request.getParameter("ordrrNm")); + + log.info("insertKiwoomSetle controller payVO ::: {}", payVO); + + String agentId = ""; + String jSesionId = ""; + String ipAdres = ""; + + // 쿠키를 가져옴 + Cookie[] cookies = request.getCookies(); + + //agentId 쿠키 있을 경우 가져옴 + if (cookies != null) { + for (Cookie cookie : cookies) { + if (cookie.getName().equals("JSESSIONID")) { + jSesionId = cookie.getValue(); + payVO.setSessionId(jSesionId); + } + } + } + //gc_agent_id 가져옴 + if (CookieUtil.hasAgentCookie(request.getCookies())) { + agentId = CookieUtil.getAgentCookieValue(request.getCookies()); + payVO.setAgentId(agentId); + } + Map util = new HashMap<>(); + util = utilClass.getRequestInfo(request); + ipAdres = util.get("XForwardedFor"); + payVO.setIpAdres(ipAdres); + + AnonymousUser user = MemberJwtContextHolder.getMemberInfo(); + payVO.setMbrNm(user.getMbrNm()); //회원명(관리자명) + if ("01".equals(user.getSysDvCd())) { + payVO.setDvCd("01"); + payVO.setSopmalCd(user.getSopmalCd()); + payVO.setMbrDvCd(user.getMbrDvCd()); + } else { + payVO.setDvCd("02"); + } + + Map content; + + try { + content = service.insertKiwoomSetle(payVO); + + log.info("insertKiwoomSetle controller content ::: {}", content); + + } catch (WnbtRestException wre) { + log.info("insertKiwoomSetle : 키움 결제 정보 등록 : 실패 WnbtRestException"); + log.error(wre.getMessage(), wre); + content = new HashMap<>() {{ + put("status", "1"); + put("message", wre.getMessage()); + }}; + } catch (Exception e) { + log.info("insertKiwoomSetle : 키움 결제 정보 등록 : 실패"); + log.error(e.getMessage(), e); + + content = new HashMap<>() {{ + put("status", "1"); + put("message", "키움 결제 정보 등록이 실패하였습니다.\n관리자에게 문의하시기 바랍니다."); + }}; + } + + if ("0".equals(content.get("status"))) { + commonOrderPostProcess(payVO); + } + + model.addAttribute("data", content); +// responseHandler.handleResponse( +// sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/ordr/ordr/insertBOTosspaySetle", payVO), +// model, +// "data" +// ); + model.addAttribute("paramVO", payVO); + + return "sopmal/ordr/OrdrRspnsKiwoomPayR"; + } + + /** * 사용자 > 상품 > 구매/결제 > 회원구매하기 > 주문완료 화면 이동 * @return OrdrComptR.jsp diff --git a/src/main/webapp/WEB-INF/views/sopmal/ordr/MbrPurchsC.jsp b/src/main/webapp/WEB-INF/views/sopmal/ordr/MbrPurchsC.jsp index 6ad8297f..85e741ea 100644 --- a/src/main/webapp/WEB-INF/views/sopmal/ordr/MbrPurchsC.jsp +++ b/src/main/webapp/WEB-INF/views/sopmal/ordr/MbrPurchsC.jsp @@ -53,7 +53,10 @@ const gcpayCardUseAt = $('#gcpayCardUseAt').val(); let gcpayAt = ( gcpayCardUseAt === 'Y')? 'Y' : 'N'; const setleTy = $('#setleSetupTyCd').val(); - const setleTyCd = (setleTy==='01')?'#pg04':'#pg03'; + let setleTyCd = '#pg04'; + if(setleTy==='01')setleTyCd = '#pg04'; //kcp + else if(setleTy==='02')setleTyCd = '#pg03'; //toss + else if(setleTy==='03')setleTyCd = '#pg06'; //kiwoom if (gcpayAt === 'N') { $(setleTyCd).click(); @@ -525,11 +528,16 @@ $(form).find('.pgContent').hide(); $(form).find('#' + id + 'Content').show(); - $(form).find('#setleSetupTyCd').val() === '01' ? $(form).find('#pg04Content').show() : $(form).find('#pg03Content').show(); + + //$(form).find('#setleSetupTyCd').val() === '01' ? $(form).find('#pg04Content').show() : $(form).find('#pg03Content').show(); + if($(form).find('#setleSetupTyCd').val() === '01'){$(form).find('#pg04Content').show();} + else if($(form).find('#setleSetupTyCd').val() === '02'){$(form).find('#pg03Content').show();} + else if($(form).find('#setleSetupTyCd').val() === '03'){$(form).find('#pg06Content').show();} + $('.order-method-normal__btn').removeClass('active'); $(form).find('#pgCmpnyNm').val(pgCmpnyNm); - if ('pg01' === id || 'pg02' === id) { + if ('pg01' === id || 'pg02' === id) { //GC페이 if ('pg02' === id) { $('#gc-pay-bank-cash-receipt').prop('checked', true).trigger("click"); @@ -549,7 +557,7 @@ $(form).find('#setleTyCd').val('pg01' === id ? '01' : '03'); $('.bankSlideW, .cardSlideW').slick('setPosition'); - } else if('pg05' === id){ + } else if('pg05' === id){ //퀵계좌이체 $('#transfer-cash-receipt').prop('checked', true).trigger("click"); $(form).find('#transfer-cash-receipt').on('click', function () { @@ -579,7 +587,10 @@ const content = $('.order-method-normal__content'); const useCashMlgAmt = $('#useCashMlgAmt').val(); - $('#setleSetupTyCd').val() === '01' ? $('#pg04').click() : $('#pg03').click(); + //$('#setleSetupTyCd').val() === '01' ? $('#pg04').click() : $('#pg03').click(); + if($('#setleSetupTyCd').val() === '01'){$('#pg04').click();} + else if($('#setleSetupTyCd').val() === '02'){$('#pg03').click();} + else if($('#setleSetupTyCd').val() === '03'){$('#pg05').click();} $('.order-method-normal__btn').removeClass('active'); $(this).addClass('active'); @@ -2987,7 +2998,7 @@ return false; } - if ('kcp' === pgCmpnyNm || 'toss' === pgCmpnyNm) { + if ('kcp' === pgCmpnyNm || 'toss' === pgCmpnyNm || 'kiwoom' === pgCmpnyNm) { const div = $('#setleForm').find('.order-method-normal'); if (!$(div).find('.order-method-normal__btn-container button').hasClass('active')) { @@ -3028,7 +3039,12 @@ const id = '01' === issuTrgetDvCd ? 'issuTrgetMbtlnb' : 'issuTrgetBsnmNb'; let rlPgCmpnyNm = $('#pgCmpnyNm').val(); - let setleTyId = $('kcp' === pgCmpnyNm ? '#pg04Content' : '#pg03Content').find('button[name="' + setleTyCd + '"]').attr('id'); + let pgCont = ""; + if('kiwoom' === pgCmpnyNm) pgCont='pg06Content'; + else if('kcp' === pgCmpnyNm) pgCont='pg04Content'; + else pgCont='pg03Content'; + let setleTyId = $('#'+pgCont).find('button[name="' + setleTyCd + '"]').attr('id'); + if ('tosspay' === rlPgCmpnyNm) { setleTyId = 'acount' @@ -3077,7 +3093,7 @@ $('#setleForm').find('#pgCmpnyNm').val(pgCmpnyNm); $('#setleForm').find('#setleTyCd').val(setleTyCd); - } else { + } else { //gc페이 if ('01' === setleTyCd) { // 카드 const index = $('.cardSlideW').slick('slickCurrentSlide'); const curCardId = $('#gcCardId' + index).val(); @@ -3524,6 +3540,82 @@ }); } + + <%-- 공통 Header --%> @@ -4437,6 +4529,138 @@ <%-- kcp 결제 종료 --%> + + <%-- 키움 결제 시작 --%> + +
+ + +
+ +
+ <%-- 키움 결제 종료 --%> diff --git a/src/main/webapp/WEB-INF/views/sopmal/ordr/OrdrReqstKiwoomPayR.jsp b/src/main/webapp/WEB-INF/views/sopmal/ordr/OrdrReqstKiwoomPayR.jsp index 566e1cae..972c0aac 100644 --- a/src/main/webapp/WEB-INF/views/sopmal/ordr/OrdrReqstKiwoomPayR.jsp +++ b/src/main/webapp/WEB-INF/views/sopmal/ordr/OrdrReqstKiwoomPayR.jsp @@ -30,14 +30,13 @@ -
- - - - +<%-- Controller에 넘어가는 값 --%> + + + + + - - - - - - + + + + + + + + +
- - - - - - +<%-- 결제창에 넘어가는 값 --%> +
+ + + + + - - + + + - + + + + + +