|
@@ -27,9 +27,7 @@ public class TscKcpService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public Payment kcpPayRequest(Payment param, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
public Payment kcpPayRequest(Payment param, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
- // PC pay_method
|
|
|
|
|
- /* = 신용카드 : 100000000000, 계좌이체 : 010000000000, 가상계좌 : 001000000000 = */
|
|
|
|
|
- /* = 포인트 : 000100000000, 휴대폰 : 000010000000, 상품권 : 000000001000, ARS : 000000000010 = */
|
|
|
|
|
|
|
+ Payment result = new Payment();
|
|
|
|
|
|
|
|
// 01. characterEncoding EUC-KR 세팅
|
|
// 01. characterEncoding EUC-KR 세팅
|
|
|
request.setCharacterEncoding("euc-kr");
|
|
request.setCharacterEncoding("euc-kr");
|
|
@@ -40,9 +38,9 @@ public class TscKcpService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 02. 지불 요청 정보 설정
|
|
// 02. 지불 요청 정보 설정
|
|
|
- param.setReqTx(request.getParameter("req_tx"));
|
|
|
|
|
- param.setTranCd(request.getParameter("tran_cd"));
|
|
|
|
|
- param.setOrdrIdxx(Integer.parseInt(request.getParameter("ordr_idxx")));
|
|
|
|
|
|
|
+ result.setReqTx(request.getParameter("req_tx"));
|
|
|
|
|
+ result.setTranCd(request.getParameter("tran_cd"));
|
|
|
|
|
+ result.setOrdrIdxx(Integer.parseInt(request.getParameter("ordr_idxx")));
|
|
|
|
|
|
|
|
// 03. 인스턴스 생성 및 초기화(변경 불가) (결제에 필요한 인스턴스를 생성하고 초기화 합니다.)
|
|
// 03. 인스턴스 생성 및 초기화(변경 불가) (결제에 필요한 인스턴스를 생성하고 초기화 합니다.)
|
|
|
J_PP_CLI_N c_PayPlus = new J_PP_CLI_N();
|
|
J_PP_CLI_N c_PayPlus = new J_PP_CLI_N();
|
|
@@ -50,7 +48,7 @@ public class TscKcpService {
|
|
|
c_PayPlus.mf_init_set();
|
|
c_PayPlus.mf_init_set();
|
|
|
|
|
|
|
|
// 04-1. 승인 요청 정보 설정
|
|
// 04-1. 승인 요청 정보 설정
|
|
|
- if ("pay".equals(param.getReqTx())){
|
|
|
|
|
|
|
+ if ("pay".equals(result.getReqTx())){
|
|
|
c_PayPlus.mf_set_enc_data(f_get_parm(request.getParameter("enc_data" )), f_get_parm(request.getParameter("enc_info")));
|
|
c_PayPlus.mf_set_enc_data(f_get_parm(request.getParameter("enc_data" )), f_get_parm(request.getParameter("enc_info")));
|
|
|
|
|
|
|
|
/* 1원은 실제로 업체에서 결제하셔야 될 원 금액을 넣어주셔야 합니다. 결제금액 유효성 검증 */
|
|
/* 1원은 실제로 업체에서 결제하셔야 될 원 금액을 넣어주셔야 합니다. 결제금액 유효성 검증 */
|
|
@@ -59,42 +57,39 @@ public class TscKcpService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 05. 실행
|
|
// 05. 실행
|
|
|
- if (param.getTranCd().length() > 0) {
|
|
|
|
|
- c_PayPlus.mf_do_tx(env.getProperty("pg.kcp.site.cd"), env.getProperty("pg.kcp.site.key"), param.getTranCd(), "", param.getOrdrIdxx() + "", env.getProperty("pg.kcp.log.level"), "0");
|
|
|
|
|
|
|
+ if (result.getTranCd().length() > 0) {
|
|
|
|
|
+ c_PayPlus.mf_do_tx(env.getProperty("pg.kcp.site.cd"), env.getProperty("pg.kcp.site.key"), result.getTranCd(), "", result.getOrdrIdxx() + "", env.getProperty("pg.kcp.log.level"), "0");
|
|
|
} else {
|
|
} else {
|
|
|
c_PayPlus.m_res_cd = "9562";
|
|
c_PayPlus.m_res_cd = "9562";
|
|
|
c_PayPlus.m_res_msg = "연동 오류|tran_cd값이 설정되지 않았습니다.";
|
|
c_PayPlus.m_res_msg = "연동 오류|tran_cd값이 설정되지 않았습니다.";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- param.setResCd(c_PayPlus.m_res_cd); // 결과 코드
|
|
|
|
|
- param.setResMsg(c_PayPlus.m_res_msg); // 결과 메시지
|
|
|
|
|
|
|
+ result.setResCd(c_PayPlus.m_res_cd); // 결과 코드
|
|
|
|
|
+ result.setResMsg(c_PayPlus.m_res_msg); // 결과 메시지
|
|
|
|
|
|
|
|
// 06. 승인 결과 값 추출
|
|
// 06. 승인 결과 값 추출
|
|
|
- if ("pay".equals(param.getReqTx())) {
|
|
|
|
|
- if ("0000".equals(param.getResCd())) {
|
|
|
|
|
- param.setPgTid(c_PayPlus.mf_get_res("tno")); // KCP 거래 고유 번호
|
|
|
|
|
- //param.setPntIssue(c_PayPlus.mf_get_res("pnt_issue")); // 결제 포인트사 코드
|
|
|
|
|
- param.setPayAmt(Integer.parseInt(c_PayPlus.mf_get_res("amount"))); // KCP 실제 거래 금액
|
|
|
|
|
- param.setPgCpnAmt(c_PayPlus.mf_get_res("coupon_mny").isEmpty() ? 0 : Integer.parseInt(c_PayPlus.mf_get_res("coupon_mny"))); // 쿠폰 할인금액
|
|
|
|
|
|
|
+ if ("pay".equals(result.getReqTx())) {
|
|
|
|
|
+ if ("0000".equals(result.getResCd())) {
|
|
|
|
|
+ result.setPgTid(c_PayPlus.mf_get_res("tno")); // KCP 거래 고유 번호
|
|
|
|
|
+ //result.setPntIssue(c_PayPlus.mf_get_res("pnt_issue")); // 결제 포인트사 코드
|
|
|
|
|
+ result.setPayAmt(Integer.parseInt(c_PayPlus.mf_get_res("amount"))); // KCP 실제 거래 금액
|
|
|
|
|
+ result.setPgCpnAmt(c_PayPlus.mf_get_res("coupon_mny").isEmpty() ? 0 : Integer.parseInt(c_PayPlus.mf_get_res("coupon_mny"))); // 쿠폰 할인금액
|
|
|
|
|
|
|
|
/* = -------------------------------------------------------------------------- = */
|
|
/* = -------------------------------------------------------------------------- = */
|
|
|
/* = 06-1. 신용카드 승인 결과 처리 = */
|
|
/* = 06-1. 신용카드 승인 결과 처리 = */
|
|
|
/* = -------------------------------------------------------------------------- = */
|
|
/* = -------------------------------------------------------------------------- = */
|
|
|
if ("100000000000".equals(param.getUsePayMethod())) {
|
|
if ("100000000000".equals(param.getUsePayMethod())) {
|
|
|
- param.setCardKind(c_PayPlus.mf_get_res("card_cd")); // 카드종류. 결제수단이 "30:신용카드"일 때 사용. PG사에서 받은 값 ?? card_cd: 카드 발급사 코드
|
|
|
|
|
- param.setCardBank(c_PayPlus.mf_get_res("card_cd")); // 카드발급은행. 결제수단이 "30:신용카드"일 때 사용. PG사에서 받은 값 ?? card_cd: 카드 발급사 코드
|
|
|
|
|
- param.setCardNm(c_PayPlus.mf_get_res("card_name")); // 카드명. 결제수단이 "30:신용카드"일 때 사용. PG사에서 받은 값 card_name: 결제건의 발급 사 명
|
|
|
|
|
|
|
+ result.setCardKind(c_PayPlus.mf_get_res("card_cd")); // 카드종류. 결제수단이 "30:신용카드"일 때 사용. PG사에서 받은 값 ?? card_cd: 카드 발급사 코드
|
|
|
|
|
+ result.setCardBank(c_PayPlus.mf_get_res("card_cd")); // 카드발급은행. 결제수단이 "30:신용카드"일 때 사용. PG사에서 받은 값 ?? card_cd: 카드 발급사 코드
|
|
|
|
|
+ result.setCardNm(c_PayPlus.mf_get_res("card_name")); // 카드명. 결제수단이 "30:신용카드"일 때 사용. PG사에서 받은 값 ?? card_name: 결제건의 발급 사 명
|
|
|
log.info("CHECK c_PayPlus.mf_get_res(\"app_time\") :::: {}", c_PayPlus.mf_get_res("app_time"));
|
|
log.info("CHECK c_PayPlus.mf_get_res(\"app_time\") :::: {}", c_PayPlus.mf_get_res("app_time"));
|
|
|
- param.setPayDt(c_PayPlus.mf_get_res("app_time"));
|
|
|
|
|
- param.setPgTradeNo(c_PayPlus.mf_get_res("app_no")); // PG거래번호(승인번호)
|
|
|
|
|
- param.setCardMips(c_PayPlus.mf_get_res("quota")); // 할부개월수
|
|
|
|
|
|
|
+ result.setPayDt(c_PayPlus.mf_get_res("app_time"));
|
|
|
|
|
+ result.setPgTradeNo(c_PayPlus.mf_get_res("app_no")); // PG거래번호(승인번호)
|
|
|
|
|
+ result.setCardMips(c_PayPlus.mf_get_res("quota")); // 할부개월수
|
|
|
//noinf = c_PayPlus.mf_get_res("noinf"); // 무이자 여부
|
|
//noinf = c_PayPlus.mf_get_res("noinf"); // 무이자 여부
|
|
|
- param.setCardPcableYn(c_PayPlus.mf_get_res("partcanc_yn")); // 부분취소 가능유무
|
|
|
|
|
- if("0".equals(c_PayPlus.mf_get_res("card_bin_type_02"))) { // 결제건의 카드 구분 정보 (일반 : 0, 체크 : 1)
|
|
|
|
|
- param.setCardType("N"); // 신용카드
|
|
|
|
|
- } else {
|
|
|
|
|
- param.setCardType("Y"); // 체크카드, 기프트카드(G)는 어떻게 알아봐야하는지 확인 ?
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ result.setCardPcableYn(c_PayPlus.mf_get_res("partcanc_yn")); // 부분취소 가능유무
|
|
|
|
|
+ // N : 신용카드, Y : 체크카드, G 기프트카드 (기프트카드는 어떻게 입력해야할지 ?)
|
|
|
|
|
+ result.setCardType("0".equals(c_PayPlus.mf_get_res("card_bin_type_02")) ? "N" : "Y");
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
throw new IllegalArgumentException("결제 실패하였습니다.");
|
|
throw new IllegalArgumentException("결제 실패하였습니다.");
|
|
@@ -104,8 +99,10 @@ public class TscKcpService {
|
|
|
int a = 1;
|
|
int a = 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ log.info("CHECK RESPONSE DATA ::::: {} / {}", c_PayPlus.toString(), c_PayPlus.getRecvObj().toString());
|
|
|
|
|
+ log.info("CHECK RESPONSE RESULT DATA ::::: {}", result.toString());
|
|
|
|
|
+ log.info("CHECK RESPONSE PARAM DATA ::::: {}", param.toString());
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- return param;
|
|
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|