결제 - 키움결제 적용 2차

This commit is contained in:
이경숙
2026-03-30 18:35:06 +09:00
parent 8fd58d80b0
commit 63b675f435
4 changed files with 75 additions and 12 deletions

View File

@@ -5492,8 +5492,12 @@ public class BOOrdrService{
================================================== */
// 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<String, Object> resultMap = new ObjectMapper().readValue(response, Map.class);
if (!CollectionUtils.isEmpty(resultMap)) {
@@ -5505,7 +5509,7 @@ public class BOOrdrService{
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("TOSS_CARD_CD",orderPgLogVO.getCardCmpnyCd()))); //카드사명
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); //할부개월수
@@ -5528,10 +5532,14 @@ public class BOOrdrService{
orderSetleVO.setCredtcardApvlnb(orderPgLogVO.getApvlnb());
orderSetleVO.setSetleTyCd(payVO.getSetleTyCd());
//orderSetleVO.setSetleMid(StringUtil.isNullToString(mapper.selectBOSopSetleMidKeyInqire(payVO))); // 쇼핑몰 결제 MID(상점키) 조회
orderSetleVO.setSetleMid("CFO20585"); //todo : paylink 관련 정리 후 db형으로 바꿈
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", "키움 결제 정보 등록을 완료 하였습니다.");
}

View File

@@ -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;
/* ####################################
사용자 > 상품 > 구매/결제 > 회원구매하기 시작
@@ -1382,6 +1385,51 @@ public class OrdrController {
}
/**
* 키움 결제 연계 전 getEnc 값 받아오기
* @return PayKiwoomSucsC.jsp
* @author 이경숙
*/
@Policy(AuthPolicy.RESTRICTED)
@ResponseBody
@RequestMapping(value="/kiwoomPayGetEnc")
public Map<String, Object> 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<String, Object> 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
@@ -1403,6 +1451,8 @@ public class OrdrController {
payVO.setSetleTyCd(request.getParameter("setleTyCd"));
payVO.setSetlerNm(request.getParameter("ordrrNm"));
log.info("insertKiwoomSetle controller payVO ::: {}", payVO);
String agentId = "";
String jSesionId = "";
String ipAdres = "";
@@ -1443,6 +1493,9 @@ public class OrdrController {
try {
content = service.insertKiwoomSetle(payVO);
log.info("insertKiwoomSetle controller content ::: {}", content);
} catch (WnbtRestException wre) {
log.info("insertKiwoomSetle : 키움 결제 정보 등록 : 실패 WnbtRestException");
log.error(wre.getMessage(), wre);