merge 충돌 수정

This commit is contained in:
chicpro
2015-09-18 13:16:28 +09:00
44 changed files with 3497 additions and 1616 deletions

View File

@ -102,6 +102,16 @@ if(!isset($default['de_easy_pay_use'])) {
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
ADD `de_easy_pay_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_iche_use` ", true);
}
// 카카오페이 필드 추가
if(!isset($default['de_kakaopay_mid'])) {
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
ADD `de_kakaopay_mid` varchar(255) NOT NULL DEFAULT '' AFTER `de_tax_flag_use`,
ADD `de_kakaopay_key` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_mid`,
ADD `de_kakaopay_enckey` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_key`,
ADD `de_kakaopay_hashkey` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_enckey`,
ADD `de_kakaopay_cancelpwd` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_hashkey` ", true);
}
?>
<form name="fconfig" action="./configformupdate.php" onsubmit="return fconfig_check(this)" method="post" enctype="MULTIPART/FORM-DATA">
@ -549,12 +559,12 @@ if(!isset($default['de_easy_pay_use'])) {
</td>
</tr>
<tr>
<th scope="row"><label for="de_easy_pay_use">PG사 간편결제 사용</label></th>
<th scope="row"><label for="de_easy_pay_use">PG사 간편결제 버튼 사용</label></th>
<td>
<?php echo help("PG사 간편결제(PAYCO, Paynow, Kpay) 사용여부를 설정합니다.", 50); ?>
<?php echo help("주문서 작성 페이지에 PG사 간편결제(PAYCO, PAYNOW, KPAY) 버튼의 별도 사용 여부를 설정합니다.", 50); ?>
<select id="de_easy_pay_use" name="de_easy_pay_use">
<option value="0" <?php echo get_selected($default['de_easy_pay_use'], 0); ?>>사용안함</option>
<option value="1" <?php echo get_selected($default['de_easy_pay_use'], 1); ?>>사용</option>
<option value="0" <?php echo get_selected($default['de_easy_pay_use'], 0); ?>>노출안함</option>
<option value="1" <?php echo get_selected($default['de_easy_pay_use'], 1); ?>>노출함</option>
</select>
</td>
</tr>
@ -679,6 +689,44 @@ if(!isset($default['de_easy_pay_use'])) {
<input type="text" name="de_inicis_admin_key" value="<?php echo $default['de_inicis_admin_key']; ?>" id="de_inicis_admin_key" class="frm_input" size="5" maxlength="4">
</td>
</tr>
<tr>
<th scope="row">
<label for="de_kakaopay_mid">카카오페이 상점MID</label>
<a href="http://sir.co.kr/main/service/kakaopay.php" target="_blank" id="scf_lgreg" class="scf_pgreg">카카오페이 서비스신청하기</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" size="5" maxlength="4"> <span class="sitecode">m</span>
</td>
</tr>
<tr>
<th scope="row"><label for="de_kakaopay_key">카카오페이 상점키</label></th>
<td>
<?php echo help("카카오페이로 부터 발급 받으신 상점 서명키를 입력합니다."); ?>
<input type="text" name="de_kakaopay_key" value="<?php echo $default['de_kakaopay_key']; ?>" id="de_kakaopay_key" class="frm_input" size="90">
</td>
</tr>
<tr>
<th scope="row"><label for="de_kakaopay_enckey">카카오페이 상점 EncKey</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">
</td>
</tr>
<tr>
<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>
<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>
<th scope="row">에스크로 사용</th>
<td>
@ -690,9 +738,9 @@ if(!isset($default['de_easy_pay_use'])) {
</td>
</tr>
<tr>
<th scope="row">신용카드 결제테스트</th>
<th scope="row">결제 테스트</th>
<td>
<?php echo help("신용카드를 테스트 하실 경우에 체크하세요. 결제단위 최소 1,000원"); ?>
<?php echo help("PG사의 결제 테스트 하실 경우에 체크하세요. 결제단위 최소 1,000원"); ?>
<input type="radio" name="de_card_test" value="0" <?php echo $default['de_card_test']==0?"checked":""; ?> id="de_card_test1">
<label for="de_card_test1">실결제 </label>
<input type="radio" name="de_card_test" value="1" <?php echo $default['de_card_test']==1?"checked":""; ?> id="de_card_test2">
@ -1545,6 +1593,23 @@ if($default['de_iche_use'] || $default['de_vbank_use'] || $default['de_hp_use']
}
}
}
// 카카오페이의 경우 log 디렉토리 체크
if($default['de_kakaopay_mid'] && $default['de_kakaopay_key'] && $default['de_kakaopay_enckey'] && $default['de_kakaopay_hashkey'] && $default['de_kakaopay_cancelpwd']) {
$log_path = G5_SHOP_PATH.'/kakaopay/log';
if(!is_dir($log_path)) {
echo '<script>'.PHP_EOL;
echo 'alert("'.str_replace(G5_PATH.'/', '', G5_SHOP_PATH).'/kakaopay 폴더 안에 log 폴더를 생성하신 후 쓰기권한을 부여해 주십시오.\n> mkdir log\n> chmod 707 log");'.PHP_EOL;
echo '</script>'.PHP_EOL;
} else {
if(!is_writable($log_path)) {
echo '<script>'.PHP_EOL;
echo 'alert("'.str_replace(G5_PATH.'/', '',$log_path).' 폴더에 쓰기권한을 부여해 주십시오.\n> chmod 707 log");'.PHP_EOL;
echo '</script>'.PHP_EOL;
}
}
}
}
include_once (G5_ADMIN_PATH.'/admin.tail.php');

View File

@ -176,6 +176,11 @@ $sql = " update {$g5['g5_shop_default_table']}
de_hp_use = '{$_POST['de_hp_use']}',
de_escrow_use = '{$_POST['de_escrow_use']}',
de_tax_flag_use = '{$_POST['de_tax_flag_use']}',
de_kakaopay_mid = '{$_POST['de_kakaopay_mid']}',
de_kakaopay_key = '{$_POST['de_kakaopay_key']}',
de_kakaopay_enckey = '{$_POST['de_kakaopay_enckey']}',
de_kakaopay_hashkey = '{$_POST['de_kakaopay_hashkey']}',
de_kakaopay_cancelpwd = '{$_POST['de_kakaopay_cancelpwd']}',
de_member_reg_coupon_use = '{$_POST['de_member_reg_coupon_use']}',
de_member_reg_coupon_term = '{$_POST['de_member_reg_coupon_term']}',
de_member_reg_coupon_price = '{$_POST['de_member_reg_coupon_price']}',

View File

