#250 부분취소 기능 추가 중
This commit is contained in:
@ -99,13 +99,14 @@ $row = sql_fetch($sql);
|
||||
$total_order = $row['sum_order'];
|
||||
|
||||
// 상품목록
|
||||
$sql = " select it_id,
|
||||
it_name,
|
||||
cp_amount
|
||||
from {$g4['shop_cart_table']}
|
||||
where uq_id = '{$od['uq_id']}'
|
||||
and ct_num = '0'
|
||||
order by ct_id ";
|
||||
$sql = " select a.it_id,
|
||||
a.it_name,
|
||||
a.cp_amount,
|
||||
b.it_notax
|
||||
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
|
||||
where a.uq_id = '{$od['uq_id']}'
|
||||
and a.ct_num = '0'
|
||||
order by a.ct_id ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$pg_anchor = '<ul class="anchor">
|
||||
@ -152,6 +153,7 @@ $pg_anchor = '<ul class="anchor">
|
||||
<li>
|
||||
<p>
|
||||
<a href="./itemform.php?w=u&it_id=<?php echo $row['it_id']; ?>"><?php echo $image; ?> <?php echo stripslashes($row['it_name']); ?></a>
|
||||
<?php if($default['de_tax_flag_use'] && $row['it_notax']) echo '[비과세상품]'; ?>
|
||||
</p>
|
||||
|
||||
<table>
|
||||
@ -255,7 +257,7 @@ $pg_anchor = '<ul class="anchor">
|
||||
// 쿠폰금액
|
||||
$amount['쿠폰'] = $t_cp_amount + $od['od_coupon'];
|
||||
|
||||
// 미수금 = (주문금액 - DC + 환불액) - (입금액 - 신용카드승인취소) - 쿠폰금액
|
||||
// 미수금 = (주문금액 - DC + 환불액) - (입금액 - 결제승인취소) - 쿠폰금액
|
||||
$amount['미수'] = ($amount['정상'] - $od['od_dc_amount'] + $od['od_refund_amount']) - ($amount['입금'] - $od['od_cancel_card']) - $amount['쿠폰'];
|
||||
|
||||
// 결제방법
|
||||
@ -334,6 +336,12 @@ $pg_anchor = '<ul class="anchor">
|
||||
<th scope="row"><?php echo $od['od_settle_case']; ?> 입금액</th>
|
||||
<td><?php echo display_price($od['od_receipt_amount']); ?></td>
|
||||
</tr>
|
||||
<?php if($od['od_settle_case'] == '계좌이체') { ?>
|
||||
<tr>
|
||||
<th scope="row" class="sodr_sppay">결제 취소금액</th>
|
||||
<td><?php echo display_price($od['od_cancel_card']); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<th scope="row">입금자</th>
|
||||
<td><?php echo $od['od_deposit_name']; ?></td>
|
||||
@ -515,6 +523,15 @@ $pg_anchor = '<ul class="anchor">
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if($od['od_settle_case'] == '계좌이체') { ?>
|
||||
<tr>
|
||||
<th scope="row" class="sodr_sppay"><label for="od_cancel_card">결제 취소금액</label></th>
|
||||
<td>
|
||||
<input type="text" name="od_cancel_card" value="<?php echo $od['od_cancel_card']; ?>" class="frm_input" size="10"> 원
|
||||
<a href="./partcancel.php?od_id=<?php echo $od['od_id']; ?>" target="_blank" id="win_partcancel">결제부분취소</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<th scope="row"><label for="od_deposit_name">입금자명</label></th>
|
||||
<td>
|
||||
@ -579,7 +596,10 @@ $pg_anchor = '<ul class="anchor">
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" class="sodr_sppay"><label for="od_cancel_card">카드 승인취소</label></th>
|
||||
<td><input type="text" name="od_cancel_card" value="<?php echo $od['od_cancel_card']; ?>" class="frm_input" size="10"> 원</td>
|
||||
<td>
|
||||
<input type="text" name="od_cancel_card" value="<?php echo $od['od_cancel_card']; ?>" class="frm_input" size="10"> 원
|
||||
<a href="./partcancel.php?od_id=<?php echo $od['od_id']; ?>" target="_blank" id="win_partcancel">결제부분취소</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
@ -846,6 +866,13 @@ $(function() {
|
||||
else
|
||||
$chk.attr("checked", false);
|
||||
});
|
||||
|
||||
// 부분취소
|
||||
$("#win_partcancel").click(function() {
|
||||
var new_win = window.open($(this).attr("href"), "win_partcancel", "left=100,top=100,width=500, height=300");
|
||||
new_win.focus();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
function form_submit(f)
|
||||
|
||||
61
adm/shop_admin/partcancel.php
Normal file
61
adm/shop_admin/partcancel.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check($auth[$sub_menu], "w");
|
||||
|
||||
$g4['title'] = $settle_method.' 부분취소 요청';
|
||||
include_once(G4_PATH.'/head.sub.php');
|
||||
|
||||
$sql = " select od_id, od_settle_case, od_receipt_amount, od_cancel_card, od_tno, od_time
|
||||
from {$g4['shop_order_table']}
|
||||
where od_id = '{$_GET['od_id']}' ";
|
||||
$od = sql_fetch($sql);
|
||||
|
||||
if(!$od['od_id'])
|
||||
alert_close('주문정보가 존재하지 않습니다.');
|
||||
|
||||
if($od['od_settle_case'] != '신용카드' && $od['od_settle_case'] != '계좌이체')
|
||||
alert_close('부분취소는 신용카드 또는 실시간 계좌이체 결제건에 대해서만 요청할 수 있습니다.');
|
||||
|
||||
if($od['od_settle_case'] == '계좌이체' && substr(0, 10, $od['od_time']) == G4_TIME_YMD)
|
||||
alert_close('실시간 계좌이체건의 부분취소 요청은 결제일 익일에 가능합니다.');
|
||||
|
||||
$mod_type = 'RN07';
|
||||
if($od['od_settle_case'] == '계좌이체')
|
||||
$mod_type = 'STPA';
|
||||
|
||||
$available_cancel = $od['od_receipt_amount'] - $od['od_cancel_card'];
|
||||
?>
|
||||
|
||||
<div>
|
||||
<form name="fcardpartcancel" method="post" action="./partcancelupdate.php">
|
||||
<input type="hidden" name="od_id" value="<?php echo $od['od_id']; ?>">
|
||||
<input type="hidden" name="req_tx" value="mod">
|
||||
<input type="hidden" name="tno" value="<?php echo $od['od_tno']; ?>">
|
||||
<input type="hidden" name="mod_type" value="<?php echo $mod_type; ?>">
|
||||
<input type="hidden" name="rem_mny" value="<?php echo $available_cancel; ?>">
|
||||
<p>
|
||||
<?php echo $g4['title']; ?>
|
||||
</p>
|
||||
<p>
|
||||
취소가능금액 : <?php echo number_format($available_cancel); ?> 원
|
||||
</p>
|
||||
<p>
|
||||
<label for="mod_mny">취소요청금액</label>
|
||||
<input type="text" name="mod_mny" id="mod_mny" size="20" required class="required"> 원
|
||||
</p>
|
||||
<p>
|
||||
<label for="mod_desc">취소요청사유</label>
|
||||
<input type="text" name="mod_desc" id="mod_desc" size="50" required class="required">
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="확인">
|
||||
<a href="javascript:;" onclick="window.close();">창닫기</a>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once(G4_PATH.'/tail.sub.php');
|
||||
?>
|
||||
164
adm/shop_admin/partcancelupdate.php
Normal file
164
adm/shop_admin/partcancelupdate.php
Normal file
@ -0,0 +1,164 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
|
||||
if(!$_POST['tno'] || !$_POST['req_tx'] || !$_POST['mod_type'])
|
||||
alert_close('올바른 방법으로 이용해 주십시오.');
|
||||
|
||||
auth_check($auth[$sub_menu], "w");
|
||||
|
||||
$sql = " select od_id, od_settle_case, od_time
|
||||
from {$g4['shop_order_table']}
|
||||
where od_id = '{$_POST['od_id']}' ";
|
||||
$od = sql_fetch($sql);
|
||||
|
||||
if(!$od['od_id'])
|
||||
alert('주문정보가 존재하지 않습니다.');
|
||||
|
||||
if($od['od_settle_case'] != '신용카드' && $od['od_settle_case'] != '계좌이체')
|
||||
alert('부분취소는 신용카드 또는 실시간 계좌이체 결제건에 대해서만 요청할 수 있습니다.');
|
||||
|
||||
if($od['od_settle_case'] == '계좌이체' && substr(0, 10, $od['od_time']) == G4_TIME_YMD)
|
||||
alert('실시간 계좌이체건의 부분취소 요청은 결제일 익일에 가능합니다.');
|
||||
|
||||
// 취소사유의 한글깨짐 방지처리
|
||||
$def_locale = setlocale(LC_CTYPE, 0);
|
||||
$_POST['mod_desc'] = iconv("utf-8", "euc-kr", $_POST['mod_desc']);
|
||||
$locale_change = false;
|
||||
if(preg_match("/utf[\-]?8/i", $def_locale)) {
|
||||
setlocale(LC_CTYPE, 'ko_KR.euc-kr');
|
||||
$locale_change = true;
|
||||
}
|
||||
|
||||
// 부분취소 실행
|
||||
if ($default['de_card_test']) {
|
||||
if ($default['de_escrow_use'] == 1) {
|
||||
// 에스크로결제 테스트
|
||||
$default['de_kcp_mid'] = "T0007";
|
||||
$default['de_kcp_site_key'] = '2.mDT7R4lUIfHlHq4byhYjf__';
|
||||
}
|
||||
else {
|
||||
// 일반결제 테스트
|
||||
$default['de_kcp_mid'] = "T0000";
|
||||
$default['de_kcp_site_key'] = '3grptw1.zW0GSo4PQdaGvsF__';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$default['de_kcp_mid'] = "SR".$default['de_kcp_mid'];
|
||||
}
|
||||
|
||||
$g_conf_site_cd = $default['de_kcp_mid'];
|
||||
$g_conf_home_dir = G4_SHOP_PATH.'/kcp';
|
||||
$g_conf_key_dir = '';
|
||||
$g_conf_log_dir = '';
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
|
||||
{
|
||||
$g_conf_key_dir = G4_SHOP_PATH.'/kcp/bin/pub.key';
|
||||
$g_conf_log_dir = G4_SHOP_PATH.'/kcp/log';
|
||||
}
|
||||
|
||||
if (preg_match("/^T000/", $g_conf_site_cd) || $default['de_card_test']) {
|
||||
$g_conf_gw_url = "testpaygw.kcp.co.kr";
|
||||
}
|
||||
else {
|
||||
$g_conf_gw_url = "paygw.kcp.co.kr";
|
||||
if (!preg_match("/^SR/", $g_conf_site_cd)) {
|
||||
alert("SR 로 시작하지 않는 KCP SITE CODE 는 지원하지 않습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
$g_conf_log_level = "3";
|
||||
$g_conf_gw_port = "8090";
|
||||
|
||||
include_once(G4_SHOP_PATH.'/kcp/pp_ax_hub_lib.php');
|
||||
|
||||
$tno = $_POST['tno'];
|
||||
$req_tx = $_POST['req_tx'];
|
||||
$mod_type = $_POST['mod_type'];
|
||||
$mod_desc = $_POST['mod_desc'];
|
||||
$cust_ip = getenv("REMOTE_ADDR");
|
||||
|
||||
$c_PayPlus = new C_PP_CLI;
|
||||
$c_PayPlus->mf_clear();
|
||||
|
||||
if ( $req_tx == "mod" )
|
||||
{
|
||||
$tran_cd = "00200000";
|
||||
|
||||
$c_PayPlus->mf_set_modx_data( "tno", $tno ); // KCP 원거래 거래번호
|
||||
$c_PayPlus->mf_set_modx_data( "mod_type", $mod_type ); // 원거래 변경 요청 종류
|
||||
$c_PayPlus->mf_set_modx_data( "mod_ip", $cust_ip ); // 변경 요청자 IP
|
||||
$c_PayPlus->mf_set_modx_data( "mod_desc", $mod_desc ); // 변경 사유
|
||||
|
||||
if ( $mod_type == "RN07" || $mod_type == "STPA" ) // 부분취소의 경우
|
||||
{
|
||||
$c_PayPlus->mf_set_modx_data( "mod_mny", $_POST[ "mod_mny" ] ); // 취소요청금액
|
||||
$c_PayPlus->mf_set_modx_data( "rem_mny", $_POST[ "rem_mny" ] ); // 취소가능잔액
|
||||
}
|
||||
}
|
||||
|
||||
if ( $tran_cd != "" )
|
||||
{
|
||||
$c_PayPlus->mf_do_tx( $trace_no, $g_conf_home_dir, $g_conf_site_cd, "", $tran_cd, "",
|
||||
$g_conf_gw_url, $g_conf_gw_port, "payplus_cli_slib", $ordr_idxx,
|
||||
$cust_ip, "3" , 0, 0, $g_conf_key_dir, $g_conf_log_dir); // 응답 전문 처리
|
||||
|
||||
$res_cd = $c_PayPlus->m_res_cd; // 결과 코드
|
||||
$res_msg = $c_PayPlus->m_res_msg; // 결과 메시지
|
||||
/* $res_en_msg = $c_PayPlus->mf_get_res_data( "res_en_msg" ); // 결과 영문 메세지 */
|
||||
}
|
||||
else
|
||||
{
|
||||
$c_PayPlus->m_res_cd = "9562";
|
||||
$c_PayPlus->m_res_msg = "연동 오류|Payplus Plugin이 설치되지 않았거나 tran_cd값이 설정되지 않았습니다.";
|
||||
}
|
||||
|
||||
if ($res_cd != '0000')
|
||||
{
|
||||
$res_msg = iconv("euc-kr", "utf-8", $res_msg);
|
||||
|
||||
alert("$res_cd : $res_msg");
|
||||
}
|
||||
|
||||
/* ============================================================================== */
|
||||
/* = 취소 결과 처리 = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
if ( $req_tx == "mod" )
|
||||
{
|
||||
if ( $res_cd == "0000" )
|
||||
{
|
||||
$tno = $c_PayPlus->mf_get_res_data( "tno" ); // KCP 거래 고유 번호
|
||||
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = 부분취소 결과 처리 = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
if ( $mod_type == "RN07" || $mod_type == "STPA" ) // 부분취소의 경우
|
||||
{
|
||||
$amount = $c_PayPlus->mf_get_res_data( "amount" ); // 원 거래금액
|
||||
$mod_mny = $c_PayPlus->mf_get_res_data( "panc_mod_mny" ); // 취소요청된 금액
|
||||
$rem_mny = $c_PayPlus->mf_get_res_data( "panc_rem_mny" ); // 취소요청후 잔액
|
||||
|
||||
$sql = " update {$g4['shop_order_table']}
|
||||
set od_cancel_card = od_cancel_card + '$mod_mny'
|
||||
where od_id = '{$od['od_id']}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
} // End of [res_cd = "0000"]
|
||||
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = 취소 실패 결과 처리 = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if($locale_change)
|
||||
setlocale(LC_CTYPE, $def_locale);
|
||||
?>
|
||||
|
||||
<script>
|
||||
alert("부분취소 요청이 정상처리 됐습니다.");
|
||||
opener.window.location.reload();
|
||||
window.close();
|
||||
</script>
|
||||
@ -331,7 +331,7 @@ if(openwin != null) {
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row">승인취소 금액</th>
|
||||
<th scope="row">결제취소 금액</th>
|
||||
<td><?php echo display_price($od['od_cancel_card']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user