카카오페이 (KG 이니시스) 결제모듈 수정
This commit is contained in:
@ -196,6 +196,10 @@ if( ! isset($config['cf_icode_token_key']) ){
|
||||
if( function_exists('pg_setting_check') ){
|
||||
pg_setting_check(true);
|
||||
}
|
||||
|
||||
if(!$default['de_kakaopay_cancelpwd']){
|
||||
$default['de_kakaopay_cancelpwd'] = '1111';
|
||||
}
|
||||
?>
|
||||
|
||||
<form name="fconfig" action="./configformupdate.php" onsubmit="return fconfig_check(this)" method="post" enctype="MULTIPART/FORM-DATA">
|
||||
@ -845,42 +849,44 @@ if( function_exists('pg_setting_check') ){
|
||||
</tr>
|
||||
<tr class="kakao_info_fld">
|
||||
<th scope="row">
|
||||
<label for="de_kakaopay_mid">카카오페이 상점MID</label>
|
||||
<a href="http://sir.kr/main/service/kakaopay.php" target="_blank" class="kakao_btn">카카오페이 서비스신청하기</a>
|
||||
<label for="de_kakaopay_mid">카카오페이 상점아이디<br>( KG이니시스 )</label>
|
||||
<a href="http://sir.kr/main/service/kakaopay.php?kk=yc5" target="_blank" class="kakao_btn">카카오페이 서비스신청하기</a>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo help("카카오페이로 부터 발급 받으신 상점아이디(MID) 10자리 중 첫 KHSIR과 끝 m 을 제외한 영문4자리를 입력 합니다. 예) KHSIRtestm"); ?>
|
||||
<span class="sitecode">KHSIR</span> <input type="text" name="de_kakaopay_mid" value="<?php echo $default['de_kakaopay_mid']; ?>" id="de_kakaopay_mid" class="frm_input code_input" size="5" maxlength="4"> <span class="sitecode">m</span>
|
||||
<?php echo help("KG이니시스로 부터 카카오페이 간편결제만 사용용도로 발급 받으신 상점아이디(MID) 10자리 중 SIRK 을 제외한 나머지 6자리를 입력 합니다."); ?>
|
||||
<span class="sitecode">SIRK</span> <input type="text" name="de_kakaopay_mid" value="<?php echo $default['de_kakaopay_mid']; ?>" id="de_kakaopay_mid" class="frm_input code_input" size="10" maxlength="7">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="kakao_info_fld">
|
||||
<th scope="row"><label for="de_kakaopay_key">카카오페이 상점키</label></th>
|
||||
<th scope="row"><label for="de_kakaopay_key">카카오페이 상점키<br>( KG이니시스 )</label></th>
|
||||
<td>
|
||||
<?php echo help("카카오페이로 부터 발급 받으신 상점 서명키를 입력합니다."); ?>
|
||||
<?php echo help("SIRK****** 아이디로 KG이니시스에서 발급받은 웹결제 사인키를 입력합니다.\nKG이니시스 상점관리자 > 상점정보 > 계약정보 > 부가정보의 웹결제 signkey생성 조회 버튼 클릭, 팝업창에서 생성 버튼 클릭 후 해당 값을 입력합니다."); ?>
|
||||
<input type="text" name="de_kakaopay_key" value="<?php echo $default['de_kakaopay_key']; ?>" id="de_kakaopay_key" class="frm_input" size="100">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="kakao_info_fld">
|
||||
<th scope="row"><label for="de_kakaopay_enckey">카카오페이 상점 EncKey</label></th>
|
||||
<th scope="row"><label for="de_kakaopay_cancelpwd">카카오페이 키패스워드<br>( KG이니시스 )</label></th>
|
||||
<td>
|
||||
<?php echo help("카카오페이로 부터 발급 받으신 상점 인증 전용 EncKey를 입력합니다."); ?>
|
||||
<input type="text" name="de_kakaopay_enckey" value="<?php echo $default['de_kakaopay_enckey']; ?>" id="de_kakaopay_enckey" class="frm_input" size="20">
|
||||
<?php echo help("SIRK****** 아이디로 KG이니시스에서 발급받은 4자리 상점 키패스워드를 입력합니다.\nKG이니시스 상점관리자 패스워드와 관련이 없습니다.\n키패스워드 값을 확인하시려면 상점측에 발급된 키파일 안의 readme.txt 파일을 참조해 주십시오"); ?>
|
||||
<input type="text" name="de_kakaopay_cancelpwd" value="<?php echo $default['de_kakaopay_cancelpwd']; ?>" id="de_kakaopay_cancelpwd" class="frm_input" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="kakao_info_fld">
|
||||
<th scope="row">
|
||||
<label for="de_kakaopay_enckey">카카오페이 사용</label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo help("체크시 카카오페이 (KG 이니시스)를 사용합니다. <br >KG 이니시스의 SIRK****** 아이디를 받은 상점만 해당됩니다.", 50); ?>
|
||||
<input type="checkbox" name="de_kakaopay_enckey" value="1" id="de_kakaopay_enckey"<?php echo $default['de_kakaopay_enckey']?' checked':''; ?>> <label for="de_kakaopay_enckey">사용</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="kakao_info_fld" style="display:none">
|
||||
<th scope="row"><label for="de_kakaopay_hashkey">카카오페이 상점 HashKey</label></th>
|
||||
<td>
|
||||
<?php echo help("카카오페이로 부터 발급 받으신 상점 인증 전용 HashKey를 입력합니다."); ?>
|
||||
<input type="text" name="de_kakaopay_hashkey" value="<?php echo $default['de_kakaopay_hashkey']; ?>" id="de_kakaopay_hashkey" class="frm_input" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="kakao_info_fld">
|
||||
<th scope="row"><label for="de_kakaopay_cancelpwd">카카오페이 결제취소 비밀번호</label></th>
|
||||
<td>
|
||||
<?php echo help("카카오페이 상점관리자에서 설정하신 취소 비밀번호를 입력합니다.<br>입력하신 비밀번호와 상점관리자에서 설정하신 비밀번호가 일치하지 않으면 취소가 되지 않습니다."); ?>
|
||||
<input type="text" name="de_kakaopay_cancelpwd" value="<?php echo $default['de_kakaopay_cancelpwd']; ?>" id="de_kakaopay_cancelpwd" class="frm_input" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="naver_info_fld">
|
||||
<th scope="row">
|
||||
<label for="de_naverpay_mid">네이버페이 가맹점 아이디</label>
|
||||
|
||||
@ -237,6 +237,14 @@ foreach( $check_sanitize_keys as $key ){
|
||||
$$key = isset($_POST[$key]) ? strip_tags(clean_xss_attributes($_POST[$key])) : '';
|
||||
}
|
||||
|
||||
$warning_msg = '';
|
||||
|
||||
if( $de_kakaopay_enckey && ($de_pg_service === 'inicis' || $de_inicis_lpay_use || $de_inicis_kakaopay_use) ){
|
||||
|
||||
$warning_msg = 'KG 이니시스 결제 또는 L.pay 또는 KG이니시스 카카오페이를 사용시 결제모듈 중복문제로 카카오페이를 활성화 할수 없습니다. \\n\\n카카오페이 사용을 비활성화 합니다.';
|
||||
$de_kakaopay_enckey = '';
|
||||
}
|
||||
|
||||
//
|
||||
// 영카트 default
|
||||
//
|
||||
@ -436,5 +444,9 @@ $sql = " update {$g5['config_table']}
|
||||
cf_lg_mert_key = '{$cf_lg_mert_key}' ";
|
||||
sql_query($sql);
|
||||
|
||||
goto_url("./configform.php");
|
||||
?>
|
||||
if( $warning_msg ){
|
||||
alert($warning_msg, "./configform.php");
|
||||
} else {
|
||||
goto_url("./configform.php");
|
||||
}
|
||||
?>
|
||||
@ -380,7 +380,8 @@ if($od['od_pg'] == 'lg') {
|
||||
|
||||
if($od['od_settle_case'] == 'KAKAOPAY')
|
||||
{
|
||||
$card_receipt_script = 'window.open(\'https://mms.cnspay.co.kr/trans/retrieveIssueLoader.do?TID='.$od['od_tno'].'&type=0\', \'popupIssue\', \'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=420,height=540\');';
|
||||
//$card_receipt_script = 'window.open(\'https://mms.cnspay.co.kr/trans/retrieveIssueLoader.do?TID='.$od['od_tno'].'&type=0\', \'popupIssue\', \'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=420,height=540\');';
|
||||
$card_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');';
|
||||
?>
|
||||
<a href="javascript:;" onclick="<?php echo $card_receipt_script; ?>">영수증 출력</a>
|
||||
<?php
|
||||
|
||||
@ -1,155 +0,0 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_LIB_PATH.'/json.lib.php');
|
||||
|
||||
/**
|
||||
* 2014.12.02 : 인증요청 송신 전문 외 항목 제거
|
||||
*/
|
||||
|
||||
include(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
|
||||
include(G5_SHOP_PATH.'/kakaopay/lgcns_KMpay.php');
|
||||
|
||||
function KMPayRequest($key) {
|
||||
return (isset($_REQUEST[$key])?$_REQUEST[$key]:"");
|
||||
}
|
||||
|
||||
// 로그 저장 위치 지정
|
||||
$kmFunc = new kmpayFunc($LogDir);
|
||||
$kmFunc->setPhpVersion($phpVersion);
|
||||
|
||||
// TXN_ID를 요청하기 위한 PARAMETERR
|
||||
$REQUESTDEALAPPROVEURL = KMPayRequest("requestDealApproveUrl"); //인증 요청 경로
|
||||
$PR_TYPE = KMPayRequest("prType"); //결제 요청 타입
|
||||
$MERCHANT_ID = KMPayRequest("MID"); //가맹점 ID
|
||||
$MERCHANT_TXN_NUM = KMPayRequest("merchantTxnNum"); //가맹점 거래번호
|
||||
$channelType = KMPayRequest("channelType");
|
||||
$PRODUCT_NAME = KMPayRequest("GoodsName"); //상품명
|
||||
$AMOUNT = KMPayRequest("Amt"); //상품금액(총거래금액) (총거래금액 = 공급가액 + 부가세 + 봉사료)
|
||||
|
||||
$CURRENCY = KMPayRequest("currency"); //거래통화(KRW/USD/JPY 등)
|
||||
$RETURN_URL = KMPayRequest("returnUrl"); //결제승인결과전송URL
|
||||
$CERTIFIED_FLAG = KMPayRequest("CERTIFIED_FLAG"); //가맹점 인증 구분값 ("N","NC")
|
||||
|
||||
$OFFER_PERIOD_FLAG = KMPayRequest("OFFER_PERIOD_FLAG"); //상품제공기간 플래그
|
||||
$OFFER_PERIOD = KMPayRequest("OFFER_PERIOD"); //상품제공기간
|
||||
|
||||
|
||||
//무이자옵션
|
||||
$NOINTYN = KMPayRequest("noIntYN"); //무이자 설정
|
||||
$NOINTOPT = KMPayRequest("noIntOpt"); //무이자 옵션
|
||||
$MAX_INT =KMPayRequest("maxInt"); //최대할부개월
|
||||
$FIXEDINT = KMPayRequest("fixedInt"); //고정할부개월
|
||||
$POINT_USE_YN = KMPayRequest("pointUseYn"); //카드사포인트사용여부
|
||||
$POSSICARD = KMPayRequest("possiCard"); //결제가능카드설정
|
||||
$BLOCK_CARD = KMPayRequest("blockCard"); //금지카드설정
|
||||
|
||||
// 복합과세
|
||||
if($default['de_tax_flag_use']) {
|
||||
$SUPPLY_AMT = KMPayRequest("SupplyAmt"); // 공급가액
|
||||
$GOODS_VAT = KMPayRequest("GoodsVat"); // 부가가치세
|
||||
$SERVICE_AMT = KMPayRequest("ServiceAmt"); // 봉사료
|
||||
}
|
||||
|
||||
// ENC KEY와 HASH KEY는 가맹점에서 생성한 KEY 로 SETTING 한다.
|
||||
$merchantEncKey = KMPayRequest("merchantEncKey");
|
||||
$merchantHashKey = KMPayRequest("merchantHashKey");
|
||||
$hashTarget = $MERCHANT_ID.$MERCHANT_TXN_NUM.str_pad($AMOUNT,7,"0",STR_PAD_LEFT);
|
||||
|
||||
// payHash 생성
|
||||
$payHash = strtoupper(hash("sha256", $hashTarget.$merchantHashKey, false));
|
||||
|
||||
//json string 생성
|
||||
$strJsonString = new JsonString($LogDir);
|
||||
|
||||
$strJsonString->setValue("PR_TYPE", $PR_TYPE);
|
||||
$strJsonString->setValue("channelType", $channelType);
|
||||
$strJsonString->setValue("MERCHANT_ID", $MERCHANT_ID);
|
||||
$strJsonString->setValue("MERCHANT_TXN_NUM", $MERCHANT_TXN_NUM);
|
||||
$strJsonString->setValue("PRODUCT_NAME", $PRODUCT_NAME);
|
||||
|
||||
$strJsonString->setValue("AMOUNT", $AMOUNT);
|
||||
|
||||
$strJsonString->setValue("CURRENCY", $CURRENCY);
|
||||
$strJsonString->setValue("CERTIFIED_FLAG", $CERTIFIED_FLAG);
|
||||
|
||||
$strJsonString->setValue("OFFER_PERIOD_FLAG", $OFFER_PERIOD_FLAG);
|
||||
$strJsonString->setValue("OFFER_PERIOD", $OFFER_PERIOD);
|
||||
|
||||
$strJsonString->setValue("NO_INT_YN", $NOINTYN);
|
||||
$strJsonString->setValue("NO_INT_OPT", $NOINTOPT);
|
||||
$strJsonString->setValue("MAX_INT", $MAX_INT);
|
||||
$strJsonString->setValue("FIXED_INT", $FIXEDINT);
|
||||
|
||||
$strJsonString->setValue("POINT_USE_YN", $POINT_USE_YN);
|
||||
$strJsonString->setValue("POSSI_CARD", $POSSICARD);
|
||||
$strJsonString->setValue("BLOCK_CARD", $BLOCK_CARD);
|
||||
|
||||
// 복합과세
|
||||
if($default['de_tax_flag_use']) {
|
||||
$strJsonString->setValue("SUPPLY_AMT", $SUPPLY_AMT);
|
||||
$strJsonString->setValue("GOODS_VAT", $GOODS_VAT);
|
||||
$strJsonString->setValue("SERVICE_AMT", $SERVICE_AMT);
|
||||
}
|
||||
|
||||
$strJsonString->setValue("PAYMENT_HASH", $payHash);
|
||||
|
||||
// 결과값을 담는 부분
|
||||
$resultCode = "";
|
||||
$resultMsg = "";
|
||||
$txnId = "";
|
||||
$merchantTxnNum = "";
|
||||
$prDt = "";
|
||||
$strValid = "";
|
||||
|
||||
// Data 검증
|
||||
$dataValidator = new KMPayDataValidator($strJsonString->getArrayValue());
|
||||
$strValid = $dataValidator->resultValid;
|
||||
if (strlen($strValid) > 0) {
|
||||
$arrVal = explode(",", $strValid);
|
||||
if (count($arrVal) == 3) {
|
||||
$resultCode = $arrVal[1];
|
||||
$resultMsg = $arrVal[2];
|
||||
} else {
|
||||
$resultCode = $strValid;
|
||||
$resultMsg = $strValid;
|
||||
}
|
||||
}
|
||||
|
||||
// Data에 이상 없는 경우
|
||||
if (strlen($strValid) == 0) {
|
||||
// CBC 암호화
|
||||
$paramStr = $strJsonString->getJsonString();
|
||||
$kmFunc->writeLog("Request");
|
||||
$kmFunc->writeLog($paramStr);
|
||||
$kmFunc->writeLog($strJsonString->getArrayValue());
|
||||
$encryptStr = $kmFunc->parameterEncrypt($merchantEncKey, $paramStr);
|
||||
$payReqResult = $kmFunc->connMPayDLP($REQUESTDEALAPPROVEURL, $MERCHANT_ID, $encryptStr);
|
||||
$resultString = $kmFunc->parameterDecrypt($merchantEncKey, $payReqResult);
|
||||
|
||||
$resultJSONObject = new JsonString($LogDir);
|
||||
if (substr($resultString, 0, 1) == "{") {
|
||||
$resultJSONObject->setJsonString($resultString);
|
||||
$resultCode = $resultJSONObject->getValue("RESULT_CODE");
|
||||
$resultMsg = $resultJSONObject->getValue("RESULT_MSG");
|
||||
if ($resultCode == "00") {
|
||||
$txnId = $resultJSONObject->getValue("TXN_ID");
|
||||
$merchantTxnNum = $resultJSONObject->getValue("MERCHANT_TXN_NUM");
|
||||
$prDt = $resultJSONObject->getValue("PR_DT");
|
||||
}
|
||||
}
|
||||
$kmFunc->writeLog("Result");
|
||||
$kmFunc->writeLog($resultString);
|
||||
$kmFunc->writeLog($resultJSONObject->getArrayValue());
|
||||
}
|
||||
|
||||
$result = array();
|
||||
|
||||
$result = array(
|
||||
'resultCode' => $resultCode,
|
||||
'resultMsg' => $resultMsg,
|
||||
'txnId' => $txnId,
|
||||
'prDt' => $prDt
|
||||
);
|
||||
|
||||
die(json_encode($result));
|
||||
?>
|
||||
@ -1,43 +1,59 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
//인증,결제 및 웹 경로
|
||||
$CNSPAY_WEB_SERVER_URL = 'https://kmpay.lgcns.com:8443';
|
||||
$targetUrl = 'https://kmpay.lgcns.com:8443';
|
||||
$msgName = '/merchant/requestDealApprove.dev';
|
||||
$CnsPayDealRequestUrl = 'https://pg.cnspay.co.kr:443';
|
||||
// 카카오페이를 사용하지 않을 경우 return;
|
||||
if( ! $default['de_kakaopay_enckey'] ) return;
|
||||
|
||||
if ($default['de_card_test']) {
|
||||
$MID = 'cnstest25m';
|
||||
$merchantEncKey = '10a3189211e1dfc6';
|
||||
$merchantHashKey = '10a3189211e1dfc6';
|
||||
$cancelPwd = '123456';
|
||||
//가맹점서명키
|
||||
$merchantKey = '33F49GnCMS1mFYlGXisbUDzVf2ATWCl9k3R++d5hDd3Frmuos/XLx8XhXpe+LDYAbpGKZYSwtlyyLOtS/8aD7A==';
|
||||
} else {
|
||||
$MID = 'KHSIR'.$default['de_kakaopay_mid'].'m';
|
||||
$merchantEncKey = trim($default['de_kakaopay_enckey']);
|
||||
$merchantHashKey = trim($default['de_kakaopay_hashkey']);
|
||||
$cancelPwd = trim($default['de_kakaopay_cancelpwd']);
|
||||
//가맹점서명키
|
||||
$merchantKey = trim($default['de_kakaopay_key']);
|
||||
if( !isset($is_mobile_order) ){
|
||||
$is_mobile_order = is_mobile();
|
||||
}
|
||||
|
||||
//버전
|
||||
$phpVersion = 'PLP-0.1.1.3';
|
||||
if( $is_mobile_order ){
|
||||
include_once(G5_MSHOP_PATH.'/settle_inicis.inc.php');
|
||||
|
||||
//로그 경로
|
||||
$LogDir = G5_SHOP_PATH.'/kakaopay/log';
|
||||
if ( $default['de_card_test']) {
|
||||
if ($default['de_escrow_use'] == 1) {
|
||||
$default['de_kakaopay_mid'] = 'iniescrow0';
|
||||
$default['de_kakaopay_cancelpwd'] = '1111';
|
||||
} else {
|
||||
$default['de_kakaopay_mid'] = 'INIpayTest';
|
||||
$default['de_kakaopay_cancelpwd'] = '1111';
|
||||
}
|
||||
} else {
|
||||
$default['de_kakaopay_mid'] = 'SIRK'.$default['de_kakaopay_mid'];
|
||||
}
|
||||
|
||||
// TXN_ID를 가져오기 위해 세팅
|
||||
$ediDate = date("YmdHis"); // 전문생성일시
|
||||
$noti_url = G5_SHOP_URL.'/kakaopay/mobile_settle_common.php';
|
||||
$next_url = G5_SHOP_URL.'/kakaopay/mobile_pay_approval.php';
|
||||
$return_url = G5_SHOP_URL.'/kakaopay/mobile_pay_return.php?oid=';
|
||||
|
||||
$_REQUEST['PayMethod'] = 'KAKAOPAY';
|
||||
$_REQUEST['CERTIFIED_FLAG'] = 'CN';
|
||||
$_REQUEST['AuthFlg'] = '10';
|
||||
$_REQUEST['currency'] = 'KRW';
|
||||
$_REQUEST['MID'] = $MID;
|
||||
$_REQUEST['merchantEncKey'] = $merchantEncKey;
|
||||
$_REQUEST['merchantHashKey'] = $merchantHashKey;
|
||||
$_REQUEST['requestDealApproveUrl'] = $targetUrl.$msgName;
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
|
||||
if ($default['de_card_test']) {
|
||||
if ($default['de_escrow_use'] == 1) {
|
||||
$default['de_kakaopay_mid'] = 'iniescrow0';
|
||||
$default['de_kakaopay_key'] = 'SU5JTElURV9UUklQTEVERVNfS0VZU1RS';
|
||||
$default['de_kakaopay_cancelpwd'] = '1111';
|
||||
} else {
|
||||
$default['de_kakaopay_mid'] = 'INIpayTest';
|
||||
$default['de_kakaopay_key'] = 'SU5JTElURV9UUklQTEVERVNfS0VZU1RS';
|
||||
$default['de_kakaopay_cancelpwd'] = '1111';
|
||||
}
|
||||
|
||||
if( !(isset($stdpay_js_url) && $stdpay_js_url) ){
|
||||
$stdpay_js_url = 'https://stgstdpay.inicis.com/stdjs/INIStdPay.js';
|
||||
}
|
||||
} else {
|
||||
$default['de_kakaopay_mid'] = 'SIRK'.$default['de_kakaopay_mid'];
|
||||
|
||||
// 실 결제 URL
|
||||
if( !(isset($stdpay_js_url) && $stdpay_js_url) ){
|
||||
$stdpay_js_url = 'https://stdpay.inicis.com/stdjs/INIStdPay.js';
|
||||
}
|
||||
}
|
||||
|
||||
$returnUrl = G5_SHOP_URL.'/kakaopay/inicis_kk_return.php';
|
||||
?>
|
||||
85
shop/kakaopay/inicis_kk_return.php
Normal file
85
shop/kakaopay/inicis_kk_return.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/HttpClient.php');
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/json_lib.php');
|
||||
|
||||
// 카카오페이를 사용하지 않을 경우
|
||||
if( ! $default['de_kakaopay_enckey'] ) die('카카오페이를 사용하지 않습니다.');
|
||||
|
||||
@header("Progma:no-cache");
|
||||
@header("Cache-Control:no-cache,must-revalidate");
|
||||
|
||||
$request_mid = isset($_POST['mid']) ? clean_xss_tags($_POST['mid']) : '';
|
||||
|
||||
if( ($request_mid != $default['de_kakaopay_mid']) ){
|
||||
alert("요청된 mid 와 설정된 mid 가 틀립니다.");
|
||||
}
|
||||
|
||||
$orderNumber = isset($_POST['orderNumber']) ? preg_replace("/[ #\&\+%@=\/\\\:;,\.'\"\^`~|\!\?\*$#<>()\[\]\{\}]/i", "", strip_tags($_POST['orderNumber'])) : 0;
|
||||
$session_order_num = get_session('ss_order_id');
|
||||
|
||||
if( !$orderNumber ){
|
||||
alert("주문번호가 없습니다.");
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_order_data_table']} where od_id = '$orderNumber' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if( empty($row) ){
|
||||
alert("임시 주문정보가 저장되지 않았습니다.");
|
||||
}
|
||||
|
||||
if ( base64_encode(base64_decode($row['dt_data'], true)) === $row['dt_data']){
|
||||
$data = unserialize(base64_decode($row['dt_data']));
|
||||
} else {
|
||||
$data = unserialize($row['dt_data']);
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$var_datas = array();
|
||||
|
||||
foreach($data as $key=>$value) {
|
||||
if(is_array($value)) {
|
||||
foreach($value as $k=>$v) {
|
||||
$_POST[$key][$k] = $params[$key][$k] = clean_xss_tags(strip_tags($v));
|
||||
}
|
||||
} else {
|
||||
$_POST[$key] = $params[$key] = clean_xss_tags(strip_tags($value));
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data['pp_id']) && $data['pp_id']) { //개인결제
|
||||
|
||||
foreach($params as $key=>$value){
|
||||
|
||||
if( in_array($key, array('pp_name', 'pp_email', 'pp_hp', 'pp_settle_case')) ){
|
||||
|
||||
$var_datas[$key] = $value;
|
||||
|
||||
$$key = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
include_once(G5_SHOP_PATH.'/personalpayformupdate.php');
|
||||
|
||||
} else { //상점주문
|
||||
|
||||
foreach($params as $key=>$value){
|
||||
|
||||
if( in_array($key, array('od_price', 'od_name', 'od_tel', 'od_hp', 'od_email', 'od_memo', 'od_settle_case', 'max_temp_point', 'od_temp_point', 'od_bank_account', 'od_deposit_name', 'od_test', 'od_ip', 'od_zip', 'od_addr1', 'od_addr2', 'od_addr3', 'od_addr_jibeon', 'od_b_name', 'od_b_tel', 'od_b_hp', 'od_b_addr1', 'od_b_addr2', 'od_b_addr3', 'od_b_addr_jibeon', 'od_b_zip', 'od_send_cost', 'od_send_cost2', 'od_hope_date')) ){
|
||||
|
||||
$var_datas[$key] = $value;
|
||||
|
||||
$$key = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$od_send_cost = (int) $_POST['od_send_cost'];
|
||||
$od_send_cost2 = (int) $_POST['od_send_cost2'];
|
||||
|
||||
include_once(G5_SHOP_PATH.'/orderformupdate.php');
|
||||
}
|
||||
?>
|
||||
@ -1,39 +1,87 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
include_once(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
|
||||
include_once(G5_SHOP_PATH.'/kakaopay/lgcns_CNSpay.php');
|
||||
/*******************************************************************
|
||||
* 7. DB연동 실패 시 강제취소 *
|
||||
* *
|
||||
* 지불 결과를 DB 등에 저장하거나 기타 작업을 수행하다가 실패하는 *
|
||||
* 경우, 아래의 코드를 참조하여 이미 지불된 거래를 취소하는 코드를 *
|
||||
* 작성합니다. *
|
||||
*******************************************************************/
|
||||
|
||||
// 로그 저장 위치 지정
|
||||
$connector = new CnsPayWebConnector($LogDir);
|
||||
$connector->CnsActionUrl($CnsPayDealRequestUrl);
|
||||
$connector->CnsPayVersion($phpVersion);
|
||||
$connector->setRequestData($_REQUEST);
|
||||
$connector->addRequestData("actionType", "CL0");
|
||||
$connector->addRequestData("CancelPwd", $cancelPwd);
|
||||
$connector->addRequestData("CancelIP", $_SERVER['REMOTE_ADDR']);
|
||||
$cancelFlag = "true";
|
||||
|
||||
//가맹점키 셋팅 (MID 별로 틀림)
|
||||
$connector->addRequestData("EncodeKey", $merchantKey);
|
||||
// $cancelFlag를 "true"로 변경하는 condition 판단은 개별적으로
|
||||
// 수행하여 주십시오.
|
||||
|
||||
// 4. CNSPAY Lite 서버 접속하여 처리
|
||||
$connector->requestAction();
|
||||
if($cancelFlag == "true")
|
||||
{
|
||||
|
||||
// 5. 결과 처리
|
||||
$resultCode = $connector->getResultData("ResultCode"); // 결과코드 (정상 :2001(취소성공), 2002(취소진행중), 그 외 에러)
|
||||
$resultMsg = $connector->getResultData("ResultMsg"); // 결과메시지
|
||||
$cancelAmt = $connector->getResultData("CancelAmt"); // 취소금액
|
||||
$cancelDate = $connector->getResultData("CancelDate"); // 취소일
|
||||
$cancelTime = $connector->getResultData("CancelTime"); // 취소시간
|
||||
$payMethod = $connector->getResultData("PayMethod"); // 취소 결제수단
|
||||
$mid = $connector->getResultData("MID"); // 가맹점 ID
|
||||
$tid = $connector->getResultData("TID"); // TID
|
||||
$errorCD = $connector->getResultData("ErrorCD"); // 상세 에러코드
|
||||
$errorMsg = $connector->getResultData("ErrorMsg"); // 상세 에러메시지
|
||||
$authDate = $cancelDate . $cancelTime; // 거래시간
|
||||
$ccPartCl = $connector->getResultData("CcPartCl"); // 부분취소 가능여부 (0:부분취소불가, 1:부분취소가능)
|
||||
$stateCD = $connector->getResultData("StateCD"); // 거래상태코드 (0: 승인, 1:전취소, 2:후취소)
|
||||
$authDate = $connector->makeDateString($authDate);
|
||||
$errorMsg = iconv("euc-kr", "utf-8", $errorMsg);
|
||||
$resultMsg = iconv("euc-kr", "utf-8", $resultMsg);
|
||||
if( isset($is_noti_pay) && $is_noti_pay ){
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(G5_SHOP_PATH.'/settle_kakaopay.inc.php');
|
||||
|
||||
if( get_session('ss_order_id') && $tno ){
|
||||
|
||||
$ini_oid = preg_replace('/[^a-z0-9_\-]/i', '', get_session('ss_order_id'));
|
||||
$tno = preg_replace('/[^a-z0-9_\-]/i', '', $tno);
|
||||
|
||||
$sql = "select oid from {$g5['g5_shop_inicis_log_table']} where oid = '$ini_oid' and P_TID = '$tno' ";
|
||||
|
||||
$exists_log = sql_fetch($sql);
|
||||
|
||||
if( $exists_log['oid'] ){
|
||||
$sql = " update {$g5['g5_shop_inicis_log_table']}
|
||||
set P_STATUS = 'cancel',
|
||||
P_AUTH_DT = '".preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS)."' where oid = '$ini_oid' and P_TID = '$tno' ";
|
||||
} else {
|
||||
$sql = " insert into {$g5['g5_shop_inicis_log_table']}
|
||||
set oid = '$ini_oid',
|
||||
P_TID = '$tno',
|
||||
P_STATUS = 'cancel',
|
||||
P_AUTH_DT = '".preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS)."' ";
|
||||
}
|
||||
|
||||
sql_query($sql, false);
|
||||
}
|
||||
|
||||
$db_check = 1;
|
||||
$cancel_msg = "DB FAIL";
|
||||
|
||||
if( $is_admin ){
|
||||
$tmp = sql_fetch("select * from `{$g5['g5_shop_order_table']}` where od_tno = '".trim($_REQUEST['TID'])."' ");
|
||||
|
||||
if( $tmp['od_pg'] === 'KAKAOPAY' ){
|
||||
$tno = trim($_REQUEST['TID']);
|
||||
|
||||
$db_check = 0;
|
||||
$cancel_msg = isset($_REQUEST['CancelMsg']) ? iconv_euckr($_REQUEST['CancelMsg']) : iconv_euckr('관리자 승인 취소');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$TID = $tno;
|
||||
$inipay->SetField("type", "cancel"); // 고정
|
||||
if( $default['de_kakaopay_cancelpwd'] ){
|
||||
$inipay->SetField("mid", $default['de_kakaopay_mid']);
|
||||
$inipay->SetField("admin", $default['de_kakaopay_cancelpwd']);
|
||||
}
|
||||
$inipay->SetField("tid", $TID); // 고정
|
||||
$inipay->SetField("cancelmsg", $cancel_msg); // 취소사유
|
||||
$inipay->startAction();
|
||||
if($inipay->GetResult('ResultCode') == "00" && $db_check)
|
||||
{
|
||||
$inipay->MakeTXErrMsg(MERCHANT_DB_ERR,"Merchant DB FAIL");
|
||||
}
|
||||
|
||||
$res_cd = $inipay->getResult('ResultCode');
|
||||
$res_msg = $inipay->getResult('ResultMsg');
|
||||
|
||||
if($res_cd != '00') {
|
||||
$pg_res_cd = $res_cd;
|
||||
$pg_res_msg = iconv_utf8($res_msg);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -1,76 +1,29 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
include_once(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
|
||||
include_once(G5_SHOP_PATH.'/kakaopay/lgcns_CNSpay.php');
|
||||
if( isset($_POST['P_NOTI']) ){
|
||||
|
||||
// 로그 저장 위치 지정
|
||||
$connector = new CnsPayWebConnector($LogDir);
|
||||
$connector->CnsActionUrl($CnsPayDealRequestUrl);
|
||||
$connector->CnsPayVersion($phpVersion);
|
||||
$sql = " select * from {$g5['g5_shop_order_data_table']} where od_id = '".preg_replace("/\s+/", "", $_POST['P_NOTI'])."' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
// 요청 페이지 파라메터 셋팅
|
||||
$connector->setRequestData($_REQUEST);
|
||||
if ( base64_encode(base64_decode($row['dt_data'], true)) === $row['dt_data']){
|
||||
$data = unserialize(base64_decode($row['dt_data']));
|
||||
} else {
|
||||
$data = unserialize($row['dt_data']);
|
||||
}
|
||||
|
||||
// 추가 파라메터 셋팅
|
||||
$connector->addRequestData("actionType", "PY0"); // actionType : CL0 취소, PY0 승인, CI0 조회
|
||||
$connector->addRequestData("MallIP", $_SERVER['REMOTE_ADDR']); // 가맹점 고유 ip
|
||||
$connector->addRequestData("CancelPwd", $cancelPwd);
|
||||
|
||||
//가맹점키 셋팅 (MID 별로 틀림)
|
||||
$connector->addRequestData("EncodeKey", $merchantKey);
|
||||
|
||||
// 4. CNSPAY Lite 서버 접속하여 처리
|
||||
$connector->requestAction();
|
||||
|
||||
// 5. 결과 처리
|
||||
$buyerName = $_REQUEST["BuyerName"]; // 구매자명
|
||||
$goodsName = $_REQUEST["GoodsName"]; // 상품명
|
||||
// $buyerName = iconv("euc-kr", "utf-8", $connector->getResultData("BuyerName")); // 구매자명
|
||||
// $goodsName = iconv("euc-kr", "utf-8", $connector->getResultData("GoodsName")); // 상품명
|
||||
|
||||
$resultCode = $connector->getResultData("ResultCode"); // 결과코드 (정상 :3001 , 그 외 에러)
|
||||
$resultMsg = $connector->getResultData("ResultMsg"); // 결과메시지
|
||||
$authDate = $connector->getResultData("AuthDate"); // 승인일시 YYMMDDHH24mmss
|
||||
$authCode = $connector->getResultData("AuthCode"); // 승인번호
|
||||
$payMethod = $connector->getResultData("PayMethod"); // 결제수단
|
||||
$mid = $connector->getResultData("MID"); // 가맹점ID
|
||||
$tid = $connector->getResultData("TID"); // 거래ID
|
||||
$moid = $connector->getResultData("Moid"); // 주문번호
|
||||
$amt = $connector->getResultData("Amt"); // 금액
|
||||
$cardCode = $connector->getResultData("CardCode"); // 카드사 코드
|
||||
$cardName = $connector->getResultData("CardName"); // 결제카드사명
|
||||
$cardQuota = $connector->getResultData("CardQuota"); // 00:일시불,02:2개월
|
||||
$cardInterest = $connector->getResultData("CardInterest"); // 무이자 여부 (0:일반, 1:무이자)
|
||||
$cardCl = $connector->getResultData("CardCl"); // 체크카드여부 (0:일반, 1:체크카드)
|
||||
$cardBin = $connector->getResultData("CardBin"); // 카드BIN번호
|
||||
$cardPoint = $connector->getResultData("CardPoint"); // 카드사포인트사용여부 (0:미사용, 1:포인트사용, 2:세이브포인트사용)
|
||||
$paySuccess = false; // 결제 성공 여부
|
||||
|
||||
$nonRepToken =$_REQUEST["NON_REP_TOKEN"]; //부인방지토큰값
|
||||
|
||||
|
||||
$resultMsg = iconv("euc-kr", "utf-8", $resultMsg);
|
||||
$cardName = iconv("euc-kr", "utf-8", $cardName);
|
||||
|
||||
/** 위의 응답 데이터 외에도 전문 Header와 개별부 데이터 Get 가능 */
|
||||
if($payMethod == "CARD"){ //신용카드
|
||||
if($resultCode == "3001") $paySuccess = true; // 결과코드 (정상 :3001 , 그 외 에러)
|
||||
if( isset($data['is_inicis_mobile_kakaopay']) && $data['is_inicis_mobile_kakaopay'] == 'mobile' ){
|
||||
|
||||
include G5_SHOP_PATH.'/kakaopay/mobile_pay_result.php';
|
||||
return;
|
||||
}
|
||||
}
|
||||
if($paySuccess) {
|
||||
$tno = $tid;
|
||||
$amount = $amt;
|
||||
$app_time = '20'.$authDate;
|
||||
$bank_name = $cardName;
|
||||
$depositor = '';
|
||||
$account = '';
|
||||
$commid = $cardCode;
|
||||
$mobile_no = '';
|
||||
$app_no = $authCode;
|
||||
$card_name = $cardName;
|
||||
$pay_type = 'CARD';
|
||||
$escw_yn = '0';
|
||||
} else {
|
||||
alert('[RESULT_CODE] : ' . $resultCode . '\\n[RESULT_MSG] : ' . $resultMsg);
|
||||
|
||||
if( isset($_REQUEST['P_STATUS']) && isset($_REQUEST['P_TID']) && isset($_REQUEST['P_REQ_URL']) && isset($_POST['P_NOTI']) && isset($_POST['P_AMT']) ){
|
||||
include G5_SHOP_PATH.'/kakaopay/mobile_pay_result.php';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
include G5_SHOP_PATH.'/kakaopay/pc_pay_result.php';
|
||||
return;
|
||||
?>
|
||||
@ -1,475 +0,0 @@
|
||||
<?php
|
||||
// 버전 1.0 : 2014/11/06 문석호, 최초 작성
|
||||
/**
|
||||
* 2014.12.02 : 1) 로깅 시 주요 정보 마스킹 처리, 2) PayMethod key check
|
||||
*/
|
||||
class CnsPayWebConnector {
|
||||
private $LogPath = "";
|
||||
private $ActionUrl = "";
|
||||
private $cancelUrl = "";
|
||||
private $phpVersion = "";
|
||||
private $encodeKey = "";
|
||||
private $requestData = array();
|
||||
private $resultData = array();
|
||||
public function CnsActionUrl($url) {
|
||||
$this->ActionUrl = $url;
|
||||
}
|
||||
public function CnsPayVersion($ver) {
|
||||
$this->phpVersion = $ver;
|
||||
}
|
||||
public function CnsPayWebConnector($LogDir) {
|
||||
$this->cancelUrl = $this->ActionUrl."/lite/cancelProcess.jsp";
|
||||
if (substr($LogDir, strlen($LogDir) - 1) == "/") {
|
||||
$LogDir = substr($LogDir, 0, strlen($LogDir) - 1);
|
||||
}
|
||||
@mkdir($LogDir);
|
||||
$this->LogPath = $LogDir."/";
|
||||
}
|
||||
public function setRequestData($request) {
|
||||
try {
|
||||
foreach (array_keys($request) as $key) {
|
||||
if(is_array($request[$key]))
|
||||
continue;
|
||||
|
||||
$this->requestData[$key] = iconv("UTF-8", "EUC-KR", $request[$key]);
|
||||
}
|
||||
return "_TRUE_";
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("setRequestData() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function addRequestData($key, $value) {
|
||||
try {
|
||||
$this->requestData[$key] = $value;
|
||||
return "_TRUE_";
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("addRequestData() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function getResultData($key) {
|
||||
try {
|
||||
if (!in_array($key, array_keys($this->resultData))) {
|
||||
return "";
|
||||
} else if ($key == "Amt") {
|
||||
if ($this->resultData[$key] != null && $this->resultData[$key] != "null" && $this->resultData[$key] != "") {
|
||||
return $this->resultData[$key];
|
||||
} else {
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
return $this->resultData[$key];
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("getResultData() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
|
||||
// 2014.12.02 추가 (check key in array)
|
||||
private function getRequestData($key) {
|
||||
if (array_key_exists($key, $this->requestData)) {
|
||||
return $this->requestData[$key];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public function requestAction() {
|
||||
$encodeKey = $this->requestData["EncodeKey"];
|
||||
unset($this->requestData["EncodeKey"]);
|
||||
try {
|
||||
if ($this->requestData["actionType"] != "CL0" && $this->requestData["actionType"] != "CI0") {
|
||||
if ($this->getRequestData("PayMethod") != "ESCROW") {
|
||||
$this->requestData["TID"] = $this->generateTID($this->requestData["MID"], $this->getRequestData("PayMethod"));
|
||||
}
|
||||
}
|
||||
$serviceUrl = $this->setActionType($this->requestData["actionType"], $this->getRequestData("PayMethod"));
|
||||
if ($serviceUrl == "_FAIL_" || $serviceUrl == "CNSPAY_10") {
|
||||
$this->resultData["ResultCode"] = "JL10";
|
||||
$this->resultData["ResultMsg"] = "actionType 설정이 잘못되었습니다.";
|
||||
return "_FAIL_";
|
||||
}
|
||||
$this->writeLog("Request");
|
||||
$this->writeLog($this->requestData);
|
||||
$requestMessage = $this->makeRequestText($this->requestData);
|
||||
$resultMessage = $this->connectToServer($serviceUrl, $requestMessage);
|
||||
$this->writeLog("Result");
|
||||
// 2014.12.02 수신 전문 로깅 처리 제외
|
||||
//$this->writeLog($resultMessage);
|
||||
if ($resultMessage == "_FAIL_" || substr($resultMessage, 0, 4) == "FAIL") {
|
||||
$resultCode = "";
|
||||
$resultMsg = "";
|
||||
$netCancelFlag = $this->requestNetCancel();
|
||||
if ($netCancelFlag == "_TRUE_") {
|
||||
$resultCode = "JL32";
|
||||
$resultMsg = "PGWEB서버 통신중 오류가 발생하였습니다. (NET_CANCEL)";
|
||||
} else { // netCancel 실패이면,
|
||||
$resultCode = "JL33";
|
||||
$resultMsg = "네트웍이 불안정으로 승인 실패하였습니다. 결제가 비 정상 처리 될 수 있으니 거래내역을 반드시 확인해주십시오.";
|
||||
}
|
||||
$this->resultData["ResultCode"] = $resultCode;
|
||||
$this->resultData["ResultMsg"] = $resultMsg;
|
||||
return "_FAIL_";
|
||||
}
|
||||
$resultMessage = $this->parseResult($resultMessage);
|
||||
//$this->writeLog($this->resultData);
|
||||
// 2014.12.02 로깅 시 주요 데이터 마스킹 처리
|
||||
$this->writeLog($this->resultDataMask($this->resultData));
|
||||
if ($resultMessage == "_FAIL_" || $resultMessage == "CNSPAY_41") {
|
||||
$this->resultData["ResultCode"] = "JL41";
|
||||
$this->resultData["ResultMsg"] = "응답전문이 없습니다.";
|
||||
return "_FAIL_";
|
||||
}
|
||||
return "_TRUE_";
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("requestAction() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
|
||||
// 2014.12.02 결과 배열 마스킹
|
||||
private function resultDataMask($strLogText) {
|
||||
$arrMask = array();
|
||||
if (is_array($strLogText)) {
|
||||
foreach (array_keys($strLogText) as $key) {
|
||||
$k = str_replace("\n", "", trim($key));
|
||||
$arrMask[$k] = $this->requestMask($k, $strLogText[$key]);
|
||||
}
|
||||
return $arrMask;
|
||||
} else {
|
||||
return str_replace("\n", "", trim($strLogText));
|
||||
}
|
||||
}
|
||||
|
||||
// 2014.12.02 주요 정보 마스킹
|
||||
private function requestMask ($name, $text) {
|
||||
$value = str_replace("\n", "", trim($text));
|
||||
|
||||
if ($value == null || strlen(trim($value)) == 0) return "";
|
||||
|
||||
if ($name == "X_CARDNO" || $name == "realPan" || $name == "cardNo"
|
||||
|| $name == "CardBin" || $name == "CardNo") {
|
||||
return $this->masking($value, 6, true, false);
|
||||
} else if ($name == "BuyerName" || $name == "buyerName") {
|
||||
return $this->masking($value, 1, true, false);
|
||||
} else if ($name == "BuyerEmail") {
|
||||
return $this->masking($value, 6, false, true);
|
||||
} else if ($name == "BuyerTel" || $name == "DstAddr") {
|
||||
return $this->masking($value, 5, false, false);
|
||||
} else if ($name == "BuyerAddr") {
|
||||
return $this->masking($value, 6, true, false);
|
||||
} else if ($name == "UserIP" || $name == "MallIP" || $name == "CancelPwd"
|
||||
|| $name == "mallUserID" || $name == "MallUserID"
|
||||
|| $name == "CancelIP") {
|
||||
return $this->masking($value, mb_strlen(iconv('euc-kr','utf-8',$value), 'utf-8'), true, true);
|
||||
} else {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
// 2014.12.02 마스킹 처리
|
||||
private function masking($string, $num, $isLeftOrder, $beginMasking) {
|
||||
|
||||
if ( $string == null )
|
||||
return "";
|
||||
|
||||
$res = "";
|
||||
$res2 = "";
|
||||
$sleng = 0;
|
||||
|
||||
$str = iconv('euc-kr','utf-8',$string);
|
||||
$n = mb_strlen($str, 'utf-8');
|
||||
|
||||
if ( $num >= 1 ) {
|
||||
if ( $n < $num ) {
|
||||
$res = $str;
|
||||
} else {
|
||||
if($beginMasking) {
|
||||
if ($isLeftOrder) {
|
||||
$res = str_repeat("*", $n);
|
||||
} else {
|
||||
$sleng = $num;
|
||||
$res2 = mb_substr($str, $sleng, $n, 'utf-8');
|
||||
for ( $j = 0; $j < $sleng; $j++ ) {
|
||||
$res .= "*";
|
||||
}
|
||||
$res .= $res2;
|
||||
}
|
||||
} else {
|
||||
$sleng = $num;
|
||||
$res2 = mb_substr($str, 0, $sleng, 'utf-8');
|
||||
for ( $j = $sleng; $j < $n; $j++ ) {
|
||||
$res .= "*";
|
||||
}
|
||||
$res = $res2 . $res;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$res = $str;
|
||||
}
|
||||
|
||||
return iconv('utf-8','euc-kr',$res);
|
||||
}
|
||||
|
||||
private function requestNetCancel() {
|
||||
try {
|
||||
// 예기치 못한 오류인경우 망상취소 시도.
|
||||
$serviceUrl = $this->cancelUrl;
|
||||
$this->requestData["actionType"] = "CL0";
|
||||
$this->requestData["CancelIP"] = $this->requestData["MallIP"];
|
||||
if ($this->requestData["Amt"] == null) {
|
||||
return "_FAIL_";
|
||||
} else {
|
||||
if (is_numeric($this->requestData["Amt"])) {
|
||||
$this->requestData["CancelAmt"] = $this->requestData["Amt"];
|
||||
} else {
|
||||
$this->requestData["CancelAmt"] = parameterDecrypt($encodeKey, $this->requestData["Amt"]);
|
||||
}
|
||||
}
|
||||
$this->requestData["CancelMsg"] = "NICE_NET_CANCEL";
|
||||
$this->requestData["PartialCancelCode"] = "0";
|
||||
$this->requestData["NetCancelCode"] = "1";
|
||||
if ($this->getRequestData("PayMethod") == "BILL" || $this->getRequestData("PayMethod") == "KAKAOPAY") $this->requestData["PayMethod"] = "CARD";
|
||||
$requestMessage = makeRequestText($this->requestData);
|
||||
$resultMessage = connectToServer($serviceUrl, $this->requestData);
|
||||
if ($resultMessage == "_FAIL_" || substr($resultMessage, 0, 4) == "FAIL") {
|
||||
$resultMessage = connectToServer2($serviceUrl, $this->requestData, 20);
|
||||
if ($resultMessage == "_FAIL_" || substr($resultMessage, 0, 4) == "FAIL") {
|
||||
//$this->resultData["ResultCode"] = "JL41";
|
||||
//$this->resultData["ResultMsg"] = "망상취소 오류";
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
return "_TRUE_";
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("requestNetCancel() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
private function generateTID($mid, $svcCd) {
|
||||
try {
|
||||
$iRandom = str_pad(rand(0, 9999), 4, "0", STR_PAD_LEFT);
|
||||
return $mid.$this->getSvcCd($svcCd)."01".date("ymdHis").$iRandom;
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("generateTID() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
private function getSvcCd($svcCd) {
|
||||
try {
|
||||
if ($svcCd == "CARD" || $svcCd == "BILL" || $svcCd == "KAKAOPAY") {
|
||||
return "01";
|
||||
} else if ($svcCd == "BANK") {
|
||||
return "02";
|
||||
} else if ($svcCd == "VBANK") {
|
||||
return "03";
|
||||
} else if ($svcCd == "CELLPHONE") {
|
||||
return "05";
|
||||
} else if ($svcCd == "MOBILE_BILLING") {
|
||||
return "05";
|
||||
} else if ($svcCd == "MOBILE_BILL") {
|
||||
return "05";
|
||||
}
|
||||
return "00";
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("getSvcCd() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
private function setActionType($type, $paymethod) {
|
||||
try {
|
||||
if ($type == null) return "CNSPAY_10";
|
||||
$builder = $this->ActionUrl;
|
||||
if ($type == "CL0") {
|
||||
$builder = $builder."/lite/cancelProcess.jsp";
|
||||
} else if ($type == "CI0") {
|
||||
$builder = $builder."/lite/tidInfoProcess.jsp";
|
||||
} else if ($type == "PY0") {
|
||||
if ($paymethod == "CASHRCPT") { // 현금영수증인경우
|
||||
$builder = $builder."/lite/cashReceiptProcess.jsp";
|
||||
} else if ($paymethod == "BILL") {
|
||||
$builder = $builder."/lite/billingProcess.jsp";
|
||||
} else if ($paymethod == "BILLKEY") {
|
||||
$builder = $builder."/lite/billkeyProcess.jsp";
|
||||
} else if ($paymethod == "ESCROW") {
|
||||
$builder = $builder."/lite/escrowProcess.jsp";
|
||||
} else if ($paymethod == "MOBILE_AUTH") {
|
||||
$builder = $builder."/lite/mobileAuth.jsp";
|
||||
} else if ($paymethod == "MOBILE_BILL") {
|
||||
$builder = $builder."/lite/mobileBill.jsp";
|
||||
} else if ($paymethod == "MOBILE_BILLING") {
|
||||
$builder = $builder."/lite/mobileBillingProcess.jsp";
|
||||
} else if ($paymethod == "MOBILE_AUTH_REQ") {
|
||||
$builder = $builder."/lite/mobileConfirmRequest.jsp";
|
||||
} else if ($paymethod == "MOBILE_AUTH_RES") {
|
||||
$builder = $builder."/lite/mobileConfirmResult.jsp";
|
||||
} else if ($paymethod == "CARD_ARS") {
|
||||
$builder = $builder."/lite/cardArsProcess.jsp";
|
||||
} else if ($paymethod == "MOBILE_AUTH_NS") {
|
||||
$builder = $builder."/lite/mobileAuth_NS.jsp";
|
||||
} else if ($paymethod == "OM_SUB_INS") {
|
||||
$builder = $builder."/lite/payproxy/subMallSetProcess.jsp";
|
||||
} else if ($paymethod == "OM_SUB_PAY") {
|
||||
$builder = $builder."/lite/payproxy/subMallIcheProcess.jsp";
|
||||
} else if ($paymethod == "LOTTE_POINT") {
|
||||
$builder = $builder."/api/checkLottePoint.jsp";
|
||||
} else if ($paymethod == "HPBILLKEY") {
|
||||
$builder = $builder."/lite/hpBillkeyProcess.jsp";
|
||||
} else if ($paymethod == "HPCARD_AUTH") {
|
||||
$builder = $builder."/lite/hpCardAuthProcess.jsp";
|
||||
} else if ($paymethod == "HPCARD_BILLKEY") {
|
||||
$builder = $builder."/lite/hpCardBillkeyProcess.jsp";
|
||||
} else {
|
||||
$builder = $builder."/lite/payProcess.jsp";
|
||||
}
|
||||
}
|
||||
return $builder;
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("setActionType() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
private function makeRequestText($reqData) {
|
||||
try {
|
||||
$strParameter = "";
|
||||
foreach (array_keys($reqData) as $key) {
|
||||
$strParameter = $strParameter.$key."=".urlencode($reqData[$key])."&";
|
||||
}
|
||||
$strParameter = substr($strParameter, 0, strlen($strParameter) - 1);
|
||||
return $strParameter;
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("makeRequestText() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
private function connectToServer($urlStr, $reqData) {
|
||||
try {
|
||||
return $this->connectToServer2($urlStr, $reqData, 15);
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("connectToServer() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
private function connectToServer2($urlStr, $reqData, $timeout) {
|
||||
try {
|
||||
// php에 cURL 모듈 설치 필요(리눅스 - curl.so, 윈도우 - php_curl.dll 확장모듈 필요)
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $urlStr); //접속할 URL 주소
|
||||
//curl_setopt($ch, CURLOPT_PORT, 6464); //접속할 port, 주소에 있으므로 설정하지 않음
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 인증서 체크같은데 true 시 안되는 경우가 많다.
|
||||
//curl_setopt($ch, CURLOPT_SSLVERSION, 3); // SSL 버젼 (https 접속시에 필요, 기본값으로 해야하므로 설정하지 않음)
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0); // 헤더 출력 여부
|
||||
curl_setopt($ch, CURLOPT_POST, 1); // Post Get 접속 여부
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $reqData); // Post 값 Get 방식처럼적는다.
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); // TimeOut 값
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // 결과값을 받을것인지
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, $this->phpVersion); // 버전
|
||||
$result = curl_exec($ch);
|
||||
$errcode = curl_error($ch);
|
||||
if ($errcode != "") $result = $errcode;
|
||||
//$errcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
//if ($errcode != 200) $result = $errcode;
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("connectToServer2() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
private function parseResult($resultMessage) {
|
||||
try {
|
||||
if ($resultMessage == null) return "CNSPAY_41";
|
||||
$parsedArr = explode("|", $resultMessage);
|
||||
foreach ($parsedArr as $valueArr) {
|
||||
$posit = strpos($valueArr, "=");
|
||||
$key = substr($valueArr, 0, $posit);
|
||||
$value = substr($valueArr, $posit + 1);
|
||||
$this->resultData[$key] = $value;
|
||||
}
|
||||
return "_TRUE_";
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("parseResult() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function writeLog($strLogText) {
|
||||
$log_string = "";
|
||||
$exclude = array('MID', 'merchantEncKey', 'merchantHashKey', 'CancelPwd', 'site_cd', 'def_site_cd', 'CST_MID', 'LGD_MID');
|
||||
if (is_array($strLogText)) {
|
||||
$log_string = "[".date("Y/m/d H:i:s")."] \r\n";
|
||||
foreach (array_keys($strLogText) as $key) {
|
||||
if(in_array($key, $exclude))
|
||||
continue;
|
||||
|
||||
if(preg_match('#^od_.+$#', $key))
|
||||
continue;
|
||||
|
||||
$log_string = $log_string." [".$key."] => ".$strLogText[$key]."\r\n";
|
||||
}
|
||||
} else {
|
||||
$log_string = "[".date("Y/m/d H:i:s")."] ".$strLogText."\r\n";
|
||||
}
|
||||
$log_filenm = $this->LogPath.date("Ymd")."_CNSpay.log";
|
||||
$log_file = fopen($log_filenm, "a");
|
||||
if($log_file == false) return;
|
||||
flock($log_file, LOCK_EX);
|
||||
//fwrite($log_file, $log_string);
|
||||
fputs($log_file, $log_string);
|
||||
fflush($log_file);
|
||||
flock($log_file, LOCK_UN);
|
||||
fclose($log_file);
|
||||
}
|
||||
public function makeDateString($sDate) {
|
||||
try {
|
||||
if ($sDate == null) return "";
|
||||
$strValue = "";
|
||||
if (strlen($sDate) == 12) {
|
||||
$strValue = $strValue."20".substr($sDate, 0, 2)."-";
|
||||
$strValue = $strValue.substr($sDate, 2, 2)."-";
|
||||
$strValue = $strValue.substr($sDate, 4, 2). " ";
|
||||
$strValue = $strValue.substr($sDate, 6, 2).":";
|
||||
$strValue = $strValue.substr($sDate, 8, 2).":";
|
||||
$strValue = $strValue.substr($sDate, 10, 2);
|
||||
} else if (strlen($sDate) == 14) {
|
||||
$strValue = $strValue.substr($sDate, 0, 4)."-";
|
||||
$strValue = $strValue.substr($sDate, 4, 2)."-";
|
||||
$strValue = $strValue.substr($sDate, 6, 2)." ";
|
||||
$strValue = $strValue.substr($sDate, 8, 2).":";
|
||||
$strValue = $strValue.substr($sDate, 10, 2).":";
|
||||
$strValue = $strValue.substr($sDate, 12, 2);
|
||||
} else if (strlen($sDate) == 8) {
|
||||
$strValue = $strValue.substr($sDate, 0, 4)."-";
|
||||
$strValue = $strValue.substr($sDate, 4, 2)."-";
|
||||
$strValue = $strValue.substr($sDate, 6, 2);
|
||||
} else {
|
||||
$strValue = $sDate;
|
||||
}
|
||||
return $strValue;
|
||||
} catch (Exception $ex) {
|
||||
writeLog("makeDateString() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function makeHashInputString($salt) {
|
||||
|
||||
$result = "";
|
||||
|
||||
for($count = 0;$count < strlen($salt)/2;$count++) {
|
||||
$temp0 = substr($salt, 2*$count, 2);
|
||||
$temp1 = hexdec($temp0);
|
||||
$temp3 = reset(unpack("l", pack("l", $temp1 +0xffffff00)));
|
||||
$temp4 = pack('C*', $temp3);
|
||||
|
||||
$result = $result.$temp4;
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -1,384 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 2014.12.02 1) 불필요한 로깅 삭제, 2) check key array
|
||||
*/
|
||||
// error_reporting(E_ALL);
|
||||
// ini_set("display_errors", 1);
|
||||
class kmpayFunc {
|
||||
private $LogPath = "";
|
||||
private $phpVersion = "";
|
||||
public function kmpayFunc($LogDir) {
|
||||
if (substr($LogDir, strlen($LogDir) - 1) == "/") {
|
||||
$LogDir = substr($LogDir, 0, strlen($LogDir) - 1);
|
||||
}
|
||||
@mkdir($LogDir);
|
||||
$this->LogPath = $LogDir."/";
|
||||
}
|
||||
public function setPhpVersion($version) {
|
||||
$this->phpVersion = $version;
|
||||
}
|
||||
public function parameterEncrypt($key, $plainText) {
|
||||
try {
|
||||
$encryptText = "";
|
||||
$iv = "";
|
||||
if ($key == null || $plainText == null || $key == "" || $plainText == "" || strlen($key) < 16) {
|
||||
return "";
|
||||
} else {
|
||||
$iv = substr($key, 0, 16);
|
||||
$encryptText = $this->AESCBCPKCS5($plainText, $key, $iv, "enc", "yes");
|
||||
}
|
||||
return $encryptText;
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("parameterEncrypt() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function parameterDecrypt($key, $EncryptText) {
|
||||
try {
|
||||
$decryptText = "";
|
||||
$iv = "";
|
||||
if ($key == null || $EncryptText == null || $key == "" || $EncryptText == "" || strlen($key) < 16) {
|
||||
return "1";
|
||||
} else {
|
||||
$iv = substr($key, 0, 16);
|
||||
$decryptText = $this->AESCBCPKCS5($EncryptText, $key, $iv, "dec", "yes");
|
||||
}
|
||||
return $decryptText;
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("parameterDecrypt() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function PKCS5Pad($text, $blocksize = 16) {
|
||||
try {
|
||||
$pad = $blocksize - (strlen($text) % $blocksize);
|
||||
return $text.str_repeat(chr($pad), $pad);
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("PKCS5Pad() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function PKCS5UnPad($text) {
|
||||
try {
|
||||
$pad = ord($text{strlen($text)-1});
|
||||
if ($pad > strlen($text)) return $text;
|
||||
if (!strspn($text, chr($pad), strlen($text) - $pad)) return $text;
|
||||
return substr($text, 0, -1 * $pad);
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("PKCS5UnPad() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function encrypt($iv, $key, $str) {
|
||||
try {
|
||||
$td = mcrypt_module_open("rijndael-128", "", "cbc", "");
|
||||
@mcrypt_generic_init($td, $key, $iv);
|
||||
$encrypted = @mcrypt_generic($td, $this->PKCS5Pad($str));
|
||||
mcrypt_generic_deinit($td);
|
||||
mcrypt_module_close($td);
|
||||
return $encrypted;
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("encrypt() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function decrypt($iv, $key, $code) {
|
||||
try {
|
||||
$td = mcrypt_module_open("rijndael-128", "", "cbc", "");
|
||||
@mcrypt_generic_init($td, $key, $iv);
|
||||
$decrypted = @mdecrypt_generic($td, $code);
|
||||
mcrypt_generic_deinit($td);
|
||||
mcrypt_module_close($td);
|
||||
return $this->PKCS5UnPad($decrypted);
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("decrypt() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function AESCBCPKCS5($source_data, $key, $iv, $mode="enc", $base64="yes") {
|
||||
try {
|
||||
if ($mode == "dec") {
|
||||
if ($base64 == "yes") return $this->decrypt($iv, $key, base64_decode($source_data));
|
||||
else return $this->decrypt($iv, $key, $source_data);
|
||||
}
|
||||
else {
|
||||
if ($base64 == "yes") return base64_encode($this->encrypt($iv, $key, $source_data));
|
||||
else return $this->encrypt($iv, $key, $source_data);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("AESCBCPKCS5() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function connMPayDLP($urlStr, $mid, $encryptStr) {
|
||||
try {
|
||||
// php에 cURL 모듈 설치 필요(리눅스 - curl.so, 윈도우 - php_curl.dll 확장모듈 필요)
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $urlStr); //접속할 URL 주소
|
||||
//curl_setopt($ch, CURLOPT_PORT, 12443); //접속할 port, 주소에 있으므로 설정하지 않음
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 인증서 체크같은데 true 시 안되는 경우가 많다.
|
||||
//curl_setopt($ch, CURLOPT_SSLVERSION, 3); // SSL 버젼 (https 접속시에 필요, 기본값으로 해야하므로 설정하지 않음)
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0); // 헤더 출력 여부
|
||||
curl_setopt($ch, CURLOPT_POST, 1); // Post Get 접속 여부
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, array("k" => $mid, "v" => $encryptStr)); // Post 값 Get 방식처럼적는다.
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // TimeOut 값
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // 결과값을 받을것인지
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, $this->phpVersion); // 버전
|
||||
$result = curl_exec($ch);
|
||||
$errcode = curl_error($ch);
|
||||
if ($errcode != "") $result = $errcode;
|
||||
//$errcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
//if ($errcode != 200) $result = $errcode;
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("connMPayDLP() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function writeLog($strLogText) {
|
||||
$log_string = "";
|
||||
if (is_array($strLogText)) {
|
||||
$log_string = "[".date("Y/m/d H:i:s")."] \r\n";
|
||||
foreach (array_keys($strLogText) as $key) {
|
||||
if($key == 'MERCHANT_ID')
|
||||
continue;
|
||||
|
||||
$log_string = $log_string." [".$key."] => ".$strLogText[$key]."\r\n";
|
||||
}
|
||||
} else {
|
||||
$log_string = "[".date("Y/m/d H:i:s")."] ".$strLogText."\r\n";
|
||||
}
|
||||
$log_filenm = $this->LogPath.date("Ymd")."_KMpay.log";
|
||||
$log_file = fopen($log_filenm, "a");
|
||||
if($log_file == false) return;
|
||||
flock($log_file, LOCK_EX);
|
||||
//fwrite($log_file, $log_string);
|
||||
fputs($log_file, $log_string);
|
||||
fflush($log_file);
|
||||
flock($log_file, LOCK_UN);
|
||||
fclose($log_file);
|
||||
}
|
||||
}
|
||||
class JsonString {
|
||||
private $LogPath = "";
|
||||
private $strValues = array();
|
||||
public function JsonString($LogDir) {
|
||||
if (substr($LogDir, strlen($LogDir) - 1) == "/") {
|
||||
$LogDir = substr($LogDir, 0, strlen($LogDir) - 1);
|
||||
}
|
||||
@mkdir($LogDir);
|
||||
$this->LogPath = $LogDir."/";
|
||||
}
|
||||
public function setValue($key, $value) {
|
||||
try {
|
||||
$this->strValues[$key] = $value;
|
||||
return "_TRUE_";
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("setValue() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function getValue($key) {
|
||||
try {
|
||||
if (!in_array($key, array_keys($this->strValues))) return "";
|
||||
return $this->strValues[$key];
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("getValue() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function getArrayValue() {
|
||||
try {
|
||||
return $this->strValues;
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("getArrayValue() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function setJsonString($strJsonString) {
|
||||
try {
|
||||
$strJsonString = substr($strJsonString, 2, strlen($strJsonString) - 4);
|
||||
$strItems = explode("\",\"", $strJsonString);
|
||||
foreach ($strItems as $strItem) {
|
||||
$strValue = explode("\":\"", $strItem);
|
||||
$this->setValue($strValue[0], $strValue[1]);
|
||||
}
|
||||
return "_TRUE_";
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("setJsonString() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function getJsonString() {
|
||||
try {
|
||||
$strJsonString = "{";
|
||||
foreach (array_keys($this->strValues) as $key) {
|
||||
$strJsonString = $strJsonString."\"".$key."\":";
|
||||
// 2014.11.25 str_replace 추가
|
||||
$strJsonString = $strJsonString."\"". str_replace(array("\\", "\""), array("\\\\", "\\\""), $this->strValues[$key])."\",";
|
||||
}
|
||||
$strJsonString = substr($strJsonString, 0, strlen($strJsonString)-1)."}";
|
||||
return $strJsonString;
|
||||
} catch (Exception $ex) {
|
||||
$this->writeLog("getJsonString() Exception Code ".$ex->getCode()." : ".$ex->getMessage()." in ".$ex->getFile()." on line ".$ex->getLine());
|
||||
return "_FAIL_";
|
||||
}
|
||||
}
|
||||
public function writeLog($strLogText) {
|
||||
$log_string = "";
|
||||
if (is_array($strLogText)) {
|
||||
$log_string = "[".date("Y/m/d H:i:s")."] \r\n";
|
||||
foreach (array_keys($strLogText) as $key) {
|
||||
$log_string = $log_string." [".$key."] => ".$strLogText[$key]."\r\n";
|
||||
}
|
||||
} else {
|
||||
$log_string = "[".date("Y/m/d H:i:s")."] ".$strLogText."\r\n";
|
||||
}
|
||||
$log_filenm = $this->LogPath.date("Ymd")."_KMpayLog.log";
|
||||
$log_file = fopen($log_filenm, "a");
|
||||
if($log_file == false) return;
|
||||
flock($log_file, LOCK_EX);
|
||||
//fwrite($log_file, $log_string);
|
||||
fputs($log_file, $log_string);
|
||||
fflush($log_file);
|
||||
flock($log_file, LOCK_UN);
|
||||
fclose($log_file);
|
||||
}
|
||||
}
|
||||
|
||||
class KMPayDataValidator {
|
||||
public $resultValid = "";
|
||||
public function KMPayDataValidator($value) {
|
||||
$this->resultValid = $this->validator($value);
|
||||
}
|
||||
// 2014.12.02 추가 (check key in array)
|
||||
private function getValueFromArray($arr, $key) {
|
||||
if(array_key_exists($key, $arr)) {
|
||||
return $arr[$key];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// 2014.12.02 수정 (getValueFromArray 사용)
|
||||
private function validator($value) {
|
||||
//필수정보
|
||||
$prType = $this->getValueFromArray($value, "PR_TYPE");
|
||||
$merchantID = $this->getValueFromArray($value, "MERCHANT_ID");
|
||||
$channelType = $this->getValueFromArray($value, "channelType");
|
||||
$merchantTxnNum = $this->getValueFromArray($value, "MERCHANT_TXN_NUM");
|
||||
$productName = $this->getValueFromArray($value, "PRODUCT_NAME");
|
||||
$amount = $this->getValueFromArray($value, "AMOUNT");
|
||||
$currency = $this->getValueFromArray($value, "CURRENCY");
|
||||
$returnUrl = $this->getValueFromArray($value, "RETURN_URL");
|
||||
|
||||
//추가정보
|
||||
$cardMerchantNum = $this->getValueFromArray($value, "CARD_MERCHANT_NUM");
|
||||
$supplyAmt = $this->getValueFromArray($value, "SUPPLY_AMT");
|
||||
$goodsVat = $this->getValueFromArray($value, "GOODS_VAT");
|
||||
$serviceAmt = $this->getValueFromArray($value, "SERVICE_AMT");
|
||||
$cancelTime = $this->getValueFromArray($value, "CANCEL_TIME");
|
||||
$fixedInt = $this->getValueFromArray($value, "FIXED_INT");
|
||||
$certifiedFlag = $this->getValueFromArray($value, "CERTIFIED_FLAG");
|
||||
$offerPeriodFlag = $this->getValueFromArray($value, "OFFER_PERIOD_FLAG");
|
||||
$offerPeriod = $this->getValueFromArray($value, "OFFER_PERIOD");
|
||||
|
||||
|
||||
if (strlen($certifiedFlag) == 0) {
|
||||
$certifiedFlag = "N";
|
||||
}
|
||||
if (strlen($supplyAmt) == 0) {
|
||||
$supplyAmt = "0";
|
||||
}
|
||||
if (strlen($goodsVat) == 0) {
|
||||
$goodsVat = "0";
|
||||
}
|
||||
if (strlen($cancelTime) == 0) {
|
||||
$cancelTime = "1440";
|
||||
}
|
||||
|
||||
//필수
|
||||
if (strlen($prType) == 0) {
|
||||
return "USER_ERROR_CODE,804,결제요청타입은 필수입력사항 입니다.";
|
||||
}
|
||||
else if ($prType != "MPM" && $prType != "WPM") {
|
||||
return "USER_ERROR_CODE,805,잘못된 결제요청타입 입니다.";
|
||||
}
|
||||
|
||||
if (strlen($merchantID) == 0) {
|
||||
return "USER_ERROR_CODE,806,가맹점 ID 필수입력사항 입니다.";
|
||||
}
|
||||
else if (strlen($merchantID) > 38) {
|
||||
return "USER_ERROR_CODE,808,가맹점 ID의 제한 길이가 초과 되었습니다.";
|
||||
}
|
||||
|
||||
if (strlen($merchantTxnNum) == 0) {
|
||||
return "USER_ERROR_CODE,823,가맹점 거래번호는 필수입력사항 입니다.";
|
||||
}
|
||||
else if (strlen($merchantTxnNum) > 40) {
|
||||
return "USER_ERROR_CODE,824,가맹점 거래번호의 제한 길이가 초과 되었습니다.";
|
||||
}
|
||||
|
||||
if (strlen($productName) == 0) {
|
||||
return "USER_ERROR_CODE,809,상품명은 필수입력사항 입니다.";
|
||||
}
|
||||
else if (strlen($productName) > 200) {
|
||||
return "USER_ERROR_CODE,810,상품명은 영문 200자 이내입니다.";
|
||||
}
|
||||
|
||||
if (strlen($amount) == 0) {
|
||||
return "USER_ERROR_CODE,811,상품금액은 필수입력사항 입니다.";
|
||||
}
|
||||
else if (!is_numeric($amount)){
|
||||
return "USER_ERROR_CODE,812,상품금액은 숫자형입니다.";
|
||||
}
|
||||
|
||||
if (strlen($currency) == 0) {
|
||||
return "USER_ERROR_CODE,813,거래통화는 필수입력사항 입니다.";
|
||||
}
|
||||
|
||||
if ($certifiedFlag == "CN") {
|
||||
//웹결제에서는 필수체크 안함
|
||||
}
|
||||
else if (strlen($certifiedFlag) == 0) {
|
||||
return "USER_ERROR_CODE,830,결제승인결과전송URL은 필수입력사항 입니다.";
|
||||
}
|
||||
|
||||
if (strlen($cardMerchantNum) > 0 && !is_numeric($cardMerchantNum)) {
|
||||
return "USER_ERROR_CODE,814,카드 가맹점 번호는 숫자형입니다.";
|
||||
}
|
||||
|
||||
if (strlen($supplyAmt) > 0 && !is_numeric($supplyAmt)) {
|
||||
return "USER_ERROR_CODE,815,공급가액은 숫자형입니다.";
|
||||
}
|
||||
|
||||
if (strlen($goodsVat) > 0 && !is_numeric($goodsVat)) {
|
||||
return "USER_ERROR_CODE,816,부가세는 숫자형입니다.";
|
||||
}
|
||||
|
||||
if (strlen($serviceAmt) > 0 && !is_numeric($serviceAmt)) {
|
||||
return "USER_ERROR_CODE,817,봉사료는 숫자형입니다.";
|
||||
}
|
||||
|
||||
if (strlen($cancelTime) > 0 && !is_numeric($cancelTime)) {
|
||||
return "USER_ERROR_CODE,818,결제취소시간(분)은 숫자형입니다.";
|
||||
}
|
||||
|
||||
if (strlen($fixedInt) == 0) {
|
||||
// 정상
|
||||
}
|
||||
else if (!is_numeric($fixedInt)) {
|
||||
return "USER_ERROR_CODE,820,고정할부개월이 잘못되었습니다.";
|
||||
}
|
||||
else if (!((0 <= intval($fixedInt) && intval($fixedInt) <= 24) || $fixedInt == "36")) {
|
||||
return "USER_ERROR_CODE,820,고정할부개월이 잘못되었습니다.";
|
||||
}
|
||||
|
||||
if ($certifiedFlag != "N" && $certifiedFlag != "CN") {
|
||||
return "USER_ERROR_CODE,831,가맹점 인증 구분값은 N 혹은 CN 입니다";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_LIB_PATH.'/json.lib.php');
|
||||
|
||||
include(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
|
||||
include(G5_SHOP_PATH.'/kakaopay/lgcns_CNSpay.php');
|
||||
|
||||
$Amt = (int)preg_replace('#[^0-9]#', '', $_POST['Amt']);
|
||||
$ediDate = trim($_POST['ediDate']);
|
||||
|
||||
////////위변조 처리/////////
|
||||
//결제요청용 키값
|
||||
$cnspay_lib = new CnsPayWebConnector($LogDir);
|
||||
$md_src = $ediDate.$MID.$Amt;
|
||||
$salt = hash("sha256",$merchantKey.$md_src,false);
|
||||
$hash_input = $cnspay_lib->makeHashInputString($salt);
|
||||
$hash_calc = hash("sha256", $hash_input, false);
|
||||
$hash_String = base64_encode($hash_calc);
|
||||
|
||||
die(json_encode(array('hash_String' => $hash_String, 'error' => '')));
|
||||
?>
|
||||
37
shop/kakaopay/makesignature.php
Normal file
37
shop/kakaopay/makesignature.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_LIB_PATH.'/json.lib.php');
|
||||
include(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
|
||||
|
||||
// 카카오페이를 사용하지 않을 경우
|
||||
if( ! $default['de_kakaopay_enckey'] ) die('카카오페이를 사용하지 않습니다.');
|
||||
|
||||
if( ! ($default['de_kakaopay_mid'] && $default['de_kakaopay_key']) ){
|
||||
die(json_encode(array('error'=>'올바른 방법으로 이용해 주십시오.')));
|
||||
}
|
||||
|
||||
$orderNumber = get_session('ss_order_id');
|
||||
$price = preg_replace('#[^0-9]#', '', $_POST['price']);
|
||||
|
||||
if(strlen($price) < 1)
|
||||
die(json_encode(array('error'=>'가격이 올바르지 않습니다.')));
|
||||
|
||||
//
|
||||
//###################################
|
||||
// 2. 가맹점 확인을 위한 signKey를 해시값으로 변경 (SHA-256방식 사용)
|
||||
//###################################
|
||||
$mKey = hash("sha256", $default['de_kakaopay_key']);
|
||||
|
||||
/*
|
||||
//*** 위변조 방지체크를 signature 생성 ***
|
||||
oid, price, timestamp 3개의 키와 값을
|
||||
key=value 형식으로 하여 '&'로 연결한 하여 SHA-256 Hash로 생성 된값
|
||||
ex) oid=INIpayTest_1432813606995&price=819000×tamp=2012-02-01 09:19:04.004
|
||||
* key기준 알파벳 정렬
|
||||
* timestamp는 반드시 signature생성에 사용한 timestamp 값을 timestamp input에 그대로 사용하여야함
|
||||
*/
|
||||
$params = "oid=" . $orderNumber . "&price=" . $price . "×tamp=" . $timestamp;
|
||||
$sign = hash("sha256", $params);
|
||||
|
||||
die(json_encode(array('error'=>'', 'mKey'=>$mKey, 'timestamp'=>$timestamp, 'sign'=>$sign)));
|
||||
?>
|
||||
130
shop/kakaopay/mobile_orderform.1.php
Normal file
130
shop/kakaopay/mobile_orderform.1.php
Normal file
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// KAKAOPAY SIRK***** 전용아이디 사용시 ( KG 이니시스 )
|
||||
if( ! $is_kakaopay_use || ('inicis' === $default['de_pg_service']) ){ //PG가 이니시스인 경우 아래 내용 사용 안함
|
||||
return;
|
||||
}
|
||||
|
||||
if(!function_exists('get_inicis_app_scheme')){
|
||||
function get_inicis_app_scheme(){
|
||||
$user_agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
|
||||
$iPod = stripos($user_agent,"iPod");
|
||||
$iPhone = stripos($user_agent,"iPhone");
|
||||
$iPad = stripos($user_agent,"iPad");
|
||||
|
||||
if( $iPod || $iPhone || $iPad ){ //IOS 의 앱브라우저에서 ISP결제시 리다이렉트 safari로 돌아가는 문제가 있음
|
||||
if( preg_match('/NAVER\(inapp;/', $user_agent) ){ //네이버
|
||||
return 'app_scheme=naversearchapp://&';
|
||||
}
|
||||
else if( preg_match('/CriOS/', $user_agent) ){ //크롬
|
||||
return 'app_scheme=googlechromes://&';
|
||||
}
|
||||
else if( preg_match('/DaumDevice/', $user_agent) ){ //다음
|
||||
return 'app_scheme=daumapps://&';
|
||||
}
|
||||
else if( preg_match('/KAKAOTALK/', $user_agent) ){ //카카오톡
|
||||
return 'app_scheme=kakaotalk://&';
|
||||
}
|
||||
else if( preg_match('/(FBAN|FBAV)/', $user_agent) ){ //페이스북
|
||||
return 'app_scheme=fb://&';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<form name="inicis_kakaopay_form" id="inicis_kakaopay_form" method="POST" action="" accept-charset="euc-kr">
|
||||
<input type="hidden" name="P_OID" value="<?php echo $od_id; ?>">
|
||||
<input type="hidden" name="P_GOODS" value="<?php echo $goods; ?>">
|
||||
<input type="hidden" name="P_AMT" value="<?php echo $tot_price; ?>">
|
||||
<input type="hidden" name="P_UNAME" value="">
|
||||
<input type="hidden" name="P_MOBILE" value="">
|
||||
<input type="hidden" name="P_EMAIL" value="">
|
||||
<input type="hidden" name="P_MID" value="<?php echo $default['de_kakaopay_mid']; ?>">
|
||||
<input type="hidden" name="P_NEXT_URL" value="<?php echo $next_url; ?>">
|
||||
<input type="hidden" name="P_NOTI_URL" value="<?php echo $noti_url; ?>">
|
||||
<input type="hidden" name="P_RETURN_URL" value="">
|
||||
<input type="hidden" name="P_HPP_METHOD" value="2">
|
||||
<input type="hidden" name="P_RESERVED" value="<?php echo get_inicis_app_scheme(); ?>bank_receipt=N&twotrs_isp=Y&block_isp=Y<?php echo $useescrow; ?>">
|
||||
<input type="hidden" name="DEF_RESERVED" value="<?php echo get_inicis_app_scheme(); ?>bank_receipt=N&twotrs_isp=Y&block_isp=Y<?php echo $useescrow; ?>">
|
||||
<input type="hidden" name="P_NOTI" value="<?php echo $od_id; ?>">
|
||||
<input type="hidden" name="P_QUOTABASE" value="01:02:03:04:05:06:07:08:09:10:11:12"> <!-- 할부기간 설정 01은 일시불 -->
|
||||
<input type="hidden" name="P_SKIP_TERMS" value="Y">
|
||||
|
||||
<input type="hidden" name="good_mny" value="<?php echo $tot_price; ?>" >
|
||||
|
||||
<?php if($default['de_tax_flag_use']) { ?>
|
||||
<input type="hidden" name="P_TAX" value="">
|
||||
<input type="hidden" name="P_TAXFREE" value="">
|
||||
<?php } ?>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
if( typeof g5_shop_url === 'undefined' ){
|
||||
var g5_shop_url = g5_url+"/shop";
|
||||
}
|
||||
|
||||
function getTxnId(pf) {
|
||||
var inicis_kakaopay_form = document.inicis_kakaopay_form;
|
||||
|
||||
var paymethod = "";
|
||||
var width = 330;
|
||||
var height = 480;
|
||||
var xpos = (screen.width - width) / 2;
|
||||
var ypos = (screen.width - height) / 2;
|
||||
var position = "top=" + ypos + ",left=" + xpos;
|
||||
var features = position + ", width=320, height=440";
|
||||
var p_reserved = inicis_kakaopay_form.DEF_RESERVED.value;
|
||||
inicis_kakaopay_form.P_RESERVED.value = p_reserved;
|
||||
|
||||
paymethod = "wcard";
|
||||
|
||||
inicis_kakaopay_form.P_RESERVED.value = inicis_kakaopay_form.P_RESERVED.value.replace("&useescrow=Y", "")+"&d_kakaopay=Y";
|
||||
|
||||
if( ! jQuery("form[name='sm_form']").length ){
|
||||
alert("해당 폼이 존재 하지 않는 결제오류입니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
inicis_kakaopay_form.P_AMT.value = inicis_kakaopay_form.good_mny.value = document.sm_form.good_mny.value;
|
||||
inicis_kakaopay_form.P_UNAME.value = pf.od_name.value;
|
||||
inicis_kakaopay_form.P_MOBILE.value = pf.od_hp.value;
|
||||
inicis_kakaopay_form.P_EMAIL.value = pf.od_email.value;
|
||||
|
||||
<?php if($default['de_tax_flag_use']) { ?>
|
||||
inicis_kakaopay_form.P_TAX.value = pf.comm_vat_mny.value;
|
||||
inicis_kakaopay_form.P_TAXFREE = pf.comm_free_mny.value;
|
||||
<?php } ?>
|
||||
|
||||
inicis_kakaopay_form.P_RETURN_URL.value = "<?php echo $return_url.$od_id; ?>";
|
||||
inicis_kakaopay_form.action = "https://mobile.inicis.com/smart/" + paymethod + "/";
|
||||
|
||||
// 주문 정보 임시저장
|
||||
var order_data = $(pf).serialize();
|
||||
var save_result = "";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: order_data,
|
||||
url: g5_shop_url+"/ajax.orderdatasave.php",
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
save_result = data;
|
||||
}
|
||||
});
|
||||
|
||||
if(save_result) {
|
||||
alert(save_result);
|
||||
return;
|
||||
}
|
||||
|
||||
inicis_kakaopay_form.submit();
|
||||
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
204
shop/kakaopay/mobile_pay_approval.php
Normal file
204
shop/kakaopay/mobile_pay_approval.php
Normal file
@ -0,0 +1,204 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$is_mobile_order = true;
|
||||
include_once(G5_SHOP_PATH.'/settle_kakaopay.inc.php');
|
||||
|
||||
// 카카오페이를 사용하지 않을 경우
|
||||
if( ! $default['de_kakaopay_enckey'] ) die('카카오페이를 사용하지 않습니다.');
|
||||
|
||||
// 세션 초기화
|
||||
set_session('P_TID', '');
|
||||
set_session('P_AMT', '');
|
||||
set_session('P_HASH', '');
|
||||
|
||||
$oid = trim($_REQUEST['P_NOTI']);
|
||||
$p_req_url = trim($_REQUEST['P_REQ_URL']);
|
||||
|
||||
if( ! $p_req_url || !preg_match('/^https\:\/\//i', $p_req_url)){
|
||||
alert("잘못된 요청 URL 입니다.");
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_order_data_table']} where od_id = '$oid' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if ( base64_encode(base64_decode($row['dt_data'], true)) === $row['dt_data']){
|
||||
$data = unserialize(base64_decode($row['dt_data']));
|
||||
} else {
|
||||
$data = unserialize($row['dt_data']);
|
||||
}
|
||||
|
||||
if(isset($data['pp_id']) && $data['pp_id']) {
|
||||
$order_action_url = G5_HTTPS_MSHOP_URL.'/personalpayformupdate.php';
|
||||
$page_return_url = G5_SHOP_URL.'/personalpayform.php?pp_id='.$data['pp_id'];
|
||||
} else {
|
||||
$order_action_url = G5_HTTPS_MSHOP_URL.'/orderformupdate.php';
|
||||
$page_return_url = G5_SHOP_URL.'/orderform.php';
|
||||
if($_SESSION['ss_direct'])
|
||||
$page_return_url .= '?sw_direct=1';
|
||||
|
||||
// 장바구니가 비어있는가?
|
||||
if (get_session('ss_direct'))
|
||||
$tmp_cart_id = get_session('ss_cart_direct');
|
||||
else
|
||||
$tmp_cart_id = get_session('ss_cart_id');
|
||||
|
||||
if (get_cart_count($tmp_cart_id) == 0)// 장바구니에 담기
|
||||
alert('세션을 잃거나 다른 브라우저에서 데이터가 변경된 경우입니다. 장바구니 상태를 확인후에 다시 시도해 주세요.', G5_SHOP_URL.'/cart.php');
|
||||
|
||||
$error = "";
|
||||
// 장바구니 상품 재고 검사
|
||||
$sql = " select it_id,
|
||||
ct_qty,
|
||||
it_name,
|
||||
io_id,
|
||||
io_type,
|
||||
ct_option
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '$tmp_cart_id'
|
||||
and ct_select = '1' ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
// 상품에 대한 현재고수량
|
||||
if($row['io_id']) {
|
||||
$it_stock_qty = (int)get_option_stock_qty($row['it_id'], $row['io_id'], $row['io_type']);
|
||||
} else {
|
||||
$it_stock_qty = (int)get_it_stock_qty($row['it_id']);
|
||||
}
|
||||
// 장바구니 수량이 재고수량보다 많다면 오류
|
||||
if ($row['ct_qty'] > $it_stock_qty)
|
||||
$error .= "{$row['ct_option']} 의 재고수량이 부족합니다. 현재고수량 : $it_stock_qty 개\\n\\n";
|
||||
}
|
||||
|
||||
if($i == 0)
|
||||
alert('장바구니가 비어 있습니다.', G5_SHOP_URL.'/cart.php');
|
||||
|
||||
if ($error != "")
|
||||
{
|
||||
$error .= "결제진행이 중단 되었습니다.";
|
||||
alert($error, G5_SHOP_URL.'/cart.php');
|
||||
}
|
||||
}
|
||||
|
||||
if($_REQUEST['P_STATUS'] != '00') {
|
||||
alert('오류 : '.iconv_utf8($_REQUEST['P_RMESG1']).' 코드 : '.$_REQUEST['P_STATUS'], $page_return_url);
|
||||
} else {
|
||||
$post_data = array(
|
||||
'P_MID' => $default['de_kakaopay_mid'],
|
||||
'P_TID' => $_REQUEST['P_TID']
|
||||
);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_PORT, 443);
|
||||
curl_setopt($ch, CURLOPT_URL, $_REQUEST['P_REQ_URL']);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$return = curl_exec($ch);
|
||||
|
||||
if(!$return)
|
||||
alert('KG이니시스와 통신 오류로 결제등록 요청을 완료하지 못했습니다.\\n결제등록 요청을 다시 시도해 주십시오.', $page_return_url);
|
||||
|
||||
// 결과를 배열로 변환
|
||||
parse_str($return, $ret);
|
||||
$PAY = array_map('trim', $ret);
|
||||
$PAY = array_map('strip_tags', $PAY);
|
||||
$PAY = array_map('get_search_string', $PAY);
|
||||
|
||||
if($PAY['P_STATUS'] != '00')
|
||||
alert('오류 : '.iconv_utf8($PAY['P_RMESG1']).' 코드 : '.$PAY['P_STATUS'], $page_return_url);
|
||||
|
||||
// TID, AMT 를 세션으로 주문완료 페이지 전달
|
||||
$hash = md5($PAY['P_TID'].$PAY['P_MID'].$PAY['P_AMT']);
|
||||
set_session('P_TID', $PAY['P_TID']);
|
||||
set_session('P_AMT', $PAY['P_AMT']);
|
||||
set_session('P_HASH', $hash);
|
||||
}
|
||||
|
||||
$params = array();
|
||||
|
||||
//개인결제
|
||||
if(isset($data['pp_id']) && !empty($data['pp_id'])) {
|
||||
// 개인결제 정보
|
||||
$pp_check = false;
|
||||
$sql = " select * from {$g5['g5_shop_personalpay_table']} where pp_id = '{$PAY['P_OID']}' and pp_tno = '{$PAY['P_TID']}' and pp_use = '1' ";
|
||||
$pp = sql_fetch($sql);
|
||||
|
||||
if( !$pp['pp_tno'] && $data['pp_id'] == $oid ){
|
||||
$res_cd = $PAY['P_STATUS'];
|
||||
$pp_id = $oid;
|
||||
|
||||
$exclude = array('res_cd', 'P_HASH', 'P_TYPE', 'P_AUTH_DT', 'P_VACT_BANK', 'LGD_PAYKEY', 'pp_id', 'good_mny', 'pp_name', 'pp_email', 'pp_hp', 'pp_settle_case');
|
||||
|
||||
foreach($data as $key=>$v) {
|
||||
if( !in_array($key, $exclude) ){
|
||||
$_POST[$key] = $params[$key] = clean_xss_tags(strip_tags($v));
|
||||
}
|
||||
}
|
||||
|
||||
$good_mny = $PAY['P_AMT'];
|
||||
$pp_name = clean_xss_tags($data['pp_name']);
|
||||
$pp_email = clean_xss_tags($data['pp_email']);
|
||||
$pp_hp = clean_xss_tags($data['pp_hp']);
|
||||
$pp_settle_case = clean_xss_tags($data['pp_settle_case']);
|
||||
|
||||
$_POST['P_HASH'] = $hash;
|
||||
$_POST['P_AUTH_NO'] = $PAY['P_AUTH_NO'];
|
||||
$_POST['pp_id'] = $PAY['P_OID'];
|
||||
$_POST['good_mny'] = $PAY['P_AMT'];
|
||||
|
||||
$_POST['P_TYPE'] = $PAY['P_TYPE'];
|
||||
$_POST['P_AUTH_DT'] = $PAY['P_AUTH_DT'];
|
||||
$_POST['P_AUTH_NO'] = $PAY['P_AUTH_NO'];
|
||||
$_POST['P_HPP_CORP'] = $PAY['P_HPP_CORP'];
|
||||
$_POST['P_APPL_NUM'] = $PAY['P_APPL_NUM'];
|
||||
$_POST['P_VACT_NUM'] = $PAY['P_VACT_NUM'];
|
||||
$_POST['P_VACT_NAME'] = iconv_utf8($PAY['P_VACT_NAME']);
|
||||
$_POST['P_VACT_BANK'] = $BANK_CODE[$PAY['P_VACT_BANK_CODE']];
|
||||
$_POST['P_CARD_ISSUER'] = $CARD_CODE[$PAY['P_CARD_ISSUER_CODE']];
|
||||
$_POST['P_UNAME'] = iconv_utf8($PAY['P_UNAME']);
|
||||
|
||||
include_once( G5_MSHOP_PATH.'/personalpayformupdate.php' );
|
||||
}
|
||||
|
||||
} else {
|
||||
// 상점 결제
|
||||
$exclude = array('res_cd', 'P_HASH', 'P_TYPE', 'P_AUTH_DT', 'P_VACT_BANK', 'P_AUTH_NO');
|
||||
|
||||
foreach($data as $key=>$value) {
|
||||
if(!empty($exclude) && in_array($key, $exclude))
|
||||
continue;
|
||||
|
||||
if(is_array($value)) {
|
||||
foreach($value as $k=>$v) {
|
||||
$_POST[$key][$k] = $params[$key][$k] = clean_xss_tags(strip_tags($v));
|
||||
}
|
||||
} else {
|
||||
$_POST[$key] = $params[$key] = clean_xss_tags(strip_tags($value));
|
||||
}
|
||||
}
|
||||
|
||||
$res_cd = $_POST['res_cd'] = $PAY['P_STATUS'];
|
||||
$P_HASH = $_POST['P_HASH'] = $hash;
|
||||
$P_TYPE = $_POST['P_TYPE'] = $PAY['P_TYPE'];
|
||||
$P_AUTH_DT = $_POST['P_AUTH_DT'] = $PAY['P_AUTH_DT'];
|
||||
$P_AUTH_NO = $_POST['P_AUTH_NO'] = $PAY['P_AUTH_NO'];
|
||||
$P_HPP_CORP = $_POST['P_HPP_CORP'] = $PAY['P_HPP_CORP'];
|
||||
$P_APPL_NUM = $_POST['P_APPL_NUM'] = $PAY['P_APPL_NUM'];
|
||||
$P_VACT_NUM = $_POST['P_VACT_NUM'] = $PAY['P_VACT_NUM'];
|
||||
$P_VACT_NAME = $_POST['P_VACT_NAME'] = iconv_utf8($PAY['P_VACT_NAME']);
|
||||
$P_VACT_BANK = $_POST['P_VACT_BANK'] = $BANK_CODE[$PAY['P_VACT_BANK_CODE']];
|
||||
$P_CARD_ISSUER = $_POST['P_CARD_ISSUER'] = $CARD_CODE[$PAY['P_CARD_ISSUER_CODE']];
|
||||
$P_UNAME = $_POST['P_UNAME'] = iconv_utf8($PAY['P_UNAME']);
|
||||
|
||||
$check_keys = array('od_name', 'od_tel', 'od_pwd', 'od_hp', 'od_zip', 'od_addr1', 'od_addr2', 'od_addr3', 'od_addr_jibeon', 'od_email', 'ad_default', 'ad_subject', 'od_hope_date', 'od_b_name', 'od_b_tel', 'od_b_hp', 'od_b_zip', 'od_b_addr1', 'od_b_addr2', 'od_b_addr3', 'od_b_addr_jibeon', 'od_memo', 'od_settle_case', 'max_temp_point', 'od_temp_point', 'od_send_cost', 'od_send_cost2', 'od_bank_account', 'od_deposit_name', 'od_test', 'od_ip');
|
||||
|
||||
foreach($check_keys as $key){
|
||||
$$key = isset($params[$key]) ? $params[$key] : '';
|
||||
}
|
||||
|
||||
include_once( G5_MSHOP_PATH.'/orderformupdate.php' );
|
||||
}
|
||||
exit;
|
||||
?>
|
||||
41
shop/kakaopay/mobile_pay_result.php
Normal file
41
shop/kakaopay/mobile_pay_result.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
include_once(G5_SHOP_PATH.'/settle_kakaopay.inc.php');
|
||||
|
||||
// 세션비교
|
||||
$hash = md5(get_session('P_TID').$default['de_kakaopay_mid'].get_session('P_AMT'));
|
||||
if($hash != $_POST['P_HASH'])
|
||||
alert('결제 정보가 일치하지 않습니다. 올바른 방법으로 이용해 주십시오.');
|
||||
|
||||
//최종결제요청 결과 성공 DB처리
|
||||
$tno = get_session('P_TID');
|
||||
$amount = get_session('P_AMT');
|
||||
$app_time = $_POST['P_AUTH_DT'];
|
||||
$pay_method = $_POST['P_TYPE'];
|
||||
$pay_type = $PAY_METHOD[$pay_method];
|
||||
$depositor = $_POST['P_UNAME'];
|
||||
$commid = $_POST['P_HPP_CORP'];
|
||||
$mobile_no = $_POST['P_APPL_NUM'];
|
||||
$app_no = $_POST['P_AUTH_NO'];
|
||||
$card_name = $_POST['P_CARD_ISSUER'];
|
||||
if ($default['de_escrow_use'] == 1)
|
||||
$escw_yn = 'Y';
|
||||
switch($pay_type) {
|
||||
case '계좌이체':
|
||||
$bank_name = $_POST['P_VACT_BANK'];
|
||||
break;
|
||||
case '가상계좌':
|
||||
$bankname = $_POST['P_VACT_BANK'];
|
||||
$account = $_POST['P_VACT_NUM'].' '.$_POST['P_VACT_NAME'];
|
||||
$app_no = $_POST['P_VACT_NUM'];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// 세션 초기화
|
||||
set_session('P_TID', '');
|
||||
set_session('P_AMT', '');
|
||||
set_session('P_HASH', '');
|
||||
?>
|
||||
5
shop/kakaopay/mobile_pay_return.php
Normal file
5
shop/kakaopay/mobile_pay_return.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// 카카오페이 (KG 이니시스) 의 경우 NOTI 과정이 없으므로 이 페이지를 사용하지 않습니다.
|
||||
?>
|
||||
5
shop/kakaopay/mobile_settle_common.php
Normal file
5
shop/kakaopay/mobile_settle_common.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// 카카오페이 (KG 이니시스) 의 경우 NOTI 과정이 없으므로 이 페이지를 사용하지 않습니다.
|
||||
?>
|
||||
@ -1,55 +1,108 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if($is_kakaopay_use) {
|
||||
if( ! $is_kakaopay_use) return;
|
||||
|
||||
if( $is_mobile_order ){
|
||||
include_once(G5_SHOP_PATH.'/kakaopay/mobile_orderform.1.php');
|
||||
return;
|
||||
}
|
||||
|
||||
// PC 결제에서는 이니시스 결제를 같이 설정하면 중복 오류 문제가 일어나므로 SIRK***** 를 사용하는 카카오페이( 이니시스결제 )를 활성화하지 않습니다.
|
||||
if( $default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use'] || ('inicis' == $default['de_pg_service']) ){
|
||||
?>
|
||||
<script>
|
||||
function getTxnId(frm) {
|
||||
alert('결제 설정에 문제가 있습니다. ( 중복설정문제 )');
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
|
||||
add_javascript('<script language="javascript" type="text/javascript" src="'.$stdpay_js_url.'" charset="UTF-8"></script>', 10);
|
||||
?>
|
||||
|
||||
<script src="<?php echo ($CnsPayDealRequestUrl) ?>/dlp/scripts/lib/easyXDM.min.js" type="text/javascript"></script>
|
||||
<script src="<?php echo ($CnsPayDealRequestUrl) ?>/dlp/scripts/lib/json3.min.js" type="text/javascript"></script>
|
||||
<form id="inicis_kakaopay_request" name="inicis_kakaopay_request" method="POST">
|
||||
|
||||
<link href="https://pg.cnspay.co.kr:443/dlp/css/kakaopayDlp.css" rel="stylesheet" type="text/css" />
|
||||
<?php /* 주문폼 자바스크립트 에러 방지를 위해 추가함 */ ?>
|
||||
<input type="hidden" name="good_mny" value="">
|
||||
<?php
|
||||
if($default['de_tax_flag_use']) {
|
||||
?>
|
||||
<input type="hidden" name="comm_tax_mny" value=""> <!-- 과세금액 -->
|
||||
<input type="hidden" name="comm_vat_mny" value=""> <!-- 부가세 -->
|
||||
<input type="hidden" name="comm_free_mny" value=""> <!-- 비과세 금액 -->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- DLP창에 대한 KaKaoPay Library -->
|
||||
<script type="text/javascript" src="<?php echo ($CNSPAY_WEB_SERVER_URL) ?>/js/dlp/client/kakaopayDlpConf.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<?php echo ($CNSPAY_WEB_SERVER_URL) ?>/js/dlp/client/kakaopayDlp.min.js" charset="utf-8"></script>
|
||||
<input type="hidden" name="version" value="1.0" >
|
||||
<input type="hidden" name="mid" value="<?php echo $default['de_kakaopay_mid']; ?>">
|
||||
<input type="hidden" name="goodname" value="<?php echo $goods; ?>">
|
||||
<input type="hidden" name="oid" value="<?php echo $od_id; ?>">
|
||||
<input type="hidden" name="price" value="<?php echo $tot_price; ?>" >
|
||||
<input type="hidden" name="currency" value="WON" >
|
||||
|
||||
<input type="hidden" name="buyername" value="">
|
||||
<input type="hidden" name="buyeremail" value="">
|
||||
<input type="hidden" name="parentemail" value="">
|
||||
<input type="hidden" name="buyertel" value="">
|
||||
<input type="hidden" name="recvname" value="">
|
||||
<input type="hidden" name="recvtel" value="">
|
||||
<input type="hidden" name="recvaddr" value="">
|
||||
<input type="hidden" name="recvpostnum" value="">
|
||||
|
||||
<input type="hidden" name="timestamp" value="">
|
||||
<input type="hidden" name="signature" value="">
|
||||
<input type="hidden" name="returnUrl" value="<?php echo $returnUrl; ?>">
|
||||
<input type="hidden" name="mKey" value="" >
|
||||
<input type="hidden" name="gopaymethod" value="">
|
||||
<input type="hidden" name="acceptmethod" value="<?php echo $acceptmethod; ?>">
|
||||
<input type="hidden" name="charset" value="UTF-8">
|
||||
<input type="hidden" name="payViewType" value="overlay">
|
||||
<input type="hidden" name="closeUrl" value="<?php echo $closeUrl; ?>">
|
||||
<input type="hidden" name="popupUrl" value="<?php echo $popupUrl; ?>">
|
||||
<input type="hidden" name="nointerest" value="<?php echo $cardNoInterestQuota ?>" >
|
||||
<input type="hidden" name="quotabase" value="<?php echo $cardQuotaBase ?>" >
|
||||
<?php if($default['de_tax_flag_use']) { ?>
|
||||
<input type="hidden" name="tax" value="">
|
||||
<input type="hidden" name="taxfree" value="">
|
||||
<?php } ?>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
/**
|
||||
cnspay 를 통해 결제를 시작합니다.
|
||||
*/
|
||||
function cnspay(frm) {
|
||||
if(document.getElementById("od_settle_kakaopay").checked){
|
||||
// TO-DO : 가맹점에서 해줘야할 부분(TXN_ID)과 KaKaoPay DLP 호출 API
|
||||
// 결과코드가 00(정상처리되었습니다.)
|
||||
if(frm.resultCode.value == '00') {
|
||||
// TO-DO : 가맹점에서 해줘야할 부분(TXN_ID)과 KaKaoPay DLP 호출 API
|
||||
kakaopayDlp.setTxnId(frm.txnId.value);
|
||||
kakaopayDlp.setChannelType('WPM', 'TMS');
|
||||
kakaopayDlp.addRequestParams({ MOBILE_NUM : frm.od_hp.value});
|
||||
kakaopayDlp.callDlp('kakaopay_layer', frm, submitFunc);
|
||||
} else {
|
||||
alert('[RESULT_CODE] : ' + frm.resultCode.value + '\n[RESULT_MSG] : ' + frm.resultMsg.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function makeHashData(frm) {
|
||||
//var inicis_kakaopay_request = jQuery("#inicis_pay_form").length ? "inicis_pay_form" : "inicis_kakaopay_request";
|
||||
var inicis_kakaopay_request = "inicis_kakaopay_request";
|
||||
|
||||
if( typeof g5_shop_url === 'undefined' ){
|
||||
var g5_shop_url = g5_url+"/shop";
|
||||
}
|
||||
|
||||
function inicis_kakao_signature(frm)
|
||||
{
|
||||
// 데이터 암호화 처리
|
||||
var result = true;
|
||||
//var ajax_str_url = (inicis_kakaopay_request == "inicis_pay_form") ? "/inicis/makesignature.php" : "/kakaopay/makesignature.php";
|
||||
var ajax_str_url = "/kakaopay/makesignature.php";
|
||||
|
||||
$.ajax({
|
||||
url: g5_url+"/shop/kakaopay/makehashdata.php",
|
||||
url: g5_shop_url+ajax_str_url,
|
||||
type: "POST",
|
||||
data: {
|
||||
Amt : frm.good_mny.value,
|
||||
ediDate : frm.EdiDate.value
|
||||
price : frm.good_mny.value
|
||||
},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
cache: false,
|
||||
success: function(data) {
|
||||
if(data.error == "") {
|
||||
frm.EncryptData.value = data.hash_String;
|
||||
frm.timestamp.value = data.timestamp;
|
||||
frm.signature.value = data.sign;
|
||||
frm.mKey.value = data.mKey;
|
||||
} else {
|
||||
alert(data.error);
|
||||
result = false;
|
||||
@ -61,50 +114,66 @@ if($is_kakaopay_use) {
|
||||
}
|
||||
|
||||
function getTxnId(frm) {
|
||||
if(makeHashData(frm)) {
|
||||
frm.Amt.value = frm.good_mny.value;
|
||||
frm.BuyerEmail.value = frm.od_email.value;
|
||||
frm.BuyerName.value = frm.od_name.value;
|
||||
|
||||
$.ajax({
|
||||
url: g5_url+"/shop/kakaopay/getTxnId.php",
|
||||
type: "POST",
|
||||
data: $("#kakaopay_request input").serialize(),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
cache: false,
|
||||
success: function(data) {
|
||||
frm.resultCode.value = data.resultCode;
|
||||
frm.resultMsg.value = data.resultMsg;
|
||||
frm.txnId.value = data.txnId;
|
||||
frm.prDt.value = data.prDt;
|
||||
var pf = document.forderform,
|
||||
inicis_kk_form = document.forms[inicis_kakaopay_request];
|
||||
|
||||
inicis_kk_form.removeAttribute("target");
|
||||
inicis_kk_form.gopaymethod.value = "onlykakaopay";
|
||||
inicis_kk_form.acceptmethod.value = "cardonly";
|
||||
|
||||
cnspay(frm);
|
||||
},
|
||||
error: function(data) {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
inicis_kk_form.price.value = inicis_kk_form.good_mny.value = pf.good_mny.value;
|
||||
inicis_kk_form.goodname.value = (typeof pf.od_goods_name != "undefined") ? pf.od_goods_name.value : "";
|
||||
|
||||
if( inicis_kk_form.goodname.value == "" ){
|
||||
if( jQuery("#LGD_PRODUCTINFO").length ){
|
||||
inicis_kk_form.goodname.value = jQuery("#LGD_PRODUCTINFO").val();
|
||||
} else if( jQuery("input[name=good_name]").length ){
|
||||
inicis_kk_form.goodname.value = jQuery("input[name=good_name]").val();
|
||||
}
|
||||
}
|
||||
|
||||
inicis_kk_form.buyername.value = pf.od_name.value;
|
||||
inicis_kk_form.buyeremail.value = pf.od_email.value;
|
||||
inicis_kk_form.buyertel.value = pf.od_hp.value ? pf.od_hp.value : pf.od_tel.value;
|
||||
inicis_kk_form.recvname.value = pf.od_b_name.value;
|
||||
inicis_kk_form.recvtel.value = pf.od_b_hp.value ? pf.od_b_hp.value : pf.od_b_tel.value;
|
||||
inicis_kk_form.recvpostnum.value = pf.od_b_zip.value;
|
||||
inicis_kk_form.recvaddr.value = pf.od_b_addr1.value + " " +pf.od_b_addr2.value;
|
||||
|
||||
<?php if($default['de_tax_flag_use']) { ?>
|
||||
inicis_kk_form.comm_tax_mny.value = pf.comm_tax_mny.value;
|
||||
inicis_kk_form.comm_vat_mny.value = pf.comm_vat_mny.value;
|
||||
inicis_kk_form.comm_free_mny.value = pf.comm_free_mny.value;
|
||||
inicis_kk_form.tax.value = pf.comm_vat_mny.value;
|
||||
inicis_kk_form.taxfree.value = pf.comm_free_mny.value;
|
||||
<?php } ?>
|
||||
|
||||
// 주문 정보 임시저장
|
||||
var order_data = $(pf).serialize();
|
||||
var save_result = "";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: order_data,
|
||||
url: g5_url+"/shop/ajax.orderdatasave.php",
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
save_result = data;
|
||||
}
|
||||
});
|
||||
|
||||
if(save_result) {
|
||||
alert(save_result);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(inicis_kakao_signature(inicis_kk_form)) {
|
||||
setTimeout(function(){
|
||||
INIStdPay.pay(inicis_kakaopay_request);
|
||||
}, 1);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var submitFunc = function cnspaySubmit(data){
|
||||
|
||||
if(data.RESULT_CODE === '00') {
|
||||
|
||||
// 부인방지토큰은 기본적으로 name="NON_REP_TOKEN"인 input박스에 들어가게 되며, 아래와 같은 방법으로 꺼내서 쓸 수도 있다.
|
||||
// 해당값은 가군인증을 위해 돌려주는 값으로서, 가맹점과 카카오페이 양측에서 저장하고 있어야 한다.
|
||||
// var temp = data.NON_REP_TOKEN;
|
||||
|
||||
document.forderform.submit();
|
||||
} else if(data.RESLUT_CODE === 'KKP_SER_002') {
|
||||
// X버튼 눌렀을때의 이벤트 처리 코드 등록
|
||||
alert('[RESULT_CODE] : ' + data.RESULT_CODE + '\n[RESULT_MSG] : ' + data.RESULT_MSG);
|
||||
} else {
|
||||
alert('[RESULT_CODE] : ' + data.RESULT_CODE + '\n[RESULT_MSG] : ' + data.RESULT_MSG);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</script>
|
||||
@ -2,35 +2,17 @@
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if($is_kakaopay_use) {
|
||||
$remoteaddr = $_SERVER['REMOTE_ADDR'];
|
||||
$serveraddr = $_SERVER['SERVER_ADDR'];
|
||||
?>
|
||||
|
||||
<div id="kakaopay_request">
|
||||
<input type="hidden" name="merchantTxnNum" value="<?php echo $od_id; ?>">
|
||||
<input type="hidden" name="GoodsName" value="<?php echo $goods; ?>">
|
||||
<input type="hidden" name="Amt" value="<?php echo $tot_price; ?>">
|
||||
<input type="hidden" name="GoodsCnt" value="<?php echo ($goods_count + 1); ?>">
|
||||
<input type="hidden" name="BuyerEmail" value="">
|
||||
<input type="hidden" name="BuyerName" value="">
|
||||
<input type="hidden" name="prType" value="<?php echo (is_mobile() ? 'MPM' : 'WPM'); ?>">
|
||||
<input type="hidden" name="channelType" value="4">
|
||||
<input type="hidden" name="TransType" value="0">
|
||||
<input type="hidden" name="resultCode" value="" id="resultCode">
|
||||
<input type="hidden" name="resultMsg" value="" id="resultMsg">
|
||||
<input type="hidden" name="txnId" value="" id="txnId">
|
||||
<input type="hidden" name="prDt" value="" id="prDt">
|
||||
<input type="hidden" name="SPU" value="">
|
||||
<input type="hidden" name="SPU_SIGN_TOKEN" value="">
|
||||
<input type="hidden" name="MPAY_PUB" value="">
|
||||
<input type="hidden" name="NON_REP_TOKEN" value="">
|
||||
<input type="hidden" name="EdiDate" value="<?php echo($ediDate); ?>">
|
||||
<input type="hidden" name="EncryptData" value="">
|
||||
<?php if($default['de_tax_flag_use']) { ?>
|
||||
<input type="hidden" name="SupplyAmt" value="<?php echo ((int)$comm_tax_mny + (int)$comm_free_mny); ?>">
|
||||
<input type="hidden" name="GoodsVat" value="<?php echo $comm_vat_mny; ?>">
|
||||
<input type="hidden" name="ServiceAmt" value="0">
|
||||
<?php } ?>
|
||||
<?php if($is_mobile_order){ ?>
|
||||
<input type="hidden" name="is_inicis_mobile_kakaopay" value="mobile" >
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
@ -1,10 +1,3 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<!-- TODO : LayerPopup의 Target DIV 생성 -->
|
||||
<script>
|
||||
$(function() {
|
||||
$("body").append('<div id="kakaopay_layer" style="display: none"></div>');
|
||||
});
|
||||
</script>
|
||||
?>
|
||||
@ -5,65 +5,62 @@ if($od['od_pg'] != 'KAKAOPAY') return;
|
||||
|
||||
include_once(G5_SHOP_PATH.'/settle_kakaopay.inc.php');
|
||||
|
||||
include_once(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
|
||||
include_once(G5_SHOP_PATH.'/kakaopay/lgcns_CNSpay.php');
|
||||
$vat_mny = round((int)$tax_mny / 1.1);
|
||||
|
||||
$CancelNo = (int)$od['od_casseqno'] + 1;
|
||||
$vat_mny = round((int)$tax_mny / 1.1);
|
||||
$currency = 'WON';
|
||||
$oldtid = $od['od_tno'];
|
||||
$price = (int)$tax_mny + (int)$free_mny;
|
||||
$confirm_price = (int)$od['od_receipt_price'] - (int)$od['od_refund_price'] - $price;
|
||||
$buyeremail = $od['od_email'];
|
||||
$tax = (int)$tax_mny - $vat_mny;
|
||||
$taxfree = (int)$free_mny;
|
||||
|
||||
$_REQUEST['TID'] = $od['od_tno'];
|
||||
$_REQUEST['Amt'] = (int)$tax_mny + (int)$free_mny;
|
||||
$_REQUEST['CancelMsg'] = $mod_memo;
|
||||
$_REQUEST['PartialCancelCode'] = 1;
|
||||
$_REQUEST['CheckRemainAmt'] = (int)$od['od_receipt_price'] - (int)$od['od_refund_price'];
|
||||
$_REQUEST['CancelNo'] = $CancelNo;
|
||||
$_REQUEST['SupplyAmt'] = ((int)$tax_mny + (int)$free_mny - $vat_mny);
|
||||
$_REQUEST['GoodsVat'] = $vat_mny;
|
||||
$_REQUEST['ServiceAmt'] = 0;
|
||||
/***********************
|
||||
* 3. 재승인 정보 설정 *
|
||||
***********************/
|
||||
$inipay->SetField("type", "repay"); // 고정 (절대 수정 불가)
|
||||
$inipay->SetField("pgid", "INIphpRPAY"); // 고정 (절대 수정 불가)
|
||||
$inipay->SetField("subpgip", "203.238.3.10"); // 고정
|
||||
$inipay->SetField("mid", $default['de_kakaopay_mid']); // 상점아이디
|
||||
$inipay->SetField("admin", $default['de_kakaopay_cancelpwd']); //비대칭 사용키 키패스워드
|
||||
$inipay->SetField("oldtid", $oldtid); // 취소할 거래의 거래아이디
|
||||
$inipay->SetField("currency", $currency); // 화폐단위
|
||||
$inipay->SetField("price", $price); // 취소금액
|
||||
$inipay->SetField("confirm_price", $confirm_price); // 승인요청금액
|
||||
$inipay->SetField("buyeremail", $buyeremail); // 구매자 이메일 주소
|
||||
$inipay->SetField("tax", $tax); // 부가세금액
|
||||
$inipay->SetField("taxfree", $taxfree); // 비과세금액
|
||||
|
||||
/******************
|
||||
* 4. 재승인 요청 *
|
||||
******************/
|
||||
$inipay->startAction();
|
||||
|
||||
|
||||
// 로그 저장 위치 지정
|
||||
$connector = new CnsPayWebConnector($LogDir);
|
||||
$connector->CnsActionUrl($CnsPayDealRequestUrl);
|
||||
$connector->CnsPayVersion($phpVersion);
|
||||
$connector->setRequestData($_REQUEST);
|
||||
$connector->addRequestData("actionType", "CL0");
|
||||
$connector->addRequestData("CancelPwd", $cancelPwd);
|
||||
$connector->addRequestData("CancelIP", $_SERVER['REMOTE_ADDR']);
|
||||
/*******************************************************************
|
||||
* 5. 재승인 결과 *
|
||||
* *
|
||||
* 신거래번호 : $inipay->getResult('TID') *
|
||||
* 결과코드 : $inipay->getResult('ResultCode') ("00"이면 재승인 성공) *
|
||||
* 결과내용 : $inipay->getResult('ResultMsg') (재승인결과에 대한 설명) *
|
||||
* 원거래 번호 : $inipay->getResult('PRTC_TID') *
|
||||
* 최종결제 금액 : $inipay->getResult('PRTC_Remains') *
|
||||
* 부분취소 금액 : $inipay->getResult('PRTC_Price') *
|
||||
* 부분취소,재승인 구분값 : $inipay->getResult('PRTC_Type') *
|
||||
* ("0" : 재승인, "1" : 부분취소) *
|
||||
* 부분취소(재승인) 요청횟수 : $inipay->getResult('PRTC_Cnt') *
|
||||
*******************************************************************/
|
||||
|
||||
//가맹점키 셋팅 (MID 별로 틀림)
|
||||
$connector->addRequestData("EncodeKey", $merchantKey);
|
||||
|
||||
// 4. CNSPAY Lite 서버 접속하여 처리
|
||||
$connector->requestAction();
|
||||
|
||||
// 5. 결과 처리
|
||||
$resultCode = $connector->getResultData("ResultCode"); // 결과코드 (정상 :2001(취소성공), 2002(취소진행중), 그 외 에러)
|
||||
$resultMsg = $connector->getResultData("ResultMsg"); // 결과메시지
|
||||
$cancelAmt = $connector->getResultData("CancelAmt"); // 취소금액
|
||||
$cancelDate = $connector->getResultData("CancelDate"); // 취소일
|
||||
$cancelTime = $connector->getResultData("CancelTime"); // 취소시간
|
||||
$payMethod = $connector->getResultData("PayMethod"); // 취소 결제수단
|
||||
$mid = $connector->getResultData("MID"); // 가맹점 ID
|
||||
$tid = $connector->getResultData("TID"); // TID
|
||||
$errorCD = $connector->getResultData("ErrorCD"); // 상세 에러코드
|
||||
$errorMsg = $connector->getResultData("ErrorMsg"); // 상세 에러메시지
|
||||
$authDate = $cancelDate . $cancelTime; // 거래시간
|
||||
$ccPartCl = $connector->getResultData("CcPartCl"); // 부분취소 가능여부 (0:부분취소불가, 1:부분취소가능)
|
||||
$stateCD = $connector->getResultData("StateCD"); // 거래상태코드 (0: 승인, 1:전취소, 2:후취소)
|
||||
$authDate = $connector->makeDateString($authDate);
|
||||
$errorMsg = iconv("euc-kr", "utf-8", $errorMsg);
|
||||
$resultMsg = iconv("euc-kr", "utf-8", $resultMsg);
|
||||
|
||||
if($resultCode == "2001" || $resultCode == "2002") {
|
||||
$mod_mny = (int)$tax_mny + (int)$free_mny;
|
||||
if($inipay->getResult('ResultCode') == '00') {
|
||||
// 환불금액기록
|
||||
$tno = $inipay->getResult('PRTC_TID');
|
||||
$re_price = $inipay->getResult('PRTC_Price');
|
||||
|
||||
$sql = " update {$g5['g5_shop_order_table']}
|
||||
set od_refund_price = od_refund_price + '$mod_mny',
|
||||
od_shop_memo = concat(od_shop_memo, \"$mod_memo\"),
|
||||
od_casseqno = '$CancelNo'
|
||||
set od_refund_price = od_refund_price + '$re_price',
|
||||
od_shop_memo = concat(od_shop_memo, \"$mod_memo\")
|
||||
where od_id = '{$od['od_id']}'
|
||||
and od_tno = '{$od['od_tno']}' ";
|
||||
and od_tno = '$tno' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 미수금 등의 정보 업데이트
|
||||
@ -76,7 +73,7 @@ if($resultCode == "2001" || $resultCode == "2002") {
|
||||
od_free_mny = '{$info['od_free_mny']}'
|
||||
where od_id = '$od_id' ";
|
||||
sql_query($sql);
|
||||
} else {
|
||||
alert($resultMsg . ' 코드 : ' . $resultCode);
|
||||
}
|
||||
} else {
|
||||
alert(iconv_utf8($inipay->GetResult("ResultMsg")).' 코드 : '.$inipay->GetResult("ResultCode"));
|
||||
}
|
||||
?>
|
||||
215
shop/kakaopay/pc_pay_result.php
Normal file
215
shop/kakaopay/pc_pay_result.php
Normal file
@ -0,0 +1,215 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/HttpClient.php');
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/json_lib.php');
|
||||
|
||||
$inicis_pay_result = false;
|
||||
|
||||
try {
|
||||
|
||||
//#############################
|
||||
// 인증결과 파라미터 일괄 수신
|
||||
//#############################
|
||||
// $var = $_REQUEST["data"];
|
||||
|
||||
//#####################
|
||||
// 인증이 성공일 경우만
|
||||
//#####################
|
||||
if (strcmp('0000', $_REQUEST['resultCode']) == 0) {
|
||||
|
||||
//############################################
|
||||
// 1.전문 필드 값 설정(***가맹점 개발수정***)
|
||||
//############################################
|
||||
|
||||
$charset = 'UTF-8'; // 리턴형식[UTF-8,EUC-KR](가맹점 수정후 고정)
|
||||
|
||||
$format = 'JSON'; // 리턴형식[XML,JSON,NVP](가맹점 수정후 고정)
|
||||
// 추가적 noti가 필요한 경우(필수아님, 공백일 경우 미발송, 승인은 성공시, 실패시 모두 Noti발송됨) 미사용
|
||||
//String notiUrl = "";
|
||||
|
||||
$authToken = $_REQUEST['authToken']; // 취소 요청 tid에 따라서 유동적(가맹점 수정후 고정)
|
||||
|
||||
$authUrl = $_REQUEST['authUrl']; // 승인요청 API url(수신 받은 값으로 설정, 임의 세팅 금지)
|
||||
|
||||
$netCancel = $_REQUEST['netCancelUrl']; // 망취소 API url(수신 받은f값으로 설정, 임의 세팅 금지)
|
||||
|
||||
///$mKey = $util->makeHash(signKey, "sha256"); // 가맹점 확인을 위한 signKey를 해시값으로 변경 (SHA-256방식 사용)
|
||||
$mKey = hash("sha256", $signKey);
|
||||
|
||||
//#####################
|
||||
// 2.signature 생성
|
||||
//#####################
|
||||
$signParam['authToken'] = $authToken; // 필수
|
||||
$signParam['timestamp'] = $timestamp; // 필수
|
||||
// signature 데이터 생성 (모듈에서 자동으로 signParam을 알파벳 순으로 정렬후 NVP 방식으로 나열해 hash)
|
||||
$signature = $util->makeSignature($signParam);
|
||||
|
||||
|
||||
//#####################
|
||||
// 3.API 요청 전문 생성
|
||||
//#####################
|
||||
$authMap['mid'] = $default['de_kakaopay_mid']; // 필수
|
||||
$authMap['authToken'] = $authToken; // 필수
|
||||
$authMap['signature'] = $signature; // 필수
|
||||
$authMap['timestamp'] = $timestamp; // 필수
|
||||
$authMap['charset'] = $charset; // default=UTF-8
|
||||
$authMap['format'] = $format; // default=XML
|
||||
//if(null != notiUrl && notiUrl.length() > 0){
|
||||
// authMap.put("notiUrl" ,notiUrl);
|
||||
//}
|
||||
|
||||
|
||||
try {
|
||||
|
||||
$httpUtil = new HttpClient();
|
||||
|
||||
//#####################
|
||||
// 4.API 통신 시작
|
||||
//#####################
|
||||
|
||||
$authResultString = "";
|
||||
if ($httpUtil->processHTTP($authUrl, $authMap)) {
|
||||
$authResultString = $httpUtil->body;
|
||||
} else {
|
||||
echo "Http Connect Error\n";
|
||||
echo $httpUtil->errormsg;
|
||||
|
||||
throw new Exception("Http Connect Error");
|
||||
}
|
||||
|
||||
//############################################################
|
||||
//5.API 통신결과 처리(***가맹점 개발수정***)
|
||||
//############################################################
|
||||
|
||||
$resultMap = json_decode($authResultString, true);
|
||||
|
||||
$tid = $resultMap['tid'];
|
||||
$oid = preg_replace('/[^A-Za-z0-9\-_]/', '', $resultMap['MOID']);
|
||||
|
||||
/************************* 결제보안 추가 2016-05-18 START ****************************/
|
||||
$secureMap['mid'] = $default['de_kakaopay_mid']; //mid
|
||||
$secureMap['tstamp'] = $timestamp; //timestemp
|
||||
$secureMap['MOID'] = $resultMap['MOID']; //MOID
|
||||
$secureMap['TotPrice'] = $resultMap['TotPrice']; //TotPrice
|
||||
|
||||
// signature 데이터 생성
|
||||
$secureSignature = $util->makeSignatureAuth($secureMap);
|
||||
/************************* 결제보안 추가 2016-05-18 END ****************************/
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_order_data_table']} where od_id = '$oid' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
$data = unserialize(base64_decode($row['dt_data']));
|
||||
|
||||
if(isset($data['pp_id']) && $data['pp_id']) {
|
||||
$page_return_url = G5_SHOP_URL.'/personalpayform.php?pp_id='.$data['pp_id'];
|
||||
} else {
|
||||
$page_return_url = G5_SHOP_URL.'/orderform.php';
|
||||
if($_SESSION['ss_direct'])
|
||||
$page_return_url .= '?sw_direct=1';
|
||||
}
|
||||
|
||||
if ((strcmp('0000', $resultMap['resultCode']) == 0) && (strcmp($secureSignature, $resultMap['authSignature']) == 0) ) { //결제보안 추가 2016-05-18
|
||||
/* * ***************************************************************************
|
||||
* 여기에 가맹점 내부 DB에 결제 결과를 반영하는 관련 프로그램 코드를 구현한다.
|
||||
|
||||
[중요!] 승인내용에 이상이 없음을 확인한 뒤 가맹점 DB에 해당건이 정상처리 되었음을 반영함
|
||||
처리중 에러 발생시 망취소를 한다.
|
||||
* **************************************************************************** */
|
||||
|
||||
//최종결제요청 결과 성공 DB처리
|
||||
$tno = $resultMap['tid'];
|
||||
$amount = $resultMap['TotPrice'];
|
||||
$app_time = $resultMap['applDate'].$resultMap['applTime'];
|
||||
$pay_method = $resultMap['payMethod'];
|
||||
$pay_type = $PAY_METHOD[$pay_method];
|
||||
$depositor = $resultMap['VACT_InputName'];
|
||||
$commid = '';
|
||||
$mobile_no = $resultMap['HPP_Num'];
|
||||
$app_no = $resultMap['applNum'];
|
||||
$card_name = $CARD_CODE[$resultMap['CARD_Code']];
|
||||
switch($pay_type) {
|
||||
case '계좌이체':
|
||||
$bank_name = $BANK_CODE[$resultMap['ACCT_BankCode']];
|
||||
if ($default['de_escrow_use'] == 1)
|
||||
$escw_yn = 'Y';
|
||||
break;
|
||||
case '가상계좌':
|
||||
$bankname = $BANK_CODE[$resultMap['VACT_BankCode']];
|
||||
$account = $resultMap['VACT_Num'].' '.$resultMap['VACT_Name'];
|
||||
$app_no = $resultMap['VACT_Num'];
|
||||
if ($default['de_escrow_use'] == 1)
|
||||
$escw_yn = 'Y';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
$inicis_pay_result = true;
|
||||
|
||||
} else {
|
||||
$s = '(오류코드:'.$resultMap['resultCode'].') '.$resultMap['resultMsg'];
|
||||
alert($s, $page_return_url);
|
||||
}
|
||||
|
||||
// 수신결과를 파싱후 resultCode가 "0000"이면 승인성공 이외 실패
|
||||
// 가맹점에서 스스로 파싱후 내부 DB 처리 후 화면에 결과 표시
|
||||
// payViewType을 popup으로 해서 결제를 하셨을 경우
|
||||
// 내부처리후 스크립트를 이용해 opener의 화면 전환처리를 하세요
|
||||
//throw new Exception("강제 Exception");
|
||||
} catch (Exception $e) {
|
||||
// $s = $e->getMessage() . ' (오류코드:' . $e->getCode() . ')';
|
||||
//####################################
|
||||
// 실패시 처리(***가맹점 개발수정***)
|
||||
//####################################
|
||||
//---- db 저장 실패시 등 예외처리----//
|
||||
$s = $e->getMessage() . ' (오류코드:' . $e->getCode() . ')';
|
||||
echo $s;
|
||||
|
||||
//#####################
|
||||
// 망취소 API
|
||||
//#####################
|
||||
|
||||
$netcancelResultString = ""; // 망취소 요청 API url(고정, 임의 세팅 금지)
|
||||
if ($httpUtil->processHTTP($netCancel, $authMap)) {
|
||||
$netcancelResultString = $httpUtil->body;
|
||||
} else {
|
||||
echo "Http Connect Error\n";
|
||||
echo $httpUtil->errormsg;
|
||||
|
||||
throw new Exception("Http Connect Error");
|
||||
}
|
||||
|
||||
echo "## 망취소 API 결과 ##";
|
||||
|
||||
$netcancelResultString = str_replace("<", "<", $$netcancelResultString);
|
||||
$netcancelResultString = str_replace(">", ">", $$netcancelResultString);
|
||||
|
||||
echo "<pre>", $netcancelResultString . "</pre>";
|
||||
// 취소 결과 확인
|
||||
}
|
||||
} else {
|
||||
|
||||
//#############
|
||||
// 인증 실패시
|
||||
//#############
|
||||
echo "<br/>";
|
||||
echo "####인증실패####";
|
||||
|
||||
ob_start();
|
||||
var_dump($_REQUEST);
|
||||
$debug_msg = ob_get_contents();
|
||||
ob_clean();
|
||||
|
||||
echo "<pre>" . strip_tags($debug_msg) . "</pre>";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$s = $e->getMessage() . ' (오류코드:' . $e->getCode() . ')';
|
||||
echo $s;
|
||||
}
|
||||
|
||||
if( !$inicis_pay_result ){
|
||||
die("<br><br>결제 에러가 일어났습니다. 에러 이유는 위와 같습니다.");
|
||||
}
|
||||
?>
|
||||
@ -370,7 +370,9 @@ if($od['od_pg'] == 'lg') {
|
||||
|
||||
if($od['od_settle_case'] == 'KAKAOPAY')
|
||||
{
|
||||
$card_receipt_script = 'window.open(\'https://mms.cnspay.co.kr/trans/retrieveIssueLoader.do?TID='.$od['od_tno'].'&type=0\', \'popupIssue\', \'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=420,height=540\');';
|
||||
//$card_receipt_script = 'window.open(\'https://mms.cnspay.co.kr/trans/retrieveIssueLoader.do?TID='.$od['od_tno'].'&type=0\', \'popupIssue\', \'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=420,height=540\');';
|
||||
$card_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');';
|
||||
|
||||
?>
|
||||
<a href="javascript:;" onclick="<?php echo $card_receipt_script; ?>">영수증 출력</a>
|
||||
<?php
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
$is_kakaopay_use = false;
|
||||
if($default['de_kakaopay_mid'] && $default['de_kakaopay_key'] && $default['de_kakaopay_enckey'] && $default['de_kakaopay_hashkey'] && $default['de_kakaopay_cancelpwd']) {
|
||||
if($default['de_kakaopay_enckey']) {
|
||||
$is_kakaopay_use = true;
|
||||
require_once(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
|
||||
}
|
||||
|
||||
@ -504,7 +504,8 @@ if($od['od_pg'] == 'lg') {
|
||||
|
||||
if($od['od_settle_case'] == 'KAKAOPAY')
|
||||
{
|
||||
$card_receipt_script = 'window.open(\'https://mms.cnspay.co.kr/trans/retrieveIssueLoader.do?TID='.$od['od_tno'].'&type=0\', \'popupIssue\', \'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=420,height=540\');';
|
||||
//$card_receipt_script = 'window.open(\'https://mms.cnspay.co.kr/trans/retrieveIssueLoader.do?TID='.$od['od_tno'].'&type=0\', \'popupIssue\', \'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=420,height=540\');';
|
||||
$card_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');';
|
||||
?>
|
||||
<a href="javascript:;" onclick="<?php echo $card_receipt_script; ?>">영수증 출력</a>
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user