관리자 취소 기능 추가

This commit is contained in:
chicpro
2015-09-16 17:20:42 +09:00
parent 9a1a1c4765
commit 8f662516bb
7 changed files with 172 additions and 11 deletions

View File

@ -444,6 +444,25 @@ 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>
@ -482,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';
@ -713,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>
@ -773,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>
@ -1001,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

@ -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

@ -485,7 +485,7 @@ 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'];
@ -511,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']}
@ -554,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',

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

@ -470,7 +470,7 @@ 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'];
@ -496,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']}
@ -539,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',