@ -24,20 +24,6 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
$ca_list .= '<option value="'.$row['ca_id'].'">'.$nbsp.$row['ca_name'].'</option>'.PHP_EOL;
}
// 스킨
$skin_list = '<option value="">선택</option>'.PHP_EOL;
$arr = get_skin_dir('shop');
for ($i=0; $i<count($arr); $i++) {
$skin_list .= '<option value="'.$arr[$i].'">'.$arr[$i].'</option>'.PHP_EOL;
}
$mskin_list = '<option value="">선택</option>'.PHP_EOL;
$arr = get_skin_dir('shop', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
for ($i=0; $i<count($arr); $i++) {
$mskin_list .= '<option value="'.$arr[$i].'">'.$arr[$i].'</option>'.PHP_EOL;
}
$where = " and ";
$sql_search = "";
if ($stx != "") {
@ -243,9 +229,7 @@ $listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목
</td>
<td headers="th_skin" class="td_numbig td_input">
<label for="it_skin_<?php echo $i; ?>" class="sound_only">PC 스킨</label>
<select name="it_skin[<?php echo $i; ?>]" id="it_skin_<?php echo $i; ?>">
<?php echo conv_selected_option($skin_list, $row['it_skin']); ?>
</select>
<?php echo get_skin_select('shop', 'it_skin_'.$i, 'it_skin['.$i.']', $row['it_skin']); ?>
</td>
</tr>
<tr class="<?php echo $bg; ?>">
@ -256,9 +240,7 @@ $listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목
</td>
<td headers="th_mskin" class="td_numbig td_input">
<label for="it_mobile_skin_<?php echo $i; ?>" class="sound_only">모바일 스킨</label>
<select name="it_mobile_skin[<?php echo $i; ?>]" id="it_mobile_skin_<?php echo $i; ?>">
<?php echo conv_selected_option($mskin_list, $row['it_mobile_skin']); ?>
</select>
<?php echo get_mobile_skin_select('shop', 'it_mobile_skin_'.$i, 'it_mobile_skin['.$i.']', $row['it_mobile_skin']); ?>
</td>
</tr>
<?php

View File

@ -53,7 +53,7 @@ $sql = $sql . " limit $from_record, $rows ";
$result = sql_query($sql);
//$qstr = 'page='.$page.'&amp;sort1='.$sort1.'&amp;sort2='.$sort2;
$qstr1 = $qstr.'&amp;sort1='.$sort1.'&amp;sort2='.$sort2.'&amp;fr_date='.$fr_date.'&amp;to_date='.$to_date.'&amp;sel_ca_id='.$sel_ca_id;
$qstr1 = $qstr.'&amp;fr_date='.$fr_date.'&amp;to_date='.$to_date.'&amp;sel_ca_id='.$sel_ca_id;
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
?>

View File

@ -297,6 +297,23 @@ add_javascript(G5_POSTCODE_JS, 0); //다음 주소 js
// 결제방법
$s_receipt_way = $od['od_settle_case'];
if($od['od_settle_case'] == '간편결제') {
switch($od['od_pg']) {
case 'lg':
$s_receipt_way = 'PAYNOW';
break;
case 'inicis':
$s_receipt_way = 'KPAY';
break;
case 'kcp':
$s_receipt_way = 'PAYCO';
break;
default:
$s_receipt_way = $row['od_settle_case'];
break;
}
}
if ($od['od_receipt_point'] > 0)
$s_receipt_way .= "+포인트";
?>
@ -427,6 +444,44 @@ add_javascript(G5_POSTCODE_JS, 0); //다음 주소 js
</tr>
<?php } ?>
<?php if ($od['od_settle_case'] == 'KAKAOPAY') { ?>
<tr>
<th scope="row" class="sodr_sppay">KAKOPAY 결제금액</th>
<td>
<?php if ($od['od_receipt_time'] == "0000-00-00 00:00:00") {?>0원
<?php } else { ?><?php echo display_price($od['od_receipt_price']); ?>
<?php } ?>
</td>
</tr>
<tr>
<th scope="row" class="sodr_sppay">KAKAOPAY 승인일시</th>
<td>
<?php if ($od['od_receipt_time'] == "0000-00-00 00:00:00") {?>신용카드 결제 일시 정보가 없습니다.
<?php } else { ?><?php echo substr($od['od_receipt_time'], 0, 20); ?>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php if ($od['od_settle_case'] == '간편결제') { ?>
<tr>
<th scope="row" class="sodr_sppay"><?php echo $s_receipt_way; ?> 결제금액</th>
<td>
<?php if ($od['od_receipt_time'] == "0000-00-00 00:00:00") {?>0원
<?php } else { ?><?php echo display_price($od['od_receipt_price']); ?>
<?php } ?>
</td>
</tr>
<tr>
<th scope="row" class="sodr_sppay"><?php echo $s_receipt_way; ?> 승인일시</th>
<td>
<?php if ($od['od_receipt_time'] == "0000-00-00 00:00:00") { echo $s_receipt_way; ?> 결제 일시 정보가 없습니다.
<?php } else { ?><?php echo substr($od['od_receipt_time'], 0, 20); ?>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php if ($od['od_settle_case'] != '무통장') { ?>
<tr>
<th scope="row">결제대행사 링크</th>
@ -446,6 +501,10 @@ add_javascript(G5_POSTCODE_JS, 0); //다음 주소 js
$pg_url = 'https://iniweb.inicis.com/';
$pg_test = 'KG이니시스';
break;
case 'KAKAOPAY':
$pg_url = 'https://mms.cnspay.co.kr';
$pg_test = 'KAKAOPAY';
break;
default:
$pg_url = 'http://admin8.kcp.co.kr';
$pg_test = 'KCP';
@ -677,6 +736,42 @@ add_javascript(G5_POSTCODE_JS, 0); //다음 주소 js
</tr>
<?php } ?>
<?php if ($od['od_settle_case'] == 'KAKAOPAY') { ?>
<tr>
<th scope="row" class="sodr_sppay"><label for="od_receipt_price">KAKAOPAY 결제금액</label></th>
<td>
<?php echo $html_receipt_chk; ?>
<input type="text" name="od_receipt_price" id="od_receipt_price" value="<?php echo $od['od_receipt_price']; ?>" class="frm_input" size="10"> 원
</td>
</tr>
<tr>
<th scope="row" class="sodr_sppay"><label for="od_receipt_time">KAKAOPAY 승인일시</label></th>
<td>
<input type="checkbox" name="od_card_chk" id="od_card_chk" value="<?php echo date("Y-m-d H:i:s", G5_SERVER_TIME); ?>" onclick="if (this.checked == true) this.form.od_receipt_time.value=this.form.od_card_chk.value; else this.form.od_receipt_time.value = this.form.od_receipt_time.defaultValue;">
<label for="od_card_chk">현재 시간으로 설정</label><br>
<input type="text" name="od_receipt_time" value="<?php echo is_null_time($od['od_receipt_time']) ? "" : $od['od_receipt_time']; ?>" id="od_receipt_time" class="frm_input" size="19" maxlength="19">
</td>
</tr>
<?php } ?>
<?php if ($od['od_settle_case'] == '간편결제') { ?>
<tr>
<th scope="row" class="sodr_sppay"><label for="od_receipt_price"><?php echo $s_receipt_way; ?> 결제금액</label></th>
<td>
<?php echo $html_receipt_chk; ?>
<input type="text" name="od_receipt_price" id="od_receipt_price" value="<?php echo $od['od_receipt_price']; ?>" class="frm_input" size="10"> 원
</td>
</tr>
<tr>
<th scope="row" class="sodr_sppay"><label for="od_receipt_time"><?php echo $s_receipt_way; ?> 승인일시</label></th>
<td>
<input type="checkbox" name="od_card_chk" id="od_card_chk" value="<?php echo date("Y-m-d H:i:s", G5_SERVER_TIME); ?>" onclick="if (this.checked == true) this.form.od_receipt_time.value=this.form.od_card_chk.value; else this.form.od_receipt_time.value = this.form.od_receipt_time.defaultValue;">
<label for="od_card_chk">현재 시간으로 설정</label><br>
<input type="text" name="od_receipt_time" value="<?php echo is_null_time($od['od_receipt_time']) ? "" : $od['od_receipt_time']; ?>" id="od_receipt_time" class="frm_input" size="19" maxlength="19">
</td>
</tr>
<?php } ?>
<tr>
<th scope="row"><label for="od_receipt_point">포인트 결제액</label></th>
<td><input type="text" name="od_receipt_point" value="<?php echo $od['od_receipt_point']; ?>" id="od_receipt_point" class="frm_input" size="10"> 점</td>
@ -737,7 +832,7 @@ add_javascript(G5_POSTCODE_JS, 0); //다음 주소 js
<?php if($od['od_status'] == '주문' && $od['od_misu'] > 0) { ?>
<a href="./personalpayform.php?popup=yes&amp;od_id=<?php echo $od_id; ?>" id="personalpay_add">개인결제추가</a>
<?php } ?>
<?php if($od['od_misu'] < 0 && ($od['od_receipt_price'] - $od['od_refund_price']) > 0 && ($od['od_settle_case'] == '신용카드' || $od['od_settle_case'] == '계좌이체')) { ?>
<?php if($od['od_misu'] < 0 && ($od['od_receipt_price'] - $od['od_refund_price']) > 0 && ($od['od_settle_case'] == '신용카드' || $od['od_settle_case'] == '계좌이체' || $od['od_settle_case'] == 'KAKAOPAY')) { ?>
<a href="./orderpartcancel.php?od_id=<?php echo $od_id; ?>" id="orderpartcancel"><?php echo $od['od_settle_case']; ?> 부분취소</a>
<?php } ?>
<a href="./orderlist.php?<?php echo $qstr; ?>">목록</a>
@ -965,16 +1060,21 @@ function form_submit(f)
var msg = "";
<?php if($od['od_settle_case'] == '신용카드') { ?>
<?php if($od['od_settle_case'] == '신용카드' || $od['od_settle_case'] == 'KAKAOPAY' || $od['od_settle_case'] == '간편결제') { ?>
if(status == "취소" || status == "반품" || status == "품절") {
var $ct_chk = $("input[name^=ct_chk]");
var chk_cnt = $ct_chk.size();
var chked_cnt = $ct_chk.filter(":checked").size();
<?php if($od['od_pg'] == 'KAKAOPAY') { ?>
var cancel_pg = "카카오페이";
<?php } else { ?>
var cancel_pg = "PG사의 <?php echo $od['od_settle_case']; ?>";
<?php } ?>
if(chk_cnt == chked_cnt) {
if(confirm("PG사의 신용카드 결제를 함께 취소하시겠습니까?\n\n한번 취소한 결제는 다시 복구할 수 없습니다.")) {
if(confirm(cancel_pg+" 결제를 함께 취소하시겠습니까?\n\n한번 취소한 결제는 다시 복구할 수 없습니다.")) {
f.pg_cancel.value = 1;
msg = "PG사의 신용카드 결제 취소와 함께 ";
msg = cancel_pg+" 결제 취소와 함께 ";
} else {
f.pg_cancel.value = 0;
msg = "";

View File

@ -181,7 +181,7 @@ if (in_array($_POST['ct_status'], $status_cancel)) {
$sql = " select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ";
$od = sql_fetch($sql);
if($od['od_tno'] && $od['od_settle_case'] == '신용카드') {
if($od['od_tno'] && ($od['od_settle_case'] == '신용카드' || $od['od_settle_case'] == '간편결제' || $od['od_settle_case'] == 'KAKAOPAY')) {
switch($od['od_pg']) {
case 'lg':
include_once(G5_SHOP_PATH.'/settle_lg.inc.php');
@ -253,6 +253,14 @@ if (in_array($_POST['ct_status'], $status_cancel)) {
$pg_res_msg = iconv_utf8($res_msg);
}
break;
case 'KAKAOPAY':
include_once(G5_SHOP_PATH.'/settle_kakaopay.inc.php');
$_REQUEST['TID'] = $od['od_tno'];
$_REQUEST['Amt'] = $od['od_receipt_price'];
$_REQUEST['CancelMsg'] = '쇼핑몰 운영자 승인 취소';
$_REQUEST['PartialCancelCode'] = 0;
include G5_SHOP_PATH.'/kakaopay/kakaopay_cancel.php';
break;
default:
include_once(G5_SHOP_PATH.'/settle_kcp.inc.php');
require_once(G5_SHOP_PATH.'/kcp/pp_ax_hub_lib.php');

View File

@ -192,6 +192,10 @@ if(!sql_query(" select mb_id from {$g5['g5_shop_order_delete_table']} limit 1 ",
<label for="od_settle_case05">휴대폰</label>
<input type="radio" name="od_settle_case" value="신용카드" id="od_settle_case06" <?php echo get_checked($od_settle_case, '신용카드'); ?>>
<label for="od_settle_case06">신용카드</label>
<input type="radio" name="od_settle_case" value="간편결제" id="od_settle_case07" <?php echo get_checked($od_settle_case, '간편결제'); ?>>
<label for="od_settle_case07">PG간편결제</label>
<input type="radio" name="od_settle_case" value="KAKAOPAY" id="od_settle_case08" <?php echo get_checked($od_settle_case, 'KAKAOPAY'); ?>>
<label for="od_settle_case08">KAKAOPAY</label>
</div>
<div>
@ -278,6 +282,24 @@ if(!sql_query(" select mb_id from {$g5['g5_shop_order_delete_table']} limit 1 ",
{
$s_receipt_way = $row['od_settle_case'];
$s_br = '<br />';
// 간편결제
if($row['od_settle_case'] == '간편결제') {
switch($row['od_pg']) {
case 'lg':
$s_receipt_way = 'PAYNOW';
break;
case 'inicis':
$s_receipt_way = 'KPAY';
break;
case 'kcp':
$s_receipt_way = 'PAYCO';
break;
default:
$s_receipt_way = $row['od_settle_case'];
break;
}
}
}
else
{

View File

@ -49,10 +49,12 @@ $od_misu = abs($od['od_misu']);
<th scope="row"><label for="mod_tax_mny">과세 취소금액</label></th>
<td><input type="text" name="mod_tax_mny" value="" id="mod_tax_mny" class="frm_input"> 원</td>
</tr>
<?php if($od['od_pg'] != 'KAKAOPAY') { ?>
<tr>
<th scope="row"><label for="mod_free_mny">비과세 취소금액</label></th>
<td><input type="text" name="mod_free_mny" value="" id="mod_free_mny" class="frm_input"> 원</td>
</tr>
<?php } ?>
<tr>
<th scope="row"><label for="mod_memo">요청사유</label></th>
<td><input type="text" name="mod_memo" id="mod_memo" required class="required frm_input" size="50"></td>
@ -73,7 +75,9 @@ function form_check(f)
{
var max_mny = parseInt(<?php echo $od_misu; ?>);
var tax_mny = parseInt(f.mod_tax_mny.value.replace("/[^0-9]/g", ""));
var free_mny = parseInt(f.mod_free_mny.value.replace("/[^0-9]/g", ""));
var free_mny = 0;
if(typeof f.mod_free.mny.value != "undefined")
free_mny = parseInt(f.mod_free_mny.value.replace("/[^0-9]/g", ""));
if(!tax_mny && !free_mny) {
alert("과세 취소금액 또는 비과세 취소금액을 입력해 주십시오.");

View File

@ -36,7 +36,7 @@ if($free_mny && $free_mny > $od_misu)
alert('비과세 취소금액을 '.display_price($od_misu).' 이하로 입력해 주십시오.');
// PG사별 부분취소 실행
include_once(G5_SHOP_PATH.'/'.$od['od_pg'].'/orderpartcancel.inc.php');
include_once(G5_SHOP_PATH.'/'.strtolower($od['od_pg']).'/orderpartcancel.inc.php');
include_once(G5_PATH.'/head.sub.php');
?>

View File

@ -104,7 +104,7 @@ if ($csv == 'csv')
$ct_send_cost = iconv_euckr($ct_send_cost);
}
echo '"'.$row['od_b_zip1'].$row['od_b_zip2'].'"'.',';
echo '"\''.$row['od_b_zip1'].$row['od_b_zip2'].'"\''.',';
echo '"'.print_address($row['od_b_addr1'], $row['od_b_addr2'], $row['od_b_addr3'], $row['od_b_addr_jibeon']).'"'.',';
echo '"'.$row['od_b_name'].'"'.',';
//echo '"'.multibyte_digit((string)$row[od_b_tel]).'"'.',';
@ -209,7 +209,7 @@ if ($csv == 'xls')
$row = array_map('iconv_euckr', $row);
$worksheet->write($i, 0, $row['od_b_zip1'].$row['od_b_zip2']);
$worksheet->write($i, 0, ' '.$row['od_b_zip1'].$row['od_b_zip2']);
$worksheet->write($i, 1, print_address($row['od_b_addr1'], $row['od_b_addr2'], $row['od_b_addr3'], $row['od_b_addr_jibeon']));
$worksheet->write($i, 2, $row['od_b_name']);
$worksheet->write($i, 3, ' '.$row['od_b_tel']);

View File

@ -393,6 +393,7 @@ a.btn_admin:focus, a.btn_admin:hover {text-decoration:none}
#sod_frm_paysel .KPAY{background:url('../img/kpay_logo.png') no-repeat;padding-left:37px;display:inline-block}
#sod_frm_paysel .PAYNOW{background:url('../img/paynow_logo.png') no-repeat;padding-left:46px;display:inline-block}
#sod_frm_paysel .PAYCO{background:url('../img/payco_logo.png') no-repeat 1px;padding-left:46px;display:inline-block}
.kakaopay_icon{background:url('../img/kakao.png') no-repeat ;height:21px;width:74px;display:inline-block;overflow:hidden;text-indent:-999px}
#settle_bank {margin:10px 0 0}
@ -520,4 +521,60 @@ a.btn_admin:focus, a.btn_admin:hover {text-decoration:none}
/* 쿠폰 */
#coupon .td_numbig {width:150px}
#coupon .td_datetime {width:180px}
#coupon .td_datetime {width:180px}
/* 모바일일때 피시버전 주문폼*/
.sod_list {position:relative;margin:0;padding:0;list-style:none}
.sod_list .sod_li {position:relative;padding:0;border:1px solid #e9e9e9;margin:10px 0}
.sod_list .sod_li:after {display:block;visibility:hidden;clear:both;content:""}
.sod_list .li_chk{position:absolute;top:10px;left:10px;}
.sod_list .li_name{min-height:130px}
.sod_list .li_name a,.sod_list .li_name strong{display:block;padding: 0 10px 0 25px;border-bottom:1px solid #e9e9e9;height:35px;line-height:35px}
.sod_list .li_name strong{padding-left:10px}
.sod_list .total_img{position:absolute;top:45px;left:10px;}
.sod_list .sod_opt{padding:10px 10px 5px;margin-left:90px;color:#9e9e9e;font-size:0.93em;background:none;border:none}
.sod_list .sod_opt li{margin-bottom:3px;border:none}
.sod_list .li_cp{position:relative}
.sod_list .li_cp .cp_btn, .sod_list .li_cp .cp_cancel, .sod_list .li_mod .mod_btn {margin:0;padding:5px 8px;border:0;background:#000;color:#fff;font-size:0.93em}
.sod_list .li_cp .cp_cancel,.odf_tbl #od_coupon_cancel,.odf_tbl #sc_coupon_cancel{border:1px solid #999;color:#777;background:#fafafa;margin-left:3px;padding:4px 5px}
.sod_list .li_prqty{margin:10px;}
.sod_list .li_prqty:after {display:block;visibility:hidden;clear:both;content:""}
.sod_list .li_prqty .li_prqty_sp{width:33%;display:inline-block;float:left;text-align:center;line-height:2.2em;border-top:1px solid #d3d3d3;border-bottom:1px solid #d3d3d3;border-left:1px solid #e9e9e9;color:#9e9e9e;font-size:0.93em;margin-left:-1px}
.sod_list .li_prqty .prqty_price{border-left:1px solid #d3d3d3;}
.sod_list .li_prqty .prqty_sc{border-right:1px solid #d3d3d3;}
.sod_list .li_prqty .li_prqty_sp span{display:block;background:#f2f2f2;}
.sod_list .li_total {position:relative;border-top:1px solid #e9e9e9;margin:10px 10px 0;}
.sod_list .total_span {display:block;position:relative;padding:5px 0;text-align:right;color:#343434}
.sod_list .total_span span{position:absolute;top:5px;left:0}
.sod_list .total_span strong{font-size:1.2em}
#sod_frm {margin:10px;}
#sod_frm section{margin-bottom:10px}
#sod_frm p#sod_frm_pt_alert {margin:20px 0;text-align:center }
#sod_bsk_list #mod_option_frm .sit_ov_tbl{background:#ededed;margin-top:5px}
#sod_bsk_list #mod_option_frm .sit_ov_tbl th,#sod_bsk_list #mod_option_frm .sit_ov_tbl td{border:none;padding-left:5px;font-weight:normal}
#sod_bsk_list #mod_option_frm .sit_ov_tbl th{width:90px}
html.no-overflowscrolling #cp_frm {height:auto;max-height:10000px !important} /* overflow 미지원 기기 대응 */
#sod_frm_deli {position:relative;line-height:2em}
#sod_frm_deli #order_address {display:block;;width:100px;background:#333;color:#fff;text-align:center}
#sod_frm_orderer {margin:15px 0 30px}
#sod_frm_orderer #od_addr_jibeon, #sod_frm_taker #od_b_addr_jibeon {display:inline-block;margin:5px 0 0}
#sod_frm .odf_tbl table{width:100%;margin:0;padding:0;border-top:1px solid #e9e9e9;border-left:1px solid #e9e9e9;border-right:1px solid #e9e9e9;border-collapse:collapse}
#sod_frm .odf_tbl table tbody td,#sod_frm .odf_tbl table tbody th{;border-bottom:1px solid #e9e9e9;padding:5px 0px 5px 10px ;text-align:left;line-height:26px;position:relative;}
#sod_frm .odf_tbl table th{width:90px;color:#343434;font-weight:normal;letter-spacing:-0.1em}
#sod_frm .odf_tbl table .frm_input{background-color:#fff !important;height:24px;line-height:24px;text-indent:5px}
#sod_frm .odf_tbl table .frm_address{margin-top:5px}
#sod_frm .odf_tbl button.btn_frmline{font-size:0.92em;padding:0 8px;height:26px;line-height:26px}
#sod_frm .odf_tbl textarea{width:99%;border:1px solid #e4eaec;}
#sod_frm_same {margin:0 0 10px}
#sod_frm_pay {position:relative}
#sod_frm_pay .tbl_head01 caption {font-size:0;line-height:0;overflow:hidden}
#sod_frm_pay .tbl_head01 th {width:auto !important;font-weight:bold;text-align:center !important}
#sod_frm_pay .tbl_head01 td {border-top:1px solid #e9e9e9 !important;border-bottom:1px solid #e9e9e9 !important;line-height:1.5em !important;word-break:break-all !important}
html.no-overflowscrolling #sc_coupon_frm, html.no-overflowscrolling #od_coupon_frm {height:auto;max-height:10000px !important} /* overflow 미지원 기기 대응 */
#sod_frm_pay_info {margin:0 0 10px}
#sod_frm_paysel {margin:10px 0 ;padding:10px;background:#f2f2f2;border:1px solid #e0e0e0}
#sod_frm_paysel ul {margin:0;padding:0;}
#sod_frm_paysel ul:after {display:block;visibility:hidden;clear:both;content:""}
#sod_frm_paysel li {float:left;padding:5px 2%;width:46%;height:21px;text-align:left;list-style:none}

View File

@ -351,10 +351,11 @@ html.no-overflowscrolling #sc_coupon_frm, html.no-overflowscrolling #od_coupon_f
#sod_frm_paysel {margin:10px 0 ;padding:10px;background:#f2f2f2;border:1px solid #e0e0e0}
#sod_frm_paysel ul {margin:0;padding:0;}
#sod_frm_paysel ul:after {display:block;visibility:hidden;clear:both;content:""}
#sod_frm_paysel li {float:left;padding:5px 2%;width:46%}
#sod_frm_paysel .KPAY{background:url('../img/kpay_logo.png') no-repeat;padding-left:37px;}
#sod_frm_paysel li {float:left;padding:5px 2%;width:46%;height:21px}
x#sod_frm_paysel .KPAY{background:url('../img/kpay_logo.png') no-repeat;padding-left:37px;}
#sod_frm_paysel .PAYNOW{background:url('../img/paynow_logo.png') no-repeat;padding-left:46px;}
#sod_frm_paysel .PAYCO{background:url('../img/payco_logo.png') no-repeat 1px ;padding-left:46px;}
.kakaopay_icon{background:url('../img/kakao.png') no-repeat ;height:21px;width:74px;display:inline-block;overflow:hidden;text-indent:-999px}
#sod_frm_paysel #settle_bank {padding:10px;background:#fff;line-height:2em;border:1px solid #dbdbdb}
#sod_frm_paysel #settle_bank label {display:inline-block;margin:0 10px 0 0;font-weight:bold}
@ -710,4 +711,11 @@ a.btn_admin:focus, a.btn_admin:hover {text-decoration:none}
/*이벤트*/
#sev_hhtml,#sev_thtml{padding:10px}
#sev_hhtml img,#sev_thtml img{width:100%}
#sev_hhtml img,#sev_thtml img{width:100%}
/*피시일때 모바일버전 주문폼*/
#sod_frm p{margin-bottom:10px}
#forderform .tbl_frm01 th{border-bottom:1px solid #e9e9e9;background:#f7f7f7;padding-left:10px}
#sod_list thead th{padding:8px 0 }
#sod_list .sod_opt{min-width:70px}

BIN
img/kakao.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

View File

@ -325,6 +325,11 @@ CREATE TABLE IF NOT EXISTS `g5_shop_default` (
`de_hp_use` tinyint(4) NOT NULL DEFAULT '0',
`de_escrow_use` tinyint(4) NOT NULL DEFAULT '0',
`de_tax_flag_use` tinyint(4) NOT NULL DEFAULT '0',
`de_kakaopay_mid` varchar(255) NOT NULL DEFAULT '',
`de_kakaopay_key` varchar(255) NOT NULL DEFAULT '',
`de_kakaopay_enckey` varchar(255) NOT NULL DEFAULT '',
`de_kakaopay_hashkey` varchar(255) NOT NULL DEFAULT '',
`de_kakaopay_cancelpwd` varchar(255) NOT NULL DEFAULT '',
`de_member_reg_coupon_use` tinyint(4) NOT NULL DEFAULT '0',
`de_member_reg_coupon_term` int(11) NOT NULL DEFAULT '0',
`de_member_reg_coupon_price` int(11) NOT NULL DEFAULT '0',
@ -792,6 +797,7 @@ CREATE TABLE IF NOT EXISTS `g5_shop_inicis_log` (
`P_TYPE` varchar(255) NOT NULL DEFAULT '',
`P_OID` varchar(255) NOT NULL DEFAULT '',
`P_FN_NM` varchar(255) NOT NULL DEFAULT '',
`P_AUTH_NO` varchar(255) NOT NULL DEFAULT '',
`P_AMT` int(11) NOT NULL DEFAULT '0',
`P_RMESG1` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`oid`)

View File

@ -15,6 +15,7 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
<input type="hidden" name="P_RETURN_URL" value="">
<input type="hidden" name="P_HPP_METHOD" value="2">
<input type="hidden" name="P_RESERVED" value="bank_receipt=N&twotrs_isp=Y&block_isp=Y<?php echo $useescrow; ?>">
<input type="hidden" name="DEF_RESERVED" value="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은 일시불 -->

View File

@ -46,7 +46,7 @@ $g5['title'] = 'KG 이니시스 결제';
$g5['body_script'] = ' onload="setPAYResult();"';
include_once(G5_PATH.'/head.sub.php');
$exclude = array('res_cd', 'P_HASH', 'P_TYPE', 'P_AUTH_DT', 'P_VACT_BANK');
$exclude = array('res_cd', 'P_HASH', 'P_TYPE', 'P_AUTH_DT', 'P_VACT_BANK', 'P_AUTH_NO');
echo '<form name="forderform" method="post" action="'.$order_action_url.'" autocomplete="off">'.PHP_EOL;
@ -57,6 +57,7 @@ echo '<input type="hidden" name="P_HASH" value="'.$hash.'">'.PHP_EOL;
echo '<input type="hidden" name="P_TYPE" value="'.$PAY['P_TYPE'].'">'.PHP_EOL;
echo '<input type="hidden" name="P_AUTH_DT" value="'.$PAY['P_AUTH_DT'].'">'.PHP_EOL;
echo '<input type="hidden" name="P_VACT_BANK" value="'.$PAY['P_FN_NM'].'">'.PHP_EOL;
echo '<input type="hidden" name="P_AUTH_NO" value="'.$PAY['P_AUTH_NO'].'">'.PHP_EOL;
echo '</form>'.PHP_EOL;
?>

View File

@ -177,6 +177,7 @@ if($PGIP == "211.219.96.165" || $PGIP == "118.129.210.25") //PG에서 보냈는
P_TYPE = '$P_TYPE',
P_OID = '$P_OID',
P_FN_NM = '".iconv_utf8($P_FN_NM)."',
P_AUTH_NO = '$P_AUTH_NO',
P_AMT = '$P_AMT',
P_RMESG1 = '".iconv_utf8($P_RMESG1)."' ";
@sql_query($sql);

View File

@ -154,7 +154,7 @@ if($it['it_mobile_skin']) {
if(preg_match('#^theme/(.+)$#', $it['it_mobile_skin'], $match))
$skin_dir = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/shop/'.$match[1];
else
$skin_dir = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/shop/'.$it['it_skin'];
$skin_dir = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/shop/'.$it['it_mobile_skin'];
if(is_dir($skin_dir)) {
$form_skin_file = $skin_dir.'/item.form.skin.php';

View File

@ -1,33 +1,8 @@
<?php
include_once('./_common.php');
set_session("ss_direct", $sw_direct);
// 장바구니가 비어있는가?
if ($sw_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');
$g5['title'] = '주문서 작성';
include_once(G5_MSHOP_PATH.'/_head.php');
if ($default['de_hope_date_use']) {
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
}
// 새로운 주문번호 생성
$od_id = get_uniqid();
set_session('ss_order_id', $od_id);
$s_cart_id = $tmp_cart_id;
$order_action_url = G5_HTTPS_MSHOP_URL.'/orderformupdate.php';
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
require_once(G5_MSHOP_PATH.'/settle_'.$default['de_pg_service'].'.inc.php');
require_once(G5_SHOP_PATH.'/settle_kakaopay.inc.php');
// 결제등록 요청시 사용할 입금마감일
$ipgm_date = date("Ymd", (G5_SERVER_TIME + 86400 * 5));
@ -268,6 +243,12 @@ require_once(G5_MSHOP_PATH.'/'.$default['de_pg_service'].'/orderform.1.php');
?>
</div>
<?php
if($is_kakaopay_use) {
require_once(G5_SHOP_PATH.'/kakaopay/orderform.1.php');
}
?>
<div id="sod_frm">
<form name="forderform" method="post" action="<?php echo $order_action_url; ?>" autocomplete="off">
<input type="hidden" name="od_price" value="<?php echo $tot_sell_price; ?>">
@ -554,10 +535,17 @@ require_once(G5_MSHOP_PATH.'/'.$default['de_pg_service'].'/orderform.1.php');
$escrow_title = "에스크로 ";
}
if ($default['de_bank_use'] || $default['de_vbank_use'] || $default['de_iche_use'] || $default['de_card_use'] || $default['de_hp_use'] || $default['de_easy_pay_use']) {
if ($is_kakaopay_use || $default['de_bank_use'] || $default['de_vbank_use'] || $default['de_iche_use'] || $default['de_card_use'] || $default['de_hp_use'] || $default['de_easy_pay_use']) {
echo '<div id="sod_frm_paysel"><ul>';
}
// 카카오페이
if($is_kakaopay_use) {
$multi_settle++;
echo '<li><input type="radio" id="od_settle_kakaopay" name="od_settle_case" value="KAKAOPAY" '.$checked.'> <label for="od_settle_kakaopay" class="kakaopay_icon">KAKAOPAY</label></li>'.PHP_EOL;
$checked = '';
}
// 무통장입금 사용
if ($default['de_bank_use']) {
$multi_settle++;
@ -677,12 +665,22 @@ require_once(G5_MSHOP_PATH.'/'.$default['de_pg_service'].'/orderform.1.php');
<?php
// 결제대행사별 코드 include (결제대행사 정보 필드 및 주분버튼)
require_once(G5_MSHOP_PATH.'/'.$default['de_pg_service'].'/orderform.2.php');
if($is_kakaopay_use) {
require_once(G5_SHOP_PATH.'/kakaopay/orderform.2.php');
}
?>
<div id="show_progress" style="display:none;">
<img src="<?php echo G5_MOBILE_URL; ?>/shop/img/loading.gif" alt="">
<span>주문완료 중입니다. 잠시만 기다려 주십시오.</span>
</div>
<?php
if($is_kakaopay_use) {
require_once(G5_SHOP_PATH.'/kakaopay/orderform.3.php');
}
?>
</form>
<?php
@ -935,7 +933,7 @@ $(function() {
$("#show_pay_btn").css("display", "inline");
});
$("#od_settle_iche,#od_settle_card,#od_settle_vbank,#od_settle_hp,#od_settle_easy_pay").bind("click", function() {
$("#od_settle_iche,#od_settle_card,#od_settle_vbank,#od_settle_hp,#od_settle_easy_pay,#od_settle_kakaopay").bind("click", function() {
$("#settle_bank").hide();
$("#show_req_btn").css("display", "inline");
$("#show_pay_btn").css("display", "none");
@ -1174,6 +1172,13 @@ function pay_approval()
f.good_mny.value = od_price + send_cost + send_cost2 - send_coupon - temp_point;
}
// 카카오페이 지불
if(settle_method == "KAKAOPAY") {
pf.good_mny.value = f.good_mny.value;
getTxnId(pf);
return false;
}
<?php if($default['de_pg_service'] == 'kcp') { ?>
f.buyr_name.value = pf.od_name.value;
f.buyr_mail.value = pf.od_email.value;
@ -1228,7 +1233,7 @@ function pay_approval()
var ypos = (screen.width - height) / 2;
var position = "top=" + ypos + ",left=" + xpos;
var features = position + ", width=320, height=440";
var p_reserved = f.P_RESERVED.value;
var p_reserved = f.DEF_RESERVED.value;
f.P_RESERVED.value = p_reserved;
switch(settle_method) {
case "계좌이체":
@ -1499,8 +1504,4 @@ $(function(){
$("#od_hope_date").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true, yearRange: "c-99:c+99", minDate: "+<?php echo (int)$default['de_hope_date_after']; ?>d;", maxDate: "+<?php echo (int)$default['de_hope_date_after'] + 6; ?>d;" });
});
<?php } ?>
</script>
<?php
include_once(G5_MSHOP_PATH.'/_tail.php');
?>
</script>

View File

@ -9,7 +9,7 @@ if(get_session('ss_direct'))
$page_return_url .= '?sw_direct=1';
// 결제등록 완료 체크
if($od_settle_case != '무통장') {
if($od_settle_case != '무통장' && $od_settle_case != 'KAKAOPAY') {
if($default['de_pg_service'] == 'kcp' && ($_POST['tran_cd'] == '' || $_POST['enc_info'] == '' || $_POST['enc_data'] == ''))
alert('결제등록 요청 후 주문해 주십시오.', $page_return_url);
@ -418,22 +418,48 @@ else if ($od_settle_case == "간편결제")
if($od_misu == 0)
$od_status = '입금';
}
else if ($od_settle_case == "KAKAOPAY")
{
include G5_SHOP_PATH.'/kakaopay/kakaopay_result.php';
$od_tno = $tno;
$od_app_no = $app_no;
$od_receipt_price = $amount;
$od_receipt_point = $i_temp_point;
$od_receipt_time = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3 \\4:\\5:\\6", $app_time);
$od_bank_account = $card_name;
$pg_price = $amount;
$od_misu = $i_price - $od_receipt_price;
if($od_misu == 0)
$od_status = '입금';
}
else
{
die("od_settle_case Error!!!");
}
$od_pg = $default['de_pg_service'];
if($od_settle_case == 'KAKAOPAY')
$od_pg = 'KAKAOPAY';
// 주문금액과 결제금액이 일치하는지 체크
if($tno) {
if((int)$order_price !== (int)$pg_price) {
$cancel_msg = '결제금액 불일치';
switch($default['de_pg_service']) {
switch($od_pg) {
case 'lg':
include G5_SHOP_PATH.'/lg/xpay_cancel.php';
break;
case 'inicis':
include G5_SHOP_PATH.'/inicis/inipay_cancel.php';
break;
case 'KAKAOPAY':
$_REQUEST['TID'] = $tno;
$_REQUEST['Amt'] = $amount;
$_REQUEST['CancelMsg'] = $cancel_msg;
$_REQUEST['PartialCancelCode'] = 0;
include G5_SHOP_PATH.'/kakaopay/kakaopay_cancel.php';
break;
default:
include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php';
break;
@ -459,13 +485,12 @@ if($escw_yn == 'Y')
$od_tax_mny = round($i_price / 1.1);
$od_vat_mny = $i_price - $od_tax_mny;
$od_free_mny = 0;
if($default['de_tax_flag_use']) {
if($default['de_tax_flag_use'] && $od_pg != 'KAKAOPAY') {
$od_tax_mny = (int)$_POST['comm_tax_mny'];
$od_vat_mny = (int)$_POST['comm_vat_mny'];
$od_free_mny = (int)$_POST['comm_free_mny'];
}
$od_pg = $default['de_pg_service'];
$od_email = get_email_address($od_email);
$od_name = clean_xss_tags($od_name);
$od_tel = clean_xss_tags($od_tel);
@ -486,6 +511,10 @@ $od_b_addr3 = clean_xss_tags($od_b_addr3);
$od_b_addr_jibeon = preg_match("/^(N|R)$/", $od_b_addr_jibeon) ? $od_b_addr_jibeon : '';
$od_memo = clean_xss_tags($od_memo);
$od_deposit_name = clean_xss_tags($od_deposit_name);
$od_tax_flag = $default['de_tax_flag_use'];
if($od_tax_flag && $od_pg == 'KAKAOPAY')
$od_tax_flag = 0;
// 주문서에 입력
$sql = " insert {$g5['g5_shop_order_table']}
@ -529,7 +558,7 @@ $sql = " insert {$g5['g5_shop_order_table']}
od_tno = '$od_tno',
od_app_no = '$od_app_no',
od_escrow = '$od_escrow',
od_tax_flag = '{$default['de_tax_flag_use']}',
od_tax_flag = '$od_tax_flag',
od_tax_mny = '$od_tax_mny',
od_vat_mny = '$od_vat_mny',
od_free_mny = '$od_free_mny',
@ -547,13 +576,20 @@ $result = sql_query($sql, false);
if(!$result) {
if($tno) {
$cancel_msg = '주문정보 입력 오류';
switch($default['de_pg_service']) {
switch($od_pg) {
case 'lg':
include G5_SHOP_PATH.'/lg/xpay_cancel.php';
break;
case 'inicis':
include G5_SHOP_PATH.'/inicis/inipay_cancel.php';
break;
case 'KAKAOPAY':
$_REQUEST['TID'] = $tno;
$_REQUEST['Amt'] = $amount;
$_REQUEST['CancelMsg'] = $cancel_msg;
$_REQUEST['PartialCancelCode'] = 0;
include G5_SHOP_PATH.'/kakaopay/kakaopay_cancel.php';
break;
default:
include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php';
break;
@ -564,7 +600,7 @@ if(!$result) {
$error = 'order';
include G5_SHOP_PATH.'/ordererrormail.php';
die('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>'.strtoupper($default['de_pg_service']).'를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
die('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>'.strtoupper($od_pg).'를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
}
// 장바구니 상태변경
@ -586,13 +622,20 @@ $result = sql_query($sql, false);
if(!$result) {
if($tno) {
$cancel_msg = '주문상태 변경 오류';
switch($default['de_pg_service']) {
switch($od_pg) {
case 'lg':
include G5_SHOP_PATH.'/lg/xpay_cancel.php';
break;
case 'inicis':
include G5_SHOP_PATH.'/inicis/inipay_cancel.php';
break;
case 'KAKAOPAY':
$_REQUEST['TID'] = $tno;
$_REQUEST['Amt'] = $amount;
$_REQUEST['CancelMsg'] = $cancel_msg;
$_REQUEST['PartialCancelCode'] = 0;
include G5_SHOP_PATH.'/kakaopay/kakaopay_cancel.php';
break;
default:
include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php';
break;
@ -606,7 +649,7 @@ if(!$result) {
// 주문삭제
sql_query(" delete from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
die('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>'.strtoupper($default['de_pg_service']).'를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
die('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>'.strtoupper($od_pg).'를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
}
// 회원이면서 포인트를 사용했다면 포인트 테이블에 사용을 추가

View File

@ -240,7 +240,7 @@ if($od['od_pg'] == 'lg') {
$disp_bank = true;
$disp_receipt = false;
$easy_pay_name = '';
if($od['od_settle_case'] == '신용카드') {
if($od['od_settle_case'] == '신용카드' || $od['od_settle_case'] == 'KAKAOPAY') {
$app_no_subj = '승인번호';
$app_no = $od['od_app_no'];
$disp_bank = false;
@ -379,6 +379,14 @@ if($od['od_pg'] == 'lg') {
<a href="javascript:;" onclick="<?php echo $card_receipt_script; ?>">영수증 출력</a>
<?php
}
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\');';
?>
<a href="javascript:;" onclick="<?php echo $card_receipt_script; ?>">영수증 출력</a>
<?php
}
?>
<td>
</td>

View File

@ -57,6 +57,7 @@ if(!sql_query(" DESCRIBE {$g5['g5_shop_inicis_log_table']} ", false)) {
`P_TYPE` varchar(255) NOT NULL DEFAULT '',
`P_OID` varchar(255) NOT NULL DEFAULT '',
`P_FN_NM` varchar(255) NOT NULL DEFAULT '',
`P_AUTH_NO` varchar(255) NOT NULL DEFAULT '',
`P_AMT` int(11) NOT NULL DEFAULT '0',
`P_RMESG1` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`oid`)
@ -81,6 +82,12 @@ if(isset($g5['g5_shop_order_data_table']) && !sql_query(" DESCRIBE {$g5['g5_shop
) ENGINE=MyISAM DEFAULT CHARSET=utf8;", true);
}
// 모바일 이니시스 결제정보 테이블 필드 추가
if(!sql_query(" select P_AUTH_NO from {$g5['g5_shop_inicis_log_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_inicis_log_table']}`
ADD `P_AUTH_NO` varchar(255) NOT NULL DEFAULT '' AFTER `P_FN_NM` ", true);
}
echo '<p>테이블 업그레이드 완료!</p>';
include_once(G5_PATH.'/tail.sub.php');

View File

@ -0,0 +1,3 @@
<?php
include_once('../../common.php');
?>

141
shop/kakaopay/getTxnId.php Normal file
View File

@ -0,0 +1,141 @@
<?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"); //금지카드설정
// 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);
$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));
?>

View File

@ -0,0 +1,43 @@
<?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';
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']);
}
//버전
$phpVersion = 'PLP-0.1.1.3';
//로그 경로
$LogDir = G5_SHOP_PATH.'/kakaopay/log';
// TXN_ID를 가져오기 위해 세팅
$ediDate = date("YmdHis"); // 전문생성일시
$_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;
?>

View File

@ -0,0 +1,39 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
include_once(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
include_once(G5_SHOP_PATH.'/kakaopay/lgcns_CNSpay.php');
// 로그 저장 위치 지정
$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']);
//가맹점키 셋팅 (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);
?>

View File

@ -0,0 +1,76 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
include_once(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
include_once(G5_SHOP_PATH.'/kakaopay/lgcns_CNSpay.php');
// 로그 저장 위치 지정
$connector = new CnsPayWebConnector($LogDir);
$connector->CnsActionUrl($CnsPayDealRequestUrl);
$connector->CnsPayVersion($phpVersion);
// 요청 페이지 파라메터 셋팅
$connector->setRequestData($_REQUEST);
// 추가 파라메터 셋팅
$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($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);
}
?>

View File

@ -0,0 +1,472 @@
<?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');
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;
$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;
}
}
?>

View File

@ -0,0 +1,384 @@
<?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 "";
}
}
?>

View File

@ -0,0 +1,21 @@
<?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' => '')));
?>

View File

@ -0,0 +1,110 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
if($is_kakaopay_use) {
?>
<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>
<link href="https://pg.cnspay.co.kr:443/dlp/css/kakaopayDlp.css" rel="stylesheet" type="text/css" />
<!-- 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>
<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 result = true;
$.ajax({
url: g5_url+"/shop/kakaopay/makehashdata.php",
type: "POST",
data: {
Amt : frm.good_mny.value,
ediDate : frm.EdiDate.value
},
dataType: "json",
async: false,
cache: false,
success: function(data) {
if(data.error == "") {
frm.EncryptData.value = data.hash_String;
} else {
alert(data.error);
result = false;
}
}
});
return result;
}
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;
cnspay(frm);
},
error: function(data) {
console.log(data);
}
});
}
}
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
}
?>

View File

@ -0,0 +1,33 @@
<?php
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="">
</div>
<?php
}
?>

View File

@ -0,0 +1,10 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
?>
<!-- TODO : LayerPopup의 Target DIV 생성 -->
<script>
$(function() {
$("body").append('<div id="kakaopay_layer" style="display: none"></div>');
});
</script>

View File

@ -0,0 +1,77 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
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');
$CancelNo = (int)$od['od_casseqno'] + 1;
$_REQUEST['TID'] = $od['od_tno'];
$_REQUEST['Amt'] = (int)$tax_mny;
$_REQUEST['CancelMsg'] = $mod_memo;
$_REQUEST['PartialCancelCode'] = 1;
$_REQUEST['CheckRemainAmt'] = (int)$od['od_receipt_price'] - (int)$od['od_refund_price'];
$_REQUEST['CancelNo'] = $CancelNo;
// 로그 저장 위치 지정
$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']);
//가맹점키 셋팅 (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;
$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'
where od_id = '{$od['od_id']}'
and od_tno = '{$od['od_tno']}' ";
sql_query($sql);
// 미수금 등의 정보 업데이트
$info = get_order_info($od_id);
$sql = " update {$g5['g5_shop_order_table']}
set od_misu = '{$info['od_misu']}',
od_tax_mny = '{$info['od_tax_mny']}',
od_vat_mny = '{$info['od_vat_mny']}',
od_free_mny = '{$info['od_free_mny']}'
where od_id = '$od_id' ";
sql_query($sql);
} else {
alert($resultMsg . ' 코드 : ' . $resultCode);
}
?>

View File

@ -17,20 +17,11 @@ if($default['de_iche_use'] || $default['de_vbank_use'] || $default['de_hp_use']
/* ============================================================================== */
?>
<script>
StartSmartUpdate();
function CheckPayplusInstall()
{
if(ChkBrowser())
{
if(document.Payplus.object != null) {
document.getElementById("display_setup_message_top").style.display = "none" ;
document.getElementById("display_setup_message").style.display = "none" ;
document.getElementById("display_pay_button").style.display = "" ;
}
}
else
{
setTimeout("init_pay_button();",300);
}
setTimeout("init_pay_button();",300);
}
/* Payplus Plug-in 실행 */
@ -65,7 +56,7 @@ function jsf__pay( form )
function init_pay_button()
{
if (navigator.userAgent.indexOf('MSIE') > 0)
if ((navigator.userAgent.indexOf('MSIE') > 0) || (navigator.userAgent.indexOf('Trident/7.0') > 0))
{
try
{
@ -74,7 +65,7 @@ function init_pay_button()
document.getElementById("display_setup_message_top").style.display = "" ;
document.getElementById("display_setup_message").style.display = "" ;
document.getElementById("display_pay_button").style.display = "none" ;
document.getElementById("display_setup_message").scrollIntoView();
//document.getElementById("display_setup_message").scrollIntoView();
}
else{
document.getElementById("display_setup_message_top").style.display = "none" ;
@ -87,7 +78,7 @@ function init_pay_button()
document.getElementById("display_setup_message_top").style.display = "" ;
document.getElementById("display_setup_message").style.display = "" ;
document.getElementById("display_pay_button").style.display = "none" ;
document.getElementById("display_setup_message").scrollIntoView();
//document.getElementById("display_setup_message").scrollIntoView();
}
}
else
@ -99,7 +90,7 @@ function init_pay_button()
document.getElementById("display_setup_message_top").style.display = "" ;
document.getElementById("display_setup_message").style.display = "" ;
document.getElementById("display_pay_button").style.display = "none" ;
document.getElementById("display_setup_message").scrollIntoView();
//document.getElementById("display_setup_message").scrollIntoView();
}
else{
document.getElementById("display_setup_message_top").style.display = "none" ;
@ -112,7 +103,7 @@ function init_pay_button()
document.getElementById("display_setup_message_top").style.display = "" ;
document.getElementById("display_setup_message").style.display = "" ;
document.getElementById("display_pay_button").style.display = "none" ;
document.getElementById("display_setup_message").scrollIntoView();
//document.getElementById("display_setup_message").scrollIntoView();
}
}
}

View File

@ -11,6 +11,7 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
<input type="hidden" name="req_tx" value="pay">
<input type="hidden" name="site_cd" value="<?php echo $default['de_kcp_mid']; ?>">
<input type="hidden" name="site_name" value="<?php echo $default['de_admin_company_name']; ?>">
<input type="hidden" name="def_site_cd" value="<?php echo $default['de_kcp_mid']; ?>">
<?php
/*

View File

@ -1,10 +1,3 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// kcp 전자결제를 사용할 때만 실행
if($default['de_iche_use'] || $default['de_vbank_use'] || $default['de_hp_use'] || $default['de_card_use'] || $default['de_easy_pay_use']) {
?>
<script>
StartSmartUpdate();
</script>
<?php } ?>
?>

File diff suppressed because it is too large Load Diff

1492
shop/orderform.sub.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -403,22 +403,48 @@ else if ($od_settle_case == "간편결제")
if($od_misu == 0)
$od_status = '입금';
}
else if ($od_settle_case == "KAKAOPAY")
{
include G5_SHOP_PATH.'/kakaopay/kakaopay_result.php';
$od_tno = $tno;
$od_app_no = $app_no;
$od_receipt_price = $amount;
$od_receipt_point = $i_temp_point;
$od_receipt_time = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3 \\4:\\5:\\6", $app_time);
$od_bank_account = $card_name;
$pg_price = $amount;
$od_misu = $i_price - $od_receipt_price;
if($od_misu == 0)
$od_status = '입금';
}
else
{
die("od_settle_case Error!!!");
}
$od_pg = $default['de_pg_service'];
if($od_settle_case == 'KAKAOPAY')
$od_pg = 'KAKAOPAY';
// 주문금액과 결제금액이 일치하는지 체크
if($tno) {
if((int)$order_price !== (int)$pg_price) {
$cancel_msg = '결제금액 불일치';
switch($default['de_pg_service']) {
switch($od_pg) {
case 'lg':
include G5_SHOP_PATH.'/lg/xpay_cancel.php';
break;
case 'inicis':
include G5_SHOP_PATH.'/inicis/inipay_cancel.php';
break;
case 'KAKAOPAY':
$_REQUEST['TID'] = $tno;
$_REQUEST['Amt'] = $amount;
$_REQUEST['CancelMsg'] = $cancel_msg;
$_REQUEST['PartialCancelCode'] = 0;
include G5_SHOP_PATH.'/kakaopay/kakaopay_cancel.php';
break;
default:
include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php';
break;
@ -444,13 +470,12 @@ if($escw_yn == 'Y')
$od_tax_mny = round($i_price / 1.1);
$od_vat_mny = $i_price - $od_tax_mny;
$od_free_mny = 0;
if($default['de_tax_flag_use']) {
if($default['de_tax_flag_use'] && $od_pg != 'KAKAOPAY') {
$od_tax_mny = (int)$_POST['comm_tax_mny'];
$od_vat_mny = (int)$_POST['comm_vat_mny'];
$od_free_mny = (int)$_POST['comm_free_mny'];
}
$od_pg = $default['de_pg_service'];
$od_email = get_email_address($od_email);
$od_name = clean_xss_tags($od_name);
$od_tel = clean_xss_tags($od_tel);
@ -471,6 +496,10 @@ $od_b_addr3 = clean_xss_tags($od_b_addr3);
$od_b_addr_jibeon = preg_match("/^(N|R)$/", $od_b_addr_jibeon) ? $od_b_addr_jibeon : '';
$od_memo = clean_xss_tags($od_memo);
$od_deposit_name = clean_xss_tags($od_deposit_name);
$od_tax_flag = $default['de_tax_flag_use'];
if($od_tax_flag && $od_pg == 'KAKAOPAY')
$od_tax_flag = 0;
// 주문서에 입력
$sql = " insert {$g5['g5_shop_order_table']}
@ -514,7 +543,7 @@ $sql = " insert {$g5['g5_shop_order_table']}
od_tno = '$od_tno',
od_app_no = '$od_app_no',
od_escrow = '$od_escrow',
od_tax_flag = '{$default['de_tax_flag_use']}',
od_tax_flag = '$od_tax_flag',
od_tax_mny = '$od_tax_mny',
od_vat_mny = '$od_vat_mny',
od_free_mny = '$od_free_mny',
@ -531,13 +560,20 @@ $result = sql_query($sql, false);
if(!$result) {
if($tno) {
$cancel_msg = '주문정보 입력 오류';
switch($default['de_pg_service']) {
switch($od_pg) {
case 'lg':
include G5_SHOP_PATH.'/lg/xpay_cancel.php';
break;
case 'inicis':
include G5_SHOP_PATH.'/inicis/inipay_cancel.php';
break;
case 'KAKAOPAY':
$_REQUEST['TID'] = $tno;
$_REQUEST['Amt'] = $amount;
$_REQUEST['CancelMsg'] = $cancel_msg;
$_REQUEST['PartialCancelCode'] = 0;
include G5_SHOP_PATH.'/kakaopay/kakaopay_cancel.php';
break;
default:
include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php';
break;
@ -548,7 +584,7 @@ if(!$result) {
$error = 'order';
include G5_SHOP_PATH.'/ordererrormail.php';
die('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>'.strtoupper($default['de_pg_service']).'를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
die('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>'.strtoupper($od_pg).'를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
}
// 장바구니 상태변경
@ -570,13 +606,20 @@ $result = sql_query($sql, false);
if(!$result) {
if($tno) {
$cancel_msg = '주문상태 변경 오류';
switch($default['de_pg_service']) {
switch($od_pg) {
case 'lg':
include G5_SHOP_PATH.'/lg/xpay_cancel.php';
break;
case 'inicis':
include G5_SHOP_PATH.'/inicis/inipay_cancel.php';
break;
case 'KAKAOPAY':
$_REQUEST['TID'] = $tno;
$_REQUEST['Amt'] = $amount;
$_REQUEST['CancelMsg'] = $cancel_msg;
$_REQUEST['PartialCancelCode'] = 0;
include G5_SHOP_PATH.'/kakaopay/kakaopay_cancel.php';
break;
default:
include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php';
break;
@ -590,7 +633,7 @@ if(!$result) {
// 주문삭제
sql_query(" delete from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
die('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>'.strtoupper($default['de_pg_service']).'를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
die('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>'.strtoupper($od_pg).'를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
}
// 회원이면서 포인트를 사용했다면 테이블에 사용을 추가

View File

@ -257,7 +257,7 @@ if($od['od_pg'] == 'lg') {
$app_no_subj = '';
$disp_bank = true;
$disp_receipt = false;
if($od['od_settle_case'] == '신용카드') {
if($od['od_settle_case'] == '신용카드' || $od['od_settle_case'] == 'KAKAOPAY') {
$app_no_subj = '승인번호';
$app_no = $od['od_app_no'];
$disp_bank = false;
@ -396,6 +396,14 @@ if($od['od_pg'] == 'lg') {
<a href="javascript:;" onclick="<?php echo $card_receipt_script; ?>">영수증 출력</a>
<?php
}
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\');';
?>
<a href="javascript:;" onclick="<?php echo $card_receipt_script; ?>">영수증 출력</a>
<?php
}
?>
<td>
</td>

View File

@ -0,0 +1,9 @@
<?php
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']) {
$is_kakaopay_use = true;
require_once(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
}
?>

View File

@ -100,9 +100,9 @@ a:hover, a:focus, a:active {color:#000;text-decoration:underline}
#captcha legend {position:absolute;margin:0;padding:0;font-size:0;line-height:0;text-indent:-9999em;overflow:hidden}
#captcha #captcha_img {width:100px;height:41px;border:1px solid #e9e9e9}
#captcha #captcha_mp3 {position:absolute;top:0;left:101px;;margin:0;padding:0;width:23px;height:22px;border:0;background:transparent;vertical-align:middle;overflow:hidden;cursor:pointer}
#captcha #captcha_mp3 span {position:absolute;top:0;left:0;width:23px;height:22px;background:url('../plugin/kcaptcha/img/sound.gif')}
#captcha #captcha_mp3 span {position:absolute;top:0;left:0;width:23px;height:22px;background:url('../../../plugin/kcaptcha/img/sound.gif')}
#captcha #captcha_reload {position:absolute;top:21px;left:101px;margin:0;padding:0;width:23px;height:22px;border:0;background:transparent;vertical-align:middle;overflow:hidden;cursor:pointer}
#captcha #captcha_reload span {position:absolute;top:0;left:0;width:23px;height:22px;background:url('../plugin/kcaptcha/img/reload.gif')}
#captcha #captcha_reload span {position:absolute;top:0;left:0;width:23px;height:22px;background:url('../../../plugin/kcaptcha/img/reload.gif')}
#captcha #captcha_key {margin:0 0 0 25px;padding:0 5px;width:70px;height:41px;border:1px solid #b8c9c2;background:#f7f7f7;font-size:1.333em;font-weight:bold;text-align:center;line-height:2.8em}
#captcha #captcha_info {display:block;margin:5px 0 0;font-size:0.95em;letter-spacing:-0.1em}
@ -393,6 +393,7 @@ a.btn_admin:focus, a.btn_admin:hover {text-decoration:none}
#sod_frm_paysel .KPAY{background:url('../../../img/kpay_logo.png') no-repeat;padding-left:37px;display:inline-block}
#sod_frm_paysel .PAYNOW{background:url('../../../img/paynow_logo.png') no-repeat;padding-left:46px;display:inline-block}
#sod_frm_paysel .PAYCO{background:url('../../../img/payco_logo.png') no-repeat 1px;padding-left:46px;display:inline-block}
.kakaopay_icon{background:url('../../../img/kakao.png') no-repeat ;height:21px;width:74px;display:inline-block;overflow:hidden;text-indent:-999px}
#settle_bank {margin:10px 0 0}
@ -520,4 +521,60 @@ a.btn_admin:focus, a.btn_admin:hover {text-decoration:none}
/* 쿠폰 */
#coupon .td_numbig {width:150px}
#coupon .td_datetime {width:180px}
#coupon .td_datetime {width:180px}
/* 모바일일때 피시버전 주문폼*/
.sod_list {position:relative;margin:0;padding:0;list-style:none}
.sod_list .sod_li {position:relative;padding:0;border:1px solid #e9e9e9;margin:10px 0}
.sod_list .sod_li:after {display:block;visibility:hidden;clear:both;content:""}
.sod_list .li_chk{position:absolute;top:10px;left:10px;}
.sod_list .li_name{min-height:130px}
.sod_list .li_name a,.sod_list .li_name strong{display:block;padding: 0 10px 0 25px;border-bottom:1px solid #e9e9e9;height:35px;line-height:35px}
.sod_list .li_name strong{padding-left:10px}
.sod_list .total_img{position:absolute;top:45px;left:10px;}
.sod_list .sod_opt{padding:10px 10px 5px;margin-left:90px;color:#9e9e9e;font-size:0.93em;background:none;border:none}
.sod_list .sod_opt li{margin-bottom:3px;border:none}
.sod_list .li_cp{position:relative}
.sod_list .li_cp .cp_btn, .sod_list .li_cp .cp_cancel, .sod_list .li_mod .mod_btn {margin:0;padding:5px 8px;border:0;background:#000;color:#fff;font-size:0.93em}
.sod_list .li_cp .cp_cancel,.odf_tbl #od_coupon_cancel,.odf_tbl #sc_coupon_cancel{border:1px solid #999;color:#777;background:#fafafa;margin-left:3px;padding:4px 5px}
.sod_list .li_prqty{margin:10px;}
.sod_list .li_prqty:after {display:block;visibility:hidden;clear:both;content:""}
.sod_list .li_prqty .li_prqty_sp{width:33%;display:inline-block;float:left;text-align:center;line-height:2.2em;border-top:1px solid #d3d3d3;border-bottom:1px solid #d3d3d3;border-left:1px solid #e9e9e9;color:#9e9e9e;font-size:0.93em;margin-left:-1px}
.sod_list .li_prqty .prqty_price{border-left:1px solid #d3d3d3;}
.sod_list .li_prqty .prqty_sc{border-right:1px solid #d3d3d3;}
.sod_list .li_prqty .li_prqty_sp span{display:block;background:#f2f2f2;}
.sod_list .li_total {position:relative;border-top:1px solid #e9e9e9;margin:10px 10px 0;}
.sod_list .total_span {display:block;position:relative;padding:5px 0;text-align:right;color:#343434}
.sod_list .total_span span{position:absolute;top:5px;left:0}
.sod_list .total_span strong{font-size:1.2em}
#sod_frm {margin:10px;}
#sod_frm section{margin-bottom:10px}
#sod_frm p#sod_frm_pt_alert {margin:20px 0;text-align:center }
#sod_bsk_list #mod_option_frm .sit_ov_tbl{background:#ededed;margin-top:5px}
#sod_bsk_list #mod_option_frm .sit_ov_tbl th,#sod_bsk_list #mod_option_frm .sit_ov_tbl td{border:none;padding-left:5px;font-weight:normal}
#sod_bsk_list #mod_option_frm .sit_ov_tbl th{width:90px}
html.no-overflowscrolling #cp_frm {height:auto;max-height:10000px !important} /* overflow 미지원 기기 대응 */
#sod_frm_deli {position:relative;line-height:2em}
#sod_frm_deli #order_address {display:block;;width:100px;background:#333;color:#fff;text-align:center}
#sod_frm_orderer {margin:15px 0 30px}
#sod_frm_orderer #od_addr_jibeon, #sod_frm_taker #od_b_addr_jibeon {display:inline-block;margin:5px 0 0}
#sod_frm .odf_tbl table{width:100%;margin:0;padding:0;border-top:1px solid #e9e9e9;border-left:1px solid #e9e9e9;border-right:1px solid #e9e9e9;border-collapse:collapse}
#sod_frm .odf_tbl table tbody td,#sod_frm .odf_tbl table tbody th{;border-bottom:1px solid #e9e9e9;padding:5px 0px 5px 10px ;text-align:left;line-height:26px;position:relative;}
#sod_frm .odf_tbl table th{width:90px;color:#343434;font-weight:normal;letter-spacing:-0.1em}
#sod_frm .odf_tbl table .frm_input{background-color:#fff !important;height:24px;line-height:24px;text-indent:5px}
#sod_frm .odf_tbl table .frm_address{margin-top:5px}
#sod_frm .odf_tbl button.btn_frmline{font-size:0.92em;padding:0 8px;height:26px;line-height:26px}
#sod_frm .odf_tbl textarea{width:99%;border:1px solid #e4eaec;}
#sod_frm_same {margin:0 0 10px}
#sod_frm_pay {position:relative}
#sod_frm_pay .tbl_head01 caption {font-size:0;line-height:0;overflow:hidden}
#sod_frm_pay .tbl_head01 th {width:auto !important;font-weight:bold;text-align:center !important}
#sod_frm_pay .tbl_head01 td {border-top:1px solid #e9e9e9 !important;border-bottom:1px solid #e9e9e9 !important;line-height:1.5em !important;word-break:break-all !important}
html.no-overflowscrolling #sc_coupon_frm, html.no-overflowscrolling #od_coupon_frm {height:auto;max-height:10000px !important} /* overflow 미지원 기기 대응 */
#sod_frm_pay_info {margin:0 0 10px}
#sod_frm_paysel {margin:10px 0 ;padding:10px;background:#f2f2f2;border:1px solid #e0e0e0}
#sod_frm_paysel ul {margin:0;padding:0;}
#sod_frm_paysel ul:after {display:block;visibility:hidden;clear:both;content:""}
#sod_frm_paysel li {float:left;padding:5px 2%;width:46%;height:21px;text-align:left;list-style:none}

View File

@ -350,10 +350,11 @@ html.no-overflowscrolling #sc_coupon_frm, html.no-overflowscrolling #od_coupon_f
#sod_frm_paysel {margin:10px 0 ;padding:10px;background:#f2f2f2;border:1px solid #e0e0e0}
#sod_frm_paysel ul {margin:0;padding:0;}
#sod_frm_paysel ul:after {display:block;visibility:hidden;clear:both;content:""}
#sod_frm_paysel li {float:left;padding:5px 2%;width:46%}
#sod_frm_paysel li {float:left;padding:5px 2%;width:46%;height:21px}
#sod_frm_paysel .KPAY{background:url('../../../img/kpay_logo.png') no-repeat;padding-left:37px;}
#sod_frm_paysel .PAYNOW{background:url('../../../img/paynow_logo.png') no-repeat;padding-left:46px;}
#sod_frm_paysel .PAYCO{background:url('../../../img/payco_logo.png') no-repeat 1px ;padding-left:46px;}
.kakaopay_icon{background:url('../../../img/kakao.png') no-repeat ;height:21px;width:74px;display:inline-block;overflow:hidden;text-indent:-999px}
#sod_frm_paysel #settle_bank {padding:10px;background:#fff;line-height:2em;border:1px solid #dbdbdb}
@ -710,4 +711,11 @@ a.btn_admin:focus, a.btn_admin:hover {text-decoration:none}
/*이벤트*/
#sev_hhtml,#sev_thtml{padding:10px}
#sev_hhtml img,#sev_thtml img{width:100%}
#sev_hhtml img,#sev_thtml img{width:100%}
/*피시일때 모바일버전 주문폼*/
#sod_frm p{margin-bottom:10px}
#forderform .tbl_frm01 th{border-bottom:1px solid #e9e9e9;background:#f7f7f7;padding-left:10px}
#sod_list thead th{padding:8px 0 }
#sod_list .sod_opt{min-width:70px}
#sod_frm #display_pay_button .btn01{width: 49%;text-align: center;padding: 11px 0px;background: #fff;border: 1px solid #34B5A1;color:#34B5A1}