Quellcode durchsuchen

Merge remote-tracking branch 'origin/xodud1202' into card007

card007 vor 5 Jahren
Ursprung
Commit
bb1c698d83

+ 46 - 6
src/main/java/com/style24/core/biz/service/TscKcpService.java

@@ -29,9 +29,8 @@ public class TscKcpService {
 	public GagaMap kcpPayRequest(Payment param, HttpServletRequest request, HttpServletResponse response) throws Exception {
 		GagaMap result = new GagaMap();
 		// PC pay_method
-		/* =  신용카드 : 100000000000, 계좌이체  : 010000000000, 가상계좌 : 001000000000 = */
-		/* =  포인트   : 000100000000, 휴대폰    : 000010000000, 상품권   : 000000001000 = */
-		/* =  ARS      : 000000000010                                                    = */
+		/* = 신용카드 : 100000000000, 계좌이체 : 010000000000, 가상계좌 : 001000000000                     = */
+		/* = 포인트   : 000100000000, 휴대폰   : 000010000000, 상품권   : 000000001000, ARS : 000000000010 = */
 
 		// 01. characterEncoding EUC-KR 세팅
 		request.setCharacterEncoding("euc-kr");
@@ -44,7 +43,7 @@ public class TscKcpService {
 		// 02. 지불 요청 정보 설정
 		param.setReqTx(request.getParameter("req_tx"));
 		param.setTranCd(request.getParameter("tran_cd"));
-		param.setOrdrIdxx(request.getParameter("ordr_idxx"));
+		param.setOrdrIdxx(Integer.parseInt(request.getParameter("ordr_idxx")));
 
 		// 03. 인스턴스 생성 및 초기화(변경 불가) (결제에 필요한 인스턴스를 생성하고 초기화 합니다.)
 		J_PP_CLI_N c_PayPlus = new J_PP_CLI_N();
@@ -62,7 +61,7 @@ public class TscKcpService {
 
 		// 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");
+			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");
 		} else {
 			c_PayPlus.m_res_cd  = "9562";
 			c_PayPlus.m_res_msg = "연동 오류|tran_cd값이 설정되지 않았습니다.";
@@ -71,7 +70,48 @@ public class TscKcpService {
 		param.setResCd(c_PayPlus.m_res_cd);		// 결과 코드
 		param.setResMsg(c_PayPlus.m_res_msg);	// 결과 메시지
 
-		log.info("CHECK RESULT >> " + param.toString());
+		// 06. 승인 결과 값 추출
+		if ("pay".equals(param.getReqTx())) {
+			if ("0000".equals(param.getResCd())) {
+				param.setTno(c_PayPlus.mf_get_res("tno"));                // KCP 거래 고유 번호
+				param.setPntIssue(c_PayPlus.mf_get_res("pnt_issue"));    // 결제 포인트사 코드
+				param.setAmount(c_PayPlus.mf_get_res("amount").isEmpty() ? 0 : Integer.parseInt(c_PayPlus.mf_get_res("amount")));                // KCP 실제 거래 금액
+				param.setCouponMny(c_PayPlus.mf_get_res("coupon_mny").isEmpty() ? 0 : Integer.parseInt(c_PayPlus.mf_get_res("coupon_mny")));    // 쿠폰금액
+
+				/* = -------------------------------------------------------------------------- = */
+				/* =   06-1. 신용카드 승인 결과 처리                                            = */
+				/* = -------------------------------------------------------------------------- = */
+				if ("100000000000".equals(param.getUsePayMethod())) {
+					/*card_cd = c_PayPlus.mf_get_res("card_cd"); // 카드사 코드
+					card_name = c_PayPlus.mf_get_res("card_name"); // 카드사 명
+					app_time = c_PayPlus.mf_get_res("app_time"); // 승인시간
+					app_no = c_PayPlus.mf_get_res("app_no"); // 승인번호
+					noinf = c_PayPlus.mf_get_res("noinf"); // 무이자 여부
+					quota = c_PayPlus.mf_get_res("quota"); // 할부 개월 수
+					partcanc_yn = c_PayPlus.mf_get_res("partcanc_yn"); // 부분취소 가능유무
+					card_bin_type_01 = c_PayPlus.mf_get_res("card_bin_type_01"); // 카드구분1
+					card_bin_type_02 = c_PayPlus.mf_get_res("card_bin_type_02"); // 카드구분2
+					card_mny = c_PayPlus.mf_get_res("card_mny"); // 카드결제금액*/
+
+					/* = -------------------------------------------------------------- = */
+					/* =   06-1.1. 복합결제(포인트+신용카드) 승인 결과 처리             = */
+					/* = -------------------------------------------------------------- = */
+					/*if (pnt_issue.equals("SCSK") || pnt_issue.equals("SCWB")) {
+						pnt_amount = c_PayPlus.mf_get_res("pnt_amount"); // 적립금액 or 사용금액
+						pnt_app_time = c_PayPlus.mf_get_res("pnt_app_time"); // 승인시간
+						pnt_app_no = c_PayPlus.mf_get_res("pnt_app_no"); // 승인번호
+						add_pnt = c_PayPlus.mf_get_res("add_pnt"); // 발생 포인트
+						use_pnt = c_PayPlus.mf_get_res("use_pnt"); // 사용가능 포인트
+						rsv_pnt = c_PayPlus.mf_get_res("rsv_pnt"); // 총 누적 포인트
+						total_amount = amount + pnt_amount;                    // 복합결제시 총 거래금액
+					}*/
+				}
+			}
+		}
+
+				/* = -------------------------------------------------------------------------- = */
+				/* =   06-2. 계좌이체 승인 결과 처리                                            = */
+				/* = -------------------------------------------------------------------------- = */
 
 		return result;
 	}

+ 0 - 60
src/main/java/com/style24/core/biz/web/TscKcpController.java

@@ -1,60 +0,0 @@
-package com.style24.core.biz.web;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import com.gagaframework.web.parameter.GagaMap;
-import com.style24.core.biz.service.TscKcpService;
-import com.style24.core.biz.service.TscOrderService;
-import com.style24.persistence.domain.Order;
-
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * KCP PG Controller
- * @author xodud1202
- * @since 2021. 03. 02
- */
-@Controller
-@RequestMapping("/kcp")
-@Slf4j
-public class TscKcpController {
-	@Autowired
-	private TscKcpService kcpService;
-
-	@Autowired
-	private TscOrderService orderService;
-
-	@Autowired
-	private Environment env;
-
-	/**
-	 * KCP ORDER
-	 * @return
-	 * @author xodud1202
-	 * @since 2021. 01. 28
-	 */
-	@ResponseBody
-	@PostMapping("/test")
-	public GagaMap kcpTest(Order param, HttpServletRequest request, HttpServletResponse response) {
-		GagaMap result = new GagaMap();
-		try {
-			request.setCharacterEncoding("euc-kr");
-
-			//result = kcpService.kcpOrderRequest(param, request, response);
-			result.put("message", "SUCCESS");
-		} catch (Exception e) {
-
-		}
-
-		return result;
-	}
-}

+ 20 - 0
src/main/java/com/style24/core/support/env/TscConstants.java

@@ -330,6 +330,26 @@ public class TscConstants {
 		}
 	}
 
+	// PG 구분
+	public enum PgGb {
+		INICIS("INICIS"),	// 이니시스
+		KAKAO("KAKAO"),		// 카카오페이
+		KCP("KCP"),			// KCP
+		NAVER("NAVER"),		// NAVERPAY
+		NICE("NICE"),		// NICEPAY
+		PAYCO("PAYCO");		// PAYCO
+
+		private String value;
+
+		private PgGb(String value) {
+			this.value = value;
+		}
+
+		public String value() {
+			return value;
+		}
+	}
+
 	// 배송비구분
 	public enum DeliveryFeeGb {
 		ORIGIN_DELIVERY_FEE("G018_10"),		// 원주문배송비

+ 35 - 1
src/main/java/com/style24/persistence/domain/Payment.java

@@ -18,16 +18,50 @@ import lombok.Data;
 @SuppressWarnings("serial")
 @Data
 public class Payment extends TscBaseDomain {
+	// TB_PAYMENT
+	private int paySq;				// 결제 일련번호
+	private int ordNo;				// 주문번호
+	private int payAmt;				// 결제금액
+	private int pgCpnAmt;			// PG 쿠폰할인금
+	private int npayPntAmt;			// 네이버페이 포인트 할인금
+	private int ordChgSq;			// 주문변경일련번호
+	private String payGb;			// 결제구분(O:주문시결제, D:배송시결제, E:에러(강제 결제 태울 때 또는 에러일 때)
+	private String payDt;			// 결제일자
+	private String pgMeans;			// 결제수단
+	private String pgGb;			// PG구분
+	private String pgTid;			// PG TID
+	private String pgTradeNo;		// PG거래번호(승인번호)
+	private String pgShopId;		// PG가맹점ID
+	private String cardType;		// PG 카드 유형 (Y:체크카드, N:신용카드, G:기프트카드) 결제수단이 "30:신용카드"일 때 사용. PG사에서 받은 값
+	private String cardKind;		// 카드종류. 결제수단이 "30:신용카드"일 때 사용. PG사에서 받은 값
+	private String cardBank;		// 카드발급은행. 결제수단이 "30:신용카드"일 때 사용. PG사에서 받은 값
+	private String cartNm;			// 카드명. 결제수단이 "30:신용카드"일 때 사용. PG사에서 받은 값
+	private String cartMips;		// 카드할부개월수. 결제수단이 "30:신용카드"일 때 사용. PG사에서 받은 값
+	private String cardPcableYn;	// 부분취소가능여부
+	private String vaNo;			// 가상계좌번호. 결제수단이 "20:무통장입금일" 때 사용
+	private String vaNm;			// 가상계좌예금주명. 결제수단이 "20:무통장입금일" 때 사용
+	private String vaBank;			// 가상계좌은행(공통코드G940). 결제수단이 "20:무통장입금일" 때 사용
+	private String vaDeadline;		// 무통장입금마감일시. 결제수단이 "20:무통장입금일" 때 사용
+	private String telecom;			// 통신사.결제수단이 휴대폰결제인경우만 사용
+	private String escrowYn;		// 에스크로 여부
+
 	// KCP
+	private int shopUserId;			// 쇼핑몰 회원 ID (CUST_NO)
 	private int quotaopt;			// 할부옵션
 	private int goodMny;			// 결제금액
+	private int ordrIdxx;			// 주문번호
+	private int amount;				// KCP 실제 거래 금액
+	private int couponMny;			// 쿠폰금액
+	private String pntIssue;		// 결제 포인트사 코드
+	private String tno;				// KCP 거래 고유 번호
+	private String paycoDirect;		// Y : PAYCO, N : KCP PG
+	private String payMthod;		// PAYCO일때 송부
 	private String reqTx;			// 요청종류 (승인 : pay, 취소, 매입 : mod)
 	private String siteCd;			// 회사코드
 	private String siteName;		// 사이트명
 	private String currency;		// 결제 화폐단위
 	private String moduleType;		// 모듈타입
 	private String payMethod;		// 지불 방법(신용카드 : 100000000000, 계좌이체 : 010000000000, 가상계좌 : 001000000000, 포인트   : 000100000000, 휴대폰   : 000010000000, 상품권   : 000000001000, ARS      : 000000000010)
-	private String ordrIdxx;		// 주문번호
 	private String goodName;		// 상품명
 	private String buyrName;		// 주문자명
 	private String buyrMail;		// 주문자 E-MAIL