pc lg 결제 모듈 추가 중
This commit is contained in:
@ -72,6 +72,14 @@ if(!isset($default['de_member_reg_coupon_use'])) {
|
||||
ADD `de_member_reg_coupon_term` int(11) NOT NULL DEFAULT '0' AFTER `de_member_reg_coupon_use`,
|
||||
ADD `de_member_reg_coupon_price` int(11) NOT NULL DEFAULT '0' AFTER `de_member_reg_coupon_term` ", true);
|
||||
}
|
||||
|
||||
// lg 결제관련 필드 추가
|
||||
if(!isset($default['de_pg_service'])) {
|
||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
||||
ADD `de_pg_service` varchar(255) NOT NULL DEFAULT '' AFTER `de_sms_hp`,
|
||||
ADD `de_lg_mid` varchar(255) NOT NULL DEFAULT '' AFTER `de_kcp_mid`,
|
||||
ADD `de_lg_mert_key` varchar(255) NOT NULL DEFAULT '' AFTER `de_kcp_site_key` ", true);
|
||||
}
|
||||
?>
|
||||
|
||||
<form name="fconfig" action="./configformupdate.php" onsubmit="return fconfig_check(this)" method="post" enctype="MULTIPART/FORM-DATA">
|
||||
@ -505,7 +513,7 @@ if(!isset($default['de_member_reg_coupon_use'])) {
|
||||
<tr>
|
||||
<th scope="row"><label for="de_card_noint_use">신용카드 무이자할부사용</label></th>
|
||||
<td>
|
||||
<?php echo help("주문시 신용카드 무이자할부를 가능하게 할것인지를 설정합니다.<br>사용으로 설정하시면 KCP 가맹점 관리자 페이지에서 설정하신 무이자할부 설정이 적용됩니다.<br>사용안함으로 설정하시면 KCP 무이자 이벤트 카드를 제외한 모든 카드의 무이자 설정이 적용되지 않습니다.", 50); ?>
|
||||
<?php echo help("주문시 신용카드 무이자할부를 가능하게 할것인지를 설정합니다.<br>사용으로 설정하시면 PG사 가맹점 관리자 페이지에서 설정하신 무이자할부 설정이 적용됩니다.<br>사용안함으로 설정하시면 PG사 무이자 이벤트 카드를 제외한 모든 카드의 무이자 설정이 적용되지 않습니다.", 50); ?>
|
||||
<select id="de_card_noint_use" name="de_card_noint_use">
|
||||
<option value="0" <?php echo get_selected($default['de_card_noint_use'], 0); ?>>사용안함</option>
|
||||
<option value="1" <?php echo get_selected($default['de_card_noint_use'], 1); ?>>사용</option>
|
||||
@ -572,6 +580,16 @@ if(!isset($default['de_member_reg_coupon_use'])) {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="de_pg_service">결제대행사</label></th>
|
||||
<td>
|
||||
<?php echo help('쇼핑몰에서 이용하실 결제대행사를 선택합니다.'); ?>
|
||||
<select id="de_pg_service" name="de_pg_service">
|
||||
<option value="kcp" <?php echo get_selected($default['de_pg_service'], 'kcp'); ?>>KCP</option>
|
||||
<option value="lg" <?php echo get_selected($default['de_pg_service'], 'lg'); ?>>LG U+</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pg_info_fld kcp_info_fld">
|
||||
<th scope="row">
|
||||
<label for="de_kcp_mid">KCP SITE CODE</label><br>
|
||||
<a href="http://sir.co.kr/main/provider/p_pg.php" target="_blank" id="scf_kcpreg">KCP서비스신청하기</a>
|
||||
@ -581,17 +599,34 @@ if(!isset($default['de_member_reg_coupon_use'])) {
|
||||
<span class="sitecode">SR</span> <input type="text" name="de_kcp_mid" value="<?php echo $default['de_kcp_mid']; ?>" id="de_kcp_mid" class="frm_input" size="2" maxlength="3" style="font:bold 15px Verdana;"> 영대문자, 숫자 혼용 3자리
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="pg_info_fld kcp_info_fld">
|
||||
<th scope="row"><label for="de_kcp_site_key">KCP SITE KEY</label></th>
|
||||
<td>
|
||||
<?php echo help("25자리 영대소문자와 숫자 - 그리고 _ 로 이루어 집니다. SITE KEY 발급 KCP 전화: 1544-8660\n예) 1Q9YRV83gz6TukH8PjH0xFf__"); ?>
|
||||
<input type="text" name="de_kcp_site_key" value="<?php echo $default['de_kcp_site_key']; ?>" id="de_kcp_site_key" class="frm_input" size="32" maxlength="25">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pg_info_fld lg_info_fld">
|
||||
<th scope="row">
|
||||
<label for="de_lg_mid">LG U+ 상점 ID</label><br>
|
||||
<a href="http://sir.co.kr/main/provider/p_pg.php" target="_blank" id="scf_kcpreg">LG U+ 서비스신청하기</a>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo help("LG U+ 에서 받은 si_ 로 시작하는 상점 ID를 입력하세요.\n만약, 상점 ID가 si_로 시작하지 않는다면 LG U+에 사이트코드 변경 요청을 하십시오. 예) si_lguplus"); ?>
|
||||
<span class="sitecode">si_</span> <input type="text" name="de_lg_mid" value="<?php echo $default['de_lg_mid']; ?>" id="de_lg_mid" class="frm_input" size="10" maxlength="20" style="font:bold 15px Verdana;"> 영문자, 숫자 혼용
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pg_info_fld lg_info_fld">
|
||||
<th scope="row"><label for="de_lg_mert_key">LG U+ Mert Key</label></th>
|
||||
<td>
|
||||
<?php echo help("Mert Key 발급 LG U+ 전화: 1544-7772\n예) 95160cce09854ef44d2edb2bfb05f9f3"); ?>
|
||||
<input type="text" name="de_lg_mert_key" value="<?php echo $default['de_lg_mert_key']; ?>" id="de_lg_mert_key" class="frm_input" size="32" maxlength="50">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">에스크로 사용</th>
|
||||
<td>
|
||||
<?php echo help("에스크로 결제를 사용하시려면, 반드시 <strong><a href='http://admin.kcp.co.kr/' target='_blank'><u>KCP 관리자</u></a> > 고객센터 > 서비스변경 및 추가 > 에스크로 신청 메뉴에서 에스크로를 사용 선택하고, 결제수단별로 적용 신청한 후 사용</strong>하셔야 합니다.\n에스크로 사용시 배송과의 연동은 되지 않으며 에스크로 결제만 지원됩니다."); ?>
|
||||
<?php echo help("에스크로 결제를 사용하시려면, 반드시 결제대행사 상점 관리자 페이지에서 에스크로 서비스를 신청하신 후 사용하셔야 합니다.\n에스크로 사용시 배송과의 연동은 되지 않으며 에스크로 결제만 지원됩니다."); ?>
|
||||
<input type="radio" name="de_escrow_use" value="0" <?php echo $default['de_escrow_use']==0?"checked":""; ?> id="de_escrow_use1">
|
||||
<label for="de_escrow_use1">일반결제 사용</label>
|
||||
<input type="radio" name="de_escrow_use" value="1"<?php echo $default['de_escrow_use']==1?"checked":""; ?> id="de_escrow_use2">
|
||||
@ -1262,6 +1297,18 @@ function fconfig_check(f)
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$(".pg_info_fld").hide();
|
||||
<?php if($default['de_pg_service']) { ?>
|
||||
$(".<?php echo $default['de_pg_service']; ?>_info_fld").show();
|
||||
<?php } else { ?>
|
||||
$(".kcp_info_fld").show();
|
||||
<?php } ?>
|
||||
$("#de_pg_service").on("change", function() {
|
||||
var pg = $(this).val();
|
||||
$(".pg_info_fld:visible").hide();
|
||||
$("."+pg+"_info_fld").show();
|
||||
});
|
||||
|
||||
$("#scf_cardtest_btn").bind("click", function() {
|
||||
var $cf_cardtest_tip = $("#scf_cardtest_tip");
|
||||
var $cf_cardtest_btn = $("#scf_cardtest_btn");
|
||||
|
||||
@ -138,7 +138,11 @@ $sql = " update {$g5['g5_shop_default_table']}
|
||||
de_mimg_height = '$de_mimg_height',
|
||||
de_cart_skin = '$de_cart_skin',
|
||||
de_register = '$de_register',
|
||||
de_pg_service = '$de_pg_service',
|
||||
de_kcp_mid = '$de_kcp_mid',
|
||||
de_kcp_site_key = '$de_kcp_site_key',
|
||||
de_lg_mid = '$de_lg_mid',
|
||||
de_lg_mert_key = '$de_lg_mert_key',
|
||||
de_iche_use = '$de_iche_use',
|
||||
de_sms_cont1 = '$de_sms_cont1',
|
||||
de_sms_cont2 = '$de_sms_cont2',
|
||||
@ -158,7 +162,6 @@ $sql = " update {$g5['g5_shop_default_table']}
|
||||
de_guest_cart_use = '$de_guest_cart_use',
|
||||
de_admin_buga_no = '$de_admin_buga_no',
|
||||
de_vbank_use = '$de_vbank_use',
|
||||
de_kcp_site_key = '$de_kcp_site_key',
|
||||
de_taxsave_use = '$de_taxsave_use',
|
||||
de_guest_privacy = '$de_guest_privacy',
|
||||
de_hp_use = '$de_hp_use',
|
||||
|
||||
@ -77,6 +77,12 @@ if(!sql_query(" select ad_addr3 from {$g5['g5_shop_order_address_table']} limit
|
||||
sql_query(" ALTER TABLE `{$g5['g5_shop_order_address_table']}`
|
||||
ADD `ad_addr3` varchar(255) NOT NULL DEFAULT '' AFTER `ad_addr2` ", true);
|
||||
}
|
||||
|
||||
// 결제 PG 필드 추가
|
||||
if(!sql_query(" select od_pg from {$g5['g5_shop_order_table']} limit 1 ", false)) {
|
||||
sql_query(" ALTER TABLE `{$g5['g5_shop_order_table']}`
|
||||
ADD `od_pg` varchar(255) NOT NULL DEFAULT '' AFTER `od_mobile` ", true);
|
||||
}
|
||||
?>
|
||||
|
||||
<section id="anc_sodr_list">
|
||||
@ -401,24 +407,29 @@ if(!sql_query(" select ad_addr3 from {$g5['g5_shop_order_address_table']} limit
|
||||
<th scope="row">결제대행사 링크</th>
|
||||
<td>
|
||||
<?php
|
||||
//------------------------------------------------------------------------------
|
||||
// KCP(PG) 바로가기
|
||||
//------------------------------------------------------------------------------
|
||||
if ($od['od_settle_case'] != '무통장') {
|
||||
// PG사를 KCP 사용하면서 테스트 상점아이디라면
|
||||
$pg_url = 'http://admin8.kcp.co.kr';
|
||||
$pg_test = '';
|
||||
if ($default['de_card_test']) {
|
||||
// 로그인 아이디 / 비번
|
||||
// 일반 : test1234 / test12345
|
||||
// 에스크로 : escrow / escrow913
|
||||
$pg_url = 'http://testadmin8.kcp.co.kr';
|
||||
if ($default['de_escrow_use'])
|
||||
$pg_test = '에스크로 테스트 ';
|
||||
else
|
||||
$pg_test = '일반 테스트 ';
|
||||
}
|
||||
echo "<a href=\"{$pg_url}\" target=\"_blank\">KCP {$pg_test}바로가기</a><br>";
|
||||
switch($od['od_pg']) {
|
||||
case 'lg':
|
||||
$pg_url = 'http://pgweb.uplus.co.kr';
|
||||
$pg_test = 'LG eCredit';
|
||||
if ($default['de_card_test']) {
|
||||
$pg_url = 'http://pgweb.uplus.co.kr/tmert';
|
||||
$pg_test .= ' 테스트 ';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$pg_url = 'http://admin8.kcp.co.kr';
|
||||
$pg_test = 'KCP';
|
||||
if ($default['de_card_test']) {
|
||||
// 로그인 아이디 / 비번
|
||||
// 일반 : test1234 / test12345
|
||||
// 에스크로 : escrow / escrow913
|
||||
$pg_url = 'http://testadmin8.kcp.co.kr';
|
||||
$pg_test .= ' 테스트 ';
|
||||
}
|
||||
|
||||
}
|
||||
echo "<a href=\"{$pg_url}\" target=\"_blank\">{$pg_test}바로가기</a><br>";
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
?>
|
||||
|
||||
@ -96,7 +96,7 @@ if(!defined('G5_IS_ADMIN'))
|
||||
echo $config['cf_add_script'];
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<body <?php echo isset($g5['body_script']) ? $g5['body_script'] : ''; ?>>
|
||||
<?php
|
||||
if ($is_member) { // 회원이라면 로그인 중이라는 메세지를 출력해준다.
|
||||
$sr_admin_msg = '';
|
||||
|
||||
@ -297,15 +297,18 @@ CREATE TABLE IF NOT EXISTS `g5_shop_default` (
|
||||
`de_sms_use4` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`de_sms_use5` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`de_sms_hp` varchar(255) NOT NULL DEFAULT '',
|
||||
`de_pg_service` varchar(255) NOT NULL DEFAULT '',
|
||||
`de_kcp_mid` varchar(255) NOT NULL DEFAULT '',
|
||||
`de_kcp_site_key` varchar(255) NOT NULL DEFAULT '',
|
||||
`de_lg_mid` varchar(255) NOT NULL DEFAULT '',
|
||||
`de_lg_mert_key` varchar(255) NOT NULL DEFAULT '',
|
||||
`de_iche_use` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`de_item_use_use` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`de_item_use_write` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`de_code_dup_use` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`de_cart_keep_term` int(11) NOT NULL DEFAULT '0',
|
||||
`de_guest_cart_use` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`de_admin_buga_no` varchar(255) NOT NULL DEFAULT '',
|
||||
`de_kcp_site_key` varchar(255) NOT NULL DEFAULT '',
|
||||
`de_admin_buga_no` varchar(255) NOT NULL DEFAULT '',
|
||||
`de_vbank_use` varchar(255) NOT NULL DEFAULT '',
|
||||
`de_taxsave_use` tinyint(4) NOT NULL,
|
||||
`de_guest_privacy` text NOT NULL,
|
||||
@ -593,6 +596,7 @@ CREATE TABLE IF NOT EXISTS `g5_shop_order` (
|
||||
`od_hope_date` date NOT NULL DEFAULT '0000-00-00',
|
||||
`od_settle_case` varchar(255) NOT NULL DEFAULT '',
|
||||
`od_mobile` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`od_pg` varchar(255) NOT NULL DEFAULT '',
|
||||
`od_tno` varchar(255) NOT NULL DEFAULT '',
|
||||
`od_app_no` varchar(20) NOT NULL DEFAULT '',
|
||||
`od_escrow` tinyint(4) NOT NULL DEFAULT '0',
|
||||
|
||||
@ -298,6 +298,7 @@ if($g5_shop_install) {
|
||||
de_cart_keep_term = '15',
|
||||
de_card_point = '0',
|
||||
de_point_days = '7',
|
||||
de_pg_service = 'kcp',
|
||||
de_kcp_mid = '',
|
||||
de_send_cost_case = '차등',
|
||||
de_send_cost_limit = '20000;30000;40000',
|
||||
|
||||
131
shop/kcp/orderform.1.php
Normal file
131
shop/kcp/orderform.1.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
/* ============================================================================== */
|
||||
/* = Javascript source Include = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = ※ 필수 = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
?>
|
||||
<script src="<?php echo $g_conf_js_url; ?>"></script>
|
||||
<?php
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = Javascript source Include END = */
|
||||
/* ============================================================================== */
|
||||
?>
|
||||
<script>
|
||||
function CheckPayplusInstall()
|
||||
{
|
||||
StartSmartUpdate();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/* Payplus Plug-in 실행 */
|
||||
function jsf__pay( form )
|
||||
{
|
||||
var RetVal = false;
|
||||
|
||||
/* Payplus Plugin 실행 */
|
||||
if ( MakePayMessage( form ) == true )
|
||||
{
|
||||
openwin = window.open( "./kcp/proc_win.html", "proc_win", "width=449, height=209, top=300, left=300" );
|
||||
document.getElementById("display_pay_button").style.display = "none" ;
|
||||
document.getElementById("display_pay_process").style.display = "" ;
|
||||
RetVal = true ;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* res_cd와 res_msg변수에 해당 오류코드와 오류메시지가 설정됩니다.
|
||||
ex) 고객이 Payplus Plugin에서 취소 버튼 클릭시 res_cd=3001, res_msg=사용자 취소
|
||||
값이 설정됩니다.
|
||||
*/
|
||||
res_cd = document.forderform.res_cd.value ;
|
||||
res_msg = document.forderform.res_msg.value ;
|
||||
|
||||
}
|
||||
|
||||
return RetVal ;
|
||||
}
|
||||
|
||||
// Payplus Plug-in 설치 안내
|
||||
|
||||
function init_pay_button()
|
||||
{
|
||||
if (navigator.userAgent.indexOf('MSIE') > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
if( document.Payplus.object == null )
|
||||
{
|
||||
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();
|
||||
}
|
||||
else{
|
||||
document.getElementById("display_setup_message_top").style.display = "none" ;
|
||||
document.getElementById("display_setup_message").style.display = "none" ;
|
||||
document.getElementById("display_pay_button").style.display = "" ;
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
if( Payplus == null )
|
||||
{
|
||||
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();
|
||||
}
|
||||
else{
|
||||
document.getElementById("display_setup_message_top").style.display = "none" ;
|
||||
document.getElementById("display_setup_message").style.display = "none" ;
|
||||
document.getElementById("display_pay_button").style.display = "" ;
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function get_intall_file()
|
||||
{
|
||||
document.location.href = GetInstallFile();
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Payplus Plug-in 설치 안내 -->
|
||||
<p id="display_setup_message_top" class="display_setup_message" style="display:block">
|
||||
<strong>결제안내</strong>
|
||||
<span class="red">결제를 하시려면 상단의 노란색 표시줄을 클릭</span>하시거나, <a href="https://pay.kcp.co.kr/plugin_new/file/KCPPluginSetup.exe" onclick="return get_intall_file();"><span class="bold">[수동설치]</span></a>를 눌러 Payplus Plug-in을 설치하시기 바랍니다.<br>
|
||||
[수동설치]를 눌러 설치하신 경우 <span class="red bold">새로고침(F5)키</span>를 눌러 진행하시기 바랍니다.
|
||||
</p>
|
||||
239
shop/kcp/orderform.2.php
Normal file
239
shop/kcp/orderform.2.php
Normal file
@ -0,0 +1,239 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
/* ============================================================================== */
|
||||
/* = 2. 가맹점 필수 정보 설정 = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = ※ 필수 - 결제에 반드시 필요한 정보입니다. = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
// 요청종류 : 승인(pay)/취소,매입(mod) 요청시 사용
|
||||
?>
|
||||
<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']; ?>">
|
||||
|
||||
<?php
|
||||
/*
|
||||
할부옵션 : Payplus Plug-in에서 카드결제시 최대로 표시할 할부개월 수를 설정합니다.(0 ~ 18 까지 설정 가능)
|
||||
※ 주의 - 할부 선택은 결제금액이 50,000원 이상일 경우에만 가능, 50000원 미만의 금액은 일시불로만 표기됩니다
|
||||
예) value 값을 "5" 로 설정했을 경우 => 카드결제시 결제창에 일시불부터 5개월까지 선택가능
|
||||
*/
|
||||
?>
|
||||
<input type="hidden" name="pay_method" value="">
|
||||
<input type="hidden" name="ordr_idxx" value="<?php echo $od_id; ?>">
|
||||
<input type="hidden" name="good_name" value="<?php echo $goods; ?>">
|
||||
<input type="hidden" name="good_mny" value="<?php echo $tot_price; ?>">
|
||||
<input type="hidden" name="buyr_name" value="">
|
||||
<input type="hidden" name="buyr_mail" value="">
|
||||
<input type="hidden" name="buyr_tel1" value="">
|
||||
<input type="hidden" name="buyr_tel2" value="">
|
||||
|
||||
<input type="hidden" name="rcvr_name" value="">
|
||||
<input type="hidden" name="rcvr_tel1" value="">
|
||||
<input type="hidden" name="rcvr_tel2" value="">
|
||||
<input type="hidden" name="rcvr_mail" value="">
|
||||
<input type="hidden" name="rcvr_zipx" value="">
|
||||
<input type="hidden" name="rcvr_add1" value="">
|
||||
<input type="hidden" name="rcvr_add2" value="">
|
||||
|
||||
<input type="hidden" name="quotaopt" value="12">
|
||||
|
||||
<!-- 필수 항목 : 결제 금액/화폐단위 -->
|
||||
<input type="hidden" name="currency" value="WON">
|
||||
|
||||
<?php
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = 2. 가맹점 필수 정보 설정 END = */
|
||||
/* ============================================================================== */
|
||||
?>
|
||||
|
||||
<?php
|
||||
/* ============================================================================== */
|
||||
/* = 3. Payplus Plugin 필수 정보(변경 불가) = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = 결제에 필요한 주문 정보를 입력 및 설정합니다. = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
?>
|
||||
<!-- PLUGIN 설정 정보입니다(변경 불가) -->
|
||||
<input type="hidden" name="module_type" value="01">
|
||||
<!-- 복합 포인트 결제시 넘어오는 포인트사 코드 : OK캐쉬백(SCSK), 베네피아 복지포인트(SCWB) -->
|
||||
<input type="hidden" name="epnt_issu" value="">
|
||||
<!--
|
||||
※ 필 수
|
||||
필수 항목 : Payplus Plugin에서 값을 설정하는 부분으로 반드시 포함되어야 합니다
|
||||
값을 설정하지 마십시오
|
||||
-->
|
||||
<input type="hidden" name="res_cd" value="">
|
||||
<input type="hidden" name="res_msg" value="">
|
||||
<input type="hidden" name="tno" value="">
|
||||
<input type="hidden" name="trace_no" value="">
|
||||
<input type="hidden" name="enc_info" value="">
|
||||
<input type="hidden" name="enc_data" value="">
|
||||
<input type="hidden" name="ret_pay_method" value="">
|
||||
<input type="hidden" name="tran_cd" value="">
|
||||
<input type="hidden" name="bank_name" value="">
|
||||
<input type="hidden" name="bank_issu" value="">
|
||||
<input type="hidden" name="use_pay_method" value="">
|
||||
|
||||
<!-- 현금영수증 관련 정보 : Payplus Plugin 에서 설정하는 정보입니다 -->
|
||||
<input type="hidden" name="cash_tsdtime" value="">
|
||||
<input type="hidden" name="cash_yn" value="">
|
||||
<input type="hidden" name="cash_authno" value="">
|
||||
<input type="hidden" name="cash_tr_code" value="">
|
||||
<input type="hidden" name="cash_id_info" value="">
|
||||
|
||||
<!-- 2012년 8월 18일 정자상거래법 개정 관련 설정 부분 -->
|
||||
<!-- 제공 기간 설정 0:일회성 1:기간설정(ex 1:2012010120120131) -->
|
||||
<!--
|
||||
2012.08.18 부터 개정 시행되는 '전자상거래 등에서의 소비자보호에 관한 법률'에 따른 코드 변경
|
||||
이용기간이 제한되는 컨텐츠 상품이나 정기 과금 상품 등에 한하여 '용역의 제공기간'을
|
||||
표기/적용하여야 하며 이와 무관한 실물 배송상품 등의 결제에는 해당되지 않습니다.
|
||||
0 : 일반결제
|
||||
good_expr의 나머지 적용 방식에 대해서는 KCP에서 제공하는 매뉴얼을 참고해 주세요.
|
||||
-->
|
||||
<input type="hidden" name="good_expr" value="0">
|
||||
|
||||
<!-- 에스크로 항목 -->
|
||||
|
||||
<!-- 에스크로 사용 여부 : 반드시 Y 로 세팅 -->
|
||||
<input type="hidden" name="escw_used" value="Y">
|
||||
|
||||
<!-- 에스크로 결제처리 모드 : 에스크로: Y, 일반: N, KCP 설정 조건: O -->
|
||||
<input type="hidden" name="pay_mod" value="<?php echo ($default['de_escrow_use']?"O":"N"); ?>">
|
||||
|
||||
<!-- 배송 소요일 : 예상 배송 소요일을 입력 -->
|
||||
<input type="hidden" name="deli_term" value="03">
|
||||
|
||||
<!-- 장바구니 상품 개수 : 장바구니에 담겨있는 상품의 개수를 입력 -->
|
||||
<input type="hidden" name="bask_cntx" value="<?php echo (int)$goods_count + 1; ?>">
|
||||
|
||||
<!-- 장바구니 상품 상세 정보 (자바 스크립트 샘플(create_goodInfo()) 참고) -->
|
||||
<input type="hidden" name="good_info" value="<?php echo $good_info; ?>">
|
||||
|
||||
<?php
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = 3. Payplus Plugin 필수 정보 END = */
|
||||
/* ============================================================================== */
|
||||
?>
|
||||
|
||||
<?php
|
||||
/* ============================================================================== */
|
||||
/* = 4. 옵션 정보 = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = ※ 옵션 - 결제에 필요한 추가 옵션 정보를 입력 및 설정합니다. = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
|
||||
/* PayPlus에서 보이는 신용카드사 삭제 파라미터 입니다
|
||||
※ 해당 카드를 결제창에서 보이지 않게 하여 고객이 해당 카드로 결제할 수 없도록 합니다. (카드사 코드는 매뉴얼을 참고)
|
||||
<input type="hidden" name="not_used_card" value="CCPH:CCSS:CCKE:CCHM:CCSH:CCLO:CCLG:CCJB:CCHN:CCCH"> */
|
||||
|
||||
/* 신용카드 결제시 OK캐쉬백 적립 여부를 묻는 창을 설정하는 파라미터 입니다
|
||||
OK캐쉬백 포인트 가맹점의 경우에만 창이 보여집니다
|
||||
<input type="hidden" name="save_ocb" value="Y"> */
|
||||
|
||||
/* 고정 할부 개월 수 선택
|
||||
value값을 "7" 로 설정했을 경우 => 카드결제시 결제창에 할부 7개월만 선택가능
|
||||
<input type="hidden" name="fix_inst" value="07"> */
|
||||
|
||||
/* 무이자 옵션
|
||||
※ 설정할부 (가맹점 관리자 페이지에 설정 된 무이자 설정을 따른다) - "" 로 설정
|
||||
※ 일반할부 (KCP 이벤트 이외에 설정 된 모든 무이자 설정을 무시한다) - "N" 로 설정
|
||||
※ 무이자 할부 (가맹점 관리자 페이지에 설정 된 무이자 이벤트 중 원하는 무이자 설정을 세팅한다) - "Y" 로 설정
|
||||
<input type="hidden" name="kcp_noint" value=""> */
|
||||
|
||||
|
||||
/* 무이자 설정
|
||||
※ 주의 1 : 할부는 결제금액이 50,000 원 이상일 경우에만 가능
|
||||
※ 주의 2 : 무이자 설정값은 무이자 옵션이 Y일 경우에만 결제 창에 적용
|
||||
예) 전 카드 2,3,6개월 무이자(국민,비씨,엘지,삼성,신한,현대,롯데,외환) : ALL-02:03:04
|
||||
BC 2,3,6개월, 국민 3,6개월, 삼성 6,9개월 무이자 : CCBC-02:03:06,CCKM-03:06,CCSS-03:06:04
|
||||
<input type="hidden" name="kcp_noint_quota" value="CCBC-02:03:06,CCKM-03:06,CCSS-03:06:09"> */
|
||||
|
||||
/* 사용카드 설정 여부 파라미터 입니다.(통합결제창 노출 유무)
|
||||
<input type="hidden" name="used_card_YN" value="Y">
|
||||
/* 사용카드 설정 파라미터 입니다. (해당 카드만 결제창에 보이게 설정하는 파라미터입니다. used_card_YN 값이 Y일때 적용됩니다.
|
||||
/<input type="hidden" name="used_card" value="CCBC:CCKM:CCSS">
|
||||
|
||||
/* 해외카드 구분하는 파라미터 입니다.(해외비자, 해외마스터, 해외JCB로 구분하여 표시)
|
||||
<input type="hidden" name="used_card_CCXX" value="Y">
|
||||
|
||||
/* 가상계좌 은행 선택 파라미터
|
||||
※ 해당 은행을 결제창에서 보이게 합니다.(은행코드는 매뉴얼을 참조) */
|
||||
?>
|
||||
|
||||
<input type="hidden" name="kcp_noint" value="<?php echo ($default['de_card_noint_use'] ? '' : 'N'); ?>">
|
||||
|
||||
<?php
|
||||
if($default['de_tax_flag_use']) {
|
||||
/* KCP는 과세상품과 비과세상품을 동시에 판매하는 업체들의 결제관리에 대한 편의성을 제공해드리고자,
|
||||
복합과세 전용 사이트코드를 지원해 드리며 총 금액에 대해 복합과세 처리가 가능하도록 제공하고 있습니다
|
||||
|
||||
복합과세 전용 사이트 코드로 계약하신 가맹점에만 해당이 됩니다
|
||||
|
||||
상품별이 아니라 금액으로 구분하여 요청하셔야 합니다
|
||||
|
||||
총결제 금액은 과세금액 + 부과세 + 비과세금액의 합과 같아야 합니다.
|
||||
(good_mny = comm_tax_mny + comm_vat_mny + comm_free_mny) */
|
||||
?>
|
||||
<input type="hidden" name="tax_flag" value="TG03"> <!-- 변경불가 -->
|
||||
<input type="hidden" name="comm_tax_mny" value="<?php echo $comm_tax_mny; ?>"> <!-- 과세금액 -->
|
||||
<input type="hidden" name="comm_vat_mny" value="<?php echo $comm_vat_mny; ?>"> <!-- 부가세 -->
|
||||
<input type="hidden" name="comm_free_mny" value="<?php echo $comm_free_mny; ?>"> <!-- 비과세 금액 -->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="hidden" name="wish_vbank_list" value="05:03:04:07:11:23:26:32:34:81:71">
|
||||
<?php
|
||||
|
||||
|
||||
/* 가상계좌 입금 기한 설정하는 파라미터 - 발급일 + 3일
|
||||
<input type="hidden" name="vcnt_expire_term" value="3"> */
|
||||
|
||||
|
||||
/* 가상계좌 입금 시간 설정하는 파라미터
|
||||
HHMMSS형식으로 입력하시기 바랍니다
|
||||
설정을 안하시는경우 기본적으로 23시59분59초가 세팅이 됩니다
|
||||
<input type="hidden" name="vcnt_expire_term_time" value="120000"> */
|
||||
|
||||
|
||||
/* 포인트 결제시 복합 결제(신용카드+포인트) 여부를 결정할 수 있습니다.- N 일경우 복합결제 사용안함
|
||||
<input type="hidden" name="complex_pnt_yn" value="N"> */
|
||||
|
||||
|
||||
/* 문화상품권 결제시 가맹점 고객 아이디 설정을 해야 합니다.(필수 설정)
|
||||
<input type="hidden" name="tk_shop_id" value=""> */
|
||||
|
||||
|
||||
/* 현금영수증 등록 창을 출력 여부를 설정하는 파라미터 입니다
|
||||
※ Y : 현금영수증 등록 창 출력
|
||||
※ N : 현금영수증 등록 창 출력 안함
|
||||
※ 주의 : 현금영수증 사용 시 KCP 상점관리자 페이지에서 현금영수증 사용 동의를 하셔야 합니다 */
|
||||
?>
|
||||
<input type="hidden" name="disp_tax_yn" value="N">
|
||||
<?php
|
||||
/* 결제창에 가맹점 사이트의 로고를 플러그인 좌측 상단에 출력하는 파라미터 입니다
|
||||
업체의 로고가 있는 URL을 정확히 입력하셔야 하며, 최대 150 X 50 미만 크기 지원
|
||||
|
||||
※ 주의 : 로고 용량이 150 X 50 이상일 경우 site_name 값이 표시됩니다. */
|
||||
?>
|
||||
<input type="hidden" name="site_logo" value="">
|
||||
<?php
|
||||
/* 결제창 영문 표시 파라미터 입니다. 영문을 기본으로 사용하시려면 Y로 세팅하시기 바랍니다
|
||||
2010-06월 현재 신용카드와 가상계좌만 지원됩니다
|
||||
<input type="hidden" name="eng_flag" value="Y"> */
|
||||
?>
|
||||
|
||||
<?php
|
||||
/* skin_indx 값은 스킨을 변경할 수 있는 파라미터이며 총 7가지가 지원됩니다.
|
||||
변경을 원하시면 1부터 7까지 값을 넣어주시기 바랍니다. */
|
||||
?>
|
||||
<input type="hidden" name="skin_indx" value="1">
|
||||
|
||||
<?php
|
||||
/* 상품코드 설정 파라미터 입니다.(상품권을 따로 구분하여 처리할 수 있는 옵션기능입니다.)
|
||||
<input type="hidden" name="good_cd" value=""> */
|
||||
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = 4. 옵션 정보 END = */
|
||||
/* ============================================================================== */
|
||||
?>
|
||||
20
shop/kcp/orderform.3.php
Normal file
20
shop/kcp/orderform.3.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<!-- Payplus Plug-in 설치 안내 시작 { -->
|
||||
<p id="display_setup_message" class="display_setup_message" style="display:block">
|
||||
<span class="red">결제를 계속 하시려면 상단의 노란색 표시줄을 클릭</span>하시거나 <a href="https://pay.kcp.co.kr/plugin_new/file/KCPPluginSetup.exe" onclick="return get_intall_file();"><b><u>[수동설치]</u></b></a>를 눌러 다운로드 된 Payplus Plug-in을 설치하시기 바랍니다.<br>
|
||||
[수동설치]를 눌러 설치하신 경우 <span class="red bold">새로고침(F5)키</span>를 눌러 진행하시기 바랍니다.<br>
|
||||
새로고침(F5) 한후에도 계속 설치파일이 다운로드 되거나 결제가 되지 않으면 브라우저를 새로 열어서 주문해 주시기 바랍니다.<br>
|
||||
브라우저가 익스플로러가 아닌 경우 Payplus Plug-in 설치에 문제가 있을수 있음을 알려 드립니다.
|
||||
</p>
|
||||
<!-- } Payplus Plug-in 설치 안내 끝 -->
|
||||
|
||||
<div id="display_pay_button" class="btn_confirm" style="display:none">
|
||||
<input type="submit" value="주문하기" class="btn_submit">
|
||||
<a href="javascript:history.go(-1);" class="btn01">취소</a>
|
||||
</div>
|
||||
<div id="display_pay_process" style="display:none">
|
||||
<p>결제 진행 중입니다. 잠시만 기다려 주세요.</p>
|
||||
</div>
|
||||
50
shop/kcp/orderform.4.php
Normal file
50
shop/kcp/orderform.4.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<!-- 에스크로 안내 시작 { -->
|
||||
<section id="sod_frm_escrow">
|
||||
<h2>에스크로 안내</h2>
|
||||
<form name="escrow_foot" method="post" action="http://admin.kcp.co.kr/Modules/escrow/kcp_pop.jsp">
|
||||
<input type="hidden" name="site_cd" value="SR<?php echo $default['de_kcp_mid']; ?>">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td align='center'><img src="<?php echo G5_SHOP_URL; ?>/img/marks_escrow/escrow_foot.gif" width="290" height="92" border="0" usemap="#Map"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='line-height:150%;'>
|
||||
<br>
|
||||
<strong>에스크로(escrow) 제도란?</strong>
|
||||
<br>상거래 시에, 판매자와 구매자의 사이에 신뢰할 수 있는 중립적인 제삼자(여기서는 <a href='http://kcp.co.kr' target='_blank'>KCP</a>)가 중개하여
|
||||
금전 또는 물품을 거래를 하도록 하는 것, 또는 그러한 서비스를 말한다. 거래의 안전성을 확보하기 위해 이용된다.
|
||||
(2006.4.1 전자상거래 소비자보호법에 따른 의무 시행)
|
||||
<br><br>
|
||||
현금 거래에만 해당(에스크로 결제를 선택했을 경우에만 해당)되며,
|
||||
신용카드로 구매하는 거래, 배송이 필요하지 않은 재화 등을 구매하는 거래(컨텐츠 등)에는 해당되지 않는다.
|
||||
<br>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<map name="Map" id="Map">
|
||||
<area shape="rect" coords="5,62,74,83" href="javascript:escrow_foot_check()" alt="가입사실확인">
|
||||
</map>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
function escrow_foot_check()
|
||||
{
|
||||
var status = "width=500 height=450 menubar=no,scrollbars=no,resizable=no,status=no";
|
||||
var obj = window.open('', 'escrow_foot_pop', status);
|
||||
|
||||
document.escrow_foot.method = "post";
|
||||
document.escrow_foot.target = "escrow_foot_pop";
|
||||
document.escrow_foot.action = "http://admin.kcp.co.kr/Modules/escrow/kcp_pop.jsp";
|
||||
|
||||
document.escrow_foot.submit();
|
||||
}
|
||||
</script>
|
||||
<!-- } 에스크로 안내 끝 -->
|
||||
|
||||
<!-- <?php if ($default['de_card_use'] || $default['de_iche_use']) { echo "결제대행사 : KCP"; } ?> -->
|
||||
7
shop/kcp/orderform.5.php
Normal file
7
shop/kcp/orderform.5.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<script>
|
||||
CheckPayplusInstall();
|
||||
</script>
|
||||
806
shop/lg/JSON.php
Normal file
806
shop/lg/JSON.php
Normal file
@ -0,0 +1,806 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* JSON (JavaScript Object Notation) is a lightweight data-interchange
|
||||
* format. It is easy for humans to read and write. It is easy for machines
|
||||
* to parse and generate. It is based on a subset of the JavaScript
|
||||
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
|
||||
* This feature can also be found in Python. JSON is a text format that is
|
||||
* completely language independent but uses conventions that are familiar
|
||||
* to programmers of the C-family of languages, including C, C++, C#, Java,
|
||||
* JavaScript, Perl, TCL, and many others. These properties make JSON an
|
||||
* ideal data-interchange language.
|
||||
*
|
||||
* This package provides a simple encoder and decoder for JSON notation. It
|
||||
* is intended for use with client-side Javascript applications that make
|
||||
* use of HTTPRequest to perform server communication functions - data can
|
||||
* be encoded into JSON notation for use in a client-side javascript, or
|
||||
* decoded from incoming Javascript requests. JSON format is native to
|
||||
* Javascript, and can be directly eval()'ed with no further parsing
|
||||
* overhead
|
||||
*
|
||||
* All strings should be in ASCII or UTF-8 format!
|
||||
*
|
||||
* LICENSE: Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met: Redistributions of source code must retain the
|
||||
* above copyright notice, this list of conditions and the following
|
||||
* disclaimer. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* @category
|
||||
* @package Services_JSON
|
||||
* @author Michal Migurski <mike-json@teczno.com>
|
||||
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
|
||||
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
|
||||
* @copyright 2005 Michal Migurski
|
||||
* @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
||||
*/
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_SLICE', 1);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_STR', 2);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_ARR', 3);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_OBJ', 4);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_CMT', 5);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_LOOSE_TYPE', 16);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* Brief example of use:
|
||||
*
|
||||
* <code>
|
||||
* // create a new instance of Services_JSON
|
||||
* $json = new Services_JSON();
|
||||
*
|
||||
* // convert a complexe value to JSON notation, and send it to the browser
|
||||
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
|
||||
* $output = $json->encode($value);
|
||||
*
|
||||
* print($output);
|
||||
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
|
||||
*
|
||||
* // accept incoming POST data, assumed to be in JSON notation
|
||||
* $input = file_get_contents('php://input', 1000000);
|
||||
* $value = $json->decode($input);
|
||||
* </code>
|
||||
*/
|
||||
class Services_JSON
|
||||
{
|
||||
/**
|
||||
* constructs a new JSON instance
|
||||
*
|
||||
* @param int $use object behavior flags; combine with boolean-OR
|
||||
*
|
||||
* possible values:
|
||||
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
|
||||
* "{...}" syntax creates associative arrays
|
||||
* instead of objects in decode().
|
||||
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
|
||||
* Values which can't be encoded (e.g. resources)
|
||||
* appear as NULL instead of throwing errors.
|
||||
* By default, a deeply-nested resource will
|
||||
* bubble up with an error, so all return values
|
||||
* from encode() should be checked with isError()
|
||||
*/
|
||||
function Services_JSON($use = 0)
|
||||
{
|
||||
$this->use = $use;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-16 char to one UTF-8 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf16 UTF-16 character
|
||||
* @return string UTF-8 character
|
||||
* @access private
|
||||
*/
|
||||
function utf162utf8($utf16)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
||||
}
|
||||
|
||||
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
|
||||
|
||||
switch(true) {
|
||||
case ((0x7F & $bytes) == $bytes):
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x7F & $bytes);
|
||||
|
||||
case (0x07FF & $bytes) == $bytes:
|
||||
// return a 2-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xC0 | (($bytes >> 6) & 0x1F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
|
||||
case (0xFFFF & $bytes) == $bytes:
|
||||
// return a 3-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xE0 | (($bytes >> 12) & 0x0F))
|
||||
. chr(0x80 | (($bytes >> 6) & 0x3F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-8 char to one UTF-16 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf8 UTF-8 character
|
||||
* @return string UTF-16 character
|
||||
* @access private
|
||||
*/
|
||||
function utf82utf16($utf8)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
||||
}
|
||||
|
||||
switch(strlen($utf8)) {
|
||||
case 1:
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return $utf8;
|
||||
|
||||
case 2:
|
||||
// return a UTF-16 character from a 2-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x07 & (ord($utf8{0}) >> 2))
|
||||
. chr((0xC0 & (ord($utf8{0}) << 6))
|
||||
| (0x3F & ord($utf8{1})));
|
||||
|
||||
case 3:
|
||||
// return a UTF-16 character from a 3-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr((0xF0 & (ord($utf8{0}) << 4))
|
||||
| (0x0F & (ord($utf8{1}) >> 2)))
|
||||
. chr((0xC0 & (ord($utf8{1}) << 6))
|
||||
| (0x7F & ord($utf8{2})));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* encodes an arbitrary variable into JSON format
|
||||
*
|
||||
* @param mixed $var any number, boolean, string, array, or object to be encoded.
|
||||
* see argument 1 to Services_JSON() above for array-parsing behavior.
|
||||
* if var is a strng, note that encode() always expects it
|
||||
* to be in ASCII or UTF-8 format!
|
||||
*
|
||||
* @return mixed JSON string representation of input var or an error if a problem occurs
|
||||
* @access public
|
||||
*/
|
||||
function encode($var)
|
||||
{
|
||||
switch (gettype($var)) {
|
||||
case 'boolean':
|
||||
return $var ? 'true' : 'false';
|
||||
|
||||
case 'NULL':
|
||||
return 'null';
|
||||
|
||||
case 'integer':
|
||||
return (int) $var;
|
||||
|
||||
case 'double':
|
||||
case 'float':
|
||||
return (float) $var;
|
||||
|
||||
case 'string':
|
||||
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
|
||||
$ascii = '';
|
||||
$strlen_var = strlen($var);
|
||||
|
||||
/*
|
||||
* Iterate over every character in the string,
|
||||
* escaping with a slash or encoding to UTF-8 where necessary
|
||||
*/
|
||||
for ($c = 0; $c < $strlen_var; ++$c) {
|
||||
|
||||
$ord_var_c = ord($var{$c});
|
||||
|
||||
switch (true) {
|
||||
case $ord_var_c == 0x08:
|
||||
$ascii .= '\b';
|
||||
break;
|
||||
case $ord_var_c == 0x09:
|
||||
$ascii .= '\t';
|
||||
break;
|
||||
case $ord_var_c == 0x0A:
|
||||
$ascii .= '\n';
|
||||
break;
|
||||
case $ord_var_c == 0x0C:
|
||||
$ascii .= '\f';
|
||||
break;
|
||||
case $ord_var_c == 0x0D:
|
||||
$ascii .= '\r';
|
||||
break;
|
||||
|
||||
case $ord_var_c == 0x22:
|
||||
case $ord_var_c == 0x2F:
|
||||
case $ord_var_c == 0x5C:
|
||||
// double quote, slash, slosh
|
||||
$ascii .= '\\'.$var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
||||
// characters U-00000000 - U-0000007F (same as ASCII)
|
||||
$ascii .= $var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xE0) == 0xC0):
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
|
||||
$c += 1;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF0) == 0xE0):
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}));
|
||||
$c += 2;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF8) == 0xF0):
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}));
|
||||
$c += 3;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFC) == 0xF8):
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}));
|
||||
$c += 4;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFE) == 0xFC):
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}),
|
||||
ord($var{$c + 5}));
|
||||
$c += 5;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return '"'.$ascii.'"';
|
||||
|
||||
case 'array':
|
||||
/*
|
||||
* As per JSON spec if any array key is not an integer
|
||||
* we must treat the the whole array as an object. We
|
||||
* also try to catch a sparsely populated associative
|
||||
* array with numeric keys here because some JS engines
|
||||
* will create an array with empty indexes up to
|
||||
* max_index which can cause memory issues and because
|
||||
* the keys, which may be relevant, will be remapped
|
||||
* otherwise.
|
||||
*
|
||||
* As per the ECMA and JSON specification an object may
|
||||
* have any string as a property. Unfortunately due to
|
||||
* a hole in the ECMA specification if the key is a
|
||||
* ECMA reserved word or starts with a digit the
|
||||
* parameter is only accessible using ECMAScript's
|
||||
* bracket notation.
|
||||
*/
|
||||
|
||||
// treat as a JSON object
|
||||
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($var),
|
||||
array_values($var));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
}
|
||||
|
||||
// treat it like a regular array
|
||||
$elements = array_map(array($this, 'encode'), $var);
|
||||
|
||||
foreach($elements as $element) {
|
||||
if(Services_JSON::isError($element)) {
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
|
||||
return '[' . join(',', $elements) . ']';
|
||||
|
||||
case 'object':
|
||||
$vars = get_object_vars($var);
|
||||
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($vars),
|
||||
array_values($vars));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
|
||||
default:
|
||||
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
||||
? 'null'
|
||||
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* array-walking function for use in generating JSON-formatted name-value pairs
|
||||
*
|
||||
* @param string $name name of key to use
|
||||
* @param mixed $value reference to an array element to be encoded
|
||||
*
|
||||
* @return string JSON-formatted name-value pair, like '"name":value'
|
||||
* @access private
|
||||
*/
|
||||
function name_value($name, $value)
|
||||
{
|
||||
$encoded_value = $this->encode($value);
|
||||
|
||||
if(Services_JSON::isError($encoded_value)) {
|
||||
return $encoded_value;
|
||||
}
|
||||
|
||||
return $this->encode(strval($name)) . ':' . $encoded_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* reduce a string by removing leading and trailing comments and whitespace
|
||||
*
|
||||
* @param $str string string value to strip of comments and whitespace
|
||||
*
|
||||
* @return string string value stripped of comments and whitespace
|
||||
* @access private
|
||||
*/
|
||||
function reduce_string($str)
|
||||
{
|
||||
$str = preg_replace(array(
|
||||
|
||||
// eliminate single line comments in '// ...' form
|
||||
'#^\s*//(.+)$#m',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at start of string
|
||||
'#^\s*/\*(.+)\*/#Us',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at end of string
|
||||
'#/\*(.+)\*/\s*$#Us'
|
||||
|
||||
), '', $str);
|
||||
|
||||
// eliminate extraneous space
|
||||
return trim($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* decodes a JSON string into appropriate variable
|
||||
*
|
||||
* @param string $str JSON-formatted string
|
||||
*
|
||||
* @return mixed number, boolean, string, array, or object
|
||||
* corresponding to given JSON input string.
|
||||
* See argument 1 to Services_JSON() above for object-output behavior.
|
||||
* Note that decode() always returns strings
|
||||
* in ASCII or UTF-8 format!
|
||||
* @access public
|
||||
*/
|
||||
function decode($str)
|
||||
{
|
||||
$str = $this->reduce_string($str);
|
||||
|
||||
switch (strtolower($str)) {
|
||||
case 'true':
|
||||
return true;
|
||||
|
||||
case 'false':
|
||||
return false;
|
||||
|
||||
case 'null':
|
||||
return null;
|
||||
|
||||
default:
|
||||
$m = array();
|
||||
|
||||
if (is_numeric($str)) {
|
||||
// Lookie-loo, it's a number
|
||||
|
||||
// This would work on its own, but I'm trying to be
|
||||
// good about returning integers where appropriate:
|
||||
// return (float)$str;
|
||||
|
||||
// Return float or int, as appropriate
|
||||
return ((float)$str == (integer)$str)
|
||||
? (integer)$str
|
||||
: (float)$str;
|
||||
|
||||
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
|
||||
// STRINGS RETURNED IN UTF-8 FORMAT
|
||||
$delim = substr($str, 0, 1);
|
||||
$chrs = substr($str, 1, -1);
|
||||
$utf8 = '';
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c < $strlen_chrs; ++$c) {
|
||||
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
$ord_chrs_c = ord($chrs{$c});
|
||||
|
||||
switch (true) {
|
||||
case $substr_chrs_c_2 == '\b':
|
||||
$utf8 .= chr(0x08);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\t':
|
||||
$utf8 .= chr(0x09);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\n':
|
||||
$utf8 .= chr(0x0A);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\f':
|
||||
$utf8 .= chr(0x0C);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\r':
|
||||
$utf8 .= chr(0x0D);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case $substr_chrs_c_2 == '\\"':
|
||||
case $substr_chrs_c_2 == '\\\'':
|
||||
case $substr_chrs_c_2 == '\\\\':
|
||||
case $substr_chrs_c_2 == '\\/':
|
||||
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
||||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
||||
$utf8 .= $chrs{++$c};
|
||||
}
|
||||
break;
|
||||
|
||||
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
|
||||
// single, escaped unicode character
|
||||
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
|
||||
. chr(hexdec(substr($chrs, ($c + 4), 2)));
|
||||
$utf8 .= $this->utf162utf8($utf16);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
|
||||
$utf8 .= $chrs{$c};
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xE0) == 0xC0:
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 2);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF0) == 0xE0:
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 3);
|
||||
$c += 2;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF8) == 0xF0:
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 4);
|
||||
$c += 3;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFC) == 0xF8:
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 5);
|
||||
$c += 4;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFE) == 0xFC:
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 6);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $utf8;
|
||||
|
||||
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
|
||||
// array, or object notation
|
||||
|
||||
if ($str{0} == '[') {
|
||||
$stk = array(SERVICES_JSON_IN_ARR);
|
||||
$arr = array();
|
||||
} else {
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = array();
|
||||
} else {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = new stdClass();
|
||||
}
|
||||
}
|
||||
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE,
|
||||
'where' => 0,
|
||||
'delim' => false));
|
||||
|
||||
$chrs = substr($str, 1, -1);
|
||||
$chrs = $this->reduce_string($chrs);
|
||||
|
||||
if ($chrs == '') {
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} else {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//print("\nparsing {$chrs}\n");
|
||||
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c <= $strlen_chrs; ++$c) {
|
||||
|
||||
$top = end($stk);
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
|
||||
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
|
||||
// found a comma that is not inside a string, array, etc.,
|
||||
// OR we've reached the end of the character list
|
||||
$slice = substr($chrs, $top['where'], ($c - $top['where']));
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
|
||||
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
// we are in an array, so just push an element onto the stack
|
||||
array_push($arr, $this->decode($slice));
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
// we are in an object, so figure
|
||||
// out the property name and set an
|
||||
// element in an associative array,
|
||||
// for now
|
||||
$parts = array();
|
||||
|
||||
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// "name":value pair
|
||||
$key = $this->decode($parts[1]);
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// name:value pair, where name is unquoted
|
||||
$key = $parts[1];
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
|
||||
// found a quote, and we are not inside a string
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
|
||||
//print("Found start of string at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == $top['delim']) &&
|
||||
($top['what'] == SERVICES_JSON_IN_STR) &&
|
||||
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
|
||||
// found a quote, we're in a string, and it's not escaped
|
||||
// we know that it's not escaped becase there is _not_ an
|
||||
// odd number of backslashes at the end of the string so far
|
||||
array_pop($stk);
|
||||
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '[') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-bracket, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of array at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
|
||||
// found a right-bracket, and we're in an array
|
||||
array_pop($stk);
|
||||
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '{') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-brace, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of object at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
|
||||
// found a right-brace, and we're in an object
|
||||
array_pop($stk);
|
||||
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '/*') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a comment start, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
|
||||
$c++;
|
||||
//print("Found start of comment at {$c}\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
|
||||
// found a comment end, and we're in one now
|
||||
array_pop($stk);
|
||||
$c++;
|
||||
|
||||
for ($i = $top['where']; $i <= $c; ++$i)
|
||||
$chrs = substr_replace($chrs, ' ', $i, 1);
|
||||
|
||||
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this should just call PEAR::isError()
|
||||
*/
|
||||
function isError($data, $code = null)
|
||||
{
|
||||
if (class_exists('pear')) {
|
||||
return PEAR::isError($data, $code);
|
||||
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
|
||||
is_subclass_of($data, 'services_json_error'))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (class_exists('PEAR_Error')) {
|
||||
|
||||
class Services_JSON_Error extends PEAR_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this class shall be descended from PEAR_Error
|
||||
*/
|
||||
class Services_JSON_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
1116
shop/lg/XPayClient.php
Normal file
1116
shop/lg/XPayClient.php
Normal file
File diff suppressed because it is too large
Load Diff
1114
shop/lg/XPayClient4DB.php
Normal file
1114
shop/lg/XPayClient4DB.php
Normal file
File diff suppressed because it is too large
Load Diff
3
shop/lg/_common.php
Normal file
3
shop/lg/_common.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
include_once('../../common.php');
|
||||
?>
|
||||
10695
shop/lg/conf/ca-bundle.crt
Normal file
10695
shop/lg/conf/ca-bundle.crt
Normal file
File diff suppressed because it is too large
Load Diff
3
shop/lg/conf/lgdacom.conf
Normal file
3
shop/lg/conf/lgdacom.conf
Normal file
@ -0,0 +1,3 @@
|
||||
url = https://xpayclient.lgdacom.net/xpay/Gateway.do
|
||||
test_url = https://xpayclient.lgdacom.net:7443/xpay/Gateway.do
|
||||
aux_url = http://xpayclient.lgdacom.net:7080/xpay/Gateway.do
|
||||
40
shop/lg/conf/mall.conf
Normal file
40
shop/lg/conf/mall.conf
Normal file
@ -0,0 +1,40 @@
|
||||
;server_id Mall <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>
|
||||
server_id = 01
|
||||
|
||||
;timeout API <20><>û timeout <20>ð<EFBFBD> (<28><><EFBFBD><EFBFBD>:<3A><>)
|
||||
timeout = 60
|
||||
|
||||
;log_level 0: FATAL; 1: ERROR; 2: WARNING; 3: INFO; 4: DEBUG
|
||||
log_level = 4
|
||||
|
||||
;verify_cert 1: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>; 0: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
verify_cert = 1
|
||||
|
||||
;verify_host 1: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> domain name Ȯ<><C8AE>; 0: Ȯ<><C8AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (test <20>ø<EFBFBD> <20><><EFBFBD><EFBFBD>)
|
||||
verify_host = 1
|
||||
|
||||
;report_error 1: error <20><> dacom <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> report <20><><EFBFBD><EFBFBD>; 0: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (error <20><><EFBFBD><EFBFBD> <20><><EFBFBD>븸 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
report_error = 1
|
||||
|
||||
;output_UTF8 1: <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> UTF-8<><38> return; 0: EUC-KR<4B><52> <20><><EFBFBD><EFBFBD>
|
||||
output_UTF8 = 1
|
||||
|
||||
;auto_rollback 0: <20>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 1: <20>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
auto_rollback = 1
|
||||
|
||||
|
||||
;log_dir log directory full path (<28>α<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> log <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ݵ<EFBFBD><DDB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>αװ<CEB1> <20><><EFBFBD><EFBFBD>)
|
||||
log_dir = c:\lgdacom\log
|
||||
|
||||
;>>>>>>>>>>>>>>>>>>>> <20>ݵ<EFBFBD><DDB5><EFBFBD> <20>Է<EFBFBD><D4B7><EFBFBD> <20>ּ<EFBFBD><D6BC><EFBFBD> <<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
;<3B><><EFBFBD><EFBFBD> ID<49><44> LG<4C>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>߱<DFB1><DEB9><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD><CCB5><EFBFBD> <20>Է<EFBFBD><D4B7>ϼ<EFBFBD><CFBC><EFBFBD>. (<28>߱<DFB1><DEB9><EFBFBD> <20><><EFBFBD>̵<EFBFBD> <20>տ<EFBFBD> "t" <20><> <20><><EFBFBD>̽ø<CCBD> <20><EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD>̵<EFBFBD> <20>Դϴ<D4B4>.)
|
||||
;MertKey<65><79> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> --> <20>ý<EFBFBD><C3BD>ۿ<EFBFBD><DBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> Ȯ<><C8AE><EFBFBD>ϽǼ<CFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>.
|
||||
|
||||
;<3B><><EFBFBD><EFBFBD> ID = MertKey (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><EFBFBD>Ʈ, 2<><32><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̵<EFBFBD><CCB5><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Է<EFBFBD><D4B7><EFBFBD><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD>. <20>Է½<D4B7> <20>ּ<EFBFBD>ǥ<EFBFBD><C7A5>(;)<29><> <20><><EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD> <20>ȵ˴ϴ<CBB4>.)
|
||||
|
||||
;<3B>Է<EFBFBD> <20><>)
|
||||
tlgdacomxpay = 95160cce09854ef44d2edb2bfb05f9f3
|
||||
lgdacomxpay = 95160cce09854ef44d2edb2bfb05f9f3
|
||||
|
||||
;>>>>>>>>>>>>>>>>>>>> <20>ݵ<EFBFBD><DDB5><EFBFBD> <20>Է<EFBFBD><D4B7><EFBFBD> <20>ּ<EFBFBD><D6BC><EFBFBD> <<<<<<<<<<<<<<<<<<<<
|
||||
48
shop/lg/makehashdata.php
Normal file
48
shop/lg/makehashdata.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// LG U+ 공통 설정
|
||||
require_once(G5_SHOP_PATH.'/settle_lg.inc.php');
|
||||
|
||||
/*
|
||||
* 1. 기본결제 인증요청 정보 변경
|
||||
*
|
||||
* 기본정보를 변경하여 주시기 바랍니다.(파라미터 전달시 POST를 사용하세요)
|
||||
*/
|
||||
$LGD_OID = $_POST['LGD_OID']; //주문번호(상점정의 유니크한 주문번호를 입력하세요)
|
||||
$LGD_AMOUNT = $_POST['LGD_AMOUNT']; //결제금액("," 를 제외한 결제금액을 입력하세요)
|
||||
$LGD_TIMESTAMP = $_POST['LGD_TIMESTAMP']; //타임스탬프
|
||||
|
||||
/*
|
||||
*************************************************
|
||||
* 2. MD5 해쉬암호화 (수정하지 마세요) - BEGIN
|
||||
*
|
||||
* MD5 해쉬암호화는 거래 위변조를 막기위한 방법입니다.
|
||||
*************************************************
|
||||
*
|
||||
* 해쉬 암호화 적용( LGD_MID + LGD_OID + LGD_AMOUNT + LGD_TIMESTAMP + LGD_MERTKEY )
|
||||
* LGD_MID : 상점아이디
|
||||
* LGD_OID : 주문번호
|
||||
* LGD_AMOUNT : 금액
|
||||
* LGD_TIMESTAMP : 타임스탬프
|
||||
* LGD_MERTKEY : 상점MertKey (mertkey는 상점관리자 -> 계약정보 -> 상점정보관리에서 확인하실수 있습니다)
|
||||
*
|
||||
* MD5 해쉬데이터 암호화 검증을 위해
|
||||
* LG유플러스에서 발급한 상점키(MertKey)를 환경설정 파일(lgdacom/conf/mall.conf)에 반드시 입력하여 주시기 바랍니다.
|
||||
*/
|
||||
|
||||
$xpay = new XPay($configPath, $CST_PLATFORM);
|
||||
|
||||
// Mert Key 설정
|
||||
$xpay->set_config_value('t'.$LGD_MID, $default['de_lg_mert_key']);
|
||||
$xpay->set_config_value($LGD_MID, $default['de_lg_mert_key']);
|
||||
|
||||
$xpay->Init_TX($LGD_MID);
|
||||
$LGD_HASHDATA = md5($LGD_MID.$LGD_OID.$LGD_AMOUNT.$LGD_TIMESTAMP.$xpay->config[$LGD_MID]);
|
||||
/*
|
||||
*************************************************
|
||||
* 2. MD5 해쉬암호화 (수정하지 마세요) - END
|
||||
*************************************************
|
||||
*/
|
||||
die($LGD_HASHDATA);
|
||||
?>
|
||||
64
shop/lg/orderform.1.php
Normal file
64
shop/lg/orderform.1.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<script language = 'javascript'>
|
||||
<!--
|
||||
/*
|
||||
* 상점결제 인증요청후 PAYKEY를 받아서 최종결제 요청.
|
||||
*/
|
||||
function doPay_ActiveX(){
|
||||
ret = xpay_check(document.getElementById('forderform'), '<?php echo $CST_PLATFORM; ?>');
|
||||
|
||||
if (ret=="00"){ //ActiveX 로딩 성공
|
||||
var LGD_RESPCODE = dpop.getData('LGD_RESPCODE'); //결과코드
|
||||
var LGD_RESPMSG = dpop.getData('LGD_RESPMSG'); //결과메세지
|
||||
|
||||
if( "0000" == LGD_RESPCODE ) { //인증성공
|
||||
var LGD_PAYKEY = dpop.getData('LGD_PAYKEY'); //LG유플러스 인증KEY
|
||||
//var msg = "인증결과 : " + LGD_RESPMSG + "\n";
|
||||
//msg += "LGD_PAYKEY : " + LGD_PAYKEY +"\n\n";
|
||||
document.getElementById('LGD_PAYKEY').value = LGD_PAYKEY;
|
||||
//alert(msg);
|
||||
document.getElementById('display_pay_button').style.display = 'none';
|
||||
document.getElementById('display_pay_process').style.display = '';
|
||||
document.getElementById('forderform').submit();
|
||||
} else { //인증실패
|
||||
alert("인증이 실패하였습니다. " + LGD_RESPMSG);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
alert("LG U+ 전자결제를 위한 ActiveX Control이 설치되지 않았습니다.");
|
||||
|
||||
xpay_showInstall(); //설치안내 팝업페이지 표시 코드 추가
|
||||
}
|
||||
}
|
||||
|
||||
function isActiveXOK(){
|
||||
if(lgdacom_atx_flag == true){
|
||||
document.getElementById('display_pay_button').style.display='';
|
||||
}else{
|
||||
document.getElementById('display_pay_button').style.display='none';
|
||||
}
|
||||
}
|
||||
|
||||
function Pay_Request(od_id, amount, timestamp)
|
||||
{
|
||||
$.ajax({
|
||||
url: "<?php echo G5_SHOP_URL; ?>/lg/makehashdata.php",
|
||||
type: "POST",
|
||||
cache: false,
|
||||
dataType: "html",
|
||||
data: { LGD_OID : od_id, LGD_AMOUNT : amount, LGD_TIMESTAMP : timestamp },
|
||||
success: function(data) {
|
||||
$("#LGD_HASHDATA").val(data);
|
||||
|
||||
doPay_ActiveX();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//-->
|
||||
</script>
|
||||
|
||||
<div id="LGD_ACTIVEX_DIV"></div> <!-- ActiveX 설치 안내 Layer 입니다. 수정하지 마세요. -->
|
||||
43
shop/lg/orderform.2.php
Normal file
43
shop/lg/orderform.2.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
$LGD_CUSTOM_PROCESSTYPE = 'TWOTR';
|
||||
?>
|
||||
|
||||
<input type="hidden" name="CST_PLATFORM" id="CST_PLATFORM" value="<?php echo $CST_PLATFORM; ?>"> <!-- 테스트, 서비스 구분 -->
|
||||
<input type="hidden" name="CST_MID" id="CST_MID" value="<?php echo $CST_MID; ?>"> <!-- 상점아이디 -->
|
||||
<input type="hidden" name="LGD_MID" id="LGD_MID" value="<?php echo $LGD_MID; ?>"> <!-- 상점아이디 -->
|
||||
<input type="hidden" name="LGD_OID" id="LGD_OID" value="<?php echo $od_id; ?>"> <!-- 주문번호 -->
|
||||
<input type="hidden" name="LGD_BUYER" id="LGD_BUYER" value=""> <!-- 구매자 -->
|
||||
<input type="hidden" name="LGD_PRODUCTINFO" id="LGD_PRODUCTINFO" value="<?php echo $goods; ?>"> <!-- 상품정보 -->
|
||||
<input type="hidden" name="LGD_AMOUNT" id="LGD_AMOUNT" value=""> <!-- 결제금액 -->
|
||||
<input type="hidden" name="LGD_CUSTOM_FIRSTPAY" id="LGD_CUSTOM_FIRSTPAY" value=""> <!-- 결제수단 -->
|
||||
<input type="hidden" name="LGD_BUYEREMAIL" id="LGD_BUYEREMAIL" value=""> <!-- 구매자 이메일 -->
|
||||
<input type="hidden" name="LGD_CUSTOM_SKIN" id="LGD_CUSTOM_SKIN" value="<?php echo $LGD_CUSTOM_SKIN; ?>"> <!-- 결제창 SKIN -->
|
||||
<input type="hidden" name="LGD_WINDOW_VER" id="LGD_WINDOW_VER" value="<?php echo $LGD_WINDOW_VER; ?>"> <!-- 결제창버전정보 (삭제하지 마세요) -->
|
||||
<input type="hidden" name="LGD_CUSTOM_PROCESSTYPE" id="LGD_CUSTOM_PROCESSTYPE" value="<?php echo $LGD_CUSTOM_PROCESSTYPE; ?>"> <!-- 트랜잭션 처리방식 -->
|
||||
<input type="hidden" name="LGD_TIMESTAMP" id="LGD_TIMESTAMP" value="<?php echo $LGD_TIMESTAMP; ?>"> <!-- 타임스탬프 -->
|
||||
<input type="hidden" name="LGD_HASHDATA" id="LGD_HASHDATA" value=""> <!-- MD5 해쉬암호값 -->
|
||||
<input type="hidden" name="LGD_PAYKEY" id="LGD_PAYKEY"> <!-- LG유플러스 PAYKEY(인증후 자동셋팅)-->
|
||||
<input type="hidden" name="LGD_VERSION" id="LGD_VERSION" value="PHP_XPay_2.5"> <!-- 버전정보 (삭제하지 마세요) -->
|
||||
<input type="hidden" name="LGD_TAXFREEAMOUNT" id="LGD_TAXFREEAMOUNT" value="<?php echo $comm_free_mny; ?>"> <!-- 결제금액 중 면세금액 -->
|
||||
<input type="hidden" name="LGD_BUYERIP" id="LGD_BUYERIP" value="<?php echo $LGD_BUYERIP; ?>"> <!-- 구매자IP -->
|
||||
<input type="hidden" name="LGD_BUYERID" id="LGD_BUYERID" value="<?php echo $LGD_BUYERID; ?>"> <!-- 구매자ID -->
|
||||
<input type="hidden" name="LGD_CUSTOM_USABLEPAY" id="LGD_CUSTOM_USABLEPAY" value="<?php echo $LGD_CUSTOM_USABLEPAY; ?>"> <!-- 결제가능수단 -->
|
||||
<input type="hidden" name="LGD_CASHRECEIPTYN" id="LGD_CASHRECEIPTYN" value="N"> <!-- 현금영수증 사용 설정 -->
|
||||
<input type="hidden" name="LGD_BUYERPHONE" id="LGD_BUYERPHONE" value=""> <!-- 구매자 휴대폰번호 -->
|
||||
|
||||
<!-- 가상계좌(무통장) 결제연동을 하시는 경우 할당/입금 결과를 통보받기 위해 반드시 LGD_CASNOTEURL 정보를 LG 유플러스에 전송해야 합니다 . -->
|
||||
<input type="hidden" name="LGD_CASNOTEURL" id="LGD_CASNOTEURL" value="<?php echo $LGD_CASNOTEURL ?>"> <!-- 가상계좌 NOTEURL -->
|
||||
|
||||
<?php /* 주문폼 자바스크립트 에러 방지를 위해 추가함 */ ?>
|
||||
<input type="hidden" name="good_mny" value="<?php echo $tot_price; ?>">
|
||||
<?php
|
||||
if($default['de_tax_flag_use']) {
|
||||
?>
|
||||
<input type="hidden" name="comm_tax_mny" value="<?php echo $comm_tax_mny; ?>"> <!-- 과세금액 -->
|
||||
<input type="hidden" name="comm_vat_mny" value="<?php echo $comm_vat_mny; ?>"> <!-- 부가세 -->
|
||||
<input type="hidden" name="comm_free_mny" value="<?php echo $comm_free_mny; ?>"> <!-- 비과세 금액 -->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
11
shop/lg/orderform.3.php
Normal file
11
shop/lg/orderform.3.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<div id="display_pay_button" class="btn_confirm" style="display:none">
|
||||
<input type="button" value="주문하기" onclick="forderform_check(this.form);"/>
|
||||
<a href="javascript:history.go(-1);" class="btn01">취소</a>
|
||||
</div>
|
||||
<div id="display_pay_process" style="display:none">
|
||||
<p>결제 진행 중입니다. 잠시만 기다려 주세요.</p>
|
||||
</div>
|
||||
3
shop/lg/orderform.4.php
Normal file
3
shop/lg/orderform.4.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
7
shop/lg/orderform.5.php
Normal file
7
shop/lg/orderform.5.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<!-- xpay.js는 반드시 body 밑에 두시기 바랍니다. -->
|
||||
<!-- UTF-8 인코딩 사용 시는 xpay.js 대신 xpay_utf-8.js 을 호출하시기 바랍니다.-->
|
||||
<script language="javascript" src="<?php echo $_SERVER['SERVER_PORT'] != 443 ? 'http' : 'https'; ?>://xpay.uplus.co.kr<?php echo ($CST_PLATFORM == 'test') ? ($_SERVER['SERVER_PORT'] != 443 ? ':7080' : ':7443') : ''; ?>/xpay/js/xpay_ub_utf-8.js" type="text/javascript"></script>
|
||||
18
shop/lg/xpay_cancel.php
Normal file
18
shop/lg/xpay_cancel.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
//최종결제요청 결과 성공 DB처리 실패시 Rollback 처리
|
||||
$isDBOK = false; //DB처리 실패시 false로 변경해 주세요.
|
||||
if( !$isDBOK ) {
|
||||
$xpay->Rollback($cancel_msg . " [TID:" . $xpay->Response("LGD_TID",0) . ",MID:" . $xpay->Response("LGD_MID",0) . ",OID:" . $xpay->Response("LGD_OID",0) . "]");
|
||||
|
||||
/*
|
||||
echo "TX Rollback Response_code = " . $xpay->Response_Code() . "<br>";
|
||||
echo "TX Rollback Response_msg = " . $xpay->Response_Msg() . "<p>";
|
||||
|
||||
if( "0000" == $xpay->Response_Code() ) {
|
||||
echo "자동취소가 정상적으로 완료 되었습니다.<br>";
|
||||
}else{
|
||||
echo "자동취소가 정상적으로 처리되지 않았습니다.<br>";
|
||||
}
|
||||
*/
|
||||
}
|
||||
?>
|
||||
104
shop/lg/xpay_result.php
Normal file
104
shop/lg/xpay_result.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
// LG U+ 공통 설정
|
||||
require_once(G5_SHOP_PATH.'/settle_lg.inc.php');
|
||||
|
||||
/*
|
||||
* [최종결제요청 페이지(STEP2-2)]
|
||||
*
|
||||
* LG유플러스으로 부터 내려받은 LGD_PAYKEY(인증Key)를 가지고 최종 결제요청.(파라미터 전달시 POST를 사용하세요)
|
||||
*/
|
||||
|
||||
/* ※ 중요
|
||||
* 환경설정 파일의 경우 반드시 외부에서 접근이 가능한 경로에 두시면 안됩니다.
|
||||
* 해당 환경파일이 외부에 노출이 되는 경우 해킹의 위험이 존재하므로 반드시 외부에서 접근이 불가능한 경로에 두시기 바랍니다.
|
||||
* 예) [Window 계열] C:\inetpub\wwwroot\lgdacom ==> 절대불가(웹 디렉토리)
|
||||
*/
|
||||
|
||||
/*
|
||||
*************************************************
|
||||
* 1.최종결제 요청 - BEGIN
|
||||
* (단, 최종 금액체크를 원하시는 경우 금액체크 부분 주석을 제거 하시면 됩니다.)
|
||||
*************************************************
|
||||
*/
|
||||
$LGD_PAYKEY = $_POST['LGD_PAYKEY'];
|
||||
|
||||
$xpay = new XPay($configPath, $CST_PLATFORM);
|
||||
|
||||
// Mert Key 설정
|
||||
$xpay->set_config_value('t'.$LGD_MID, $default['de_lg_mert_key']);
|
||||
$xpay->set_config_value($LGD_MID, $default['de_lg_mert_key']);
|
||||
|
||||
$xpay->Init_TX($LGD_MID);
|
||||
|
||||
$xpay->Set('LGD_TXNAME', 'PaymentByKey');
|
||||
$xpay->Set('LGD_PAYKEY', $LGD_PAYKEY);
|
||||
|
||||
//금액을 체크하시기 원하는 경우 아래 주석을 풀어서 이용하십시요.
|
||||
//$DB_AMOUNT = "DB나 세션에서 가져온 금액"; //반드시 위변조가 불가능한 곳(DB나 세션)에서 금액을 가져오십시요.
|
||||
//$xpay->Set('LGD_AMOUNTCHECKYN', 'Y');
|
||||
//$xpay->Set('LGD_AMOUNT', $DB_AMOUNT);
|
||||
|
||||
/*
|
||||
*************************************************
|
||||
* 1.최종결제 요청(수정하지 마세요) - END
|
||||
*************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* 2. 최종결제 요청 결과처리
|
||||
*
|
||||
* 최종 결제요청 결과 리턴 파라미터는 연동메뉴얼을 참고하시기 바랍니다.
|
||||
*/
|
||||
if ($xpay->TX()) {
|
||||
//1)결제결과 화면처리(성공,실패 결과 처리를 하시기 바랍니다.)
|
||||
/*
|
||||
echo "결제요청이 완료되었습니다. <br>";
|
||||
echo "TX Response_code = " . $xpay->Response_Code() . "<br>";
|
||||
echo "TX Response_msg = " . $xpay->Response_Msg() . "<p>";
|
||||
|
||||
echo "거래번호 : " . $xpay->Response("LGD_TID",0) . "<br>";
|
||||
echo "상점아이디 : " . $xpay->Response("LGD_MID",0) . "<br>";
|
||||
echo "상점주문번호 : " . $xpay->Response("LGD_OID",0) . "<br>";
|
||||
echo "결제금액 : " . $xpay->Response("LGD_AMOUNT",0) . "<br>";
|
||||
echo "결과코드 : " . $xpay->Response("LGD_RESPCODE",0) . "<br>";
|
||||
echo "결과메세지 : " . $xpay->Response("LGD_RESPMSG",0) . "<p>";
|
||||
|
||||
$keys = $xpay->Response_Names();
|
||||
foreach($keys as $name) {
|
||||
echo $name . " = " . $xpay->Response($name, 0) . "<br>";
|
||||
}
|
||||
|
||||
echo "<p>";
|
||||
exit;
|
||||
*/
|
||||
|
||||
if( '0000' == $xpay->Response_Code() ) {
|
||||
//최종결제요청 결과 성공 DB처리
|
||||
$tno = $xpay->Response('LGD_TID',0);
|
||||
$amount = $xpay->Response('LGD_AMOUNT',0);
|
||||
$app_time = $xpay->Response('LGD_PAYDATE',0);
|
||||
$bank_name = $xpay->Response('LGD_FINANCENAME',0);
|
||||
$depositor = $xpay->Response('LGD_PAYER',0);
|
||||
$account = $xpay->Response('LGD_FINANCENAME',0).' '.$xpay->Response('LGD_ACCOUNTNUM',0).' '.$xpay->Response('LGD_SAOWNER',0);
|
||||
$commid = $xpay->Response('LGD_FINANCENAME',0);
|
||||
$mobile_no = $xpay->Response('LGD_TELNO',0);
|
||||
$app_no = $xpay->Response('LGD_FINANCEAUTHNUM',0);
|
||||
$card_name = $xpay->Response('LGD_FINANCENAME',0);
|
||||
$pay_type = $xpay->Response('LGD_PAYTYPE',0);
|
||||
$escw_yn = $xpay->Response('LGD_ESCROWYN',0);
|
||||
} else {
|
||||
//최종결제요청 결과 실패 DB처리
|
||||
//echo "최종결제요청 결과 실패 DB처리하시기 바랍니다.<br>";
|
||||
}
|
||||
} else {
|
||||
//2)API 요청실패 화면처리
|
||||
/*
|
||||
echo "결제요청이 실패하였습니다. <br>";
|
||||
echo "TX Response_code = " . $xpay->Response_Code() . "<br>";
|
||||
echo "TX Response_msg = " . $xpay->Response_Msg() . "<p>";
|
||||
|
||||
//최종결제요청 결과 실패 DB처리
|
||||
echo "최종결제요청 결과 실패 DB처리하시기 바랍니다.<br>";
|
||||
*/
|
||||
}
|
||||
?>
|
||||
@ -20,6 +20,10 @@ if (get_cart_count($tmp_cart_id) == 0)
|
||||
|
||||
$g5['title'] = '주문서 작성';
|
||||
|
||||
if($default['de_pg_service'] == 'lg') {
|
||||
$g5['body_script'] = 'onload="isActiveXOK();"';
|
||||
}
|
||||
|
||||
include_once('./_head.php');
|
||||
if ($default['de_hope_date_use']) {
|
||||
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
|
||||
@ -31,138 +35,13 @@ set_session('ss_order_id', $od_id);
|
||||
$s_cart_id = $tmp_cart_id;
|
||||
$order_action_url = G5_HTTPS_SHOP_URL.'/orderformupdate.php';
|
||||
|
||||
require './settle_kcp.inc.php';
|
||||
require_once('./settle_'.$default['de_pg_service'].'.inc.php');
|
||||
|
||||
// 결제대행사별 코드 include (스크립트 등)
|
||||
require_once('./'.$default['de_pg_service'].'/orderform.1.php');
|
||||
?>
|
||||
|
||||
<?php
|
||||
/* ============================================================================== */
|
||||
/* = Javascript source Include = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = ※ 필수 = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
?>
|
||||
<script src="<?php echo $g_conf_js_url; ?>"></script>
|
||||
<?php
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = Javascript source Include END = */
|
||||
/* ============================================================================== */
|
||||
?>
|
||||
<script>
|
||||
function CheckPayplusInstall()
|
||||
{
|
||||
StartSmartUpdate();
|
||||
|
||||
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 = "block" ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setTimeout("init_pay_button();",300);
|
||||
}
|
||||
}
|
||||
|
||||
/* Payplus Plug-in 실행 */
|
||||
function jsf__pay( form )
|
||||
{
|
||||
var RetVal = false;
|
||||
|
||||
/* Payplus Plugin 실행 */
|
||||
if ( MakePayMessage( form ) == true )
|
||||
{
|
||||
openwin = window.open( "./kcp/proc_win.html", "proc_win", "width=449, height=209, top=300, left=300" );
|
||||
RetVal = true ;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* res_cd와 res_msg변수에 해당 오류코드와 오류메시지가 설정됩니다.
|
||||
ex) 고객이 Payplus Plugin에서 취소 버튼 클릭시 res_cd=3001, res_msg=사용자 취소
|
||||
값이 설정됩니다.
|
||||
*/
|
||||
res_cd = document.forderform.res_cd.value ;
|
||||
res_msg = document.forderform.res_msg.value ;
|
||||
|
||||
}
|
||||
|
||||
return RetVal ;
|
||||
}
|
||||
|
||||
// Payplus Plug-in 설치 안내
|
||||
|
||||
function init_pay_button()
|
||||
{
|
||||
if (navigator.userAgent.indexOf('MSIE') > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
if( document.Payplus.object == null )
|
||||
{
|
||||
document.getElementById("display_setup_message_top").style.display = "block" ;
|
||||
document.getElementById("display_setup_message").style.display = "block" ;
|
||||
document.getElementById("display_pay_button").style.display = "none" ;
|
||||
document.getElementById("display_setup_message").scrollIntoView();
|
||||
}
|
||||
else{
|
||||
document.getElementById("display_setup_message_top").style.display = "none" ;
|
||||
document.getElementById("display_setup_message").style.display = "none" ;
|
||||
document.getElementById("display_pay_button").style.display = "block" ;
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
document.getElementById("display_setup_message_top").style.display = "block" ;
|
||||
document.getElementById("display_setup_message").style.display = "block" ;
|
||||
document.getElementById("display_pay_button").style.display = "none" ;
|
||||
document.getElementById("display_setup_message").scrollIntoView();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
if( Payplus == null )
|
||||
{
|
||||
document.getElementById("display_setup_message_top").style.display = "block" ;
|
||||
document.getElementById("display_setup_message").style.display = "block" ;
|
||||
document.getElementById("display_pay_button").style.display = "none" ;
|
||||
document.getElementById("display_setup_message").scrollIntoView();
|
||||
}
|
||||
else{
|
||||
document.getElementById("display_setup_message_top").style.display = "none" ;
|
||||
document.getElementById("display_setup_message").style.display = "none" ;
|
||||
document.getElementById("display_pay_button").style.display = "block" ;
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
document.getElementById("display_setup_message_top").style.display = "block" ;
|
||||
document.getElementById("display_setup_message").style.display = "block" ;
|
||||
document.getElementById("display_pay_button").style.display = "none" ;
|
||||
document.getElementById("display_setup_message").scrollIntoView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function get_intall_file()
|
||||
{
|
||||
document.location.href = GetInstallFile();
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Payplus Plug-in 설치 안내 -->
|
||||
<p id="display_setup_message_top" class="display_setup_message" style="display:block">
|
||||
<strong>결제안내</strong>
|
||||
<span class="red">결제를 하시려면 상단의 노란색 표시줄을 클릭</span>하시거나, <a href="https://pay.kcp.co.kr/plugin_new/file/KCPPluginSetup.exe" onclick="return get_intall_file();"><span class="bold">[수동설치]</span></a>를 눌러 Payplus Plug-in을 설치하시기 바랍니다.<br>
|
||||
[수동설치]를 눌러 설치하신 경우 <span class="red bold">새로고침(F5)키</span>를 눌러 진행하시기 바랍니다.
|
||||
</p>
|
||||
|
||||
<form name="forderform" method="post" action="<?php echo $order_action_url; ?>" onsubmit="return forderform_check(this);" autocomplete="off">
|
||||
<form name="forderform" id="forderform" method="post" action="<?php echo $order_action_url; ?>" onsubmit="return forderform_check(this);" autocomplete="off">
|
||||
<div id="sod_frm">
|
||||
<!-- 주문상품 확인 시작 { -->
|
||||
<p>주문하실 상품을 확인하세요.</p>
|
||||
@ -395,241 +274,8 @@ function get_intall_file()
|
||||
<input type="hidden" name="od_send_coupon" value="0">
|
||||
|
||||
<?php
|
||||
/* ============================================================================== */
|
||||
/* = 2. 가맹점 필수 정보 설정 = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = ※ 필수 - 결제에 반드시 필요한 정보입니다. = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
// 요청종류 : 승인(pay)/취소,매입(mod) 요청시 사용
|
||||
?>
|
||||
<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']; ?>">
|
||||
|
||||
<?php
|
||||
/*
|
||||
할부옵션 : Payplus Plug-in에서 카드결제시 최대로 표시할 할부개월 수를 설정합니다.(0 ~ 18 까지 설정 가능)
|
||||
※ 주의 - 할부 선택은 결제금액이 50,000원 이상일 경우에만 가능, 50000원 미만의 금액은 일시불로만 표기됩니다
|
||||
예) value 값을 "5" 로 설정했을 경우 => 카드결제시 결제창에 일시불부터 5개월까지 선택가능
|
||||
*/
|
||||
?>
|
||||
<input type="hidden" name="pay_method" value="">
|
||||
<input type="hidden" name="ordr_idxx" value="<?php echo $od_id; ?>">
|
||||
<input type="hidden" name="good_name" value="<?php echo $goods; ?>">
|
||||
<input type="hidden" name="good_mny" value="<?php echo $tot_price; ?>">
|
||||
<input type="hidden" name="buyr_name" value="">
|
||||
<input type="hidden" name="buyr_mail" value="">
|
||||
<input type="hidden" name="buyr_tel1" value="">
|
||||
<input type="hidden" name="buyr_tel2" value="">
|
||||
|
||||
<input type="hidden" name="rcvr_name" value="">
|
||||
<input type="hidden" name="rcvr_tel1" value="">
|
||||
<input type="hidden" name="rcvr_tel2" value="">
|
||||
<input type="hidden" name="rcvr_mail" value="">
|
||||
<input type="hidden" name="rcvr_zipx" value="">
|
||||
<input type="hidden" name="rcvr_add1" value="">
|
||||
<input type="hidden" name="rcvr_add2" value="">
|
||||
|
||||
<input type="hidden" name="quotaopt" value="12">
|
||||
|
||||
<!-- 필수 항목 : 결제 금액/화폐단위 -->
|
||||
<input type="hidden" name="currency" value="WON">
|
||||
|
||||
<?php
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = 2. 가맹점 필수 정보 설정 END = */
|
||||
/* ============================================================================== */
|
||||
?>
|
||||
|
||||
<?php
|
||||
/* ============================================================================== */
|
||||
/* = 3. Payplus Plugin 필수 정보(변경 불가) = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = 결제에 필요한 주문 정보를 입력 및 설정합니다. = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
?>
|
||||
<!-- PLUGIN 설정 정보입니다(변경 불가) -->
|
||||
<input type="hidden" name="module_type" value="01">
|
||||
<!-- 복합 포인트 결제시 넘어오는 포인트사 코드 : OK캐쉬백(SCSK), 베네피아 복지포인트(SCWB) -->
|
||||
<input type="hidden" name="epnt_issu" value="">
|
||||
<!--
|
||||
※ 필 수
|
||||
필수 항목 : Payplus Plugin에서 값을 설정하는 부분으로 반드시 포함되어야 합니다
|
||||
값을 설정하지 마십시오
|
||||
-->
|
||||
<input type="hidden" name="res_cd" value="">
|
||||
<input type="hidden" name="res_msg" value="">
|
||||
<input type="hidden" name="tno" value="">
|
||||
<input type="hidden" name="trace_no" value="">
|
||||
<input type="hidden" name="enc_info" value="">
|
||||
<input type="hidden" name="enc_data" value="">
|
||||
<input type="hidden" name="ret_pay_method" value="">
|
||||
<input type="hidden" name="tran_cd" value="">
|
||||
<input type="hidden" name="bank_name" value="">
|
||||
<input type="hidden" name="bank_issu" value="">
|
||||
<input type="hidden" name="use_pay_method" value="">
|
||||
|
||||
<!-- 현금영수증 관련 정보 : Payplus Plugin 에서 설정하는 정보입니다 -->
|
||||
<input type="hidden" name="cash_tsdtime" value="">
|
||||
<input type="hidden" name="cash_yn" value="">
|
||||
<input type="hidden" name="cash_authno" value="">
|
||||
<input type="hidden" name="cash_tr_code" value="">
|
||||
<input type="hidden" name="cash_id_info" value="">
|
||||
|
||||
<!-- 2012년 8월 18일 정자상거래법 개정 관련 설정 부분 -->
|
||||
<!-- 제공 기간 설정 0:일회성 1:기간설정(ex 1:2012010120120131) -->
|
||||
<!--
|
||||
2012.08.18 부터 개정 시행되는 '전자상거래 등에서의 소비자보호에 관한 법률'에 따른 코드 변경
|
||||
이용기간이 제한되는 컨텐츠 상품이나 정기 과금 상품 등에 한하여 '용역의 제공기간'을
|
||||
표기/적용하여야 하며 이와 무관한 실물 배송상품 등의 결제에는 해당되지 않습니다.
|
||||
0 : 일반결제
|
||||
good_expr의 나머지 적용 방식에 대해서는 KCP에서 제공하는 매뉴얼을 참고해 주세요.
|
||||
-->
|
||||
<input type="hidden" name="good_expr" value="0">
|
||||
|
||||
<!-- 에스크로 항목 -->
|
||||
|
||||
<!-- 에스크로 사용 여부 : 반드시 Y 로 세팅 -->
|
||||
<input type="hidden" name="escw_used" value="Y">
|
||||
|
||||
<!-- 에스크로 결제처리 모드 : 에스크로: Y, 일반: N, KCP 설정 조건: O -->
|
||||
<input type="hidden" name="pay_mod" value="<?php echo ($default['de_escrow_use']?"O":"N"); ?>">
|
||||
|
||||
<!-- 배송 소요일 : 예상 배송 소요일을 입력 -->
|
||||
<input type="hidden" name="deli_term" value="03">
|
||||
|
||||
<!-- 장바구니 상품 개수 : 장바구니에 담겨있는 상품의 개수를 입력 -->
|
||||
<input type="hidden" name="bask_cntx" value="<?php echo (int)$goods_count + 1; ?>">
|
||||
|
||||
<!-- 장바구니 상품 상세 정보 (자바 스크립트 샘플(create_goodInfo()) 참고) -->
|
||||
<input type="hidden" name="good_info" value="<?php echo $good_info; ?>">
|
||||
|
||||
<?php
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = 3. Payplus Plugin 필수 정보 END = */
|
||||
/* ============================================================================== */
|
||||
?>
|
||||
|
||||
<?php
|
||||
/* ============================================================================== */
|
||||
/* = 4. 옵션 정보 = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = ※ 옵션 - 결제에 필요한 추가 옵션 정보를 입력 및 설정합니다. = */
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
|
||||
/* PayPlus에서 보이는 신용카드사 삭제 파라미터 입니다
|
||||
※ 해당 카드를 결제창에서 보이지 않게 하여 고객이 해당 카드로 결제할 수 없도록 합니다. (카드사 코드는 매뉴얼을 참고)
|
||||
<input type="hidden" name="not_used_card" value="CCPH:CCSS:CCKE:CCHM:CCSH:CCLO:CCLG:CCJB:CCHN:CCCH"> */
|
||||
|
||||
/* 신용카드 결제시 OK캐쉬백 적립 여부를 묻는 창을 설정하는 파라미터 입니다
|
||||
OK캐쉬백 포인트 가맹점의 경우에만 창이 보여집니다
|
||||
<input type="hidden" name="save_ocb" value="Y"> */
|
||||
|
||||
/* 고정 할부 개월 수 선택
|
||||
value값을 "7" 로 설정했을 경우 => 카드결제시 결제창에 할부 7개월만 선택가능
|
||||
<input type="hidden" name="fix_inst" value="07"> */
|
||||
|
||||
/* 무이자 옵션
|
||||
※ 설정할부 (가맹점 관리자 페이지에 설정 된 무이자 설정을 따른다) - "" 로 설정
|
||||
※ 일반할부 (KCP 이벤트 이외에 설정 된 모든 무이자 설정을 무시한다) - "N" 로 설정
|
||||
※ 무이자 할부 (가맹점 관리자 페이지에 설정 된 무이자 이벤트 중 원하는 무이자 설정을 세팅한다) - "Y" 로 설정
|
||||
<input type="hidden" name="kcp_noint" value=""> */
|
||||
|
||||
|
||||
/* 무이자 설정
|
||||
※ 주의 1 : 할부는 결제금액이 50,000 원 이상일 경우에만 가능
|
||||
※ 주의 2 : 무이자 설정값은 무이자 옵션이 Y일 경우에만 결제 창에 적용
|
||||
예) 전 카드 2,3,6개월 무이자(국민,비씨,엘지,삼성,신한,현대,롯데,외환) : ALL-02:03:04
|
||||
BC 2,3,6개월, 국민 3,6개월, 삼성 6,9개월 무이자 : CCBC-02:03:06,CCKM-03:06,CCSS-03:06:04
|
||||
<input type="hidden" name="kcp_noint_quota" value="CCBC-02:03:06,CCKM-03:06,CCSS-03:06:09"> */
|
||||
|
||||
/* 사용카드 설정 여부 파라미터 입니다.(통합결제창 노출 유무)
|
||||
<input type="hidden" name="used_card_YN" value="Y">
|
||||
/* 사용카드 설정 파라미터 입니다. (해당 카드만 결제창에 보이게 설정하는 파라미터입니다. used_card_YN 값이 Y일때 적용됩니다.
|
||||
/<input type="hidden" name="used_card" value="CCBC:CCKM:CCSS">
|
||||
|
||||
/* 해외카드 구분하는 파라미터 입니다.(해외비자, 해외마스터, 해외JCB로 구분하여 표시)
|
||||
<input type="hidden" name="used_card_CCXX" value="Y">
|
||||
|
||||
/* 가상계좌 은행 선택 파라미터
|
||||
※ 해당 은행을 결제창에서 보이게 합니다.(은행코드는 매뉴얼을 참조) */
|
||||
?>
|
||||
|
||||
<input type="hidden" name="kcp_noint" value="<?php echo ($default['de_card_noint_use'] ? '' : 'N'); ?>">
|
||||
|
||||
<?php
|
||||
if($default['de_tax_flag_use']) {
|
||||
/* KCP는 과세상품과 비과세상품을 동시에 판매하는 업체들의 결제관리에 대한 편의성을 제공해드리고자,
|
||||
복합과세 전용 사이트코드를 지원해 드리며 총 금액에 대해 복합과세 처리가 가능하도록 제공하고 있습니다
|
||||
|
||||
복합과세 전용 사이트 코드로 계약하신 가맹점에만 해당이 됩니다
|
||||
|
||||
상품별이 아니라 금액으로 구분하여 요청하셔야 합니다
|
||||
|
||||
총결제 금액은 과세금액 + 부과세 + 비과세금액의 합과 같아야 합니다.
|
||||
(good_mny = comm_tax_mny + comm_vat_mny + comm_free_mny) */
|
||||
?>
|
||||
<input type="hidden" name="tax_flag" value="TG03"> <!-- 변경불가 -->
|
||||
<input type="hidden" name="comm_tax_mny" value="<?php echo $comm_tax_mny; ?>"> <!-- 과세금액 -->
|
||||
<input type="hidden" name="comm_vat_mny" value="<?php echo $comm_vat_mny; ?>"> <!-- 부가세 -->
|
||||
<input type="hidden" name="comm_free_mny" value="<?php echo $comm_free_mny; ?>"> <!-- 비과세 금액 -->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="hidden" name="wish_vbank_list" value="05:03:04:07:11:23:26:32:34:81:71">
|
||||
<?php
|
||||
|
||||
|
||||
/* 가상계좌 입금 기한 설정하는 파라미터 - 발급일 + 3일
|
||||
<input type="hidden" name="vcnt_expire_term" value="3"> */
|
||||
|
||||
|
||||
/* 가상계좌 입금 시간 설정하는 파라미터
|
||||
HHMMSS형식으로 입력하시기 바랍니다
|
||||
설정을 안하시는경우 기본적으로 23시59분59초가 세팅이 됩니다
|
||||
<input type="hidden" name="vcnt_expire_term_time" value="120000"> */
|
||||
|
||||
|
||||
/* 포인트 결제시 복합 결제(신용카드+포인트) 여부를 결정할 수 있습니다.- N 일경우 복합결제 사용안함
|
||||
<input type="hidden" name="complex_pnt_yn" value="N"> */
|
||||
|
||||
|
||||
/* 문화상품권 결제시 가맹점 고객 아이디 설정을 해야 합니다.(필수 설정)
|
||||
<input type="hidden" name="tk_shop_id" value=""> */
|
||||
|
||||
|
||||
/* 현금영수증 등록 창을 출력 여부를 설정하는 파라미터 입니다
|
||||
※ Y : 현금영수증 등록 창 출력
|
||||
※ N : 현금영수증 등록 창 출력 안함
|
||||
※ 주의 : 현금영수증 사용 시 KCP 상점관리자 페이지에서 현금영수증 사용 동의를 하셔야 합니다 */
|
||||
?>
|
||||
<input type="hidden" name="disp_tax_yn" value="N">
|
||||
<?php
|
||||
/* 결제창에 가맹점 사이트의 로고를 플러그인 좌측 상단에 출력하는 파라미터 입니다
|
||||
업체의 로고가 있는 URL을 정확히 입력하셔야 하며, 최대 150 X 50 미만 크기 지원
|
||||
|
||||
※ 주의 : 로고 용량이 150 X 50 이상일 경우 site_name 값이 표시됩니다. */
|
||||
?>
|
||||
<input type="hidden" name="site_logo" value="">
|
||||
<?php
|
||||
/* 결제창 영문 표시 파라미터 입니다. 영문을 기본으로 사용하시려면 Y로 세팅하시기 바랍니다
|
||||
2010-06월 현재 신용카드와 가상계좌만 지원됩니다
|
||||
<input type="hidden" name="eng_flag" value="Y"> */
|
||||
?>
|
||||
|
||||
<?php
|
||||
/* skin_indx 값은 스킨을 변경할 수 있는 파라미터이며 총 7가지가 지원됩니다.
|
||||
변경을 원하시면 1부터 7까지 값을 넣어주시기 바랍니다. */
|
||||
?>
|
||||
<input type="hidden" name="skin_indx" value="1">
|
||||
|
||||
<?php
|
||||
/* 상품코드 설정 파라미터 입니다.(상품권을 따로 구분하여 처리할 수 있는 옵션기능입니다.)
|
||||
<input type="hidden" name="good_cd" value=""> */
|
||||
|
||||
/* = -------------------------------------------------------------------------- = */
|
||||
/* = 4. 옵션 정보 END = */
|
||||
/* ============================================================================== */
|
||||
// 결제대행사별 코드 include (결제대행사 정보 필드)
|
||||
require_once('./'.$default['de_pg_service'].'/orderform.2.php');
|
||||
?>
|
||||
|
||||
<!-- 주문하시는 분 입력 시작 { -->
|
||||
@ -1021,69 +667,18 @@ function get_intall_file()
|
||||
</section>
|
||||
<!-- } 결제 정보 입력 끝 -->
|
||||
|
||||
<!-- Payplus Plug-in 설치 안내 시작 { -->
|
||||
<p id="display_setup_message" class="display_setup_message" style="display:block">
|
||||
<span class="red">결제를 계속 하시려면 상단의 노란색 표시줄을 클릭</span>하시거나 <a href="https://pay.kcp.co.kr/plugin_new/file/KCPPluginSetup.exe" onclick="return get_intall_file();"><b><u>[수동설치]</u></b></a>를 눌러 다운로드 된 Payplus Plug-in을 설치하시기 바랍니다.<br>
|
||||
[수동설치]를 눌러 설치하신 경우 <span class="red bold">새로고침(F5)키</span>를 눌러 진행하시기 바랍니다.<br>
|
||||
새로고침(F5) 한후에도 계속 설치파일이 다운로드 되거나 결제가 되지 않으면 브라우저를 새로 열어서 주문해 주시기 바랍니다.<br>
|
||||
브라우저가 익스플로러가 아닌 경우 Payplus Plug-in 설치에 문제가 있을수 있음을 알려 드립니다.
|
||||
</p>
|
||||
<!-- } Payplus Plug-in 설치 안내 끝 -->
|
||||
|
||||
<div id="display_pay_button" class="btn_confirm" style="display:none">
|
||||
<input type="submit" value="주문하기" class="btn_submit">
|
||||
<a href="javascript:history.go(-1);" class="btn01">취소</a>
|
||||
</div>
|
||||
<?php
|
||||
// 결제대행사별 코드 include (주문버튼)
|
||||
require_once('./'.$default['de_pg_service'].'/orderform.3.php');
|
||||
?>
|
||||
</form>
|
||||
|
||||
<?php if ($default['de_escrow_use']) { ?>
|
||||
<!-- 에스크로 안내 시작 { -->
|
||||
<section id="sod_frm_escrow">
|
||||
<h2>에스크로 안내</h2>
|
||||
<form name="escrow_foot" method="post" action="http://admin.kcp.co.kr/Modules/escrow/kcp_pop.jsp">
|
||||
<input type="hidden" name="site_cd" value="SR<?php echo $default['de_kcp_mid']; ?>">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td align='center'><img src="<?php echo G5_SHOP_URL; ?>/img/marks_escrow/escrow_foot.gif" width="290" height="92" border="0" usemap="#Map"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='line-height:150%;'>
|
||||
<br>
|
||||
<strong>에스크로(escrow) 제도란?</strong>
|
||||
<br>상거래 시에, 판매자와 구매자의 사이에 신뢰할 수 있는 중립적인 제삼자(여기서는 <a href='http://kcp.co.kr' target='_blank'>KCP</a>)가 중개하여
|
||||
금전 또는 물품을 거래를 하도록 하는 것, 또는 그러한 서비스를 말한다. 거래의 안전성을 확보하기 위해 이용된다.
|
||||
(2006.4.1 전자상거래 소비자보호법에 따른 의무 시행)
|
||||
<br><br>
|
||||
현금 거래에만 해당(에스크로 결제를 선택했을 경우에만 해당)되며,
|
||||
신용카드로 구매하는 거래, 배송이 필요하지 않은 재화 등을 구매하는 거래(컨텐츠 등)에는 해당되지 않는다.
|
||||
<br>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<map name="Map" id="Map">
|
||||
<area shape="rect" coords="5,62,74,83" href="javascript:escrow_foot_check()" alt="가입사실확인">
|
||||
</map>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
function escrow_foot_check()
|
||||
{
|
||||
var status = "width=500 height=450 menubar=no,scrollbars=no,resizable=no,status=no";
|
||||
var obj = window.open('', 'escrow_foot_pop', status);
|
||||
|
||||
document.escrow_foot.method = "post";
|
||||
document.escrow_foot.target = "escrow_foot_pop";
|
||||
document.escrow_foot.action = "http://admin.kcp.co.kr/Modules/escrow/kcp_pop.jsp";
|
||||
|
||||
document.escrow_foot.submit();
|
||||
<?php
|
||||
if ($default['de_escrow_use']) {
|
||||
// 결제대행사별 코드 include (에스크로 안내)
|
||||
require_once('./'.$default['de_pg_service'].'/orderform.4.php');
|
||||
}
|
||||
</script>
|
||||
<!-- } 에스크로 안내 끝 -->
|
||||
<?php } ?>
|
||||
|
||||
<!-- <?php if ($default['de_card_use'] || $default['de_iche_use']) { echo "결제대행사 : KCP"; } ?> -->
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
@ -1694,6 +1289,7 @@ function forderform_check(f)
|
||||
<?php } ?>
|
||||
|
||||
// pay_method 설정
|
||||
<?php if($default['de_pg_service'] == 'kcp') { ?>
|
||||
switch(settle_method)
|
||||
{
|
||||
case "계좌이체":
|
||||
@ -1712,8 +1308,33 @@ function forderform_check(f)
|
||||
f.pay_method.value = "무통장";
|
||||
break;
|
||||
}
|
||||
<?php } else if($default['de_pg_service'] == 'lg') { ?>
|
||||
switch(settle_method)
|
||||
{
|
||||
case "계좌이체":
|
||||
f.LGD_CUSTOM_FIRSTPAY.value = "SC0030";
|
||||
f.LGD_CUSTOM_USABLEPAY.value = "SC0030";
|
||||
break;
|
||||
case "가상계좌":
|
||||
f.LGD_CUSTOM_FIRSTPAY.value = "SC0040";
|
||||
f.LGD_CUSTOM_USABLEPAY.value = "SC0040";
|
||||
break;
|
||||
case "휴대폰":
|
||||
f.LGD_CUSTOM_FIRSTPAY.value = "SC0060";
|
||||
f.LGD_CUSTOM_USABLEPAY.value = "SC0060";
|
||||
break;
|
||||
case "신용카드":
|
||||
f.LGD_CUSTOM_FIRSTPAY.value = "SC0010";
|
||||
f.LGD_CUSTOM_USABLEPAY.value = "SC0010";
|
||||
break;
|
||||
default:
|
||||
f.LGD_CUSTOM_FIRSTPAY.value = "무통장";
|
||||
break;
|
||||
}
|
||||
<?php } ?>
|
||||
|
||||
// kcp 결제정보설정
|
||||
// 결제정보설정
|
||||
<?php if($default['de_pg_service'] == 'kcp') { ?>
|
||||
f.buyr_name.value = f.od_name.value;
|
||||
f.buyr_mail.value = f.od_email.value;
|
||||
f.buyr_tel1.value = f.od_tel.value;
|
||||
@ -1735,6 +1356,21 @@ function forderform_check(f)
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
<?php } if($default['de_pg_service'] == 'lg') { ?>
|
||||
f.LGD_BUYER.value = f.od_name.value;
|
||||
f.LGD_BUYEREMAIL.value = f.od_email.value;
|
||||
f.LGD_BUYERPHONE.value = f.od_hp.value;
|
||||
f.LGD_AMOUNT.value = f.good_mny.value;
|
||||
<?php if($default['de_tax_flag_use']) { ?>
|
||||
f.LGD_TAXFREEAMOUNT.value = f.comm_free_mny.value;
|
||||
<?php } ?>
|
||||
|
||||
if(f.LGD_CUSTOM_FIRSTPAY.value != "무통장") {
|
||||
Pay_Request("<?php echo $od_id; ?>", f.LGD_AMOUNT.value, f.LGD_TIMESTAMP.value);
|
||||
} else {
|
||||
f.submit();
|
||||
}
|
||||
<?php } ?>
|
||||
}
|
||||
|
||||
// 구매자 정보와 동일합니다.
|
||||
@ -1777,8 +1413,7 @@ $(function(){
|
||||
|
||||
<?php
|
||||
include_once('./_tail.php');
|
||||
?>
|
||||
|
||||
<script>
|
||||
CheckPayplusInstall();
|
||||
</script>
|
||||
// 결제대행사별 코드 include (스크립트 실행)
|
||||
require_once('./'.$default['de_pg_service'].'/orderform.5.php');
|
||||
?>
|
||||
@ -269,7 +269,15 @@ if ($od_settle_case == "무통장")
|
||||
}
|
||||
else if ($od_settle_case == "계좌이체")
|
||||
{
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub.php';
|
||||
switch($default['de_pg_service']) {
|
||||
case 'lg':
|
||||
include G5_SHOP_PATH.'/lg/xpay_result.php';
|
||||
break;
|
||||
default:
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub.php';
|
||||
$bank_name = iconv("cp949", "utf-8", $bank_name);
|
||||
break;
|
||||
}
|
||||
|
||||
$od_tno = $tno;
|
||||
$od_receipt_price = $amount;
|
||||
@ -277,7 +285,6 @@ else if ($od_settle_case == "계좌이체")
|
||||
$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 = $od_settle_case;
|
||||
$od_deposit_name = $od_name;
|
||||
$bank_name = iconv("cp949", "utf-8", $bank_name);
|
||||
$od_bank_account = $bank_name;
|
||||
$pg_price = $amount;
|
||||
$od_misu = $i_price - $od_receipt_price;
|
||||
@ -286,13 +293,20 @@ else if ($od_settle_case == "계좌이체")
|
||||
}
|
||||
else if ($od_settle_case == "가상계좌")
|
||||
{
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub.php';
|
||||
switch($default['de_pg_service']) {
|
||||
case 'lg':
|
||||
include G5_SHOP_PATH.'/lg/xpay_result.php';
|
||||
break;
|
||||
default:
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub.php';
|
||||
$bankname = iconv("cp949", "utf-8", $bankname);
|
||||
$depositor = iconv("cp949", "utf-8", $depositor);
|
||||
break;
|
||||
}
|
||||
|
||||
$od_receipt_point = $i_temp_point;
|
||||
$od_tno = $tno;
|
||||
$od_receipt_price = 0;
|
||||
$bankname = iconv("cp949", "utf-8", $bankname);
|
||||
$depositor = iconv("cp949", "utf-8", $depositor);
|
||||
$od_bank_account = $bankname.' '.$account;
|
||||
$od_deposit_name = $depositor;
|
||||
$pg_price = $amount;
|
||||
@ -300,7 +314,14 @@ else if ($od_settle_case == "가상계좌")
|
||||
}
|
||||
else if ($od_settle_case == "휴대폰")
|
||||
{
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub.php';
|
||||
switch($default['de_pg_service']) {
|
||||
case 'lg':
|
||||
include G5_SHOP_PATH.'/lg/xpay_result.php';
|
||||
break;
|
||||
default:
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub.php';
|
||||
break;
|
||||
}
|
||||
|
||||
$od_tno = $tno;
|
||||
$od_receipt_price = $amount;
|
||||
@ -314,14 +335,21 @@ else if ($od_settle_case == "휴대폰")
|
||||
}
|
||||
else if ($od_settle_case == "신용카드")
|
||||
{
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub.php';
|
||||
switch($default['de_pg_service']) {
|
||||
case 'lg':
|
||||
include G5_SHOP_PATH.'/lg/xpay_result.php';
|
||||
break;
|
||||
default:
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub.php';
|
||||
$card_name = iconv("cp949", "utf-8", $card_name);
|
||||
break;
|
||||
}
|
||||
|
||||
$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);
|
||||
$card_name = iconv("cp949", "utf-8", $card_name);
|
||||
$od_bank_account = $card_name;
|
||||
$pg_price = $amount;
|
||||
$od_misu = $i_price - $od_receipt_price;
|
||||
@ -337,7 +365,14 @@ else
|
||||
if($tno) {
|
||||
if((int)$i_price !== (int)$pg_price) {
|
||||
$cancel_msg = '결제금액 불일치';
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php'; // 결제취소처리
|
||||
switch($default['de_pg_service']) {
|
||||
case 'lg':
|
||||
include G5_SHOP_PATH.'/lg/xpay_cancel.php';
|
||||
break;
|
||||
default:
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php';
|
||||
break;
|
||||
}
|
||||
|
||||
die("Receipt Amount Error");
|
||||
}
|
||||
@ -365,6 +400,10 @@ if($default['de_tax_flag_use']) {
|
||||
$od_free_mny = (int)$_POST['comm_free_mny'];
|
||||
}
|
||||
|
||||
$od_pg = $default['de_pg_service'];
|
||||
if($od_settle_case == '무통장')
|
||||
$od_pg = '';
|
||||
|
||||
// 주문서에 입력
|
||||
$sql = " insert {$g5['g5_shop_order_table']}
|
||||
set od_id = '$od_id',
|
||||
@ -403,6 +442,7 @@ $sql = " insert {$g5['g5_shop_order_table']}
|
||||
od_bank_account = '$od_bank_account',
|
||||
od_receipt_time = '$od_receipt_time',
|
||||
od_misu = '$od_misu',
|
||||
od_pg = '$od_pg',
|
||||
od_tno = '$od_tno',
|
||||
od_app_no = '$od_app_no',
|
||||
od_escrow = '$od_escrow',
|
||||
@ -423,14 +463,21 @@ $result = sql_query($sql, false);
|
||||
if(!$result) {
|
||||
if($tno) {
|
||||
$cancel_msg = '주문정보 입력 오류';
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php'; // 결제취소처리
|
||||
switch($default['de_pg_service']) {
|
||||
case 'lg':
|
||||
include G5_SHOP_PATH.'/lg/xpay_cancel.php';
|
||||
break;
|
||||
default:
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 관리자에게 오류 알림 메일발송
|
||||
$error = 'order';
|
||||
include G5_SHOP_PATH.'/ordererrormail.php';
|
||||
|
||||
die_utf8('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>KCP를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
|
||||
die_utf8('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>'.strtoupper($default['de_pg_service']).'를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
|
||||
}
|
||||
|
||||
// 장바구니 상태변경
|
||||
@ -452,7 +499,14 @@ $result = sql_query($sql, false);
|
||||
if(!$result) {
|
||||
if($tno) {
|
||||
$cancel_msg = '주문상태 변경 오류';
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php'; // 결제취소처리
|
||||
switch($default['de_pg_service']) {
|
||||
case 'lg':
|
||||
include G5_SHOP_PATH.'/lg/xpay_cancel.php';
|
||||
break;
|
||||
default:
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 관리자에게 오류 알림 메일발송
|
||||
@ -462,7 +516,7 @@ if(!$result) {
|
||||
// 주문삭제
|
||||
sql_query(" delete from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
|
||||
|
||||
die_utf8('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>KCP를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
|
||||
die_utf8('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>'.strtoupper($default['de_pg_service']).'를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
|
||||
}
|
||||
|
||||
// 회원이면서 포인트를 사용했다면 테이블에 사용을 추가
|
||||
@ -640,7 +694,7 @@ goto_url(G5_SHOP_URL.'/orderinquiryview.php?od_id='.$od_id.'&uid='.$uid);
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>*** KCP [AX-HUB Version] ***</title>
|
||||
<title>주문정보 기록</title>
|
||||
<script>
|
||||
// 결제 중 새로고침 방지 샘플 스크립트 (중복결제 방지)
|
||||
function noRefresh()
|
||||
|
||||
@ -30,32 +30,65 @@ if($od['od_cancel_price'] > 0 || $ct['od_count1'] != $ct['od_count2']) {
|
||||
|
||||
// PG 결제 취소
|
||||
if($od['od_tno']) {
|
||||
require './settle_kcp.inc.php';
|
||||
switch($od['od_pg']) {
|
||||
case 'lg':
|
||||
require './settle_lg.inc.php';
|
||||
$LGD_TID = $od['od_tno']; //LG유플러스으로 부터 내려받은 거래번호(LGD_TID)
|
||||
|
||||
$_POST['tno'] = $od['od_tno'];
|
||||
$_POST['req_tx'] = 'mod';
|
||||
$_POST['mod_type'] = 'STSC';
|
||||
if($od['od_escrow']) {
|
||||
$_POST['req_tx'] = 'mod_escrow';
|
||||
$_POST['mod_type'] = 'STE2';
|
||||
if($od['od_settle_case'] == '가상계좌')
|
||||
$_POST['mod_type'] = 'STE5';
|
||||
$xpay = new XPay($configPath, $CST_PLATFORM);
|
||||
|
||||
// Mert Key 설정
|
||||
$xpay->set_config_value('t'.$LGD_MID, $default['de_lg_mert_key']);
|
||||
$xpay->set_config_value($LGD_MID, $default['de_lg_mert_key']);
|
||||
$xpay->Init_TX($LGD_MID);
|
||||
|
||||
$xpay->Set("LGD_TXNAME", "Cancel");
|
||||
$xpay->Set("LGD_TID", $LGD_TID);
|
||||
|
||||
if ($xpay->TX()) {
|
||||
//1)결제취소결과 화면처리(성공,실패 결과 처리를 하시기 바랍니다.)
|
||||
/*
|
||||
echo "결제 취소요청이 완료되었습니다. <br>";
|
||||
echo "TX Response_code = " . $xpay->Response_Code() . "<br>";
|
||||
echo "TX Response_msg = " . $xpay->Response_Msg() . "<p>";
|
||||
*/
|
||||
} else {
|
||||
//2)API 요청 실패 화면처리
|
||||
$msg = "결제 취소요청이 실패하였습니다.\\n";
|
||||
$msg .= "TX Response_code = " . $xpay->Response_Code() . "\\n";
|
||||
$msg .= "TX Response_msg = " . $xpay->Response_Msg();
|
||||
|
||||
alert($msg);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
require './settle_kcp.inc.php';
|
||||
|
||||
$_POST['tno'] = $od['od_tno'];
|
||||
$_POST['req_tx'] = 'mod';
|
||||
$_POST['mod_type'] = 'STSC';
|
||||
if($od['od_escrow']) {
|
||||
$_POST['req_tx'] = 'mod_escrow';
|
||||
$_POST['mod_type'] = 'STE2';
|
||||
if($od['od_settle_case'] == '가상계좌')
|
||||
$_POST['mod_type'] = 'STE5';
|
||||
}
|
||||
$_POST['mod_desc'] = iconv("utf-8", "euc-kr", '주문자 본인 취소-'.$cancel_memo);
|
||||
$_POST['site_cd'] = $default['de_kcp_mid'];
|
||||
|
||||
// 취소내역 한글깨짐방지
|
||||
$def_locale = setlocale(LC_CTYPE, 0);
|
||||
$locale_change = false;
|
||||
if(preg_match("/utf[\-]?8/i", $def_locale)) {
|
||||
setlocale(LC_CTYPE, 'ko_KR.euc-kr');
|
||||
$locale_change = true;
|
||||
}
|
||||
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub.php';
|
||||
|
||||
if($locale_change)
|
||||
setlocale(LC_CTYPE, $def_locale);
|
||||
}
|
||||
$_POST['mod_desc'] = iconv("utf-8", "euc-kr", '주문자 본인 취소-'.$cancel_memo);
|
||||
$_POST['site_cd'] = $default['de_kcp_mid'];
|
||||
|
||||
// 취소내역 한글깨짐방지
|
||||
$def_locale = setlocale(LC_CTYPE, 0);
|
||||
$locale_change = false;
|
||||
if(preg_match("/utf[\-]?8/i", $def_locale)) {
|
||||
setlocale(LC_CTYPE, 'ko_KR.euc-kr');
|
||||
$locale_change = true;
|
||||
}
|
||||
|
||||
include G5_SHOP_PATH.'/kcp/pp_ax_hub.php';
|
||||
|
||||
if($locale_change)
|
||||
setlocale(LC_CTYPE, $def_locale);
|
||||
}
|
||||
|
||||
// 장바구니 자료 취소
|
||||
|
||||
@ -250,7 +250,7 @@ if(openwin != null) {
|
||||
$disp_bank = false;
|
||||
$disp_receipt = true;
|
||||
} else if($od['od_settle_case'] == '가상계좌' || $od['od_settle_case'] == '계좌이체') {
|
||||
$app_no_subj = 'KCP 거래번호';
|
||||
$app_no_subj = '거래번호';
|
||||
$app_no = $od['od_tno'];
|
||||
}
|
||||
?>
|
||||
@ -292,7 +292,7 @@ if(openwin != null) {
|
||||
<?php
|
||||
}
|
||||
|
||||
// 승인번호, 휴대폰번호, KCP 거래번호
|
||||
// 승인번호, 휴대폰번호, 거래번호
|
||||
if($app_no_subj)
|
||||
{
|
||||
?>
|
||||
@ -578,7 +578,7 @@ if(openwin != null) {
|
||||
<?php } ?>
|
||||
</section>
|
||||
|
||||
<?php if ($od['od_settle_case'] == '가상계좌' && $od['od_misu'] > 0 && $default['de_card_test'] && $is_admin) {
|
||||
<?php if ($od['od_settle_case'] == '가상계좌' && $od['od_misu'] > 0 && $default['de_card_test'] && $is_admin && $od['od_pg'] == 'kcp') {
|
||||
preg_match("/\s{1}([^\s]+)\s?/", $od['od_bank_account'], $matchs);
|
||||
$deposit_no = trim($matchs[1]);
|
||||
?>
|
||||
@ -586,10 +586,14 @@ if(openwin != null) {
|
||||
<legend>모의입금처리</legend>
|
||||
<p>관리자가 가상계좌 테스트를 한 경우에만 보입니다.</p>
|
||||
<form method="post" action="http://devadmin.kcp.co.kr/Modules/Noti/TEST_Vcnt_Noti_Proc.jsp" target="_blank">
|
||||
<input type="text" name="e_trade_no" value="<?php echo $od['od_tno']; ?>" size="80"><br />
|
||||
<input type="text" name="deposit_no" value="<?php echo $deposit_no; ?>" size="80"><br />
|
||||
<input type="text" name="req_name" value="<?php echo $od['od_name']; ?>" size="80"><br />
|
||||
<input type="text" name="noti_url" value="<?php echo G5_SHOP_URL; ?>/settle_kcp_common.php" size="80"><br /><br />
|
||||
<label for="e_trade_no">KCP 거래번호</label>
|
||||
<input type="text" name="e_trade_no" id="e_trade_no" value="<?php echo $od['od_tno']; ?>" size="80"><br />
|
||||
<label for="deposit_no">입금계좌</label>
|
||||
<input type="text" name="deposit_no" id="deposit_no" value="<?php echo $deposit_no; ?>" size="80"><br />
|
||||
<label for="req_name">입금자명</label>
|
||||
<input type="text" name="req_name" id="req_name" value="<?php echo $od['od_name']; ?>" size="80"><br />
|
||||
<label for="noti_url">입금통보 URL</label>
|
||||
<input type="text" name="noti_url" id="noti_url" value="<?php echo G5_SHOP_URL; ?>/settle_kcp_common.php" size="80"><br /><br />
|
||||
<input type="submit" value="입금통보 테스트">
|
||||
</form>
|
||||
</fieldset>
|
||||
|
||||
50
shop/settle_lg.inc.php
Normal file
50
shop/settle_lg.inc.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
require_once(G5_SHOP_PATH.'/lg/XPayClient.php');
|
||||
|
||||
class XPay extends XPayClient
|
||||
{
|
||||
public function set_config_value($key, $val)
|
||||
{
|
||||
$this->config[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 1. 기본결제 인증요청 정보 변경
|
||||
*
|
||||
* 기본정보를 변경하여 주시기 바랍니다.(파라미터 전달시 POST를 사용하세요)
|
||||
*/
|
||||
$CST_PLATFORM = $default['de_card_test'] ? 'test' : 'service'; //LG유플러스 결제 서비스 선택(test:테스트, service:서비스)
|
||||
$CST_MID = 'si_'.$default['de_lg_mid']; //상점아이디(LG유플러스으로 부터 발급받으신 상점아이디를 입력하세요)
|
||||
//테스트 아이디는 't'를 반드시 제외하고 입력하세요.
|
||||
$LGD_MID = (('test' == $CST_PLATFORM) ? 't' : '').$CST_MID; //상점아이디(자동생성)
|
||||
$LGD_TIMESTAMP = date('YmdHis'); //타임스탬프
|
||||
$LGD_BUYERIP = $_SERVER['REMOTE_ADDR']; //구매자IP
|
||||
$LGD_BUYERID = ''; //구매자ID
|
||||
$LGD_CUSTOM_SKIN = 'red'; //상점정의 결제창 스킨 (red, purple, yellow)
|
||||
$LGD_WINDOW_VER = '2.5'; //결제창 버젼정보
|
||||
$LGD_MERTKEY = ''; //상점MertKey(mertkey는 상점관리자 -> 계약정보 -> 상점정보관리에서 확인하실수 있습니다)
|
||||
|
||||
// 결제가능 수단
|
||||
$useablepay = array();
|
||||
$LGD_CUSTOM_USABLEPAY = '';
|
||||
if($default['de_iche_use'])
|
||||
$useablepay[] = 'SC0030';
|
||||
if($default['de_vbank_use'])
|
||||
$useablepay[] = 'SC0040';
|
||||
if($default['de_card_use'])
|
||||
$useablepay[] = 'SC0010';
|
||||
if($default['de_hp_use'])
|
||||
$useablepay[] = 'SC0060';
|
||||
if(count($useablepay) > 0)
|
||||
$LGD_CUSTOM_USABLEPAY = implode("-", $useablepay);
|
||||
|
||||
$configPath = G5_SHOP_PATH.'/lg'; //LG유플러스에서 제공한 환경파일("/conf/lgdacom.conf") 위치 지정.
|
||||
|
||||
/*
|
||||
* 가상계좌(무통장) 결제 연동을 하시는 경우 아래 LGD_CASNOTEURL 을 설정하여 주시기 바랍니다.
|
||||
*/
|
||||
$LGD_CASNOTEURL = G5_SHOP_URL.'/settle_lg_common.php';
|
||||
?>
|
||||
164
shop/settle_lg_common.php
Normal file
164
shop/settle_lg_common.php
Normal file
@ -0,0 +1,164 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
/*
|
||||
* [상점 결제결과처리(DB) 페이지]
|
||||
*
|
||||
* 1) 위변조 방지를 위한 hashdata값 검증은 반드시 적용하셔야 합니다.
|
||||
*
|
||||
*/
|
||||
$LGD_RESPCODE = $_POST["LGD_RESPCODE"]; // 응답코드: 0000(성공) 그외 실패
|
||||
$LGD_RESPMSG = $_POST["LGD_RESPMSG"]; // 응답메세지
|
||||
$LGD_MID = $_POST["LGD_MID"]; // 상점아이디
|
||||
$LGD_OID = $_POST["LGD_OID"]; // 주문번호
|
||||
$LGD_AMOUNT = $_POST["LGD_AMOUNT"]; // 거래금액
|
||||
$LGD_TID = $_POST["LGD_TID"]; // LG유플러스에서 부여한 거래번호
|
||||
$LGD_PAYTYPE = $_POST["LGD_PAYTYPE"]; // 결제수단코드
|
||||
$LGD_PAYDATE = $_POST["LGD_PAYDATE"]; // 거래일시(승인일시/이체일시)
|
||||
$LGD_HASHDATA = $_POST["LGD_HASHDATA"]; // 해쉬값
|
||||
$LGD_FINANCECODE = $_POST["LGD_FINANCECODE"]; // 결제기관코드(은행코드)
|
||||
$LGD_FINANCENAME = $_POST["LGD_FINANCENAME"]; // 결제기관이름(은행이름)
|
||||
$LGD_ESCROWYN = $_POST["LGD_ESCROWYN"]; // 에스크로 적용여부
|
||||
$LGD_TIMESTAMP = $_POST["LGD_TIMESTAMP"]; // 타임스탬프
|
||||
$LGD_ACCOUNTNUM = $_POST["LGD_ACCOUNTNUM"]; // 계좌번호(무통장입금)
|
||||
$LGD_CASTAMOUNT = $_POST["LGD_CASTAMOUNT"]; // 입금총액(무통장입금)
|
||||
$LGD_CASCAMOUNT = $_POST["LGD_CASCAMOUNT"]; // 현입금액(무통장입금)
|
||||
$LGD_CASFLAG = $_POST["LGD_CASFLAG"]; // 무통장입금 플래그(무통장입금) - 'R':계좌할당, 'I':입금, 'C':입금취소
|
||||
$LGD_CASSEQNO = $_POST["LGD_CASSEQNO"]; // 입금순서(무통장입금)
|
||||
$LGD_CASHRECEIPTNUM = $_POST["LGD_CASHRECEIPTNUM"]; // 현금영수증 승인번호
|
||||
$LGD_CASHRECEIPTSELFYN = $_POST["LGD_CASHRECEIPTSELFYN"]; // 현금영수증자진발급제유무 Y: 자진발급제 적용, 그외 : 미적용
|
||||
$LGD_CASHRECEIPTKIND = $_POST["LGD_CASHRECEIPTKIND"]; // 현금영수증 종류 0: 소득공제용 , 1: 지출증빙용
|
||||
$LGD_PAYER = $_POST["LGD_PAYER"]; // 입금자명
|
||||
|
||||
/*
|
||||
* 구매정보
|
||||
*/
|
||||
$LGD_BUYER = $_POST["LGD_BUYER"]; // 구매자
|
||||
$LGD_PRODUCTINFO = $_POST["LGD_PRODUCTINFO"]; // 상품명
|
||||
$LGD_BUYERID = $_POST["LGD_BUYERID"]; // 구매자 ID
|
||||
$LGD_BUYERADDRESS = $_POST["LGD_BUYERADDRESS"]; // 구매자 주소
|
||||
$LGD_BUYERPHONE = $_POST["LGD_BUYERPHONE"]; // 구매자 전화번호
|
||||
$LGD_BUYEREMAIL = $_POST["LGD_BUYEREMAIL"]; // 구매자 이메일
|
||||
$LGD_BUYERSSN = $_POST["LGD_BUYERSSN"]; // 구매자 주민번호
|
||||
$LGD_PRODUCTCODE = $_POST["LGD_PRODUCTCODE"]; // 상품코드
|
||||
$LGD_RECEIVER = $_POST["LGD_RECEIVER"]; // 수취인
|
||||
$LGD_RECEIVERPHONE = $_POST["LGD_RECEIVERPHONE"]; // 수취인 전화번호
|
||||
$LGD_DELIVERYINFO = $_POST["LGD_DELIVERYINFO"]; // 배송지
|
||||
|
||||
$LGD_MERTKEY = $default['de_lg_mert_key']; //LG유플러스에서 발급한 상점키로 변경해 주시기 바랍니다.
|
||||
|
||||
$LGD_HASHDATA2 = md5($LGD_MID.$LGD_OID.$LGD_AMOUNT.$LGD_RESPCODE.$LGD_TIMESTAMP.$LGD_MERTKEY);
|
||||
|
||||
/*
|
||||
* 상점 처리결과 리턴메세지
|
||||
*
|
||||
* OK : 상점 처리결과 성공
|
||||
* 그외 : 상점 처리결과 실패
|
||||
*
|
||||
* ※ 주의사항 : 성공시 'OK' 문자이외의 다른문자열이 포함되면 실패처리 되오니 주의하시기 바랍니다.
|
||||
*/
|
||||
$resultMSG = "결제결과 상점 DB처리(LGD_CASNOTEURL) 결과값을 입력해 주시기 바랍니다.";
|
||||
|
||||
|
||||
if ( $LGD_HASHDATA2 == $LGD_HASHDATA ) { //해쉬값 검증이 성공이면
|
||||
if ( "0000" == $LGD_RESPCODE ){ //결제가 성공이면
|
||||
if( "R" == $LGD_CASFLAG ) {
|
||||
/*
|
||||
* 무통장 할당 성공 결과 상점 처리(DB) 부분
|
||||
* 상점 결과 처리가 정상이면 "OK"
|
||||
*/
|
||||
//if( 무통장 할당 성공 상점처리결과 성공 )
|
||||
$resultMSG = "OK";
|
||||
}else if( "I" == $LGD_CASFLAG ) {
|
||||
/*
|
||||
* 무통장 입금 성공 결과 상점 처리(DB) 부분
|
||||
* 상점 결과 처리가 정상이면 "OK"
|
||||
*/
|
||||
|
||||
$sql = " select pp_id, od_id from {$g5['g5_shop_personalpay_table']} where pp_id = '$order_no' and pp_tno = '$LGD_TID' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if($row['pp_id']) {
|
||||
// 개인결제 UPDATE
|
||||
$sql = " update {$g5['g5_shop_personalpay_table']}
|
||||
set pp_receipt_price = '$LGD_AMOUNT',
|
||||
pp_receipt_time = '$LGD_PAYDATE'
|
||||
where pp_id = '$order_no'
|
||||
and pp_tno = '$LGD_TID' ";
|
||||
sql_query($sql, false);
|
||||
|
||||
if($row['od_id']) {
|
||||
// 주문서 UPDATE
|
||||
$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", $LGD_PAYDATE);
|
||||
$sql = " update {$g5['g5_shop_order_table']}
|
||||
set od_receipt_price = od_receipt_price + '$LGD_AMOUNT',
|
||||
od_receipt_time = '$LGD_PAYDATE',
|
||||
od_shop_memo = concat(od_shop_memo, \"\\n개인결제 ".$row['pp_id']." 로 결제완료 - ".$receipt_time."\")
|
||||
where od_id = '{$row['od_id']}' ";
|
||||
$result = sql_query($sql, FALSE);
|
||||
}
|
||||
} else {
|
||||
// 주문서 UPDATE
|
||||
$sql = " update {$g5['g5_shop_order_table']}
|
||||
set od_receipt_price = '$LGD_AMOUNT',
|
||||
od_receipt_time = '$LGD_PAYDATE'
|
||||
where od_id = '$LGD_OID'
|
||||
and od_tno = '$LGD_TID' ";
|
||||
$result = sql_query($sql, FALSE);
|
||||
}
|
||||
|
||||
if($result) {
|
||||
if($row['od_id'])
|
||||
$od_id = $row['od_id'];
|
||||
else
|
||||
$od_id = $order_no;
|
||||
|
||||
// 미수금 정보 업데이트
|
||||
$info = get_order_info($od_id);
|
||||
|
||||
$sql = " update {$g5['g5_shop_order_table']}
|
||||
set od_misu = '{$info['od_misu']}' ";
|
||||
if($info['od_misu'] == 0)
|
||||
$sql .= " , od_status = '입금' ";
|
||||
$sql .= " where od_id = '$od_id' ";
|
||||
$result = sql_query($sql, FALSE);
|
||||
|
||||
// 장바구니 상태변경
|
||||
if($info['od_misu'] == 0) {
|
||||
$sql = " update {$g5['g5_shop_cart_table']}
|
||||
set ct_status = '입금'
|
||||
where od_id = '$od_id' ";
|
||||
sql_query($sql, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
//if( 무통장 입금 성공 상점처리결과 성공 )
|
||||
if ($result)
|
||||
$resultMSG = "OK";
|
||||
else
|
||||
$resultMSG = "DB Error";
|
||||
}else if( "C" == $LGD_CASFLAG ) {
|
||||
/*
|
||||
* 무통장 입금취소 성공 결과 상점 처리(DB) 부분
|
||||
* 상점 결과 처리가 정상이면 "OK"
|
||||
*/
|
||||
//if( 무통장 입금취소 성공 상점처리결과 성공 )
|
||||
$resultMSG = "OK";
|
||||
}
|
||||
} else { //결제가 실패이면
|
||||
/*
|
||||
* 거래실패 결과 상점 처리(DB) 부분
|
||||
* 상점결과 처리가 정상이면 "OK"
|
||||
*/
|
||||
//if( 결제실패 상점처리결과 성공 )
|
||||
$resultMSG = "OK";
|
||||
}
|
||||
} else { //해쉬값이 검증이 실패이면
|
||||
/*
|
||||
* hashdata검증 실패 로그를 처리하시기 바랍니다.
|
||||
*/
|
||||
$resultMSG = "결제결과 상점 DB처리(LGD_CASNOTEURL) 해쉬값 검증이 실패하였습니다.";
|
||||
}
|
||||
|
||||
echo $resultMSG;
|
||||
?>
|
||||
Reference in New Issue
Block a user