Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e45bd1d9e1 | ||
|
|
acdbcfd8ba |
@@ -3,6 +3,8 @@ if (!defined('G5_USE_SHOP') || !G5_USE_SHOP) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $default;
|
||||
|
||||
$menu['menu400'] = array(
|
||||
array('400000', '쇼핑몰관리', G5_ADMIN_URL . '/shop_admin/', 'shop_config'),
|
||||
array('400010', '쇼핑몰현황', G5_ADMIN_URL . '/shop_admin/', 'shop_index'),
|
||||
@@ -21,3 +23,8 @@ $menu['menu400'] = array(
|
||||
array('400750', '추가배송비관리', G5_ADMIN_URL . '/shop_admin/sendcostlist.php', 'scf_sendcost', 1),
|
||||
array('400410', '미완료주문', G5_ADMIN_URL . '/shop_admin/inorderlist.php', 'scf_inorder', 1),
|
||||
);
|
||||
|
||||
// 결제방식이 KG이니시스이고 INIpay PRO를 사용할 때만 노출한다.
|
||||
if (isset($default['de_pg_service']) && $default['de_pg_service'] === 'inicis' && !empty($default['de_inicis_pro_use'])) {
|
||||
$menu['menu400'][] = array('400420', 'KG이니시스 PRO 현황', G5_ADMIN_URL . '/shop_admin/inicisloglist.php', 'scf_inicis_log');
|
||||
}
|
||||
|
||||
+258
-1
@@ -374,6 +374,263 @@ if (!sql_query(" DESC `{$g5['member_auto_login_table']}` ", false)) {
|
||||
$is_check = true;
|
||||
}
|
||||
|
||||
// KG이니시스 결제 처리 현황 및 단계별 이력 테이블
|
||||
if (defined('G5_USE_SHOP') && G5_USE_SHOP) {
|
||||
$inicis_pro_config_columns = array(
|
||||
'de_inicis_pro_alert_use' => "ADD COLUMN `de_inicis_pro_alert_use` tinyint(4) NOT NULL DEFAULT '1'",
|
||||
'de_inicis_pro_reconcile_use' => "ADD COLUMN `de_inicis_pro_reconcile_use` tinyint(4) NOT NULL DEFAULT '0'",
|
||||
'de_inicis_pro_log_days' => "ADD COLUMN `de_inicis_pro_log_days` int(11) NOT NULL DEFAULT '365'",
|
||||
'de_inicis_pro_summary_days' => "ADD COLUMN `de_inicis_pro_summary_days` int(11) NOT NULL DEFAULT '1825'",
|
||||
'de_inicis_pro_monitor_at' => "ADD COLUMN `de_inicis_pro_monitor_at` datetime DEFAULT NULL",
|
||||
'de_inicis_pro_monitor_message' => "ADD COLUMN `de_inicis_pro_monitor_message` varchar(255) NOT NULL DEFAULT ''"
|
||||
);
|
||||
$inicis_pro_config_alter = array();
|
||||
foreach ($inicis_pro_config_columns as $column => $alter) {
|
||||
$column_result = sql_query(" SHOW COLUMNS FROM `{$g5['g5_shop_default_table']}` LIKE '$column' ", false);
|
||||
if (!$column_result || sql_num_rows($column_result) === 0)
|
||||
$inicis_pro_config_alter[] = $alter;
|
||||
}
|
||||
if (count($inicis_pro_config_alter)) {
|
||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}` ".implode(', ', $inicis_pro_config_alter), true);
|
||||
$is_check = true;
|
||||
}
|
||||
|
||||
if (!isset($g5['g5_shop_inicis_pay_table']))
|
||||
$g5['g5_shop_inicis_pay_table'] = G5_SHOP_TABLE_PREFIX.'inicis_pay';
|
||||
if (!isset($g5['g5_shop_inicis_pay_event_table']))
|
||||
$g5['g5_shop_inicis_pay_event_table'] = G5_SHOP_TABLE_PREFIX.'inicis_pay_event';
|
||||
|
||||
if (!sql_query(" DESC `{$g5['g5_shop_inicis_pay_table']}` ", false)) {
|
||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_inicis_pay_table']}` (
|
||||
`ip_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ip_oid` varchar(64) NOT NULL DEFAULT '',
|
||||
`ip_tid` varchar(80) NOT NULL DEFAULT '',
|
||||
`ip_auth_tid` varchar(80) NOT NULL DEFAULT '',
|
||||
`ip_mid` varchar(80) NOT NULL DEFAULT '',
|
||||
`ip_environment` varchar(10) NOT NULL DEFAULT '',
|
||||
`mb_id` varchar(20) NOT NULL DEFAULT '',
|
||||
`ip_amount` int(11) NOT NULL DEFAULT '0',
|
||||
`ip_pay_type` varchar(20) NOT NULL DEFAULT '',
|
||||
`ip_easy_pay` varchar(20) NOT NULL DEFAULT '',
|
||||
`ip_device` varchar(10) NOT NULL DEFAULT '',
|
||||
`ip_order_type` varchar(10) NOT NULL DEFAULT '',
|
||||
`ip_status` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_result_code` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_result_message` varchar(255) NOT NULL DEFAULT '',
|
||||
`ip_noti_status` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_noti_code` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_noti_message` varchar(255) NOT NULL DEFAULT '',
|
||||
`ip_noti_failed_count` int(11) NOT NULL DEFAULT '0',
|
||||
`ip_noti_at` datetime DEFAULT NULL,
|
||||
`ip_cancel_status` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_cancel_code` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_cancel_message` varchar(255) NOT NULL DEFAULT '',
|
||||
`ip_cancel_checked_at` datetime DEFAULT NULL,
|
||||
`ip_refund_required` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`ip_vbank_due_at` datetime DEFAULT NULL,
|
||||
`ip_expired_at` datetime DEFAULT NULL,
|
||||
`ip_order_exists` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`ip_approved_at` datetime DEFAULT NULL,
|
||||
`ip_ordered_at` datetime DEFAULT NULL,
|
||||
`ip_notified_at` datetime DEFAULT NULL,
|
||||
`ip_canceled_at` datetime DEFAULT NULL,
|
||||
`ip_created_at` datetime DEFAULT NULL,
|
||||
`ip_updated_at` datetime DEFAULT NULL,
|
||||
`ip_ip` varchar(45) NOT NULL DEFAULT '',
|
||||
`ip_event_count` int(11) NOT NULL DEFAULT '0',
|
||||
`ip_audit_error` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`ip_alerted_at` datetime DEFAULT NULL,
|
||||
`ip_alert_key` varchar(64) NOT NULL DEFAULT '',
|
||||
`ip_pg_status` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_pg_amount` int(11) NOT NULL DEFAULT '0',
|
||||
`ip_pg_tid` varchar(80) NOT NULL DEFAULT '',
|
||||
`ip_pg_result_code` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_pg_message` varchar(255) NOT NULL DEFAULT '',
|
||||
`ip_pg_checked_at` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`ip_id`),
|
||||
UNIQUE KEY `ip_oid` (`ip_oid`),
|
||||
KEY `ip_tid` (`ip_tid`),
|
||||
KEY `ip_auth_tid` (`ip_auth_tid`),
|
||||
KEY `ip_status` (`ip_status`),
|
||||
KEY `ip_noti_status` (`ip_noti_status`),
|
||||
KEY `ip_cancel_status` (`ip_cancel_status`),
|
||||
KEY `ip_refund_required` (`ip_refund_required`),
|
||||
KEY `ip_updated_at` (`ip_updated_at`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
|
||||
$is_check = true;
|
||||
}
|
||||
|
||||
if (sql_query(" DESC `{$g5['g5_shop_inicis_pay_table']}` ", false)) {
|
||||
$inicis_pay_columns = array(
|
||||
'ip_environment' => "ADD COLUMN `ip_environment` varchar(10) NOT NULL DEFAULT '' AFTER `ip_mid`",
|
||||
'ip_easy_pay' => "ADD COLUMN `ip_easy_pay` varchar(20) NOT NULL DEFAULT '' AFTER `ip_pay_type`",
|
||||
'ip_noti_status' => "ADD COLUMN `ip_noti_status` varchar(30) NOT NULL DEFAULT '' AFTER `ip_result_message`",
|
||||
'ip_noti_code' => "ADD COLUMN `ip_noti_code` varchar(30) NOT NULL DEFAULT '' AFTER `ip_noti_status`",
|
||||
'ip_noti_message' => "ADD COLUMN `ip_noti_message` varchar(255) NOT NULL DEFAULT '' AFTER `ip_noti_code`",
|
||||
'ip_noti_failed_count' => "ADD COLUMN `ip_noti_failed_count` int(11) NOT NULL DEFAULT '0' AFTER `ip_noti_message`",
|
||||
'ip_noti_at' => "ADD COLUMN `ip_noti_at` datetime DEFAULT NULL AFTER `ip_noti_failed_count`",
|
||||
'ip_cancel_status' => "ADD COLUMN `ip_cancel_status` varchar(30) NOT NULL DEFAULT '' AFTER `ip_noti_at`",
|
||||
'ip_cancel_code' => "ADD COLUMN `ip_cancel_code` varchar(30) NOT NULL DEFAULT '' AFTER `ip_cancel_status`",
|
||||
'ip_cancel_message' => "ADD COLUMN `ip_cancel_message` varchar(255) NOT NULL DEFAULT '' AFTER `ip_cancel_code`",
|
||||
'ip_cancel_checked_at' => "ADD COLUMN `ip_cancel_checked_at` datetime DEFAULT NULL AFTER `ip_cancel_message`",
|
||||
'ip_refund_required' => "ADD COLUMN `ip_refund_required` tinyint(4) NOT NULL DEFAULT '0' AFTER `ip_cancel_checked_at`",
|
||||
'ip_vbank_due_at' => "ADD COLUMN `ip_vbank_due_at` datetime DEFAULT NULL AFTER `ip_refund_required`",
|
||||
'ip_expired_at' => "ADD COLUMN `ip_expired_at` datetime DEFAULT NULL AFTER `ip_vbank_due_at`",
|
||||
'ip_audit_error' => "ADD COLUMN `ip_audit_error` tinyint(4) NOT NULL DEFAULT '0'",
|
||||
'ip_alerted_at' => "ADD COLUMN `ip_alerted_at` datetime DEFAULT NULL",
|
||||
'ip_alert_key' => "ADD COLUMN `ip_alert_key` varchar(64) NOT NULL DEFAULT ''",
|
||||
'ip_pg_status' => "ADD COLUMN `ip_pg_status` varchar(30) NOT NULL DEFAULT ''",
|
||||
'ip_pg_amount' => "ADD COLUMN `ip_pg_amount` int(11) NOT NULL DEFAULT '0'",
|
||||
'ip_pg_tid' => "ADD COLUMN `ip_pg_tid` varchar(80) NOT NULL DEFAULT ''",
|
||||
'ip_pg_result_code' => "ADD COLUMN `ip_pg_result_code` varchar(30) NOT NULL DEFAULT ''",
|
||||
'ip_pg_message' => "ADD COLUMN `ip_pg_message` varchar(255) NOT NULL DEFAULT ''",
|
||||
'ip_pg_checked_at' => "ADD COLUMN `ip_pg_checked_at` datetime DEFAULT NULL"
|
||||
);
|
||||
$inicis_pay_alter = array();
|
||||
foreach ($inicis_pay_columns as $column => $alter) {
|
||||
$column_result = sql_query(" SHOW COLUMNS FROM `{$g5['g5_shop_inicis_pay_table']}` LIKE '$column' ", false);
|
||||
if (!$column_result || sql_num_rows($column_result) === 0)
|
||||
$inicis_pay_alter[] = $alter;
|
||||
}
|
||||
if (count($inicis_pay_alter)) {
|
||||
sql_query(" ALTER TABLE `{$g5['g5_shop_inicis_pay_table']}` ".implode(', ', $inicis_pay_alter), true);
|
||||
$is_check = true;
|
||||
}
|
||||
|
||||
if (count($inicis_pay_alter)) {
|
||||
$environment = !empty($default['de_card_test']) ? 'test' : 'live';
|
||||
sql_query(" insert ignore into `{$g5['g5_shop_inicis_pay_table']}`
|
||||
(ip_oid, ip_environment, ip_status, ip_noti_status, ip_noti_code, ip_noti_message,
|
||||
ip_noti_failed_count, ip_noti_at, ip_created_at, ip_updated_at, ip_event_count)
|
||||
select e.ip_oid, '$environment', e.pe_status, e.pe_status, e.pe_code, e.pe_message,
|
||||
sum(if(e.pe_status = 'notification_failed', 1, 0)), max(e.pe_created_at),
|
||||
min(e.pe_created_at), max(e.pe_created_at), count(*)
|
||||
from `{$g5['g5_shop_inicis_pay_event_table']}` e
|
||||
left join `{$g5['g5_shop_inicis_pay_table']}` p on p.ip_oid = e.ip_oid
|
||||
where p.ip_id is null
|
||||
and e.pe_stage = 'notification'
|
||||
group by e.ip_oid ", false);
|
||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}`
|
||||
set ip_environment = case
|
||||
when lower(ip_mid) in ('inipaytest','iniescrow0') then 'test'
|
||||
when ip_mid <> '' then 'live'
|
||||
else '$environment'
|
||||
end
|
||||
where ip_environment = '' ", false);
|
||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}` p
|
||||
inner join (
|
||||
select ip_oid, max(pe_id) as pe_id,
|
||||
sum(if(pe_status = 'notification_failed', 1, 0)) as fail_count
|
||||
from `{$g5['g5_shop_inicis_pay_event_table']}`
|
||||
where pe_stage = 'notification'
|
||||
group by ip_oid
|
||||
) x on x.ip_oid = p.ip_oid
|
||||
inner join `{$g5['g5_shop_inicis_pay_event_table']}` e on e.pe_id = x.pe_id
|
||||
set p.ip_noti_status = e.pe_status,
|
||||
p.ip_noti_code = e.pe_code,
|
||||
p.ip_noti_message = e.pe_message,
|
||||
p.ip_noti_failed_count = x.fail_count,
|
||||
p.ip_noti_at = e.pe_created_at ", false);
|
||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}` p
|
||||
inner join (
|
||||
select ip_oid, max(pe_id) as pe_id
|
||||
from `{$g5['g5_shop_inicis_pay_event_table']}`
|
||||
where pe_stage = 'cancel'
|
||||
group by ip_oid
|
||||
) x on x.ip_oid = p.ip_oid
|
||||
inner join `{$g5['g5_shop_inicis_pay_event_table']}` e on e.pe_id = x.pe_id
|
||||
set p.ip_cancel_status = e.pe_status,
|
||||
p.ip_cancel_code = e.pe_code,
|
||||
p.ip_cancel_message = e.pe_message,
|
||||
p.ip_cancel_checked_at = e.pe_created_at ", false);
|
||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}` p
|
||||
inner join `{$g5['g5_shop_inicis_pay_event_table']}` e on e.ip_oid = p.ip_oid and e.pe_stage = 'request'
|
||||
set p.ip_easy_pay = case
|
||||
when e.pe_message like '삼성페이%' then 'SAMSUNGPAY'
|
||||
when e.pe_message like 'lpay%' then 'LPAY'
|
||||
when e.pe_message like 'inicis_kakaopay%' then 'KAKAOPAY'
|
||||
when e.pe_message like '간편결제%' then 'EASYPAY'
|
||||
else p.ip_easy_pay
|
||||
end
|
||||
where p.ip_easy_pay = '' ", false);
|
||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}`
|
||||
set ip_noti_status = case
|
||||
when ip_status = 'paid' then 'paid'
|
||||
when ip_status = 'vbank_issued' then 'vbank_issued'
|
||||
when ip_status = 'notification_received' then 'notification_received'
|
||||
else ip_noti_status
|
||||
end,
|
||||
ip_cancel_status = case
|
||||
when ip_status in ('canceled','cancel_failed','partial_canceled','partial_cancel_failed') then ip_status
|
||||
else ip_cancel_status
|
||||
end ", false);
|
||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}` p
|
||||
inner join {$g5['g5_shop_order_table']} o on o.od_id = p.ip_oid
|
||||
set p.ip_status = 'paid_after_cancel',
|
||||
p.ip_refund_required = '1',
|
||||
p.ip_noti_status = 'paid_after_cancel',
|
||||
p.ip_noti_message = '취소 주문에 가상계좌 입금 확인'
|
||||
where p.ip_pay_type = 'VBANK'
|
||||
and p.ip_status = 'paid'
|
||||
and o.od_status = '취소'
|
||||
and o.od_receipt_price > 0 ", false);
|
||||
$inicis_pro_migrated_at = G5_TIME_YMDHIS;
|
||||
$inicis_pro_migrated_message = '기존 결제·주문 이력 대조에서 취소 후 입금 확인';
|
||||
sql_query(" insert into `{$g5['g5_shop_inicis_pay_event_table']}`
|
||||
(ip_oid, ip_tid, pe_stage, pe_status, pe_code, pe_message, pe_source, pe_ip, pe_created_at)
|
||||
select p.ip_oid, p.ip_tid, 'reconcile', 'paid_after_cancel', '',
|
||||
'".sql_escape_string($inicis_pro_migrated_message)."', 'system', '', '$inicis_pro_migrated_at'
|
||||
from `{$g5['g5_shop_inicis_pay_table']}` p
|
||||
left join `{$g5['g5_shop_inicis_pay_event_table']}` e
|
||||
on e.ip_oid = p.ip_oid and e.pe_status = 'paid_after_cancel'
|
||||
where p.ip_status = 'paid_after_cancel'
|
||||
and p.ip_refund_required = '1'
|
||||
and e.pe_id is null ", false);
|
||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}` p
|
||||
inner join `{$g5['g5_shop_inicis_pay_event_table']}` e
|
||||
on e.ip_oid = p.ip_oid
|
||||
and e.pe_status = 'paid_after_cancel'
|
||||
and e.pe_message = '".sql_escape_string($inicis_pro_migrated_message)."'
|
||||
and e.pe_created_at = '$inicis_pro_migrated_at'
|
||||
set p.ip_event_count = p.ip_event_count + 1 ", false);
|
||||
}
|
||||
|
||||
$inicis_pay_indexes = array(
|
||||
'ip_noti_status' => "ADD KEY `ip_noti_status` (`ip_noti_status`)",
|
||||
'ip_cancel_status' => "ADD KEY `ip_cancel_status` (`ip_cancel_status`)",
|
||||
'ip_refund_required' => "ADD KEY `ip_refund_required` (`ip_refund_required`)"
|
||||
);
|
||||
foreach ($inicis_pay_indexes as $index_name => $index_sql) {
|
||||
$index_result = sql_query(" SHOW INDEX FROM `{$g5['g5_shop_inicis_pay_table']}` WHERE Key_name = '$index_name' ", false);
|
||||
if (!$index_result || sql_num_rows($index_result) === 0) {
|
||||
sql_query(" ALTER TABLE `{$g5['g5_shop_inicis_pay_table']}` $index_sql ", true);
|
||||
$is_check = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!sql_query(" DESC `{$g5['g5_shop_inicis_pay_event_table']}` ", false)) {
|
||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_inicis_pay_event_table']}` (
|
||||
`pe_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ip_oid` varchar(64) NOT NULL DEFAULT '',
|
||||
`ip_tid` varchar(80) NOT NULL DEFAULT '',
|
||||
`pe_stage` varchar(30) NOT NULL DEFAULT '',
|
||||
`pe_status` varchar(30) NOT NULL DEFAULT '',
|
||||
`pe_code` varchar(30) NOT NULL DEFAULT '',
|
||||
`pe_message` varchar(255) NOT NULL DEFAULT '',
|
||||
`pe_source` varchar(10) NOT NULL DEFAULT '',
|
||||
`pe_ip` varchar(45) NOT NULL DEFAULT '',
|
||||
`pe_created_at` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`pe_id`),
|
||||
KEY `ip_oid` (`ip_oid`),
|
||||
KEY `ip_tid` (`ip_tid`),
|
||||
KEY `pe_status` (`pe_status`),
|
||||
KEY `pe_created_at` (`pe_created_at`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
|
||||
$is_check = true;
|
||||
}
|
||||
}
|
||||
|
||||
$is_check = run_replace('admin_dbupgrade', $is_check);
|
||||
|
||||
$db_upgrade_msg = $is_check ? 'DB 업그레이드가 완료되었습니다.' : '더 이상 업그레이드 할 내용이 없습니다.<br>현재 DB 업그레이드가 완료된 상태입니다.';
|
||||
@@ -386,4 +643,4 @@ $db_upgrade_msg = $is_check ? 'DB 업그레이드가 완료되었습니다.' : '
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once ('./admin.tail.php');
|
||||
include_once ('./admin.tail.php');
|
||||
|
||||
@@ -200,6 +200,7 @@ function pg_setting_check($is_print=false){
|
||||
}
|
||||
|
||||
function is_cancel_shop_pg_order($od){
|
||||
global $default;
|
||||
|
||||
$is_od_pg_cancel = false;
|
||||
|
||||
@@ -215,9 +216,201 @@ function is_cancel_shop_pg_order($od){
|
||||
$is_od_pg_cancel = true;
|
||||
}
|
||||
|
||||
if ($od['od_pg'] === 'inicis' && !empty($default['de_inicis_pro_use']) && !empty($od['od_tno'])
|
||||
&& in_array($od['od_settle_case'], array('신용카드', '간편결제', '가상계좌', '계좌이체', '휴대폰', '삼성페이', 'lpay', 'inicis_kakaopay'))) {
|
||||
$is_od_pg_cancel = true;
|
||||
}
|
||||
|
||||
return $is_od_pg_cancel;
|
||||
}
|
||||
|
||||
function check_order_inicis_pro_payments($run_external = true){
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
|
||||
// 사이트 이용 흐름에서 실행되는 경량 감시는 잠금 대기 없이 즉시 시도하고,
|
||||
// 획득하지 못하면 다른 요청이 이미 처리 중이므로 그대로 넘어간다.
|
||||
$monitor_lock = inicis_pro_lock('monitor_process', $run_external ? 10 : 0);
|
||||
if ($monitor_lock === '')
|
||||
return false;
|
||||
|
||||
check_order_inicis_pro_payments_run($run_external);
|
||||
inicis_pro_unlock($monitor_lock);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 서버 스케줄러 없이 사이트 접속 흐름에서 실행되는 경량 감시.
|
||||
// 방문자 응답을 먼저 종료해 페이지 지연 없이 뒤에서 처리한다.
|
||||
function check_order_inicis_pro_payments_inline(){
|
||||
global $default;
|
||||
|
||||
if (empty($default['de_pg_service']) || $default['de_pg_service'] !== 'inicis' || empty($default['de_inicis_pro_use']))
|
||||
return;
|
||||
|
||||
if (function_exists('fastcgi_finish_request'))
|
||||
@fastcgi_finish_request();
|
||||
@ignore_user_abort(true);
|
||||
|
||||
check_order_inicis_pro_payments(false);
|
||||
}
|
||||
|
||||
function check_order_inicis_pro_payments_run($run_external = true){
|
||||
global $g5, $config, $default;
|
||||
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
include_once(G5_ADMIN_PATH.'/shop_admin/inicislog.lib.php');
|
||||
|
||||
if (!inicis_pro_audit_schema_ready()) {
|
||||
// 스키마가 준비되지 않았어도 감시 시각을 전진시켜, 사이트 접속 흐름의
|
||||
// 인라인 감시가 매 요청마다 재등록·재실행되는 것을 막는다.
|
||||
if (array_key_exists('de_inicis_pro_monitor_at', $default))
|
||||
sql_query(" update {$g5['g5_shop_default_table']}
|
||||
set de_inicis_pro_monitor_at = '".G5_TIME_YMDHIS."' ", false);
|
||||
return;
|
||||
}
|
||||
|
||||
$log_days = isset($default['de_inicis_pro_log_days']) ? (int) $default['de_inicis_pro_log_days'] : 365;
|
||||
if ($log_days >= 30) {
|
||||
inicis_pro_purge_events($log_days, 500);
|
||||
inicis_pro_purge_payloads($log_days, 200);
|
||||
}
|
||||
$summary_days = isset($default['de_inicis_pro_summary_days']) ? (int) $default['de_inicis_pro_summary_days'] : 1825;
|
||||
if ($summary_days >= 365)
|
||||
inicis_pro_purge_summaries($summary_days, 50);
|
||||
|
||||
$tables = inicis_pro_audit_tables();
|
||||
$expired_count = 0;
|
||||
$expired_result = sql_query(" select ip_oid from `{$tables['summary']}`
|
||||
where ip_status = 'request_ready'
|
||||
and ip_updated_at < date_sub(now(), interval 30 minute)
|
||||
order by ip_updated_at asc
|
||||
limit 50 ", false);
|
||||
if ($expired_result) {
|
||||
while ($expired = sql_fetch_array($expired_result)) {
|
||||
if (inicis_pro_audit_write($expired['ip_oid'], 'request', 'request_expired', array(
|
||||
'source' => 'system',
|
||||
'message' => '결제창 요청 후 인증결과가 없어 미진행으로 정리'
|
||||
)))
|
||||
$expired_count++;
|
||||
}
|
||||
}
|
||||
|
||||
$order_amount_sql = "(o.od_cart_price + o.od_send_cost + o.od_send_cost2 - o.od_cart_coupon - o.od_coupon - o.od_send_coupon - o.od_receipt_point)";
|
||||
$anomaly_sql = inicis_admin_anomaly_sql();
|
||||
$sql_from = " from `{$tables['summary']}` p
|
||||
left join {$g5['g5_shop_order_table']} o on p.ip_order_type <> 'personal' and o.od_id = p.ip_oid
|
||||
left join {$g5['g5_shop_personalpay_table']} pp on p.ip_order_type = 'personal' and pp.pp_id = p.ip_oid ";
|
||||
$sql_fields = " select p.*,
|
||||
o.od_id as order_oid, o.od_tno as order_tid, o.od_status as order_status,
|
||||
o.od_receipt_price as order_receipt_price, o.od_misu as order_misu, o.od_cancel_price as order_cancel_price,
|
||||
o.od_settle_case as order_settle_case, $order_amount_sql as order_amount,
|
||||
pp.pp_id as personal_oid, pp.pp_tno as personal_tid, pp.pp_price as personal_amount, pp.pp_receipt_price as personal_receipt_price ";
|
||||
|
||||
$recover_result = sql_query(" select ip_oid from `{$tables['summary']}`
|
||||
where ip_tid = ''
|
||||
and ip_status in ('authentication_received','approval_started','validation_failed','order_saving')
|
||||
and ip_updated_at < date_sub(now(), interval 3 minute)
|
||||
order by ip_updated_at asc
|
||||
limit 5 ", false);
|
||||
if ($recover_result) {
|
||||
while ($recover_row = sql_fetch_array($recover_result))
|
||||
inicis_pro_recover_approved_tid($recover_row['ip_oid'], 'system');
|
||||
}
|
||||
|
||||
$reconcile_count = 0;
|
||||
$reconcile_failed_count = 0;
|
||||
if ($run_external && empty($default['de_card_test']) && !empty($default['de_inicis_pro_reconcile_use']) && inicis_pro_get_iniapi_key() !== '') {
|
||||
$result = sql_query(" $sql_fields $sql_from
|
||||
where p.ip_tid <> ''
|
||||
and p.ip_updated_at < date_sub(now(), interval 3 minute)
|
||||
and (p.ip_pg_checked_at is null or p.ip_pg_checked_at < date_sub(now(), interval 1 hour))
|
||||
and (p.ip_refund_required = '1'
|
||||
or $anomaly_sql
|
||||
or (p.ip_updated_at > date_sub(now(), interval 7 day)
|
||||
and (p.ip_status in ('order_saved','paid','paid_after_cancel','vbank_issued','canceled','refund_completed')
|
||||
or p.ip_cancel_status <> '')))
|
||||
order by p.ip_refund_required desc, p.ip_updated_at asc
|
||||
limit 10 ", false);
|
||||
if ($result) {
|
||||
while ($row = sql_fetch_array($result)) {
|
||||
$inquiry = inicis_pro_inquiry($row['ip_tid'], $row['ip_oid'], $row);
|
||||
if (inicis_pro_save_inquiry($row['ip_oid'], $inquiry, 'system') && !empty($inquiry['success']))
|
||||
$reconcile_count++;
|
||||
else
|
||||
$reconcile_failed_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$anomaly_count_row = sql_fetch(" select count(*) as cnt $sql_from where $anomaly_sql ");
|
||||
$anomaly_count = isset($anomaly_count_row['cnt']) ? (int) $anomaly_count_row['cnt'] : 0;
|
||||
if ($run_external)
|
||||
$monitor_message = '미진행 '.$expired_count.'건 정리 / KG 대사 성공 '.$reconcile_count.'건, 실패 '.$reconcile_failed_count.'건 / 확인 필요 '.$anomaly_count.'건';
|
||||
else
|
||||
$monitor_message = '미진행 '.$expired_count.'건 정리 / 확인 필요 '.$anomaly_count.'건';
|
||||
if (array_key_exists('de_inicis_pro_monitor_at', $default)) {
|
||||
$monitor_set = "de_inicis_pro_monitor_at = '".G5_TIME_YMDHIS."'";
|
||||
if (isset($default['de_inicis_pro_monitor_message']))
|
||||
$monitor_set .= ", de_inicis_pro_monitor_message = '".sql_escape_string($monitor_message)."'";
|
||||
sql_query(" update {$g5['g5_shop_default_table']} set $monitor_set ", false);
|
||||
}
|
||||
|
||||
// 테스트 거래는 상세 화면에서 직접 조회하며 운영 메일에는 포함하지 않는다.
|
||||
if (!empty($default['de_card_test']))
|
||||
return;
|
||||
|
||||
if (empty($default['de_inicis_pro_alert_use']) || empty($config['cf_email_use']) || empty($config['cf_admin_email']))
|
||||
return;
|
||||
|
||||
$result = sql_query(" $sql_fields $sql_from
|
||||
where $anomaly_sql
|
||||
order by p.ip_updated_at asc
|
||||
limit 20 ", false);
|
||||
if (!$result)
|
||||
return;
|
||||
|
||||
$alert_rows = array();
|
||||
$mail_msg = '';
|
||||
while ($row = sql_fetch_array($result)) {
|
||||
if (!inicis_admin_is_anomaly($row))
|
||||
continue;
|
||||
|
||||
$alert_key = inicis_admin_alert_key($row);
|
||||
if (!empty($row['ip_alert_key']) && $row['ip_alert_key'] === $alert_key)
|
||||
continue;
|
||||
|
||||
$pg_state = !empty($row['ip_pg_checked_at'])
|
||||
? ($row['ip_pg_result_code'] === '00' ? inicis_admin_pg_status_label($row['ip_pg_status']) : '거래조회 실패')
|
||||
: '미조회';
|
||||
$mail_msg .= '<tr>'
|
||||
.'<td style="padding:6px;border:1px solid #ddd"><a href="'.G5_ADMIN_URL.'/shop_admin/inicislogview.php?oid='.urlencode($row['ip_oid']).'">'.get_text($row['ip_oid']).'</a></td>'
|
||||
.'<td style="padding:6px;border:1px solid #ddd">'.get_text(inicis_admin_status_label(inicis_admin_primary_status($row))).'</td>'
|
||||
.'<td style="padding:6px;border:1px solid #ddd">'.get_text($pg_state).'</td>'
|
||||
.'<td style="padding:6px;border:1px solid #ddd;text-align:right">'.number_format((int) $row['ip_amount']).'원</td>'
|
||||
.'</tr>';
|
||||
$alert_rows[] = array('oid' => $row['ip_oid'], 'key' => $alert_key);
|
||||
}
|
||||
|
||||
if (!count($alert_rows))
|
||||
return;
|
||||
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
$content = '<p>KG이니시스 결제와 영카트 주문을 대조해야 하는 거래가 확인됐습니다.</p>'
|
||||
.'<p>자동으로 주문을 생성하거나 결제를 취소하지 않았습니다. KG이니시스 거래조회 결과와 상점관리자 거래내역을 확인한 후 조치해 주십시오.</p>'
|
||||
.'<table style="border-collapse:collapse"><thead><tr><th style="padding:6px;border:1px solid #ddd">주문번호</th><th style="padding:6px;border:1px solid #ddd">로컬 상태</th><th style="padding:6px;border:1px solid #ddd">KG 상태</th><th style="padding:6px;border:1px solid #ddd">금액</th></tr></thead><tbody>'
|
||||
.$mail_msg.'</tbody></table>';
|
||||
$sent = mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $config['cf_admin_email'], '['.$config['cf_title'].'] KG이니시스 결제 확인 필요', $content, 1);
|
||||
if (!$sent)
|
||||
return;
|
||||
|
||||
foreach ($alert_rows as $alert_row) {
|
||||
sql_query(" update `{$tables['summary']}`
|
||||
set ip_alerted_at = '".G5_TIME_YMDHIS."',
|
||||
ip_alert_key = '".sql_escape_string($alert_row['key'])."'
|
||||
where ip_oid = '".sql_escape_string($alert_row['oid'])."' ", false);
|
||||
}
|
||||
}
|
||||
|
||||
function check_order_inicis_tmps(){
|
||||
global $g5, $config, $default, $member;
|
||||
|
||||
@@ -225,7 +418,9 @@ function check_order_inicis_tmps(){
|
||||
|
||||
if( ! $admin_cookie_time ){
|
||||
|
||||
if( $default['de_pg_service'] === 'inicis' && empty($default['de_card_test']) ){
|
||||
if ($default['de_pg_service'] === 'inicis' && !empty($default['de_inicis_pro_use'])) {
|
||||
check_order_inicis_pro_payments();
|
||||
} elseif( $default['de_pg_service'] === 'inicis' && empty($default['de_card_test']) ){
|
||||
$sql = " select * from {$g5['g5_shop_inicis_log_table']} where P_TID <> '' and P_TYPE in ('CARD', 'ISP', 'BANK') and P_MID <> '' and P_STATUS = '00' and is_mail_send = 0 and substr(P_AUTH_DT, 1, 14) < '".date('YmdHis', strtotime('-3 minutes', G5_SERVER_TIME))."' ";
|
||||
|
||||
$result = sql_query($sql, false);
|
||||
@@ -240,7 +435,7 @@ function check_order_inicis_tmps(){
|
||||
|
||||
$oid = $row['oid'];
|
||||
$p_tid = $row['P_TID'];
|
||||
$p_mid = strtolower($tmps['P_MID']);
|
||||
$p_mid = strtolower($row['P_MID']);
|
||||
|
||||
if( in_array($p_mid, array('iniescrow0', 'inipaytest')) ) continue;
|
||||
|
||||
|
||||
@@ -207,6 +207,44 @@ if( ! isset($default['de_inicis_iniapi_key']) ){
|
||||
sql_query($sql, false);
|
||||
}
|
||||
|
||||
// KG이니시스 INIpay PRO 설정 추가
|
||||
if (!isset($default['de_inicis_pro_use'])) {
|
||||
$sql = "ALTER TABLE `{$g5['g5_shop_default_table']}`
|
||||
ADD COLUMN `de_inicis_pro_use` TINYINT(4) NOT NULL DEFAULT '0' AFTER `de_inicis_sign_key`,
|
||||
ADD COLUMN `de_inicis_hash_key` VARCHAR(255) NOT NULL DEFAULT '' AFTER `de_inicis_pro_use`; ";
|
||||
sql_query($sql, false);
|
||||
}
|
||||
|
||||
if (!isset($default['de_inicis_pro_alert_use'])) {
|
||||
sql_query("ALTER TABLE `{$g5['g5_shop_default_table']}` ADD COLUMN `de_inicis_pro_alert_use` TINYINT(4) NOT NULL DEFAULT '1'", false);
|
||||
$default['de_inicis_pro_alert_use'] = 1;
|
||||
}
|
||||
if (!isset($default['de_inicis_pro_reconcile_use'])) {
|
||||
sql_query("ALTER TABLE `{$g5['g5_shop_default_table']}` ADD COLUMN `de_inicis_pro_reconcile_use` TINYINT(4) NOT NULL DEFAULT '0'", false);
|
||||
$default['de_inicis_pro_reconcile_use'] = 0;
|
||||
}
|
||||
if (!isset($default['de_inicis_pro_log_days'])) {
|
||||
sql_query("ALTER TABLE `{$g5['g5_shop_default_table']}` ADD COLUMN `de_inicis_pro_log_days` INT(11) NOT NULL DEFAULT '365'", false);
|
||||
$default['de_inicis_pro_log_days'] = 365;
|
||||
}
|
||||
if (!isset($default['de_inicis_pro_summary_days'])) {
|
||||
sql_query("ALTER TABLE `{$g5['g5_shop_default_table']}` ADD COLUMN `de_inicis_pro_summary_days` INT(11) NOT NULL DEFAULT '1825'", false);
|
||||
$default['de_inicis_pro_summary_days'] = 1825;
|
||||
}
|
||||
if (!array_key_exists('de_inicis_pro_monitor_at', $default)) {
|
||||
sql_query("ALTER TABLE `{$g5['g5_shop_default_table']}` ADD COLUMN `de_inicis_pro_monitor_at` DATETIME DEFAULT NULL", false);
|
||||
$default['de_inicis_pro_monitor_at'] = '';
|
||||
}
|
||||
if (!isset($default['de_inicis_pro_monitor_message'])) {
|
||||
sql_query("ALTER TABLE `{$g5['g5_shop_default_table']}` ADD COLUMN `de_inicis_pro_monitor_message` VARCHAR(255) NOT NULL DEFAULT ''", false);
|
||||
$default['de_inicis_pro_monitor_message'] = '';
|
||||
}
|
||||
|
||||
// KG이니시스 INIpay PRO 결제 감사 테이블이 없으면 생성한다.
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
if (function_exists('inicis_pro_audit_ensure_tables'))
|
||||
inicis_pro_audit_ensure_tables();
|
||||
|
||||
// NICEPAY mid, key 추가
|
||||
if (! isset($default['de_nicepay_mid'])) {
|
||||
$sql = "ALTER TABLE `{$g5['g5_shop_default_table']}`
|
||||
@@ -879,34 +917,73 @@ if(!$default['de_kakaopay_cancelpwd']){
|
||||
<span class="sitecode">SIR</span> <input type="text" name="de_inicis_mid" value="<?php echo $default['de_inicis_mid']; ?>" id="de_inicis_mid" class="frm_input code_input" size="10" maxlength="10"> 영문소문자(숫자포함 가능)
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pg_info_fld inicis_info_fld">
|
||||
<th scope="row"><label for="de_inicis_pro_use">KG이니시스 INIpay PRO</label></th>
|
||||
<td>
|
||||
<?php echo help("체크시 PC와 모바일에서 가장 최신 결제모듈인 KG이니시스 INIpay PRO 통합 결제창을 사용합니다. 실결제시 반드시 필수로 KG이니시스 모바일 금액위변조 Hash Key 를 입력해야 합니다."); ?>
|
||||
<input type="checkbox" name="de_inicis_pro_use" value="1" id="de_inicis_pro_use"<?php echo !empty($default['de_inicis_pro_use']) ? ' checked' : ''; ?>> <label for="de_inicis_pro_use">사용</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pg_info_fld inicis_info_fld">
|
||||
<th scope="row"><label for="de_inicis_sign_key">KG이니시스 웹결제 사인키</label></th>
|
||||
<td>
|
||||
<?php echo help("KG이니시스에서 발급받은 웹결제 사인키를 입력합니다.\n<a href='https://iniweb.inicis.com/' target='_blank'>KG이니시스 가맹점관리자</a> > 상점정보 > 계약정보 > 부가정보의 웹결제 signkey생성 조회 버튼 클릭, 팝업창에서 생성 버튼 클릭 후 해당 값을 입력합니다."); ?>
|
||||
<?php echo help("KG이니시스에서 발급받은 웹결제 사인키를 입력합니다.\n<a href='https://iniweb.inicis.com/' target='_blank'>KG이니시스 가맹점관리자</a> > 상점정보 > 계약정보 > KEY 정보의 웹결제 signkey생성 조회 버튼 클릭, 팝업창에서 생성 버튼 클릭 후 해당 값을 입력합니다."); ?>
|
||||
<input type="text" name="de_inicis_sign_key" value="<?php echo get_sanitize_input($default['de_inicis_sign_key']); ?>" id="de_inicis_sign_key" class="frm_input" size="40" maxlength="50">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pg_info_fld inicis_info_fld">
|
||||
<th scope="row"><label for="de_inicis_hash_key">KG이니시스 모바일 금액위변조 Hash Key</label></th>
|
||||
<td>
|
||||
<?php echo help("<a href='https://iniweb.inicis.com/' target='_blank'>KG이니시스 가맹점관리자</a> > 상점정보 > 계약정보 > KEY 정보의 모바일 금액위변조 HashKey를 입력합니다."); ?>
|
||||
<input type="text" name="de_inicis_hash_key" value="<?php echo isset($default['de_inicis_hash_key']) ? get_sanitize_input($default['de_inicis_hash_key']) : ''; ?>" id="de_inicis_hash_key" class="frm_input" size="40" maxlength="255" autocomplete="off">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pg_info_fld inicis_info_fld">
|
||||
<th scope="row"><label for="de_inicis_iniapi_key">KG이니시스 INIAPI KEY</label></th>
|
||||
<td>
|
||||
<?php echo help("<a href='https://iniweb.inicis.com/' target='_blank'>KG이니시스 가맹점관리자</a> > 상점정보 > 계약정보 > 부가정보 > INIAPI key 생성 조회 하여 KEY를 여기에 입력합니다.\n이 항목은 영카트 주문에서 kg이니시스 PG 결제 취소, 부분취소, 에스크로 배송등록, 현금영수증 발급에 필요합니다."); ?>
|
||||
<?php echo help("<a href='https://iniweb.inicis.com/' target='_blank'>KG이니시스 가맹점관리자</a> > 상점정보 > 계약정보 > KEY 정보 > INIAPI key 생성 조회 하여 KEY를 여기에 입력합니다.\n이 항목은 영카트 주문에서 kg이니시스 PG 결제 취소, 부분취소, 에스크로 배송등록, 현금영수증 발급에 필요합니다."); ?>
|
||||
<input type="text" name="de_inicis_iniapi_key" value="<?php echo get_sanitize_input($default['de_inicis_iniapi_key']); ?>" id="de_inicis_iniapi_key" class="frm_input" size="30" maxlength="30">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pg_info_fld inicis_info_fld">
|
||||
<th scope="row"><label for="de_inicis_iniapi_iv">KG이니시스 INIAPI IV</label></th>
|
||||
<td>
|
||||
<?php echo help("<a href='https://iniweb.inicis.com/' target='_blank'>KG이니시스 가맹점관리자</a> > 상점정보 > 계약정보 > 부가정보 > INIAPI IV 생성 조회 하여 KEY를 여기에 입력합니다.\n이 항목은 영카트 주문에서 kg이니시스 현금영수증 발급에 필요합니다."); ?>
|
||||
<?php echo help("<a href='https://iniweb.inicis.com/' target='_blank'>KG이니시스 가맹점관리자</a> > 상점정보 > 계약정보 > KEY 정보 > INIAPI IV 생성 조회 하여 KEY를 여기에 입력합니다.\n이 항목은 영카트 주문에서 kg이니시스 현금영수증 발급에 필요합니다."); ?>
|
||||
<input type="text" name="de_inicis_iniapi_iv" value="<?php echo get_sanitize_input($default['de_inicis_iniapi_iv']); ?>" id="de_inicis_iniapi_iv" class="frm_input" size="30" maxlength="30">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pg_info_fld inicis_info_fld">
|
||||
<th scope="row">KG이니시스 PRO 운영 감시</th>
|
||||
<td>
|
||||
<?php echo help("결제 이상 알림과 미진행 거래 정리는 서버 작업 스케줄러 없이 사이트 접속 흐름에서 자동 실행됩니다. KG이니시스 INIAPI 거래대사는 관리자 접속 시 함께 실행됩니다.\n관리자 접속이 드물거나 독립 실행이 필요하면 서버 작업 스케줄러에서 5~10분 간격으로 다음 명령을 추가로 실행할 수 있습니다(선택).\nphp ".G5_SHOP_PATH."/inicis/pro/monitor.php --host=".preg_replace('/[^A-Za-z0-9.:-]/', '', isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost').((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? ' --https' : '')." --client-ip=".preg_replace('/[^0-9.]/', '', isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '')."\n거래대사는 최근 완료 거래와 확인 필요 거래를 KG이니시스 INIAPI로 조회하며 주문 생성이나 결제 취소를 자동 실행하지 않습니다."); ?>
|
||||
<input type="checkbox" name="de_inicis_pro_alert_use" value="1" id="de_inicis_pro_alert_use"<?php echo !empty($default['de_inicis_pro_alert_use']) ? ' checked' : ''; ?>> <label for="de_inicis_pro_alert_use">이상 거래 메일 알림</label>
|
||||
|
||||
<input type="checkbox" name="de_inicis_pro_reconcile_use" value="1" id="de_inicis_pro_reconcile_use"<?php echo !empty($default['de_inicis_pro_reconcile_use']) ? ' checked' : ''; ?>> <label for="de_inicis_pro_reconcile_use">최근 완료·확인 필요 거래 자동 대사</label>
|
||||
<br>최근 감시: <?php echo !empty($default['de_inicis_pro_monitor_at']) ? get_text($default['de_inicis_pro_monitor_at']) : '실행 기록 없음'; ?>
|
||||
<?php if (!empty($default['de_inicis_pro_monitor_message'])) { ?> / <?php echo get_text($default['de_inicis_pro_monitor_message']); ?><?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pg_info_fld inicis_info_fld">
|
||||
<th scope="row"><label for="de_inicis_pro_log_days">PRO 상세 이력 보존기간</label></th>
|
||||
<td>
|
||||
<?php echo help("단계별 상세 이력과 기존 이니시스 로그의 결제 응답 payload를 설정 기간 이후 순차 삭제합니다. 결제 요약은 아래의 별도 보존기간을 적용합니다. 0은 자동 정리 안 함이며, 보존하는 경우 30~3650일로 설정하십시오."); ?>
|
||||
<input type="text" name="de_inicis_pro_log_days" value="<?php echo isset($default['de_inicis_pro_log_days']) ? (int) $default['de_inicis_pro_log_days'] : 365; ?>" id="de_inicis_pro_log_days" class="frm_input" size="6" maxlength="4"> 일
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pg_info_fld inicis_info_fld">
|
||||
<th scope="row"><label for="de_inicis_pro_summary_days">PRO 결제 요약 보존기간</label></th>
|
||||
<td>
|
||||
<?php echo help("주문이 이미 삭제됐고 확인 또는 환불이 필요하지 않은 최종 결제 요약을 설정 기간 이후 순차 삭제합니다. 실제 주문이 남아 있거나 환불 확인이 필요한 거래는 삭제하지 않습니다. 0은 자동 정리 안 함이며, 보존하는 경우 365~3650일로 설정하십시오."); ?>
|
||||
<input type="text" name="de_inicis_pro_summary_days" value="<?php echo isset($default['de_inicis_pro_summary_days']) ? (int) $default['de_inicis_pro_summary_days'] : 1825; ?>" id="de_inicis_pro_summary_days" class="frm_input" size="6" maxlength="4"> 일
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pg_info_fld inicis_info_fld">
|
||||
<th scope="row">
|
||||
<label for="de_samsung_pay_use">KG이니시스 삼성페이 사용</label>
|
||||
<a href="http://sir.kr/main/service/samsungpay.php" target="_blank" class="kg_btn">삼성페이 서비스신청하기</a>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo help("KG이니시스와 별도로 <strong>삼성페이 사용 계약을 하신 경우</strong>에만 체크해주세요. (모바일 주문서 결제수단에 삼성페이가 노출됩니다.) <br >실결제시 반드시 결제대행사 KG이니시스 항목에 상점 아이디와 웹결제 사인키를 입력해 주세요.", 50); ?>
|
||||
<?php echo help("KG이니시스와 별도로 <strong>삼성페이 사용 계약을 하신 경우</strong>에만 체크해주세요. INIpay PRO 사용 시 PC와 모바일 주문서에 삼성페이가 노출되며 삼성페이 결제창을 직접 호출합니다. 구버전 결제에서는 모바일 주문서에만 노출됩니다.<br>실결제 시 상점 아이디와 사용 중인 결제모듈의 인증키(PRO: HashKey, 구버전: 웹결제 사인키)를 입력해 주세요.", 50); ?>
|
||||
<input type="checkbox" name="de_samsung_pay_use" value="1" id="de_samsung_pay_use"<?php echo $default['de_samsung_pay_use']?' checked':''; ?>> <label for="de_samsung_pay_use">사용</label>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -915,7 +992,7 @@ if(!$default['de_kakaopay_cancelpwd']){
|
||||
<label for="de_inicis_lpay_use">KG이니시스 L.pay 사용</label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo help("체크시 KG이니시스 L.pay를 사용합니다. <br >실결제시 반드시 결제대행사 KG이니시스 항목의 상점 정보( 아이디, 웹결제 사인키 )를 입력해 주세요.", 50); ?>
|
||||
<?php echo help("체크 시 KG이니시스 L.pay를 사용합니다. INIpay PRO에서는 주문서에서 L.pay 선택 시 L.pay 결제창을 직접 호출합니다.<br>실결제 시 상점 아이디와 사용 중인 결제모듈의 인증키(PRO: HashKey, 구버전: 웹결제 사인키)를 입력해 주세요.", 50); ?>
|
||||
<input type="checkbox" name="de_inicis_lpay_use" value="1" id="de_inicis_lpay_use"<?php echo $default['de_inicis_lpay_use']?' checked':''; ?>> <label for="de_inicis_lpay_use">사용</label>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -924,7 +1001,7 @@ if(!$default['de_kakaopay_cancelpwd']){
|
||||
<label for="de_inicis_kakaopay_use">KG이니시스 카카오페이 사용</label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo help("체크시 KG이니시스 결제의 카카오페이를 사용합니다. 주문서 결제수단에 카카오페이가 노출됩니다. <br>실결제시 반드시 결제대행사 KG이니시스 항목의 상점 정보( 아이디, 웹결제 사인키 )를 입력해 주세요.", 50); ?>
|
||||
<?php echo help("체크 시 KG이니시스 결제의 카카오페이를 사용합니다. INIpay PRO에서는 주문서에서 카카오페이 선택 시 카카오페이 결제창을 직접 호출합니다.<br>실결제 시 상점 아이디와 사용 중인 결제모듈의 인증키(PRO: HashKey, 구버전: 웹결제 사인키)를 입력해 주세요.", 50); ?>
|
||||
<input type="checkbox" name="de_inicis_kakaopay_use" value="1" id="de_inicis_kakaopay_use"<?php echo $default['de_inicis_kakaopay_use']?' checked':''; ?>> <label for="de_inicis_kakaopay_use">사용</label>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -933,7 +1010,7 @@ if(!$default['de_kakaopay_cancelpwd']){
|
||||
<label for="de_inicis_cartpoint_use">KG이니시스 신용카드 포인트 결제</label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo help("신용카드 포인트 결제에 대해 이니시스와 계약을 맺은 상점에서만 적용하는 옵션입니다.<br>체크시 pc 결제에서는 신용카드 포인트 사용 여부에 대한 팝업창에 사용 버튼과 사용안함 버튼이 표기되어 결제하는 고객의 선택여부에 따라 신용카드 포인트 결제가 가능합니다.<br >모바일에서는 신용카드 포인트 사용이 가능합니다.", 50); ?>
|
||||
<?php echo help("신용카드 포인트 결제에 대해 이니시스와 계약을 맺은 상점에서만 적용하는 구버전 결제 옵션입니다.<br>체크 시 PC 결제에서는 신용카드 포인트 사용 여부를 선택할 수 있고 모바일에서도 카드 포인트를 사용할 수 있습니다.<br>INIpay PRO에는 이 설정을 전달하지 않습니다. PRO 카드 포인트 사용은 KG이니시스에서 해당 MID의 지원 여부와 요청 규격을 확인한 후 적용해야 합니다.", 50); ?>
|
||||
<input type="checkbox" name="de_inicis_cartpoint_use" value="1" id="de_inicis_cartpoint_use"<?php echo $default['de_inicis_cartpoint_use']?' checked':''; ?>> <label for="de_inicis_cartpoint_use">사용</label>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -1789,6 +1866,26 @@ function byte_check(el_cont, el_byte)
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function inicis_pro_retention_check(id, min, label)
|
||||
{
|
||||
var el = document.getElementById(id);
|
||||
if (!el) return true;
|
||||
var raw = el.value.replace(/^\s+|\s+$/g, "");
|
||||
if (raw === "") return true;
|
||||
if (!/^[0-9]+$/.test(raw)) {
|
||||
alert("INIpay PRO " + label + " 보존기간은 숫자로 입력해 주십시오.");
|
||||
el.focus();
|
||||
return false;
|
||||
}
|
||||
var days = parseInt(raw, 10);
|
||||
if (days !== 0 && (days < min || days > 3650)) {
|
||||
alert("INIpay PRO " + label + " 보존기간은 0 또는 " + min + "~3650일로 설정해 주십시오.");
|
||||
el.focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function fconfig_check(f)
|
||||
{
|
||||
<?php echo get_editor_js('de_baesong_content'); ?>
|
||||
@@ -1798,6 +1895,29 @@ function fconfig_check(f)
|
||||
var msg = "",
|
||||
pg_msg = "";
|
||||
|
||||
if (!inicis_pro_retention_check("de_inicis_pro_log_days", 30, "상세 이력")) return false;
|
||||
if (!inicis_pro_retention_check("de_inicis_pro_summary_days", 365, "결제 요약")) return false;
|
||||
|
||||
if (f.de_pg_service.value == "inicis") {
|
||||
var pro_use_el = document.getElementById("de_inicis_pro_use");
|
||||
var inicis_test = parseInt(f.de_card_test.value, 10) > 0;
|
||||
if (pro_use_el && pro_use_el.checked && !inicis_test) {
|
||||
var hash_el = document.getElementById("de_inicis_hash_key");
|
||||
if (hash_el && hash_el.value.replace(/[^A-Za-z0-9+\/=_-]/g, "") === "") {
|
||||
alert("INIpay PRO를 사용하려면 HashKey를 입력해 주십시오.");
|
||||
hash_el.focus();
|
||||
return false;
|
||||
}
|
||||
var reconcile_el = document.getElementById("de_inicis_pro_reconcile_use");
|
||||
var iniapi_el = document.getElementById("de_inicis_iniapi_key");
|
||||
if (reconcile_el && reconcile_el.checked && iniapi_el && iniapi_el.value.replace(/^\s+|\s+$/g, "") === "") {
|
||||
alert("INIpay PRO 자동 거래대사를 사용하려면 INIAPI KEY를 입력해 주십시오.");
|
||||
iniapi_el.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( f.de_pg_service.value == "kcp" ){
|
||||
if( f.de_kcp_mid.value && f.de_kcp_site_key.value && parseInt(f.de_card_test.value) > 0 ){
|
||||
pg_msg = "NHN KCP";
|
||||
|
||||
@@ -167,6 +167,12 @@ $check_sanitize_keys = array(
|
||||
'de_inicis_iniapi_key', //KG이니시스 INIAPI KEY
|
||||
'de_inicis_iniapi_iv', //KG이니시스 INIAPI IV
|
||||
'de_inicis_sign_key', //KG이니시스 웹결제 사인키
|
||||
'de_inicis_pro_use', //KG이니시스 INIpay PRO 사용
|
||||
'de_inicis_hash_key', //KG이니시스 INIpay PRO HashKey
|
||||
'de_inicis_pro_alert_use', //KG이니시스 INIpay PRO 이상 거래 알림
|
||||
'de_inicis_pro_reconcile_use', //KG이니시스 INIpay PRO 자동 거래대사
|
||||
'de_inicis_pro_log_days', //KG이니시스 INIpay PRO 상세 이력 보존기간
|
||||
'de_inicis_pro_summary_days', //KG이니시스 INIpay PRO 결제 요약 보존기간
|
||||
'de_samsung_pay_use', //KG이니시스 삼성페이 사용
|
||||
'de_inicis_lpay_use', //KG이니시스 Lpay 사용
|
||||
'de_inicis_kakaopay_use', //KG이니시스 카카오페이 사용
|
||||
@@ -253,6 +259,29 @@ foreach( $check_sanitize_keys as $key ){
|
||||
}
|
||||
}
|
||||
|
||||
$de_inicis_pro_use = !empty($de_inicis_pro_use) ? 1 : 0;
|
||||
$de_inicis_hash_key = preg_replace('/[^A-Za-z0-9+\/=_-]/', '', $de_inicis_hash_key);
|
||||
|
||||
$de_inicis_pro_alert_use = !empty($de_inicis_pro_alert_use) ? 1 : 0;
|
||||
$de_inicis_pro_reconcile_use = !empty($de_inicis_pro_reconcile_use) ? 1 : 0;
|
||||
$de_inicis_pro_log_days = (int) $de_inicis_pro_log_days;
|
||||
if ($de_inicis_pro_log_days !== 0 && ($de_inicis_pro_log_days < 30 || $de_inicis_pro_log_days > 3650))
|
||||
alert('INIpay PRO 상세 이력 보존기간은 0 또는 30~3650일로 설정해 주십시오.');
|
||||
$de_inicis_pro_summary_days = (int) $de_inicis_pro_summary_days;
|
||||
if ($de_inicis_pro_summary_days !== 0 && ($de_inicis_pro_summary_days < 365 || $de_inicis_pro_summary_days > 3650))
|
||||
alert('INIpay PRO 결제 요약 보존기간은 0 또는 365~3650일로 설정해 주십시오.');
|
||||
|
||||
if ($de_pg_service === 'inicis' && $de_inicis_pro_use) {
|
||||
if (empty($de_card_test) && $de_inicis_hash_key === '')
|
||||
alert('INIpay PRO를 사용하려면 HashKey를 입력해 주십시오.');
|
||||
if (!function_exists('curl_init'))
|
||||
alert('INIpay PRO를 사용하려면 PHP cURL 모듈이 필요합니다.');
|
||||
if (!function_exists('hash') || !in_array('sha512', hash_algos()))
|
||||
alert('INIpay PRO를 사용하려면 SHA-512 해시 지원이 필요합니다.');
|
||||
if ($de_inicis_pro_reconcile_use && empty($de_card_test) && trim($de_inicis_iniapi_key) === '')
|
||||
alert('INIpay PRO 자동 거래대사를 사용하려면 INIAPI KEY를 입력해 주십시오.');
|
||||
}
|
||||
|
||||
$warning_msg = '';
|
||||
|
||||
// kcp 전자결제를 사용할 때 site key 입력체크
|
||||
@@ -411,6 +440,12 @@ $sql = " update {$g5['g5_shop_default_table']}
|
||||
de_inicis_iniapi_key = '{$de_inicis_iniapi_key}',
|
||||
de_inicis_iniapi_iv = '{$de_inicis_iniapi_iv}',
|
||||
de_inicis_sign_key = '{$de_inicis_sign_key}',
|
||||
de_inicis_pro_use = '{$de_inicis_pro_use}',
|
||||
de_inicis_hash_key = '{$de_inicis_hash_key}',
|
||||
de_inicis_pro_alert_use = '{$de_inicis_pro_alert_use}',
|
||||
de_inicis_pro_reconcile_use = '{$de_inicis_pro_reconcile_use}',
|
||||
de_inicis_pro_log_days = '{$de_inicis_pro_log_days}',
|
||||
de_inicis_pro_summary_days = '{$de_inicis_pro_summary_days}',
|
||||
de_iche_use = '{$de_iche_use}',
|
||||
de_sms_cont1 = '{$_POST['de_sms_cont1']}',
|
||||
de_sms_cont2 = '{$_POST['de_sms_cont2']}',
|
||||
|
||||
@@ -0,0 +1,407 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
if (!function_exists('inicis_admin_status_label')) {
|
||||
function inicis_admin_status_label($status)
|
||||
{
|
||||
$labels = array(
|
||||
'request_ready' => '결제창 요청 준비',
|
||||
'request_expired' => '결제창 종료·미진행',
|
||||
'authentication_received' => '인증결과 수신',
|
||||
'authentication_failed' => '인증 실패',
|
||||
'validation_failed' => '주문 검증 실패',
|
||||
'approval_started' => '승인 요청 중',
|
||||
'communication_failed' => '승인 통신 실패',
|
||||
'approval_failed' => '승인 실패',
|
||||
'approved' => '승인 성공',
|
||||
'order_saving' => '주문 저장 중',
|
||||
'order_saved' => '주문 저장 완료',
|
||||
'notification_received' => '서버 통보 수신',
|
||||
'notification_failed' => '서버 통보 검증 실패',
|
||||
'notification_acknowledged' => '처리 완료 통보 확인',
|
||||
'vbank_issued' => '가상계좌 발급',
|
||||
'paid' => '입금 통보 처리 완료',
|
||||
'paid_after_cancel' => '취소 후 입금·환불 필요',
|
||||
'refund_required' => '환불 필요',
|
||||
'refund_completed' => '환불 확인 완료',
|
||||
'cancel_requested' => '취소 요청 중',
|
||||
'canceled' => '취소 완료',
|
||||
'cancel_failed' => '취소 확인 필요',
|
||||
'partial_canceled' => '부분취소 완료',
|
||||
'partial_cancel_failed' => '부분취소 확인 필요',
|
||||
'inquiry_success' => 'KG 거래조회 완료',
|
||||
'inquiry_failed' => 'KG 거래조회 실패',
|
||||
'approval_reference_recovered' => '승인 TID 복구'
|
||||
);
|
||||
|
||||
return isset($labels[$status]) ? $labels[$status] : $status;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_admin_pay_type_label')) {
|
||||
function inicis_admin_pay_type_label($pay_type, $easy_pay)
|
||||
{
|
||||
$easy_labels = array(
|
||||
'SAMSUNGPAY' => '삼성페이',
|
||||
'LPAY' => 'L.pay',
|
||||
'KAKAOPAY' => '카카오페이',
|
||||
'EASYPAY' => '간편결제'
|
||||
);
|
||||
$easy_pay = strtoupper((string) $easy_pay);
|
||||
if (isset($easy_labels[$easy_pay]))
|
||||
return $easy_labels[$easy_pay].' (CARD)';
|
||||
|
||||
$pay_labels = array('CARD' => '신용카드', 'BANK' => '계좌이체', 'VBANK' => '가상계좌', 'HPP' => '휴대폰');
|
||||
$pay_type = strtoupper((string) $pay_type);
|
||||
|
||||
return isset($pay_labels[$pay_type]) ? $pay_labels[$pay_type] : $pay_type;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_admin_stage_label')) {
|
||||
function inicis_admin_stage_label($stage)
|
||||
{
|
||||
$labels = array(
|
||||
'request' => '결제 요청',
|
||||
'authentication' => '결제 인증',
|
||||
'validation' => '주문 검증',
|
||||
'approval' => '결제 승인',
|
||||
'order' => '주문 저장',
|
||||
'notification' => '서버 통보',
|
||||
'cancel' => '결제 취소',
|
||||
'reconcile' => 'KG 거래대사'
|
||||
);
|
||||
|
||||
return isset($labels[$stage]) ? $labels[$stage] : $stage;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_admin_pg_status_label')) {
|
||||
function inicis_admin_pg_status_label($status)
|
||||
{
|
||||
$status = strtoupper((string) $status);
|
||||
$labels = array(
|
||||
'0' => '승인',
|
||||
'1' => '취소',
|
||||
'9' => '거래 없음',
|
||||
'N' => '가상계좌 입금대기',
|
||||
'Y' => '가상계좌 입금완료',
|
||||
'C' => '가상계좌 입금 전 취소',
|
||||
'APPROVAL' => '승인',
|
||||
'CANCEL' => '전체취소',
|
||||
'PART_CANCEL' => '부분취소',
|
||||
'DEPOSIT_COMPLETED' => '가상계좌 입금완료',
|
||||
'NON_DEPOSIT' => '가상계좌 입금대기',
|
||||
'DEPOSIT_CANCELED' => '가상계좌 입금취소',
|
||||
'WAITING_FOR_REFUND' => '가상계좌 환불대기',
|
||||
'REFUND_COMPLETED' => '가상계좌 환불완료'
|
||||
);
|
||||
|
||||
return isset($labels[$status]) ? $labels[$status] : $status;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_admin_source_label')) {
|
||||
function inicis_admin_source_label($source)
|
||||
{
|
||||
$labels = array(
|
||||
'web' => 'PC 브라우저',
|
||||
'mobile' => '모바일 브라우저',
|
||||
'server' => '이니시스 통보',
|
||||
'system' => '시스템',
|
||||
'admin' => '관리자'
|
||||
);
|
||||
|
||||
return isset($labels[$source]) ? $labels[$source] : $source;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_admin_primary_status')) {
|
||||
function inicis_admin_primary_status($row)
|
||||
{
|
||||
if (!empty($row['ip_refund_required']))
|
||||
return 'refund_required';
|
||||
if (!empty($row['ip_noti_status']) && $row['ip_noti_status'] === 'notification_failed')
|
||||
return 'notification_failed';
|
||||
if (!empty($row['ip_cancel_status']) && in_array($row['ip_cancel_status'], array('cancel_failed', 'partial_cancel_failed')))
|
||||
return $row['ip_cancel_status'];
|
||||
if (!empty($row['ip_cancel_status']) && $row['ip_cancel_status'] === 'cancel_requested')
|
||||
return 'cancel_requested';
|
||||
if (!empty($row['ip_noti_status']) && $row['ip_noti_status'] === 'notification_received')
|
||||
return 'notification_received';
|
||||
|
||||
// 서버 통보가 이후 정상 확인·처리 상태로 넘어갔는데도 이전 통보 검증 실패가
|
||||
// 원본 상태에 남아 있으면, 최신 통보 상태를 대표 상태로 사용한다.
|
||||
if (isset($row['ip_status']) && $row['ip_status'] === 'notification_failed'
|
||||
&& !empty($row['ip_noti_status']) && $row['ip_noti_status'] !== 'notification_failed')
|
||||
return $row['ip_noti_status'];
|
||||
|
||||
return isset($row['ip_status']) ? $row['ip_status'] : '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_admin_has_order')) {
|
||||
function inicis_admin_has_order($row)
|
||||
{
|
||||
if (isset($row['ip_order_type']) && $row['ip_order_type'] === 'personal')
|
||||
return !empty($row['personal_oid']);
|
||||
|
||||
return !empty($row['order_oid']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_admin_order_tid')) {
|
||||
function inicis_admin_order_tid($row)
|
||||
{
|
||||
if (isset($row['ip_order_type']) && $row['ip_order_type'] === 'personal')
|
||||
return isset($row['personal_tid']) ? $row['personal_tid'] : '';
|
||||
|
||||
return isset($row['order_tid']) ? $row['order_tid'] : '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_admin_order_amount')) {
|
||||
function inicis_admin_order_amount($row)
|
||||
{
|
||||
if (isset($row['ip_order_type']) && $row['ip_order_type'] === 'personal')
|
||||
return isset($row['personal_amount']) ? (int) $row['personal_amount'] : 0;
|
||||
|
||||
return isset($row['order_amount']) ? (int) $row['order_amount'] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_admin_is_anomaly')) {
|
||||
function inicis_admin_is_anomaly($row)
|
||||
{
|
||||
if (!empty($row['ip_audit_error']))
|
||||
return true;
|
||||
|
||||
$status = isset($row['ip_status']) ? $row['ip_status'] : '';
|
||||
$noti_status = isset($row['ip_noti_status']) ? $row['ip_noti_status'] : '';
|
||||
$cancel_status = isset($row['ip_cancel_status']) ? $row['ip_cancel_status'] : '';
|
||||
if (!empty($row['ip_refund_required']) || in_array($status, array('paid_after_cancel', 'refund_required')))
|
||||
return true;
|
||||
if ($noti_status === 'notification_failed')
|
||||
return true;
|
||||
if (in_array($cancel_status, array('cancel_failed', 'partial_cancel_failed')))
|
||||
return true;
|
||||
if ($status === 'partial_cancel_failed')
|
||||
return true;
|
||||
$has_order = inicis_admin_has_order($row);
|
||||
$saved_tid = $has_order ? inicis_admin_order_tid($row) : '';
|
||||
$amount_mismatch = $has_order && (int) $row['ip_amount'] > 0
|
||||
&& inicis_admin_order_amount($row) !== (int) $row['ip_amount'];
|
||||
$tid_mismatch = $has_order && !empty($row['ip_tid']) && $saved_tid !== $row['ip_tid'];
|
||||
$mismatch = $amount_mismatch || $tid_mismatch;
|
||||
$is_personal = isset($row['ip_order_type']) && $row['ip_order_type'] === 'personal';
|
||||
$order_canceled = $has_order && !$is_personal
|
||||
&& isset($row['order_status']) && $row['order_status'] === '취소';
|
||||
$order_receipt = $is_personal
|
||||
? (isset($row['personal_receipt_price']) ? (int) $row['personal_receipt_price'] : 0)
|
||||
: (isset($row['order_receipt_price']) ? (int) $row['order_receipt_price'] : 0);
|
||||
$order_misu = !$is_personal && isset($row['order_misu']) ? (int) $row['order_misu'] : 0;
|
||||
$vbank_paid = isset($row['ip_pay_type']) && $row['ip_pay_type'] === 'VBANK'
|
||||
&& ($status === 'paid' || in_array($noti_status, array('paid', 'paid_after_cancel')));
|
||||
if ($status !== 'refund_completed' && $vbank_paid
|
||||
&& ($order_canceled || !$has_order || $order_receipt !== (int) $row['ip_amount'] || $order_misu !== 0))
|
||||
return true;
|
||||
if (isset($row['ip_pay_type']) && $row['ip_pay_type'] === 'VBANK'
|
||||
&& ($status === 'vbank_issued' || $noti_status === 'vbank_issued') && $order_canceled
|
||||
&& $status !== 'canceled' && $cancel_status !== 'canceled')
|
||||
return true;
|
||||
|
||||
$local_order_active = false;
|
||||
if ($has_order) {
|
||||
if (isset($row['ip_order_type']) && $row['ip_order_type'] === 'personal')
|
||||
$local_order_active = isset($row['personal_receipt_price']) && (int) $row['personal_receipt_price'] > 0;
|
||||
else
|
||||
$local_order_active = isset($row['order_status']) && $row['order_status'] !== '취소';
|
||||
}
|
||||
|
||||
$pg_status = !empty($row['ip_pg_result_code']) && $row['ip_pg_result_code'] === '00'
|
||||
? strtoupper((string) $row['ip_pg_status']) : '';
|
||||
$pg_mismatch = $pg_status !== ''
|
||||
&& ((!empty($row['ip_pg_tid']) && !empty($row['ip_tid']) && $row['ip_pg_tid'] !== $row['ip_tid'])
|
||||
|| ((int) $row['ip_pg_amount'] > 0 && (int) $row['ip_amount'] > 0 && (int) $row['ip_pg_amount'] !== (int) $row['ip_amount']));
|
||||
$pg_paid = in_array($pg_status, array('0', 'Y', 'APPROVAL', 'PART_CANCEL', 'DEPOSIT_COMPLETED'));
|
||||
$pg_pending = in_array($pg_status, array('N', 'NON_DEPOSIT'));
|
||||
$pg_attention = $pg_status === 'WAITING_FOR_REFUND';
|
||||
$pg_canceled = in_array($pg_status, array('1', '9', 'C', 'CANCEL', 'DEPOSIT_CANCELED', 'REFUND_COMPLETED'));
|
||||
|
||||
if ($pg_attention)
|
||||
return true;
|
||||
|
||||
if ($pg_paid)
|
||||
return $pg_mismatch || !$local_order_active || $mismatch;
|
||||
|
||||
$updated = isset($row['ip_updated_at']) ? strtotime($row['ip_updated_at']) : false;
|
||||
if ($pg_pending)
|
||||
return $pg_mismatch || $status === 'canceled' || $status === 'cancel_failed' || $mismatch
|
||||
|| (!$has_order && $updated !== false && $updated < G5_SERVER_TIME - 180);
|
||||
|
||||
if ($pg_canceled)
|
||||
return $pg_mismatch || $local_order_active;
|
||||
|
||||
if (in_array($status, array('authentication_received', 'approval_started', 'cancel_requested'))
|
||||
|| $noti_status === 'notification_received' || $cancel_status === 'cancel_requested')
|
||||
return $updated !== false && $updated < G5_SERVER_TIME - 180;
|
||||
if ($status === 'communication_failed')
|
||||
return true;
|
||||
if ($status === 'validation_failed' && !empty($row['ip_tid']))
|
||||
return true;
|
||||
if ($status === 'cancel_failed' || $cancel_status === 'cancel_failed')
|
||||
return true;
|
||||
|
||||
if ($status === 'canceled') {
|
||||
return $local_order_active;
|
||||
}
|
||||
|
||||
if ($status === 'notification_received')
|
||||
return $updated !== false && $updated < G5_SERVER_TIME - 180;
|
||||
|
||||
if ($has_order)
|
||||
return $mismatch;
|
||||
|
||||
$approved_states = array('approved', 'order_saving', 'order_saved', 'notification_received', 'vbank_issued', 'paid');
|
||||
if (!in_array($status, $approved_states))
|
||||
return false;
|
||||
|
||||
return $updated !== false && $updated < G5_SERVER_TIME - 180;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_admin_anomaly_sql')) {
|
||||
function inicis_admin_anomaly_sql()
|
||||
{
|
||||
$order_amount = "(o.od_cart_price + o.od_send_cost + o.od_send_cost2 - o.od_cart_coupon - o.od_coupon - o.od_send_coupon - o.od_receipt_point)";
|
||||
$has_order = "((p.ip_order_type = 'personal' and pp.pp_id is not null) or (p.ip_order_type <> 'personal' and o.od_id is not null))";
|
||||
$saved_tid = "if(p.ip_order_type = 'personal', ifnull(pp.pp_tno, ''), ifnull(o.od_tno, ''))";
|
||||
$saved_amount = "if(p.ip_order_type = 'personal', ifnull(pp.pp_price, 0), ifnull($order_amount, 0))";
|
||||
$mismatch = "($has_order and ((p.ip_tid <> '' and p.ip_tid <> $saved_tid) or (p.ip_amount > 0 and p.ip_amount <> $saved_amount)))";
|
||||
$local_active = "((p.ip_order_type = 'personal' and pp.pp_id is not null and pp.pp_receipt_price > 0) or (p.ip_order_type <> 'personal' and o.od_id is not null and o.od_status <> '취소'))";
|
||||
$local_canceled = "(p.ip_order_type <> 'personal' and o.od_id is not null and o.od_status = '취소')";
|
||||
$vbank_paid_mismatch = "(p.ip_status <> 'refund_completed' and p.ip_pay_type = 'VBANK'
|
||||
and (p.ip_status = 'paid' or p.ip_noti_status in ('paid','paid_after_cancel'))
|
||||
and ((p.ip_order_type = 'personal' and (pp.pp_id is null or pp.pp_receipt_price <> p.ip_amount))
|
||||
or (p.ip_order_type <> 'personal' and (o.od_id is null or o.od_status = '취소' or o.od_receipt_price <> p.ip_amount or o.od_misu <> 0))))";
|
||||
$vbank_canceled_before_payment = "(p.ip_pay_type = 'VBANK' and (p.ip_status = 'vbank_issued' or p.ip_noti_status = 'vbank_issued')
|
||||
and p.ip_status <> 'canceled' and p.ip_cancel_status <> 'canceled' and $local_canceled)";
|
||||
$stale = "p.ip_updated_at < date_sub(now(), interval 3 minute)";
|
||||
$pg_paid = "(p.ip_pg_result_code = '00' and p.ip_pg_status in ('0','Y','APPROVAL','PART_CANCEL','DEPOSIT_COMPLETED'))";
|
||||
$pg_pending = "(p.ip_pg_result_code = '00' and p.ip_pg_status in ('N','NON_DEPOSIT'))";
|
||||
$pg_attention = "(p.ip_pg_result_code = '00' and p.ip_pg_status = 'WAITING_FOR_REFUND')";
|
||||
$pg_canceled = "(p.ip_pg_result_code = '00' and p.ip_pg_status in ('1','9','C','CANCEL','DEPOSIT_CANCELED','REFUND_COMPLETED'))";
|
||||
$pg_known = "($pg_paid or $pg_pending or $pg_attention or $pg_canceled)";
|
||||
$pg_mismatch = "(p.ip_pg_result_code = '00' and ((p.ip_pg_tid <> '' and p.ip_tid <> '' and p.ip_pg_tid <> p.ip_tid) or (p.ip_pg_amount > 0 and p.ip_amount > 0 and p.ip_pg_amount <> p.ip_amount)))";
|
||||
$approved_states = "'approved','order_saving','order_saved','notification_received','vbank_issued','paid'";
|
||||
$local_anomaly = "(p.ip_status = 'cancel_failed'
|
||||
or p.ip_status = 'communication_failed'
|
||||
or (p.ip_status = 'validation_failed' and p.ip_tid <> '')
|
||||
or (p.ip_status in ('authentication_received','approval_started','cancel_requested') and $stale)
|
||||
or (p.ip_noti_status = 'notification_received' and $stale)
|
||||
or (p.ip_cancel_status = 'cancel_requested' and $stale)
|
||||
or (p.ip_status = 'canceled' and $local_active)
|
||||
or (p.ip_status = 'notification_received' and $stale)
|
||||
or $mismatch
|
||||
or (not $has_order and p.ip_status in ($approved_states) and $stale))";
|
||||
|
||||
return "(p.ip_audit_error = '1'
|
||||
or p.ip_refund_required = '1'
|
||||
or p.ip_status in ('paid_after_cancel','refund_required')
|
||||
or p.ip_noti_status = 'notification_failed'
|
||||
or p.ip_cancel_status in ('cancel_failed','partial_cancel_failed')
|
||||
or p.ip_status = 'partial_cancel_failed'
|
||||
or $vbank_paid_mismatch
|
||||
or $vbank_canceled_before_payment
|
||||
or $pg_mismatch
|
||||
or $pg_attention
|
||||
or ($pg_paid and (not $local_active or $mismatch))
|
||||
or ($pg_pending and (p.ip_status in ('canceled','cancel_failed') or $mismatch or (not $has_order and $stale)))
|
||||
or ($pg_canceled and $local_active)
|
||||
or (not $pg_known and $local_anomaly))";
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_admin_alert_key')) {
|
||||
function inicis_admin_alert_key($row)
|
||||
{
|
||||
return md5(
|
||||
(isset($row['ip_status']) ? $row['ip_status'] : '').'|'.
|
||||
(isset($row['ip_tid']) ? $row['ip_tid'] : '').'|'.
|
||||
(isset($row['ip_amount']) ? $row['ip_amount'] : '').'|'.
|
||||
(isset($row['ip_pg_result_code']) ? $row['ip_pg_result_code'] : '').'|'.
|
||||
(isset($row['ip_pg_status']) ? $row['ip_pg_status'] : '').'|'.
|
||||
(isset($row['ip_pg_tid']) ? $row['ip_pg_tid'] : '').'|'.
|
||||
(isset($row['ip_pg_amount']) ? $row['ip_pg_amount'] : '').'|'.
|
||||
(isset($row['ip_noti_status']) ? $row['ip_noti_status'] : '').'|'.
|
||||
(isset($row['ip_noti_code']) ? $row['ip_noti_code'] : '').'|'.
|
||||
(isset($row['ip_cancel_status']) ? $row['ip_cancel_status'] : '').'|'.
|
||||
(!empty($row['ip_refund_required']) ? '1' : '0').'|'.
|
||||
(inicis_admin_has_order($row) ? '1' : '0').'|'.
|
||||
inicis_admin_order_tid($row).'|'.inicis_admin_order_amount($row).'|'.
|
||||
(isset($row['order_status']) ? $row['order_status'] : '').'|'.
|
||||
(isset($row['order_receipt_price']) ? $row['order_receipt_price'] : '').'|'.
|
||||
(isset($row['order_misu']) ? $row['order_misu'] : '').'|'.
|
||||
(isset($row['personal_receipt_price']) ? $row['personal_receipt_price'] : '').'|'.
|
||||
(!empty($row['ip_audit_error']) ? '1' : '0')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_admin_recommendation')) {
|
||||
function inicis_admin_recommendation($row)
|
||||
{
|
||||
if (!empty($row['ip_audit_error']))
|
||||
return '감사 상세 이력 기록이 일부 누락됐습니다. 서버 오류 로그를 확인하고 KG이니시스 상점관리자 거래내역을 기준으로 상태를 확정하십시오.';
|
||||
|
||||
if (!empty($row['ip_refund_required']) || in_array($row['ip_status'], array('paid_after_cancel', 'refund_required')))
|
||||
return '취소된 주문에 가상계좌 입금이 확인됐습니다. 상품을 발송하지 말고 KG이니시스 상점관리자에서 입금 TID를 확인한 뒤 고객 환불을 처리하고 KG 거래조회를 다시 실행하십시오.';
|
||||
if (!empty($row['ip_noti_status']) && $row['ip_noti_status'] === 'notification_failed')
|
||||
return '최근 KG 서버 통보를 검증하거나 저장하지 못했습니다. 통보 실패 코드와 서버 오류 로그를 확인하고 상점관리자에서 입금통보 결과를 재전송하십시오.';
|
||||
if (!empty($row['ip_cancel_status']) && $row['ip_cancel_status'] === 'cancel_failed')
|
||||
return 'PG 전체취소 결과를 확정하지 못했습니다. 로컬 주문상태를 변경하지 말고 KG이니시스 상점관리자의 원거래를 직접 확인하십시오.';
|
||||
if (!empty($row['ip_cancel_status']) && $row['ip_cancel_status'] === 'partial_cancel_failed')
|
||||
return '부분취소 결과를 확정하지 못했습니다. KG이니시스 상점관리자의 원거래와 부분취소 거래내역을 직접 대조하십시오.';
|
||||
if (!empty($row['ip_noti_status']) && $row['ip_noti_status'] === 'notification_received')
|
||||
return '가상계좌 입금 통보 수신 후 주문 반영 완료 기록이 없습니다. 주문 입금액과 미수금을 확인하고, 불일치하면 KG이니시스 상점관리자에서 입금 통보를 재전송하십시오.';
|
||||
if (!empty($row['ip_cancel_status']) && $row['ip_cancel_status'] === 'cancel_requested')
|
||||
return 'PG 취소 요청 후 결과가 확정되지 않았습니다. 로컬 주문을 추가로 변경하지 말고 KG이니시스 상점관리자에서 원거래 취소 여부를 먼저 확인하십시오.';
|
||||
|
||||
if (!empty($row['ip_pg_checked_at']) && $row['ip_pg_result_code'] !== '00')
|
||||
return 'KG 거래조회가 실패했습니다. 해당 MID의 거래조회 계약, INIAPI KEY와 서버 IPv4를 확인한 후 다시 조회하거나 KG이니시스 상점관리자에서 직접 조회하십시오.';
|
||||
|
||||
$has_order = inicis_admin_has_order($row);
|
||||
$pg_status = !empty($row['ip_pg_result_code']) && $row['ip_pg_result_code'] === '00' ? strtoupper((string) $row['ip_pg_status']) : '';
|
||||
$pg_paid = in_array($pg_status, array('0', 'Y', 'APPROVAL', 'PART_CANCEL', 'DEPOSIT_COMPLETED'));
|
||||
$pg_pending = in_array($pg_status, array('N', 'NON_DEPOSIT'));
|
||||
$pg_attention = $pg_status === 'WAITING_FOR_REFUND';
|
||||
$pg_canceled = in_array($pg_status, array('1', '9', 'C', 'CANCEL', 'DEPOSIT_CANCELED', 'REFUND_COMPLETED'));
|
||||
|
||||
if ($pg_status !== '' && ((!empty($row['ip_pg_tid']) && !empty($row['ip_tid']) && $row['ip_pg_tid'] !== $row['ip_tid'])
|
||||
|| ((int) $row['ip_pg_amount'] > 0 && (int) $row['ip_amount'] > 0 && (int) $row['ip_pg_amount'] !== (int) $row['ip_amount'])))
|
||||
return 'KG 거래조회 결과와 로컬 결제 이력의 TID 또는 금액이 다릅니다. 자동 조치하지 말고 KG이니시스 상점관리자 원거래 내역을 직접 확인하십시오.';
|
||||
if ($pg_attention)
|
||||
return '가상계좌 입금 후 환불 대기 상태입니다. 환불이 완료될 때까지 KG이니시스 상점관리자에서 상태를 계속 확인하십시오.';
|
||||
if ($pg_paid && !$has_order)
|
||||
return 'KG이니시스에는 승인 또는 입금이 있으나 영카트 주문이 없습니다. 원 주문 데이터와 재고·포인트 반영 여부를 확인한 뒤 안전한 복원이 불가능하면 상점관리자에서 승인 취소하십시오.';
|
||||
if ($pg_pending && !$has_order)
|
||||
return '가상계좌가 발급됐지만 영카트 주문이 없습니다. 고객 입금 전에 주문 복원 가능 여부를 확인하고, 복원이 불가능하면 해당 가상계좌 거래를 정리하십시오.';
|
||||
if ($pg_canceled && $has_order)
|
||||
return 'KG이니시스 거래는 취소 또는 거래 없음 상태입니다. 로컬 주문의 결제금액·상태를 확인하고 PG 상태와 일치하도록 관리자 처리하십시오.';
|
||||
if (isset($row['ip_status']) && in_array($row['ip_status'], array('authentication_received', 'approval_started', 'communication_failed')) && empty($row['ip_tid']))
|
||||
return '최종 승인 TID가 로컬에 저장되기 전에 처리가 중단됐을 수 있습니다. 같은 주문을 다시 결제시키기 전에 KG이니시스 상점관리자에서 주문번호 OID로 승인 여부를 확인하십시오.';
|
||||
if (isset($row['ip_status']) && $row['ip_status'] === 'validation_failed' && !empty($row['ip_tid']))
|
||||
return '승인 TID가 생성된 뒤 주문 검증이 중단됐습니다. KG 거래조회 결과를 확인하고 주문이 없다면 승인 취소 여부를 결정하십시오.';
|
||||
if ($has_order && ((!empty($row['ip_tid']) && inicis_admin_order_tid($row) !== $row['ip_tid'])
|
||||
|| ((int) $row['ip_amount'] > 0 && inicis_admin_order_amount($row) !== (int) $row['ip_amount'])))
|
||||
return '결제 이력과 주문 DB의 TID 또는 금액이 다릅니다. 주문 상태를 변경하기 전에 KG이니시스 원거래 TID와 승인금액을 직접 대조하십시오.';
|
||||
if (isset($row['ip_status']) && $row['ip_status'] === 'cancel_failed')
|
||||
return '자동 취소 결과를 확정하지 못했습니다. KG 거래조회를 다시 실행하고 승인 상태라면 상점관리자에서 취소 여부를 결정하십시오.';
|
||||
if (isset($row['ip_status']) && $row['ip_status'] === 'partial_cancel_failed')
|
||||
return '부분취소 결과를 확정하지 못했습니다. KG이니시스 상점관리자의 원거래와 부분취소 거래내역을 직접 대조하십시오.';
|
||||
|
||||
return inicis_admin_is_anomaly($row)
|
||||
? 'KG이니시스 상점관리자에서 승인 TID와 금액을 확인한 뒤 영카트 주문 상태와 맞추십시오.'
|
||||
: '현재 별도 조치가 필요하지 않습니다. KG 거래상태와 영카트 주문의 TID 및 금액이 일치합니다.';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
$sub_menu = '400420';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
auth_check_menu($auth, $sub_menu, 'w');
|
||||
check_admin_token();
|
||||
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
include_once('./inicislog.lib.php');
|
||||
|
||||
if (!inicis_pro_audit_schema_ready())
|
||||
alert('결제 현황 DB 업그레이드를 먼저 실행해 주십시오.', G5_ADMIN_URL.'/dbupgrade.php');
|
||||
if (inicis_pro_get_iniapi_key() === '')
|
||||
alert('KG이니시스 INIAPI KEY를 먼저 설정해 주십시오.', './configform.php');
|
||||
|
||||
$tables = inicis_pro_audit_tables();
|
||||
$mode = isset($_POST['mode']) && !is_array($_POST['mode']) ? $_POST['mode'] : '';
|
||||
$targets = array();
|
||||
|
||||
if ($mode === 'batch') {
|
||||
$order_amount_sql = "(o.od_cart_price + o.od_send_cost + o.od_send_cost2 - o.od_cart_coupon - o.od_coupon - o.od_send_coupon - o.od_receipt_point)";
|
||||
$anomaly_sql = inicis_admin_anomaly_sql();
|
||||
$result = sql_query(" select p.*,
|
||||
o.od_id as order_oid, o.od_tno as order_tid, o.od_status as order_status,
|
||||
o.od_receipt_price as order_receipt_price, o.od_misu as order_misu, o.od_cancel_price as order_cancel_price,
|
||||
o.od_settle_case as order_settle_case, $order_amount_sql as order_amount,
|
||||
pp.pp_id as personal_oid, pp.pp_tno as personal_tid, pp.pp_price as personal_amount, pp.pp_receipt_price as personal_receipt_price
|
||||
from `{$tables['summary']}` p
|
||||
left join {$g5['g5_shop_order_table']} o on p.ip_order_type <> 'personal' and o.od_id = p.ip_oid
|
||||
left join {$g5['g5_shop_personalpay_table']} pp on p.ip_order_type = 'personal' and pp.pp_id = p.ip_oid
|
||||
left join {$g5['g5_shop_inicis_log_table']} il on il.oid = p.ip_oid
|
||||
where (p.ip_tid <> '' or (il.P_TID <> '' and il.P_STATUS = '00'))
|
||||
and $anomaly_sql
|
||||
order by p.ip_updated_at asc
|
||||
limit 5 ");
|
||||
while ($row = sql_fetch_array($result))
|
||||
$targets[] = $row;
|
||||
} else {
|
||||
$oid_raw = isset($_POST['oid']) && !is_array($_POST['oid']) ? trim($_POST['oid']) : '';
|
||||
$oid = inicis_pro_clean_oid($oid_raw);
|
||||
if ($oid === '' || $oid !== $oid_raw)
|
||||
alert('결제 주문번호가 올바르지 않습니다.', './inicisloglist.php');
|
||||
|
||||
$row = sql_fetch(" select * from `{$tables['summary']}` where ip_oid = '".sql_escape_string($oid)."' ");
|
||||
if (empty($row['ip_id']))
|
||||
alert('결제 처리 이력을 찾을 수 없습니다.', './inicisloglist.php');
|
||||
$targets[] = $row;
|
||||
}
|
||||
|
||||
if (!count($targets))
|
||||
alert('KG이니시스에서 조회할 확인 필요 거래가 없습니다.', './inicisloglist.php');
|
||||
|
||||
$success_count = 0;
|
||||
$failed_count = 0;
|
||||
$last_oid = '';
|
||||
foreach ($targets as $target) {
|
||||
$last_oid = $target['ip_oid'];
|
||||
$target_tid = !empty($target['ip_tid']) ? $target['ip_tid'] : inicis_pro_recover_approved_tid($target['ip_oid'], 'admin');
|
||||
if ($target_tid === '') {
|
||||
if ($mode !== 'batch')
|
||||
alert('승인 TID가 없어 KG이니시스 거래조회를 실행할 수 없습니다. 인증 전 미완료 결제이거나 승인 TID가 복구되지 않은 거래입니다.', './inicislogview.php?oid='.urlencode($target['ip_oid']));
|
||||
$failed_count++;
|
||||
continue;
|
||||
}
|
||||
$inquiry = inicis_pro_inquiry($target_tid, $target['ip_oid'], $target);
|
||||
if (inicis_pro_save_inquiry($target['ip_oid'], $inquiry, 'admin') && !empty($inquiry['success']))
|
||||
$success_count++;
|
||||
else
|
||||
$failed_count++;
|
||||
}
|
||||
|
||||
$message = 'KG이니시스 거래조회가 완료되었습니다. 성공 '.$success_count.'건, 실패 '.$failed_count.'건';
|
||||
if ($mode !== 'batch' && $last_oid !== '')
|
||||
alert($message, './inicislogview.php?oid='.urlencode($last_oid));
|
||||
|
||||
alert($message, './inicisloglist.php?risk=anomaly');
|
||||
@@ -0,0 +1,265 @@
|
||||
<?php
|
||||
$sub_menu = '400420';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, 'r');
|
||||
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
include_once('./inicislog.lib.php');
|
||||
|
||||
$g5['title'] = 'KG이니시스 INIpay PRO 결제 처리 현황';
|
||||
$tables = inicis_pro_audit_tables();
|
||||
$tables_ready = inicis_pro_audit_tables_ready();
|
||||
$schema_ready = inicis_pro_audit_schema_ready();
|
||||
|
||||
$status = isset($_GET['status']) && !is_array($_GET['status']) ? preg_replace('/[^a-z_]/', '', strtolower($_GET['status'])) : '';
|
||||
$allowed_status = array('', 'request_ready', 'request_expired', 'authentication_received', 'authentication_failed', 'validation_failed', 'approval_started', 'communication_failed', 'approval_failed', 'approved', 'order_saving', 'order_saved', 'notification_received', 'notification_failed', 'vbank_issued', 'paid', 'paid_after_cancel', 'refund_required', 'refund_completed', 'cancel_requested', 'canceled', 'cancel_failed', 'partial_canceled', 'partial_cancel_failed');
|
||||
if (!in_array($status, $allowed_status))
|
||||
$status = '';
|
||||
|
||||
$risk = isset($_GET['risk']) && !is_array($_GET['risk']) ? preg_replace('/[^a-z_]/', '', strtolower($_GET['risk'])) : '';
|
||||
if (!in_array($risk, array('', 'anomaly', 'failed', 'processing', 'complete', 'canceled', 'abandoned')))
|
||||
$risk = '';
|
||||
|
||||
$sfl = isset($_GET['sfl']) && !is_array($_GET['sfl']) ? $_GET['sfl'] : 'ip_oid';
|
||||
if (!in_array($sfl, array('ip_oid', 'ip_tid', 'ip_auth_tid', 'mb_id')))
|
||||
$sfl = 'ip_oid';
|
||||
$stx = isset($_GET['stx']) && !is_array($_GET['stx']) ? get_search_string($_GET['stx']) : '';
|
||||
$fr_date = isset($_GET['fr_date']) && !is_array($_GET['fr_date']) && preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $_GET['fr_date']) ? $_GET['fr_date'] : '';
|
||||
$to_date = isset($_GET['to_date']) && !is_array($_GET['to_date']) && preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $_GET['to_date']) ? $_GET['to_date'] : '';
|
||||
|
||||
include_once(G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
if (!$tables_ready) {
|
||||
?>
|
||||
<div class="local_desc02 local_desc">
|
||||
<p>결제 현황 테이블이 아직 설치되지 않았습니다. 최고관리자로 <a href="<?php echo G5_ADMIN_URL; ?>/dbupgrade.php"><strong>DB 업그레이드</strong></a>를 실행한 후 이용해 주십시오.</p>
|
||||
</div>
|
||||
<?php
|
||||
include_once(G5_ADMIN_PATH.'/admin.tail.php');
|
||||
exit;
|
||||
}
|
||||
if (!$schema_ready) {
|
||||
?>
|
||||
<div class="local_desc02 local_desc">
|
||||
<p>결제 현황 테이블의 운영 감시 필드가 설치되지 않았습니다. 최고관리자로 <a href="<?php echo G5_ADMIN_URL; ?>/dbupgrade.php"><strong>DB 업그레이드</strong></a>를 실행한 후 이용해 주십시오.</p>
|
||||
</div>
|
||||
<?php
|
||||
include_once(G5_ADMIN_PATH.'/admin.tail.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
|
||||
|
||||
$order_amount_sql = "(o.od_cart_price + o.od_send_cost + o.od_send_cost2 - o.od_cart_coupon - o.od_coupon - o.od_send_coupon - o.od_receipt_point)";
|
||||
$has_order_sql = "((p.ip_order_type = 'personal' and pp.pp_id is not null) or (p.ip_order_type <> 'personal' and o.od_id is not null))";
|
||||
$anomaly_sql = inicis_admin_anomaly_sql();
|
||||
|
||||
$where = array();
|
||||
if ($status === 'refund_required')
|
||||
$where[] = "p.ip_refund_required = '1'";
|
||||
elseif ($status !== '')
|
||||
$where[] = "(p.ip_status = '".sql_escape_string($status)."' or p.ip_noti_status = '".sql_escape_string($status)."' or p.ip_cancel_status = '".sql_escape_string($status)."')";
|
||||
if ($stx !== '')
|
||||
$where[] = "p.$sfl like '%".sql_escape_string($stx)."%'";
|
||||
if ($fr_date !== '')
|
||||
$where[] = "p.ip_created_at >= '".sql_escape_string($fr_date)." 00:00:00'";
|
||||
if ($to_date !== '')
|
||||
$where[] = "p.ip_created_at <= '".sql_escape_string($to_date)." 23:59:59'";
|
||||
|
||||
if ($risk === 'anomaly')
|
||||
$where[] = $anomaly_sql;
|
||||
elseif ($risk === 'failed')
|
||||
$where[] = "(p.ip_status in ('authentication_failed','validation_failed','communication_failed','approval_failed') or p.ip_noti_status = 'notification_failed' or p.ip_cancel_status in ('cancel_failed','partial_cancel_failed'))";
|
||||
elseif ($risk === 'processing')
|
||||
$where[] = "(p.ip_status in ('request_ready','authentication_received','approval_started','order_saving','cancel_requested') or p.ip_cancel_status = 'cancel_requested')";
|
||||
elseif ($risk === 'complete')
|
||||
$where[] = "$has_order_sql and p.ip_status in ('order_saved','paid','refund_completed') and not ($anomaly_sql)";
|
||||
elseif ($risk === 'canceled')
|
||||
$where[] = "(p.ip_status = 'canceled' or p.ip_cancel_status in ('canceled','partial_canceled'))";
|
||||
elseif ($risk === 'abandoned')
|
||||
$where[] = "p.ip_status = 'request_expired'";
|
||||
|
||||
$sql_from = " from `{$tables['summary']}` p
|
||||
left join {$g5['g5_shop_order_table']} o on p.ip_order_type <> 'personal' and o.od_id = p.ip_oid
|
||||
left join {$g5['g5_shop_personalpay_table']} pp on p.ip_order_type = 'personal' and pp.pp_id = p.ip_oid ";
|
||||
$sql_where = count($where) ? ' where '.implode(' and ', $where) : '';
|
||||
|
||||
$count = sql_fetch(" select count(*) as cnt $sql_from $sql_where ");
|
||||
$total_count = isset($count['cnt']) ? (int) $count['cnt'] : 0;
|
||||
$all_count = sql_fetch(" select count(*) as cnt from `{$tables['summary']}` ");
|
||||
$anomaly_count = sql_fetch(" select count(*) as cnt $sql_from where $anomaly_sql ");
|
||||
$failed_count = sql_fetch(" select count(*) as cnt from `{$tables['summary']}` where ip_status in ('authentication_failed','validation_failed','communication_failed','approval_failed') or ip_noti_status = 'notification_failed' or ip_cancel_status in ('cancel_failed','partial_cancel_failed') ");
|
||||
$audit_error_count = sql_fetch(" select count(*) as cnt from `{$tables['summary']}` where ip_audit_error = '1' ");
|
||||
|
||||
$rows = (int) $config['cf_page_rows'];
|
||||
if ($rows < 1)
|
||||
$rows = 20;
|
||||
$total_page = ceil($total_count / $rows);
|
||||
if ($page < 1)
|
||||
$page = 1;
|
||||
if ($total_page > 0 && $page > $total_page)
|
||||
$page = (int) $total_page;
|
||||
$from_record = ($page - 1) * $rows;
|
||||
|
||||
$sql = " select p.*,
|
||||
o.od_id as order_oid, o.od_tno as order_tid, o.od_status as order_status, o.od_receipt_price as order_receipt_price,
|
||||
o.od_misu as order_misu, o.od_cancel_price as order_cancel_price, o.od_settle_case as order_settle_case, $order_amount_sql as order_amount,
|
||||
pp.pp_id as personal_oid, pp.pp_tno as personal_tid, pp.pp_price as personal_amount, pp.pp_receipt_price as personal_receipt_price
|
||||
$sql_from
|
||||
$sql_where
|
||||
order by p.ip_id desc
|
||||
limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$query = array(
|
||||
'status' => $status,
|
||||
'risk' => $risk,
|
||||
'sfl' => $sfl,
|
||||
'stx' => $stx,
|
||||
'fr_date' => $fr_date,
|
||||
'to_date' => $to_date
|
||||
);
|
||||
$query_string = http_build_query($query, '', '&');
|
||||
// 상세보기 링크는 목록으로 돌아올 때 현재 페이지까지 유지하도록 page를 포함한다.
|
||||
$view_query_string = $query_string.'&page='.$page;
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<a href="./inicisloglist.php" class="ov_listall">전체목록</a>
|
||||
<span class="btn_ov01"><span class="ov_txt">전체</span><span class="ov_num"><?php echo number_format((int) $all_count['cnt']); ?>건</span></span>
|
||||
<a href="?risk=anomaly" class="btn_ov01"><span class="ov_txt">확인 필요</span><span class="ov_num"><?php echo number_format((int) $anomaly_count['cnt']); ?>건</span></a>
|
||||
<a href="?risk=failed" class="btn_ov01"><span class="ov_txt">실패</span><span class="ov_num"><?php echo number_format((int) $failed_count['cnt']); ?>건</span></a>
|
||||
</div>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>이 화면은 INIpay PRO의 결제 요청, 인증, 승인, 주문 저장, 서버 통보 및 취소 이력을 표시합니다. KG 거래조회 결과가 있으면 실제 PG 상태와 주문 DB를 함께 비교합니다. 거래조회 실패 또는 조회 전 거래는 KG이니시스 상점관리자에서 TID와 금액을 다시 확인하십시오.</p>
|
||||
<p>최근 자동 감시: <?php echo !empty($default['de_inicis_pro_monitor_at']) ? get_text($default['de_inicis_pro_monitor_at']) : '실행 기록 없음'; ?><?php if (!empty($default['de_inicis_pro_monitor_message'])) { ?> / <?php echo get_text($default['de_inicis_pro_monitor_message']); ?><?php } ?></p>
|
||||
<p>감사 이력 기록 오류: <strong<?php echo !empty($audit_error_count['cnt']) ? ' style="color:#d00"' : ''; ?>><?php echo number_format((int) $audit_error_count['cnt']); ?>건</strong> / 통보 허용 IP: <?php echo get_text(implode(', ', inicis_pro_noti_allowed_ips())); ?></p>
|
||||
</div>
|
||||
|
||||
<form method="post" action="./inicislogcheck.php" style="margin-bottom:10px">
|
||||
<input type="hidden" name="token" value="">
|
||||
<input type="hidden" name="mode" value="batch">
|
||||
<button type="submit" class="btn btn_02" onclick="return confirm('확인 필요 거래 중 조회 가능한 최근 5건을 KG이니시스에서 조회하시겠습니까? 주문 생성이나 결제 취소는 실행하지 않습니다.');">확인 필요 거래 KG 대사</button>
|
||||
</form>
|
||||
|
||||
<form class="local_sch03 local_sch" method="get">
|
||||
<div>
|
||||
<strong>처리 구분</strong>
|
||||
<select name="risk">
|
||||
<option value=""<?php echo get_selected($risk, ''); ?>>전체</option>
|
||||
<option value="anomaly"<?php echo get_selected($risk, 'anomaly'); ?>>확인 필요</option>
|
||||
<option value="failed"<?php echo get_selected($risk, 'failed'); ?>>실패</option>
|
||||
<option value="processing"<?php echo get_selected($risk, 'processing'); ?>>처리 중</option>
|
||||
<option value="complete"<?php echo get_selected($risk, 'complete'); ?>>정상 완료</option>
|
||||
<option value="canceled"<?php echo get_selected($risk, 'canceled'); ?>>취소 완료</option>
|
||||
<option value="abandoned"<?php echo get_selected($risk, 'abandoned'); ?>>결제창 종료·미진행</option>
|
||||
</select>
|
||||
<strong>현재 상태</strong>
|
||||
<select name="status">
|
||||
<option value="">전체</option>
|
||||
<?php foreach ($allowed_status as $status_value) { if ($status_value === '') continue; ?>
|
||||
<option value="<?php echo $status_value; ?>"<?php echo get_selected($status, $status_value); ?>><?php echo get_text(inicis_admin_status_label($status_value)); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<strong>기간</strong>
|
||||
<input type="text" id="fr_date" name="fr_date" value="<?php echo get_text($fr_date); ?>" class="frm_input" size="10" maxlength="10" placeholder="YYYY-MM-DD">
|
||||
~
|
||||
<input type="text" id="to_date" name="to_date" value="<?php echo get_text($to_date); ?>" class="frm_input" size="10" maxlength="10" placeholder="YYYY-MM-DD">
|
||||
</div>
|
||||
<div>
|
||||
<select name="sfl">
|
||||
<option value="ip_oid"<?php echo get_selected($sfl, 'ip_oid'); ?>>주문번호 OID</option>
|
||||
<option value="ip_tid"<?php echo get_selected($sfl, 'ip_tid'); ?>>승인 TID</option>
|
||||
<option value="ip_auth_tid"<?php echo get_selected($sfl, 'ip_auth_tid'); ?>>인증 TID</option>
|
||||
<option value="mb_id"<?php echo get_selected($sfl, 'mb_id'); ?>>회원 ID</option>
|
||||
</select>
|
||||
<input type="text" name="stx" value="<?php echo get_text($stx); ?>" class="frm_input" size="30">
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption>KG이니시스 INIpay PRO 결제 처리 현황 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">최근 처리일시</th>
|
||||
<th scope="col">주문번호</th>
|
||||
<th scope="col">승인 TID</th>
|
||||
<th scope="col">회원</th>
|
||||
<th scope="col">구분</th>
|
||||
<th scope="col">결제수단</th>
|
||||
<th scope="col">금액</th>
|
||||
<th scope="col">현재 상태</th>
|
||||
<th scope="col">KG 거래상태</th>
|
||||
<th scope="col">주문 확인</th>
|
||||
<th scope="col">이력</th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php for ($i = 0; $row = sql_fetch_array($result); $i++) {
|
||||
$has_order = inicis_admin_has_order($row);
|
||||
$is_anomaly = inicis_admin_is_anomaly($row);
|
||||
$order_type_label = $row['ip_order_type'] === 'personal' ? '개인결제' : '주문';
|
||||
$device_label = $row['ip_device'] === 'MOBILE' ? '모바일' : ($row['ip_device'] === 'WEB' ? 'PC' : $row['ip_device']);
|
||||
$bg = 'bg'.($i % 2);
|
||||
?>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_time"><?php echo get_text($row['ip_updated_at']); ?></td>
|
||||
<td class="td_odrnum2"><a href="./inicislogview.php?oid=<?php echo urlencode($row['ip_oid']); ?>&<?php echo $view_query_string; ?>"><?php echo get_text($row['ip_oid']); ?></a></td>
|
||||
<td class="td_left"><?php echo $row['ip_tid'] !== '' ? get_text($row['ip_tid']) : '-'; ?></td>
|
||||
<td class="td_name"><?php echo $row['mb_id'] !== '' ? get_text($row['mb_id']) : '비회원'; ?></td>
|
||||
<td class="td_center"><?php echo get_text($order_type_label.' / '.$device_label); ?><br><?php
|
||||
if ($row['ip_environment'] === 'test') echo '<strong style="color:#d00">테스트</strong>';
|
||||
elseif ($row['ip_environment'] === 'live') echo '<span style="font-size:11px">실결제</span>';
|
||||
else echo '<span style="font-size:11px;color:#d00">확인 필요</span>';
|
||||
?></td>
|
||||
<td class="td_center"><?php echo get_text(inicis_admin_pay_type_label($row['ip_pay_type'], $row['ip_easy_pay'])); ?></td>
|
||||
<td class="td_price"><?php echo number_format((int) $row['ip_amount']); ?></td>
|
||||
<td class="td_center"><?php echo get_text(inicis_admin_status_label(inicis_admin_primary_status($row))); ?></td>
|
||||
<td class="td_center">
|
||||
<?php if (!empty($row['ip_pg_checked_at'])) { ?>
|
||||
<?php echo $row['ip_pg_result_code'] === '00' ? get_text(inicis_admin_pg_status_label($row['ip_pg_status'])) : '<strong style="color:#d00">조회 실패</strong>'; ?><br>
|
||||
<span style="font-size:11px"><?php echo get_text($row['ip_pg_checked_at']); ?></span>
|
||||
<?php } else { ?>미조회<?php } ?>
|
||||
</td>
|
||||
<td class="td_center">
|
||||
<?php if ($is_anomaly) { ?><strong style="color:#d00">확인 필요</strong>
|
||||
<?php } elseif ($has_order) { ?><span style="color:#168b3f">정상 연결</span>
|
||||
<?php } elseif ($row['ip_status'] === 'canceled') { ?>취소됨
|
||||
<?php } else { ?>미생성<?php } ?>
|
||||
</td>
|
||||
<td class="td_num"><?php echo number_format((int) $row['ip_event_count']); ?></td>
|
||||
<td class="td_mng td_mng_s">
|
||||
<a href="./inicislogview.php?oid=<?php echo urlencode($row['ip_oid']); ?>&<?php echo $view_query_string; ?>" class="btn btn_03">상세</a>
|
||||
<?php if ($has_order && $row['ip_order_type'] === 'personal') { ?>
|
||||
<a href="./personalpayform.php?w=u&pp_id=<?php echo urlencode($row['ip_oid']); ?>" class="btn btn_02">개인</a>
|
||||
<?php } elseif ($has_order) { ?>
|
||||
<a href="./orderform.php?od_id=<?php echo urlencode($row['ip_oid']); ?>" class="btn btn_02">주문</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }
|
||||
if ($i === 0)
|
||||
echo '<tr><td colspan="12" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$paging_url = './inicisloglist.php?'.$query_string.'&page=';
|
||||
echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, $paging_url);
|
||||
?>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
$("#fr_date, #to_date").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true, yearRange: "c-99:c+99", maxDate: "+0d" });
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
$sub_menu = '400420';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, 'r');
|
||||
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
include_once('./inicislog.lib.php');
|
||||
|
||||
$oid = isset($_GET['oid']) && !is_array($_GET['oid']) ? inicis_pro_clean_oid($_GET['oid']) : '';
|
||||
if ($oid === '' || !isset($_GET['oid']) || $oid !== $_GET['oid'])
|
||||
alert('결제 주문번호가 올바르지 않습니다.', './inicisloglist.php');
|
||||
|
||||
$tables = inicis_pro_audit_tables();
|
||||
if (!inicis_pro_audit_schema_ready())
|
||||
alert('결제 현황 테이블이 설치되지 않았습니다. DB 업그레이드를 실행해 주십시오.', G5_ADMIN_URL.'/dbupgrade.php');
|
||||
|
||||
// 목록으로 돌아갈 때 넘어온 검색 조건과 페이지를 그대로 유지한다.
|
||||
$list_query = array();
|
||||
foreach (array('status', 'risk', 'sfl', 'stx', 'fr_date', 'to_date', 'page') as $list_key) {
|
||||
if (isset($_GET[$list_key]) && !is_array($_GET[$list_key]) && $_GET[$list_key] !== '')
|
||||
$list_query[$list_key] = (string) $_GET[$list_key];
|
||||
}
|
||||
$list_url = './inicisloglist.php'.(count($list_query) ? '?'.http_build_query($list_query, '', '&') : '');
|
||||
|
||||
$oid_sql = sql_escape_string($oid);
|
||||
$order_amount_sql = "(o.od_cart_price + o.od_send_cost + o.od_send_cost2 - o.od_cart_coupon - o.od_coupon - o.od_send_coupon - o.od_receipt_point)";
|
||||
$sql = " select p.*,
|
||||
o.od_id as order_oid, o.od_tno as order_tid, o.od_status as order_status, o.od_time as order_time,
|
||||
o.od_receipt_price as order_receipt_price, o.od_misu as order_misu, o.od_cancel_price as order_cancel_price,
|
||||
o.od_settle_case as order_settle_case, $order_amount_sql as order_amount,
|
||||
pp.pp_id as personal_oid, pp.pp_tno as personal_tid, pp.pp_price as personal_amount, pp.pp_receipt_price as personal_receipt_price, pp.pp_time as personal_time
|
||||
from `{$tables['summary']}` p
|
||||
left join {$g5['g5_shop_order_table']} o on p.ip_order_type <> 'personal' and o.od_id = p.ip_oid
|
||||
left join {$g5['g5_shop_personalpay_table']} pp on p.ip_order_type = 'personal' and pp.pp_id = p.ip_oid
|
||||
where p.ip_oid = '$oid_sql' ";
|
||||
$row = sql_fetch($sql);
|
||||
if (empty($row['ip_id']))
|
||||
alert('결제 처리 이력을 찾을 수 없습니다.', './inicisloglist.php');
|
||||
|
||||
$events = sql_query(" select * from `{$tables['event']}` where ip_oid = '$oid_sql' order by pe_id asc ");
|
||||
$has_order = inicis_admin_has_order($row);
|
||||
$is_anomaly = inicis_admin_is_anomaly($row);
|
||||
$saved_tid = inicis_admin_order_tid($row);
|
||||
$saved_amount = inicis_admin_order_amount($row);
|
||||
$legacy_pro_log = empty($row['ip_tid']) ? inicis_pro_get_log($oid) : array();
|
||||
$legacy_pro_data = isset($legacy_pro_log['pro_data']) && is_array($legacy_pro_log['pro_data']) ? $legacy_pro_log['pro_data'] : array();
|
||||
// 승인 TID가 있거나 승인 로그에서 복구할 수 있을 때만 조회한다.
|
||||
// TID를 참조할 수 없는 미완료(인증 전) 거래는 KG에 조회할 대상이 없다.
|
||||
$can_inquiry = !empty($row['ip_tid'])
|
||||
|| (!empty($legacy_pro_data['__pro']) && $legacy_pro_data['__pro'] === '1'
|
||||
&& isset($legacy_pro_log['P_STATUS']) && $legacy_pro_log['P_STATUS'] === '00' && !empty($legacy_pro_data['P_APPL_TID']));
|
||||
$g5['title'] = 'KG이니시스 INIpay PRO 결제 처리 상세';
|
||||
include_once(G5_ADMIN_PATH.'/admin.head.php');
|
||||
?>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>이 기록은 영카트 서버가 처리한 단계의 감사 이력입니다. 최종 결제·취소 여부는 KG이니시스 상점관리자의 TID 거래내역과 대조하여 확정하십시오.</p>
|
||||
<p>설정된 보존기간이 지난 단계별 상세 이력은 순차 삭제될 수 있으며, 아래 누적 이력 수에는 삭제 전 기록도 포함됩니다.</p>
|
||||
<?php if (!empty($row['ip_audit_error'])) { ?><p><strong style="color:#d00">이 거래에서 감사 상세 이력 기록 오류가 감지됐습니다. 서버 오류 로그와 KG이니시스 거래내역을 함께 확인하십시오.</strong></p><?php } ?>
|
||||
<?php if (!empty($row['ip_refund_required'])) { ?><p><strong style="color:#d00">취소 주문에 입금이 확인되어 환불이 필요합니다. 상품을 발송하지 말고 KG이니시스 상점관리자에서 입금 및 환불 상태를 확인하십시오.</strong></p><?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="local_desc02 local_desc">
|
||||
<p><strong><?php echo $is_anomaly ? '권장 조치' : '확인 결과'; ?>:</strong> <?php echo get_text(inicis_admin_recommendation($row)); ?></p>
|
||||
</div>
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption>결제 처리 요약</caption>
|
||||
<tbody>
|
||||
<tr><th scope="row">주문번호 OID</th><td><?php echo get_text($row['ip_oid']); ?></td><th scope="row">처리 판정</th><td><?php echo $is_anomaly ? '<strong style="color:#d00">확인 필요</strong>' : ($has_order ? '<span style="color:#168b3f">주문 정상 연결</span>' : get_text(inicis_admin_status_label(inicis_admin_primary_status($row)))); ?></td></tr>
|
||||
<tr><th scope="row">인증 TID</th><td><?php echo $row['ip_auth_tid'] !== '' ? get_text($row['ip_auth_tid']) : '-'; ?></td><th scope="row">승인 TID</th><td><?php echo $row['ip_tid'] !== '' ? get_text($row['ip_tid']) : '-'; ?></td></tr>
|
||||
<tr><th scope="row">회원 ID</th><td><?php echo $row['mb_id'] !== '' ? get_text($row['mb_id']) : '비회원'; ?></td><th scope="row">MID</th><td><?php echo get_text($row['ip_mid']); ?></td></tr>
|
||||
<tr><th scope="row">결제금액</th><td><?php echo number_format((int) $row['ip_amount']); ?>원</td><th scope="row">결제수단</th><td><?php echo get_text(inicis_admin_pay_type_label($row['ip_pay_type'], $row['ip_easy_pay'])); ?></td></tr>
|
||||
<tr><th scope="row">결제환경</th><td><?php echo $row['ip_environment'] === 'test' ? '<strong style="color:#d00">테스트</strong>' : ($row['ip_environment'] === 'live' ? '실결제' : '<strong style="color:#d00">확인 필요</strong>'); ?></td><th scope="row">환불 확인 필요</th><td><?php echo !empty($row['ip_refund_required']) ? '<strong style="color:#d00">예</strong>' : '아니오'; ?></td></tr>
|
||||
<tr><th scope="row">접속 구분</th><td><?php echo get_text($row['ip_device']); ?></td><th scope="row">결제 구분</th><td><?php echo $row['ip_order_type'] === 'personal' ? '개인결제' : '일반주문'; ?></td></tr>
|
||||
<tr><th scope="row">현재 상태</th><td><?php echo get_text(inicis_admin_status_label(inicis_admin_primary_status($row))); ?></td><th scope="row">결과 코드</th><td><?php echo $row['ip_result_code'] !== '' ? get_text($row['ip_result_code']) : '-'; ?></td></tr>
|
||||
<tr><th scope="row">최근 서버 통보</th><td><?php echo $row['ip_noti_status'] !== '' ? get_text(inicis_admin_status_label($row['ip_noti_status'])).($row['ip_noti_code'] !== '' ? ' ('.get_text($row['ip_noti_code']).')' : '') : '-'; ?></td><th scope="row">통보 실패 누계</th><td><?php echo number_format((int) $row['ip_noti_failed_count']); ?>회</td></tr>
|
||||
<tr><th scope="row">최근 취소 처리</th><td><?php echo $row['ip_cancel_status'] !== '' ? get_text(inicis_admin_status_label($row['ip_cancel_status'])).($row['ip_cancel_code'] !== '' ? ' ('.get_text($row['ip_cancel_code']).')' : '') : '-'; ?></td><th scope="row">가상계좌 입금기한</th><td><?php echo !empty($row['ip_vbank_due_at']) ? get_text($row['ip_vbank_due_at']) : '-'; ?></td></tr>
|
||||
<tr><th scope="row">통보 메시지</th><td><?php echo $row['ip_noti_message'] !== '' ? get_text($row['ip_noti_message']) : '-'; ?></td><th scope="row">취소 메시지</th><td><?php echo $row['ip_cancel_message'] !== '' ? get_text($row['ip_cancel_message']) : '-'; ?></td></tr>
|
||||
<tr><th scope="row">감사 이력 상태</th><td><?php echo !empty($row['ip_audit_error']) ? '<strong style="color:#d00">상세 기록 오류</strong>' : '정상'; ?></td><th scope="row">최근 이상 알림</th><td><?php echo !empty($row['ip_alerted_at']) ? get_text($row['ip_alerted_at']) : '-'; ?></td></tr>
|
||||
<tr><th scope="row">마지막 메시지</th><td colspan="3"><?php echo $row['ip_result_message'] !== '' ? get_text($row['ip_result_message']) : '-'; ?></td></tr>
|
||||
<tr><th scope="row">승인 일시</th><td><?php echo !empty($row['ip_approved_at']) ? get_text($row['ip_approved_at']) : '-'; ?></td><th scope="row">주문 저장 일시</th><td><?php echo !empty($row['ip_ordered_at']) ? get_text($row['ip_ordered_at']) : '-'; ?></td></tr>
|
||||
<tr><th scope="row">통보 일시</th><td><?php echo !empty($row['ip_notified_at']) ? get_text($row['ip_notified_at']) : '-'; ?></td><th scope="row">취소 일시</th><td><?php echo !empty($row['ip_canceled_at']) ? get_text($row['ip_canceled_at']) : '-'; ?></td></tr>
|
||||
<tr><th scope="row">주문 DB의 TID</th><td><?php echo $has_order ? get_text($saved_tid) : '-'; ?></td><th scope="row">주문 DB의 금액</th><td><?php echo $has_order ? number_format($saved_amount).'원' : '-'; ?></td></tr>
|
||||
<?php if ($row['ip_order_type'] !== 'personal') { ?><tr><th scope="row">주문 상태/입금액</th><td><?php echo $has_order ? get_text($row['order_status']).' / '.number_format((int) $row['order_receipt_price']).'원' : '-'; ?></td><th scope="row">주문 미수금/취소액</th><td><?php echo $has_order ? number_format((int) $row['order_misu']).'원 / '.number_format((int) $row['order_cancel_price']).'원' : '-'; ?></td></tr><?php } ?>
|
||||
<tr><th scope="row">KG 거래조회 상태</th><td><?php echo !empty($row['ip_pg_checked_at']) ? ($row['ip_pg_result_code'] === '00' ? get_text(inicis_admin_pg_status_label($row['ip_pg_status'])) : '조회 실패 ('.get_text($row['ip_pg_result_code']).')') : '미조회'; ?></td><th scope="row">KG 거래조회 일시</th><td><?php echo !empty($row['ip_pg_checked_at']) ? get_text($row['ip_pg_checked_at']) : '-'; ?></td></tr>
|
||||
<tr><th scope="row">KG 조회 TID</th><td><?php echo !empty($row['ip_pg_tid']) ? get_text($row['ip_pg_tid']) : '-'; ?></td><th scope="row">KG 조회 금액</th><td><?php echo (int) $row['ip_pg_amount'] > 0 ? number_format((int) $row['ip_pg_amount']).'원' : '-'; ?></td></tr>
|
||||
<tr><th scope="row">KG 조회 메시지</th><td colspan="3"><?php echo !empty($row['ip_pg_message']) ? get_text($row['ip_pg_message']) : '-'; ?></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="<?php echo $list_url; ?>" class="btn btn_02">목록</a>
|
||||
<?php if ($can_inquiry) { ?>
|
||||
<form method="post" action="./inicislogcheck.php" style="display:inline">
|
||||
<input type="hidden" name="token" value="">
|
||||
<input type="hidden" name="mode" value="single">
|
||||
<input type="hidden" name="oid" value="<?php echo get_text($row['ip_oid']); ?>">
|
||||
<button type="submit" class="btn btn_02" onclick="return confirm('이 거래를 KG이니시스에서 조회하시겠습니까? 주문 생성이나 결제 취소는 실행하지 않습니다.');">KG 거래조회</button>
|
||||
</form>
|
||||
<?php } ?>
|
||||
<?php if ($has_order && $row['ip_order_type'] === 'personal') { ?>
|
||||
<a href="./personalpayform.php?w=u&pp_id=<?php echo urlencode($row['ip_oid']); ?>" class="btn btn_03">개인결제 보기</a>
|
||||
<?php } elseif ($has_order) { ?>
|
||||
<a href="./orderform.php?od_id=<?php echo urlencode($row['ip_oid']); ?>" class="btn btn_03">주문 보기</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption>결제 단계별 처리 이력</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">순서</th>
|
||||
<th scope="col">처리일시</th>
|
||||
<th scope="col">경로</th>
|
||||
<th scope="col">단계</th>
|
||||
<th scope="col">결과</th>
|
||||
<th scope="col">코드</th>
|
||||
<th scope="col">메시지</th>
|
||||
<th scope="col">IP</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php for ($i = 1; $event = sql_fetch_array($events); $i++) { ?>
|
||||
<tr class="bg<?php echo ($i - 1) % 2; ?>">
|
||||
<td class="td_num"><?php echo $i; ?></td>
|
||||
<td class="td_time"><?php echo get_text($event['pe_created_at']); ?></td>
|
||||
<td class="td_center"><?php echo get_text(inicis_admin_source_label($event['pe_source'])); ?></td>
|
||||
<td class="td_center"><?php echo get_text(inicis_admin_stage_label($event['pe_stage'])); ?></td>
|
||||
<td class="td_center"><?php echo get_text(inicis_admin_status_label($event['pe_status'])); ?></td>
|
||||
<td class="td_center"><?php echo $event['pe_code'] !== '' ? get_text($event['pe_code']) : '-'; ?></td>
|
||||
<td class="td_left"><?php echo $event['pe_message'] !== '' ? get_text($event['pe_message']) : '-'; ?></td>
|
||||
<td class="td_center"><?php echo get_text($event['pe_ip']); ?></td>
|
||||
</tr>
|
||||
<?php }
|
||||
if ($i === 1)
|
||||
echo '<tr><td colspan="8" class="empty_table">단계별 이력이 없습니다.</td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once(G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -19,6 +19,72 @@ if (in_array($_POST['ct_status'], $status_normal) || in_array($_POST['ct_status'
|
||||
alert('변경할 상태가 올바르지 않습니다.');
|
||||
}
|
||||
|
||||
// INIpay PRO 전체취소는 로컬 상품상태를 바꾸기 전에 PG 취소를 먼저 확정한다.
|
||||
// PG 취소 실패 후에도 주문만 취소되어 가상계좌 입금이 남는 상태를 방지한다.
|
||||
$inicis_pro_cancel_preprocessed = false;
|
||||
$inicis_pro_order_lock = '';
|
||||
if (in_array($_POST['ct_status'], $status_cancel)) {
|
||||
$selected_ct_ids = array();
|
||||
$posted_ct_count = isset($_POST['ct_id']) && is_array($_POST['ct_id']) ? count($_POST['ct_id']) : 0;
|
||||
for ($pre_i = 0; $pre_i < $posted_ct_count; $pre_i++) {
|
||||
$pre_k = isset($_POST['ct_chk'][$pre_i]) ? (int) $_POST['ct_chk'][$pre_i] : -1;
|
||||
if ($pre_k < 0 || !isset($_POST['ct_id'][$pre_k]))
|
||||
continue;
|
||||
$pre_ct_id = (int) $_POST['ct_id'][$pre_k];
|
||||
if ($pre_ct_id > 0)
|
||||
$selected_ct_ids[$pre_ct_id] = $pre_ct_id;
|
||||
}
|
||||
|
||||
if (count($selected_ct_ids)) {
|
||||
$selected_ct_sql = implode(',', array_values($selected_ct_ids));
|
||||
$future = sql_fetch(" select count(*) as total_count,
|
||||
sum(if(ct_status in ('취소','반품','품절') or ct_id in ($selected_ct_sql), 1, 0)) as cancel_count
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '".sql_escape_string($od_id)."' ");
|
||||
if ((int) $future['total_count'] > 0 && (int) $future['total_count'] === (int) $future['cancel_count']) {
|
||||
$pre_od = sql_fetch(" select * from {$g5['g5_shop_order_table']} where od_id = '".sql_escape_string($od_id)."' ");
|
||||
if (!empty($pre_od['od_tno']) && $pre_od['od_pg'] === 'inicis') {
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
$pro_tables = inicis_pro_audit_tables();
|
||||
$pro_summary = sql_fetch(" select * from `{$pro_tables['summary']}`
|
||||
where ip_oid = '".sql_escape_string($pre_od['od_id'])."'
|
||||
and ip_tid = '".sql_escape_string($pre_od['od_tno'])."' ", false);
|
||||
if (!empty($pro_summary['ip_id'])) {
|
||||
if (!isset($_POST['pg_cancel']) || (int) $_POST['pg_cancel'] !== 1)
|
||||
alert('INIpay PRO 주문은 PG 승인취소를 함께 처리해야 전체취소할 수 있습니다. PG 승인취소를 선택한 후 다시 처리해 주십시오.');
|
||||
|
||||
$inicis_pro_order_lock = inicis_pro_lock($pre_od['od_id']);
|
||||
if ($inicis_pro_order_lock === '')
|
||||
alert('동일 주문의 결제 또는 통보 처리가 진행 중입니다. 잠시 후 다시 취소해 주십시오.');
|
||||
|
||||
$pro_environment = !empty($pro_summary['ip_environment']) ? $pro_summary['ip_environment'] : inicis_pro_environment();
|
||||
if ($pro_summary['ip_mid'] !== inicis_pro_get_mid(!empty($pro_summary['ip_pay_type']) ? $pro_summary['ip_pay_type'] : null) || $pro_environment !== inicis_pro_environment())
|
||||
alert('거래 당시 MID 또는 결제환경과 현재 설정이 달라 PG 취소를 실행할 수 없습니다. KG이니시스 상점관리자에서 원거래를 확인해 주십시오.');
|
||||
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
$pre_cancel_args = array(
|
||||
'paymethod' => get_type_inicis_paymethod($pre_od['od_settle_case']),
|
||||
'tid' => $pre_od['od_tno'],
|
||||
'mid' => $pro_summary['ip_mid'],
|
||||
'audit_oid' => $pre_od['od_id'],
|
||||
'audit_source' => 'admin',
|
||||
'msg' => '쇼핑몰 운영자 승인 취소',
|
||||
'url' => $pro_environment === 'test' ? 'https://stginiapi.inicis.com/api/v1/refund' : 'https://iniapi.inicis.com/api/v1/refund'
|
||||
);
|
||||
$pre_cancel_response = inicis_tid_cancel($pre_cancel_args);
|
||||
$pre_cancel_result = json_decode($pre_cancel_response, true);
|
||||
if (!isset($pre_cancel_result['resultCode']) || $pre_cancel_result['resultCode'] !== '00') {
|
||||
$pre_cancel_code = !empty($pre_cancel_result['resultCode']) ? $pre_cancel_result['resultCode'] : 'COMMUNICATION_FAILED';
|
||||
$pre_cancel_message = !empty($pre_cancel_result['resultMsg']) ? $pre_cancel_result['resultMsg'] : 'KG이니시스 취소 응답을 확인하지 못했습니다.';
|
||||
alert($pre_cancel_message.' 코드 : '.$pre_cancel_code);
|
||||
}
|
||||
$inicis_pro_cancel_preprocessed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$search = isset($_REQUEST['search']) ? get_search_string($_REQUEST['search']) : '';
|
||||
$sort1 = isset($_REQUEST['sort1']) ? clean_xss_tags($_REQUEST['sort1'], 1, 1) : '';
|
||||
$sort2 = isset($_REQUEST['sort2']) ? clean_xss_tags($_REQUEST['sort2'], 1, 1) : '';
|
||||
@@ -227,15 +293,19 @@ if (in_array($_POST['ct_status'], $status_cancel)) {
|
||||
case 'inicis':
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
$cancel_msg = '쇼핑몰 운영자 승인 취소';
|
||||
|
||||
$args = array(
|
||||
'paymethod' => get_type_inicis_paymethod($od['od_settle_case']),
|
||||
'tid' => $od['od_tno'],
|
||||
'msg' => $cancel_msg
|
||||
);
|
||||
|
||||
$response = inicis_tid_cancel($args);
|
||||
$result = json_decode($response, true);
|
||||
if ($inicis_pro_cancel_preprocessed) {
|
||||
$result = array('resultCode' => '00', 'resultMsg' => 'INIpay PRO PG 취소 선처리 완료');
|
||||
} else {
|
||||
$args = array(
|
||||
'paymethod' => get_type_inicis_paymethod($od['od_settle_case']),
|
||||
'tid' => $od['od_tno'],
|
||||
'msg' => $cancel_msg
|
||||
);
|
||||
|
||||
$response = inicis_tid_cancel($args);
|
||||
$result = json_decode($response, true);
|
||||
}
|
||||
|
||||
if (isset($result['resultCode'])) {
|
||||
if ($result['resultCode'] != '00') {
|
||||
@@ -376,6 +446,9 @@ $qstr = "sort1=$sort1&sort2=$sort2&sel_field=$sel_field&search=$sear
|
||||
|
||||
$url = "./orderform.php?od_id=$od_id&$qstr";
|
||||
|
||||
if ($inicis_pro_order_lock !== '')
|
||||
inicis_pro_unlock($inicis_pro_order_lock);
|
||||
|
||||
// 신용카드 취소 때 오류가 있으면 알림
|
||||
if($pg_cancel == 1 && $pg_res_cd && $pg_res_msg) {
|
||||
alert('오류코드 : '.$pg_res_cd.' 오류내용 : '.$pg_res_msg, $url);
|
||||
@@ -386,4 +459,4 @@ if($pg_cancel == 1 && $pg_res_cd && $pg_res_msg) {
|
||||
alert("포인트로 결제한 주문은,\\n\\n주문상태 변경으로 인해 포인트의 가감이 발생하는 경우\\n\\n회원관리 > 포인트관리에서 수작업으로 포인트를 맞추어 주셔야 합니다.", $url);
|
||||
else
|
||||
goto_url($url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,6 +354,14 @@ CREATE TABLE IF NOT EXISTS `g5_shop_default` (
|
||||
`de_inicis_iniapi_key` varchar(30) NOT NULL DEFAULT '',
|
||||
`de_inicis_iniapi_iv` varchar(30) NOT NULL DEFAULT '',
|
||||
`de_inicis_sign_key` varchar(255) NOT NULL DEFAULT '',
|
||||
`de_inicis_pro_use` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`de_inicis_hash_key` varchar(255) NOT NULL DEFAULT '',
|
||||
`de_inicis_pro_alert_use` tinyint(4) NOT NULL DEFAULT '1',
|
||||
`de_inicis_pro_reconcile_use` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`de_inicis_pro_log_days` int(11) NOT NULL DEFAULT '365',
|
||||
`de_inicis_pro_summary_days` int(11) NOT NULL DEFAULT '1825',
|
||||
`de_inicis_pro_monitor_at` datetime DEFAULT NULL,
|
||||
`de_inicis_pro_monitor_message` varchar(255) NOT NULL DEFAULT '',
|
||||
`de_iche_use` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`de_easy_pay_use` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`de_easy_pay_services` varchar(255) NOT NULL DEFAULT '',
|
||||
@@ -888,3 +896,92 @@ CREATE TABLE IF NOT EXISTS `g5_shop_inicis_log` (
|
||||
`is_mail_send` tinyint(4) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`oid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `g5_shop_inicis_pay`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `g5_shop_inicis_pay`;
|
||||
CREATE TABLE IF NOT EXISTS `g5_shop_inicis_pay` (
|
||||
`ip_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ip_oid` varchar(64) NOT NULL DEFAULT '',
|
||||
`ip_tid` varchar(80) NOT NULL DEFAULT '',
|
||||
`ip_auth_tid` varchar(80) NOT NULL DEFAULT '',
|
||||
`ip_mid` varchar(80) NOT NULL DEFAULT '',
|
||||
`ip_environment` varchar(10) NOT NULL DEFAULT '',
|
||||
`mb_id` varchar(20) NOT NULL DEFAULT '',
|
||||
`ip_amount` int(11) NOT NULL DEFAULT '0',
|
||||
`ip_pay_type` varchar(20) NOT NULL DEFAULT '',
|
||||
`ip_easy_pay` varchar(20) NOT NULL DEFAULT '',
|
||||
`ip_device` varchar(10) NOT NULL DEFAULT '',
|
||||
`ip_order_type` varchar(10) NOT NULL DEFAULT '',
|
||||
`ip_status` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_result_code` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_result_message` varchar(255) NOT NULL DEFAULT '',
|
||||
`ip_noti_status` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_noti_code` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_noti_message` varchar(255) NOT NULL DEFAULT '',
|
||||
`ip_noti_failed_count` int(11) NOT NULL DEFAULT '0',
|
||||
`ip_noti_at` datetime DEFAULT NULL,
|
||||
`ip_cancel_status` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_cancel_code` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_cancel_message` varchar(255) NOT NULL DEFAULT '',
|
||||
`ip_cancel_checked_at` datetime DEFAULT NULL,
|
||||
`ip_refund_required` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`ip_vbank_due_at` datetime DEFAULT NULL,
|
||||
`ip_expired_at` datetime DEFAULT NULL,
|
||||
`ip_order_exists` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`ip_approved_at` datetime DEFAULT NULL,
|
||||
`ip_ordered_at` datetime DEFAULT NULL,
|
||||
`ip_notified_at` datetime DEFAULT NULL,
|
||||
`ip_canceled_at` datetime DEFAULT NULL,
|
||||
`ip_created_at` datetime DEFAULT NULL,
|
||||
`ip_updated_at` datetime DEFAULT NULL,
|
||||
`ip_ip` varchar(45) NOT NULL DEFAULT '',
|
||||
`ip_event_count` int(11) NOT NULL DEFAULT '0',
|
||||
`ip_audit_error` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`ip_alerted_at` datetime DEFAULT NULL,
|
||||
`ip_alert_key` varchar(64) NOT NULL DEFAULT '',
|
||||
`ip_pg_status` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_pg_amount` int(11) NOT NULL DEFAULT '0',
|
||||
`ip_pg_tid` varchar(80) NOT NULL DEFAULT '',
|
||||
`ip_pg_result_code` varchar(30) NOT NULL DEFAULT '',
|
||||
`ip_pg_message` varchar(255) NOT NULL DEFAULT '',
|
||||
`ip_pg_checked_at` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`ip_id`),
|
||||
UNIQUE KEY `ip_oid` (`ip_oid`),
|
||||
KEY `ip_tid` (`ip_tid`),
|
||||
KEY `ip_auth_tid` (`ip_auth_tid`),
|
||||
KEY `ip_status` (`ip_status`),
|
||||
KEY `ip_noti_status` (`ip_noti_status`),
|
||||
KEY `ip_cancel_status` (`ip_cancel_status`),
|
||||
KEY `ip_refund_required` (`ip_refund_required`),
|
||||
KEY `ip_updated_at` (`ip_updated_at`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `g5_shop_inicis_pay_event`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `g5_shop_inicis_pay_event`;
|
||||
CREATE TABLE IF NOT EXISTS `g5_shop_inicis_pay_event` (
|
||||
`pe_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ip_oid` varchar(64) NOT NULL DEFAULT '',
|
||||
`ip_tid` varchar(80) NOT NULL DEFAULT '',
|
||||
`pe_stage` varchar(30) NOT NULL DEFAULT '',
|
||||
`pe_status` varchar(30) NOT NULL DEFAULT '',
|
||||
`pe_code` varchar(30) NOT NULL DEFAULT '',
|
||||
`pe_message` varchar(255) NOT NULL DEFAULT '',
|
||||
`pe_source` varchar(10) NOT NULL DEFAULT '',
|
||||
`pe_ip` varchar(45) NOT NULL DEFAULT '',
|
||||
`pe_created_at` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`pe_id`),
|
||||
KEY `ip_oid` (`ip_oid`),
|
||||
KEY `ip_tid` (`ip_tid`),
|
||||
KEY `pe_status` (`pe_status`),
|
||||
KEY `pe_created_at` (`pe_created_at`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -660,6 +660,8 @@ if($g5_shop_install) {
|
||||
install_file_write($f, "\$g5['g5_shop_post_log_table'] = G5_SHOP_TABLE_PREFIX.'order_post_log'; // 주문요청 로그 테이블\n");
|
||||
install_file_write($f, "\$g5['g5_shop_order_data_table'] = G5_SHOP_TABLE_PREFIX.'order_data'; // 모바일 결제정보 임시저장 테이블\n");
|
||||
install_file_write($f, "\$g5['g5_shop_inicis_log_table'] = G5_SHOP_TABLE_PREFIX.'inicis_log'; // 이니시스 모바일 계좌이체 로그 테이블\n");
|
||||
install_file_write($f, "\$g5['g5_shop_inicis_pay_table'] = G5_SHOP_TABLE_PREFIX.'inicis_pay'; // 이니시스 결제 처리 현황 테이블\n");
|
||||
install_file_write($f, "\$g5['g5_shop_inicis_pay_event_table'] = G5_SHOP_TABLE_PREFIX.'inicis_pay_event'; // 이니시스 결제 처리 이력 테이블\n");
|
||||
}
|
||||
|
||||
install_file_write($f, "?>");
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if (!empty($inicis_pro_use)) {
|
||||
require(G5_SHOP_PATH.'/inicis/pro/orderform.1.php');
|
||||
return;
|
||||
}
|
||||
|
||||
if(!function_exists('get_inicis_app_scheme')){
|
||||
function get_inicis_app_scheme(){
|
||||
$user_agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
@@ -56,4 +61,4 @@ if(!function_exists('get_inicis_app_scheme')){
|
||||
<input type="hidden" name="P_TAX" value="">
|
||||
<input type="hidden" name="P_TAXFREE" value="">
|
||||
<?php } ?>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
@@ -4,7 +4,7 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
require_once(G5_MSHOP_PATH.'/settle_'.$default['de_pg_service'].'.inc.php');
|
||||
require_once(G5_SHOP_PATH.'/settle_kakaopay.inc.php');
|
||||
|
||||
if( is_inicis_simple_pay() ){ //이니시스 삼성페이 또는 Lpay 사용시
|
||||
if( empty($inicis_pro_use) && is_inicis_simple_pay() ){ //이니시스 삼성페이 또는 Lpay 사용시
|
||||
require_once(G5_MSHOP_PATH.'/samsungpay/incSamsungpayCommon.php');
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ ob_end_clean();
|
||||
// 결제대행사별 코드 include (결제등록 필드)
|
||||
require_once(G5_MSHOP_PATH.'/'.$default['de_pg_service'].'/orderform.1.php');
|
||||
|
||||
if( is_inicis_simple_pay() ){ //이니시스 삼성페이 또는 lpay 사용시
|
||||
if( empty($inicis_pro_use) && is_inicis_simple_pay() ){ //이니시스 삼성페이 또는 lpay 사용시
|
||||
require_once(G5_MSHOP_PATH.'/samsungpay/orderform.1.php');
|
||||
}
|
||||
|
||||
@@ -698,18 +698,21 @@ if($is_kakaopay_use) {
|
||||
|
||||
//이니시스 삼성페이
|
||||
if($default['de_samsung_pay_use']) {
|
||||
$multi_settle++;
|
||||
echo '<li><input type="radio" id="od_settle_samsungpay" data-case="samsungpay" name="od_settle_case" value="삼성페이" '.$checked.'> <label for="od_settle_samsungpay" class="samsung_pay lb_icon">삼성페이</label></li>'.PHP_EOL;
|
||||
$checked = '';
|
||||
}
|
||||
|
||||
//이니시스 Lpay
|
||||
if($default['de_inicis_lpay_use']) {
|
||||
$multi_settle++;
|
||||
echo '<li><input type="radio" id="od_settle_inicislpay" data-case="lpay" name="od_settle_case" value="lpay" '.$checked.'> <label for="od_settle_inicislpay" class="inicis_lpay">L.pay</label></li>'.PHP_EOL;
|
||||
$checked = '';
|
||||
}
|
||||
|
||||
//이니시스 카카오페이
|
||||
if($default['de_inicis_kakaopay_use']) {
|
||||
$multi_settle++;
|
||||
echo '<li><input type="radio" id="od_settle_inicis_kakaopay" data-case="inicis_kakaopay" name="od_settle_case" value="inicis_kakaopay" '.$checked.'> <label for="od_settle_inicis_kakaopay" title="KG 이니시스 카카오페이" class="inicis_kakaopay">KG 이니시스 카카오페이</label></li>'.PHP_EOL;
|
||||
$checked = '';
|
||||
}
|
||||
@@ -770,7 +773,7 @@ if($is_kakaopay_use) {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if ($default['de_bank_use'] || $default['de_vbank_use'] || $default['de_iche_use'] || $default['de_card_use'] || $default['de_hp_use'] || $default['de_easy_pay_use'] || is_inicis_simple_pay() ) {
|
||||
if ($default['de_bank_use'] || $default['de_vbank_use'] || $default['de_iche_use'] || $default['de_card_use'] || $default['de_hp_use'] || $default['de_easy_pay_use'] || is_inicis_simple_pay()) {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
@@ -783,7 +786,7 @@ if($is_kakaopay_use) {
|
||||
// 결제대행사별 코드 include (결제대행사 정보 필드 및 주분버튼)
|
||||
require_once(G5_MSHOP_PATH.'/'.$default['de_pg_service'].'/orderform.2.php');
|
||||
|
||||
if( is_inicis_simple_pay() ){ //삼성페이 또는 L.pay 사용시
|
||||
if( empty($inicis_pro_use) && is_inicis_simple_pay() ){ //삼성페이 또는 L.pay 사용시
|
||||
require_once(G5_MSHOP_PATH.'/samsungpay/orderform.2.php');
|
||||
}
|
||||
|
||||
@@ -813,7 +816,7 @@ if($is_kakaopay_use) {
|
||||
// 결제대행사별 코드 include (에스크로 안내)
|
||||
require_once(G5_MSHOP_PATH.'/'.$default['de_pg_service'].'/orderform.3.php');
|
||||
|
||||
if( is_inicis_simple_pay() ){ //삼성페이 사용시
|
||||
if( empty($inicis_pro_use) && is_inicis_simple_pay() ){ //삼성페이 사용시
|
||||
require_once(G5_MSHOP_PATH.'/samsungpay/orderform.3.php');
|
||||
}
|
||||
}
|
||||
@@ -822,7 +825,7 @@ if($is_kakaopay_use) {
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if( is_inicis_simple_pay() ){ //삼성페이 사용시
|
||||
if( empty($inicis_pro_use) && is_inicis_simple_pay() ){ //삼성페이 사용시
|
||||
require_once(G5_MSHOP_PATH.'/samsungpay/order.script.php');
|
||||
}
|
||||
|
||||
@@ -1333,7 +1336,7 @@ function pay_approval()
|
||||
|
||||
var form_order_method = '';
|
||||
|
||||
if( settle_method == "삼성페이" || settle_method == "lpay" || settle_method == "inicis_kakaopay" ){
|
||||
if( (settle_method == "삼성페이" || settle_method == "lpay" || settle_method == "inicis_kakaopay") && <?php echo !empty($inicis_pro_use) ? 'false' : 'true'; ?> ){
|
||||
form_order_method = 'samsungpay';
|
||||
} else if(settle_method == "간편결제") {
|
||||
if(jQuery("input[name='od_settle_case']:checked" ).attr("data-pay") === "naverpay"){
|
||||
@@ -1479,6 +1482,7 @@ function pay_approval()
|
||||
f.windowTarget.value = 'self';
|
||||
|
||||
<?php } else if($default['de_pg_service'] == 'inicis') { ?>
|
||||
<?php if (empty($inicis_pro_use)) { ?>
|
||||
var paymethod = "";
|
||||
var width = 330;
|
||||
var height = 480;
|
||||
@@ -1535,6 +1539,7 @@ function pay_approval()
|
||||
<?php } ?>
|
||||
f.P_RETURN_URL.value = "<?php echo $return_url.$od_id; ?>";
|
||||
f.action = "https://mobile.inicis.com/smart/" + paymethod + "/";
|
||||
<?php } ?>
|
||||
<?php } else if($default['de_pg_service'] == 'nicepay') { ?>
|
||||
|
||||
f.Amt.value = f.good_mny.value;
|
||||
@@ -1636,6 +1641,10 @@ function pay_approval()
|
||||
return false;
|
||||
}
|
||||
|
||||
<?php if ($default['de_pg_service'] == 'inicis' && !empty($inicis_pro_use)) { ?>
|
||||
return inicis_pro_pay("<?php echo $od_id; ?>", "MOBILE");
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($default['de_pg_service'] == 'nicepay') { ?>
|
||||
nicepayStart(f);
|
||||
return false;
|
||||
@@ -1862,4 +1871,4 @@ $(function(){
|
||||
$("#od_hope_date").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true, yearRange: "c-99:c+99", minDate: "+<?php echo (int)$default['de_hope_date_after']; ?>d;", maxDate: "+<?php echo (int)$default['de_hope_date_after'] + 6; ?>d;" });
|
||||
});
|
||||
<?php } ?>
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -372,7 +372,10 @@ else if ($od_settle_case == "계좌이체")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_MSHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -404,7 +407,10 @@ else if ($od_settle_case == "가상계좌")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_MSHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -436,7 +442,10 @@ else if ($od_settle_case == "휴대폰")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_MSHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -466,7 +475,10 @@ else if ($od_settle_case == "신용카드")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_MSHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -498,7 +510,10 @@ else if ($od_settle_case == "간편결제")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_MSHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -523,7 +538,10 @@ else if ($od_settle_case == "간편결제")
|
||||
else if ( is_inicis_order_pay($od_settle_case) ) //이니시스의 삼성페이 또는 L.pay 또는 이니시스 카카오페이
|
||||
{
|
||||
// 이니시스에서만 지원
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
|
||||
$od_tno = $tno;
|
||||
$od_app_no = $app_no;
|
||||
@@ -751,6 +769,9 @@ if(!$result) {
|
||||
die('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>'.strtoupper($od_pg).'를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
|
||||
}
|
||||
|
||||
if (!empty($_POST['inicis_pro']) && function_exists('inicis_pro_audit_order_saved'))
|
||||
inicis_pro_audit_order_saved($od_id, $od_tno, 'order', 'mobile');
|
||||
|
||||
// 회원이면서 포인트를 사용했다면 포인트 테이블에 사용을 추가
|
||||
// 동시 주문 race condition 방지 — 회원 단위 GET_LOCK + 잔액 재조회
|
||||
if ($is_member && $od_receipt_point) {
|
||||
@@ -1013,7 +1034,7 @@ set_session('ss_orderview_uid', $uid);
|
||||
$sql = " delete from {$g5['g5_shop_order_data_table']} where od_id = '$od_id' and dt_pg = '$od_pg' ";
|
||||
sql_query($sql);
|
||||
|
||||
if( $od_pg == 'inicis' && $od_tno ){
|
||||
if( $od_pg == 'inicis' && $od_tno && empty($_POST['inicis_pro']) ){
|
||||
$sql = "delete from {$g5['g5_shop_inicis_log_table']} where oid = '$od_id' and P_TID = '$od_tno' ";
|
||||
sql_query($sql, false);
|
||||
}
|
||||
|
||||
@@ -230,6 +230,7 @@ function pay_approval()
|
||||
<?php } ?>
|
||||
f.windowTarget.value = 'self';
|
||||
<?php } else if($default['de_pg_service'] == 'inicis') { ?>
|
||||
<?php if (empty($inicis_pro_use)) { ?>
|
||||
var paymethod = "";
|
||||
var width = 330;
|
||||
var height = 480;
|
||||
@@ -261,6 +262,7 @@ function pay_approval()
|
||||
<?php } ?>
|
||||
f.P_RETURN_URL.value = "<?php echo $return_url.$pp_id; ?>";
|
||||
f.action = "https://mobile.inicis.com/smart/" + paymethod + "/";
|
||||
<?php } ?>
|
||||
<?php } else if($default['de_pg_service'] == 'nicepay') { ?>
|
||||
|
||||
f.Amt.value = f.good_mny.value;
|
||||
@@ -330,6 +332,10 @@ function pay_approval()
|
||||
alert(save_result);
|
||||
return false;
|
||||
}
|
||||
|
||||
<?php if ($default['de_pg_service'] == 'inicis' && !empty($inicis_pro_use)) { ?>
|
||||
return inicis_pro_pay("<?php echo $od_id; ?>", "MOBILE");
|
||||
<?php } ?>
|
||||
|
||||
<?php if($default['de_pg_service'] == 'nicepay') { ?>
|
||||
nicepayStart(f);
|
||||
@@ -421,4 +427,4 @@ function payment_check(f)
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -69,7 +69,10 @@ if ($pp_settle_case == "계좌이체")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_MSHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -97,7 +100,10 @@ else if ($pp_settle_case == "가상계좌")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_MSHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -126,7 +132,10 @@ else if ($pp_settle_case == "휴대폰")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_MSHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -152,7 +161,10 @@ else if ($pp_settle_case == "신용카드")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_MSHOP_PATH.'/inicis/pay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_MSHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -237,7 +249,7 @@ if(!$result) {
|
||||
break;
|
||||
}
|
||||
|
||||
die("<p>$sql<p>" . sql_error_info() . "<p>error file : {$_SERVER['SCRIPT_NAME']}");
|
||||
die('개인결제 정보를 처리하는 중 오류가 발생했습니다. 결제 취소 여부를 관리자에게 문의해 주십시오.');
|
||||
}
|
||||
|
||||
// 주문번호가 있으면 결제정보 반영
|
||||
@@ -281,7 +293,7 @@ if($pp_receipt_price > 0 && $pp['pp_id'] && $pp['od_id']) {
|
||||
break;
|
||||
}
|
||||
|
||||
die("<p>$sql<p>" . sql_error_info() . "<p>error file : {$_SERVER['SCRIPT_NAME']}");
|
||||
die('주문 결제정보를 처리하는 중 오류가 발생했습니다. 결제 취소 여부를 관리자에게 문의해 주십시오.');
|
||||
}
|
||||
|
||||
// 미수금 정보 업데이트
|
||||
@@ -304,6 +316,9 @@ if($pp_receipt_price > 0 && $pp['pp_id'] && $pp['od_id']) {
|
||||
}
|
||||
|
||||
// 주문 정보 임시 데이터 삭제
|
||||
if (!empty($_POST['inicis_pro']) && function_exists('inicis_pro_audit_order_saved'))
|
||||
inicis_pro_audit_order_saved($pp['pp_id'], $pp_tno, 'personal', 'mobile');
|
||||
|
||||
$sql = " delete from {$g5['g5_shop_order_data_table']} where od_id = '{$pp['pp_id']}' and dt_pg = '$pp_pg' ";
|
||||
sql_query($sql);
|
||||
|
||||
@@ -321,4 +336,4 @@ if( $is_noti_pay ){
|
||||
return;
|
||||
}
|
||||
|
||||
goto_url(G5_SHOP_URL.'/personalpayresult.php?pp_id='.$pp['pp_id'].'&uid='.$uid);
|
||||
goto_url(G5_SHOP_URL.'/personalpayresult.php?pp_id='.$pp['pp_id'].'&uid='.$uid);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
define('G5_MOBILE_INICIS_SETTLE', true);
|
||||
$inicis_pro_use = isset($default['de_inicis_pro_use']) && (int) $default['de_inicis_pro_use'] === 1;
|
||||
|
||||
// curl 체크
|
||||
if (!function_exists('curl_init')) {
|
||||
@@ -108,7 +109,9 @@ $inicis_cardpoint = $default['de_inicis_cartpoint_use'] ? '&cp_yn=Y' : '';
|
||||
//$inicis_cardpoint .= ''; // &merc_noint=Y&noint_quota=카드사코드-개월:개월^추가카드사코드-개월:개월:개월 형식으로 설정
|
||||
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/inicis_youngcart_fn.php');
|
||||
if ($inicis_pro_use)
|
||||
require_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
|
||||
$noti_url = G5_MSHOP_URL.'/inicis/settle_common.php';
|
||||
$next_url = G5_MSHOP_URL.'/inicis/pay_approval.php';
|
||||
$return_url = G5_MSHOP_URL.'/inicis/pay_return.php?oid=';
|
||||
$return_url = G5_MSHOP_URL.'/inicis/pay_return.php?oid=';
|
||||
|
||||
@@ -126,6 +126,22 @@ define('G5_OD_STATUS_FINISH' , '배송완료');
|
||||
'품절' : 주문이나 입금후 상품의 품절된 상태를 나타냅니다.
|
||||
*/
|
||||
|
||||
// KG이니시스 PRO 경량 운영 감시
|
||||
// 서버 작업 스케줄러 없이 사이트 접속(GET) 흐름에서 주기적으로 실행한다.
|
||||
// $default 는 이미 로드되어 있어 평상시에는 추가 조회 없이 시각만 비교한다.
|
||||
// 실제 감시는 응답 종료 후 잠금 대기 없이 처리하므로 방문자 페이지에 영향을 주지 않는다.
|
||||
if (!empty($default['de_inicis_pro_use'])
|
||||
&& isset($default['de_pg_service']) && $default['de_pg_service'] === 'inicis'
|
||||
&& PHP_SAPI !== 'cli'
|
||||
&& isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'GET'
|
||||
&& array_key_exists('de_inicis_pro_monitor_at', $default)
|
||||
&& (empty($default['de_inicis_pro_monitor_at'])
|
||||
|| $default['de_inicis_pro_monitor_at'] < date('Y-m-d H:i:s', G5_SERVER_TIME - 600))) {
|
||||
include_once(G5_ADMIN_PATH.'/shop_admin/admin.shop.lib.php');
|
||||
if (function_exists('check_order_inicis_pro_payments_inline'))
|
||||
register_shutdown_function('check_order_inicis_pro_payments_inline');
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// 쇼핑몰 필수 실행코드 모음 끝
|
||||
//==============================================================================;
|
||||
@@ -111,7 +111,8 @@ curl_setopt($ch, CURLOPT_URL, $url); // 전
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 요청 결과를 문자열로 반환
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); // connection timeout 10초
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); // POST data
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // (※ 로컬 테스트에서만 사용) 원격 서버의 인증서가 유효한지 검사 안함
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); // 원격 서버 인증서 검증
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 인증서 호스트명 검증
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded; charset=utf-8')); // 전송헤더 설정
|
||||
curl_setopt($ch, CURLOPT_POST, 1); // post 전송
|
||||
|
||||
|
||||
@@ -23,6 +23,56 @@ if($cancelFlag == "true")
|
||||
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
|
||||
$pro_oid = '';
|
||||
$pro_audit_values = array();
|
||||
$pro_cancel_needs_fallback = false;
|
||||
|
||||
// INIpay PRO 승인 직후 주문 DB 저장에 실패한 경우에는 인증 TID로 망취소한다.
|
||||
// 망취소가 실패하면 아래의 기존 INIAPI 취소를 보조 경로로 계속 시도한다.
|
||||
if (!empty($_POST['inicis_pro'])) {
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
|
||||
$pro_oid = isset($_POST['inicis_pro_oid']) ? inicis_pro_clean_oid($_POST['inicis_pro_oid']) : inicis_pro_clean_oid(get_session('ss_order_id'));
|
||||
$pro_log = inicis_pro_get_log($pro_oid);
|
||||
$pro_data = isset($pro_log['pro_data']) && is_array($pro_log['pro_data']) ? $pro_log['pro_data'] : array();
|
||||
$pro_auth_tid = isset($pro_data['P_AUTH_TID']) ? inicis_pro_clean_tid($pro_data['P_AUTH_TID']) : '';
|
||||
$pro_idc = isset($pro_data['P_IDCNAME']) ? strtolower($pro_data['P_IDCNAME']) : '';
|
||||
$pro_mid = isset($pro_data['P_MID']) ? $pro_data['P_MID'] : '';
|
||||
$pro_amount = isset($pro_data['P_AMT']) ? (int) $pro_data['P_AMT'] : 0;
|
||||
$pro_tid = isset($pro_data['P_APPL_TID']) ? inicis_pro_clean_tid($pro_data['P_APPL_TID']) : '';
|
||||
$pro_audit_values = array(
|
||||
'tid' => $pro_tid,
|
||||
'auth_tid' => $pro_auth_tid,
|
||||
'mid' => $pro_mid,
|
||||
'amount' => $pro_amount,
|
||||
'pay_type' => isset($pro_data['P_TYPE']) ? $pro_data['P_TYPE'] : '',
|
||||
'device' => isset($pro_data['__device']) ? $pro_data['__device'] : '',
|
||||
'source' => 'system',
|
||||
'message' => '주문 저장 이후 DB 처리 오류로 자동 취소를 요청했습니다.'
|
||||
);
|
||||
|
||||
$pro_pay_type = isset($pro_data['P_TYPE']) ? $pro_data['P_TYPE'] : null;
|
||||
if ($pro_oid !== '' && $pro_auth_tid !== '' && $pro_mid === inicis_pro_get_mid($pro_pay_type) && $pro_amount > 0) {
|
||||
inicis_pro_audit_write($pro_oid, 'cancel', 'cancel_requested', $pro_audit_values);
|
||||
$pro_cancel = inicis_pro_net_cancel($pro_idc, $pro_mid, $pro_auth_tid, $pro_amount, $pro_oid, isset($cancel_msg) ? $cancel_msg : 'DB FAIL', $pro_pay_type);
|
||||
if (!empty($pro_cancel['success'])) {
|
||||
sql_query(" update {$g5['g5_shop_inicis_log_table']}
|
||||
set P_STATUS = 'cancel',
|
||||
P_AUTH_DT = '".preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS)."',
|
||||
P_RMESG1 = 'INIpay PRO net-cancel success'
|
||||
where oid = '".sql_escape_string($pro_oid)."' ", false);
|
||||
$pro_audit_values['code'] = isset($pro_cancel['data']['P_STATUS']) ? $pro_cancel['data']['P_STATUS'] : '00';
|
||||
$pro_audit_values['message'] = '주문 DB 처리 실패 후 망취소 완료';
|
||||
inicis_pro_audit_write($pro_oid, 'cancel', 'canceled', $pro_audit_values);
|
||||
return;
|
||||
}
|
||||
|
||||
$pro_cancel_needs_fallback = true;
|
||||
$pro_audit_values['message'] = '망취소 결과를 확인하지 못해 INIAPI 취소를 시도합니다.';
|
||||
inicis_pro_audit_write($pro_oid, 'cancel', 'cancel_requested', $pro_audit_values);
|
||||
}
|
||||
}
|
||||
|
||||
if( get_session('ss_order_id') && $tno ){
|
||||
|
||||
$ini_oid = preg_replace('/[^a-z0-9_\-]/i', '', get_session('ss_order_id'));
|
||||
@@ -53,9 +103,28 @@ if($cancelFlag == "true")
|
||||
$args = array(
|
||||
'paymethod' => $ini_paymethod,
|
||||
'tid' => $tno,
|
||||
'msg' => 'DB FAIL' // 취소사유
|
||||
'msg' => 'DB FAIL', // 취소사유
|
||||
'audit' => false
|
||||
);
|
||||
|
||||
$response = inicis_tid_cancel($args);
|
||||
|
||||
if ($pro_oid !== '' && $pro_cancel_needs_fallback) {
|
||||
$result_code = '';
|
||||
if (is_string($response) && preg_match('/["\']resultCode["\']\s*:\s*["\']([^"\']+)["\']/', $response, $matches))
|
||||
$result_code = inicis_pro_cut($matches[1], 30);
|
||||
|
||||
$pro_audit_values['code'] = $result_code;
|
||||
if ($result_code === '00') {
|
||||
$pro_audit_values['message'] = 'INIAPI 보조 취소 완료';
|
||||
inicis_pro_audit_write($pro_oid, 'cancel', 'canceled', $pro_audit_values);
|
||||
} else {
|
||||
$pro_audit_values['message'] = '자동 취소 결과를 확인하지 못했습니다. 상점관리자 확인이 필요합니다.';
|
||||
inicis_pro_audit_write($pro_oid, 'cancel', 'cancel_failed', $pro_audit_values);
|
||||
}
|
||||
}
|
||||
} elseif ($pro_oid !== '' && $pro_cancel_needs_fallback) {
|
||||
$pro_audit_values['message'] = '자동 취소수단을 확인하지 못했습니다. 상점관리자 확인이 필요합니다.';
|
||||
inicis_pro_audit_write($pro_oid, 'cancel', 'cancel_failed', $pro_audit_values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,19 +87,97 @@ function inicis_tid_cancel($args, $is_part=false){
|
||||
);
|
||||
}
|
||||
|
||||
$url = "https://iniapi.inicis.com/api/v1/refund";
|
||||
$url = !empty($args['url']) ? $args['url'] : (!empty($default['de_card_test']) ? 'https://stginiapi.inicis.com/api/v1/refund' : 'https://iniapi.inicis.com/api/v1/refund');
|
||||
if (!function_exists('json_encode'))
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/json_lib.php');
|
||||
if (!in_array($url, array('https://iniapi.inicis.com/api/v1/refund', 'https://stginiapi.inicis.com/api/v1/refund')))
|
||||
return json_encode(array('resultCode' => 'INVALID_ENDPOINT', 'resultMsg' => 'Invalid INIAPI endpoint'));
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded; charset=utf-8'));
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
$audit_row = array();
|
||||
$audit_values = array();
|
||||
if (!isset($args['audit']) || $args['audit']) {
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
if (function_exists('inicis_pro_audit_tables') && function_exists('inicis_pro_audit_write')) {
|
||||
$tables = inicis_pro_audit_tables();
|
||||
$audit_tid = inicis_pro_clean_tid($tid);
|
||||
$audit_oid = isset($args['audit_oid']) ? inicis_pro_clean_oid($args['audit_oid']) : '';
|
||||
$audit_where = $audit_oid !== ''
|
||||
? "ip_oid = '".sql_escape_string($audit_oid)."' and ip_tid = '".sql_escape_string($audit_tid)."'"
|
||||
: "ip_tid = '".sql_escape_string($audit_tid)."'";
|
||||
$audit_row = $audit_tid !== '' ? sql_fetch(" select * from `{$tables['summary']}` where $audit_where order by ip_id desc limit 1 ", false) : array();
|
||||
if (!empty($audit_row['ip_oid'])) {
|
||||
$audit_source = isset($args['audit_source']) && in_array($args['audit_source'], array('web', 'admin', 'system')) ? $args['audit_source'] : 'system';
|
||||
$audit_actor = $audit_source === 'web' ? '주문자' : ($audit_source === 'admin' ? '관리자' : '시스템');
|
||||
$audit_values = array(
|
||||
'tid' => $audit_tid,
|
||||
'auth_tid' => isset($audit_row['ip_auth_tid']) ? $audit_row['ip_auth_tid'] : '',
|
||||
'mid' => isset($audit_row['ip_mid']) ? $audit_row['ip_mid'] : '',
|
||||
'environment' => isset($audit_row['ip_environment']) ? $audit_row['ip_environment'] : '',
|
||||
'amount' => isset($audit_row['ip_amount']) ? (int) $audit_row['ip_amount'] : 0,
|
||||
'pay_type' => isset($audit_row['ip_pay_type']) ? $audit_row['ip_pay_type'] : '',
|
||||
'easy_pay' => isset($audit_row['ip_easy_pay']) ? $audit_row['ip_easy_pay'] : '',
|
||||
'device' => isset($audit_row['ip_device']) ? $audit_row['ip_device'] : '',
|
||||
'order_type' => isset($audit_row['ip_order_type']) ? $audit_row['ip_order_type'] : '',
|
||||
'source' => $audit_source,
|
||||
'message' => $is_part ? $audit_actor.' 부분취소 요청' : $audit_actor.' 전체취소 요청'
|
||||
);
|
||||
if ($is_part)
|
||||
$audit_values['event_only'] = '1';
|
||||
inicis_pro_audit_write($audit_row['ip_oid'], 'cancel', 'cancel_requested', $audit_values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
$response = '';
|
||||
$request_environment = strpos($url, 'stginiapi.') !== false ? 'test' : 'live';
|
||||
if (!empty($audit_row['ip_oid'])) {
|
||||
$audit_environment = !empty($audit_row['ip_environment']) ? $audit_row['ip_environment'] : $request_environment;
|
||||
if ((!empty($audit_row['ip_mid']) && $audit_row['ip_mid'] !== $mid) || $audit_environment !== $request_environment)
|
||||
$response = json_encode(array('resultCode' => 'TRANSACTION_CONFIG_MISMATCH', 'resultMsg' => '거래 당시 MID 또는 결제환경과 현재 취소 설정이 다릅니다.'));
|
||||
}
|
||||
|
||||
if ($response === '') {
|
||||
$ch = curl_init();
|
||||
if (!$ch) {
|
||||
$response = json_encode(array('resultCode' => 'COMMUNICATION_FAILED', 'resultMsg' => 'cURL 초기화 실패'));
|
||||
} else {
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded; charset=utf-8'));
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$curl_error = curl_error($ch);
|
||||
$http_status = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
if ($response === false || $http_status < 200 || $http_status >= 300) {
|
||||
$error_message = $curl_error !== '' ? $curl_error : 'HTTP '.$http_status;
|
||||
$response = json_encode(array('resultCode' => 'COMMUNICATION_FAILED', 'resultMsg' => substr($error_message, 0, 150)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// INIpay PRO 거래는 관리자 취소 결과도 단계별 결제 이력에 남긴다.
|
||||
if (!empty($audit_row['ip_oid'])) {
|
||||
if (!function_exists('json_decode'))
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/json_lib.php');
|
||||
$result_data = json_decode($response, true);
|
||||
$result_code = is_array($result_data) && isset($result_data['resultCode']) ? inicis_pro_cut($result_data['resultCode'], 30) : 'INVALID_RESPONSE';
|
||||
$result_message = is_array($result_data) && isset($result_data['resultMsg']) ? inicis_pro_cut($result_data['resultMsg'], 180) : '';
|
||||
$audit_success = $result_code === '00';
|
||||
$audit_values['code'] = $result_code;
|
||||
$audit_values['message'] = $is_part ? ($audit_success ? $audit_actor.' 부분취소 완료' : $audit_actor.' 부분취소 결과 확인 필요') : ($audit_success ? $audit_actor.' 전체취소 완료' : $audit_actor.' 전체취소 결과 확인 필요');
|
||||
if ($result_message !== '')
|
||||
$audit_values['message'] .= ' - '.$result_message;
|
||||
|
||||
inicis_pro_audit_write($audit_row['ip_oid'], 'cancel', $is_part ? ($audit_success ? 'partial_canceled' : 'partial_cancel_failed') : ($audit_success ? 'canceled' : 'cancel_failed'), $audit_values);
|
||||
}
|
||||
|
||||
//step3. 요청 결과
|
||||
return $response;
|
||||
@@ -131,4 +209,4 @@ function get_type_inicis_paymethod($od_settle_case){
|
||||
}
|
||||
|
||||
return $ini_paymethod;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if (!empty($inicis_pro_use)) {
|
||||
require(G5_SHOP_PATH.'/inicis/pro/orderform.1.php');
|
||||
return;
|
||||
}
|
||||
|
||||
// 전자결제를 사용할 때만 실행
|
||||
if($default['de_iche_use'] || $default['de_vbank_use'] || $default['de_hp_use'] || $default['de_card_use'] || $default['de_easy_pay_use']) {
|
||||
add_javascript('<script language="javascript" type="text/javascript" src="'.$stdpay_js_url.'" charset="UTF-8"></script>', 10);
|
||||
@@ -39,4 +44,4 @@ function paybtn(f) {
|
||||
INIStdPay.pay(f.id);
|
||||
}
|
||||
</script>
|
||||
<?php }
|
||||
<?php }
|
||||
|
||||
@@ -18,6 +18,8 @@ $taxfree = (int)$free_mny;
|
||||
$args = array(
|
||||
'paymethod' => get_type_inicis_paymethod($od['od_settle_case']),
|
||||
'tid' => $od['od_tno'],
|
||||
'audit_oid' => $od['od_id'],
|
||||
'audit_source' => 'admin',
|
||||
'msg' => $od['od_id'].' '.$mod_memo,
|
||||
'price' => $price,
|
||||
'confirmPrice' => $confirm_price,
|
||||
@@ -30,14 +32,13 @@ $result = json_decode($response, true);
|
||||
|
||||
if(isset($result['resultCode']) && $result['resultCode'] == '00') {
|
||||
// 환불금액기록
|
||||
$tno = $result['prtcTid'];
|
||||
$re_price = $result['prtcPrice'];
|
||||
$re_price = (int) $result['prtcPrice'];
|
||||
|
||||
$sql = " update {$g5['g5_shop_order_table']}
|
||||
set od_refund_price = od_refund_price + '$re_price',
|
||||
od_shop_memo = concat(od_shop_memo, \"$mod_memo\")
|
||||
where od_id = '{$od['od_id']}'
|
||||
and od_tno = '$tno' ";
|
||||
and od_tno = '{$od['od_tno']}' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 미수금 등의 정보 업데이트
|
||||
@@ -56,4 +57,4 @@ $result = json_decode($response, true);
|
||||
} else {
|
||||
alert('curl 오류로 부분환불에 실패했습니다.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
include_once('../../../common.php');
|
||||
|
||||
if (!defined('G5_USE_SHOP') || !G5_USE_SHOP)
|
||||
die('<p>쇼핑몰 설치 후 이용해 주십시오.</p>');
|
||||
|
||||
define('_SHOP_', true);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
// 웹 요청으로는 실행하지 않고 서버 작업 스케줄러의 PHP CLI에서만 실행한다.
|
||||
if (PHP_SAPI !== 'cli') {
|
||||
if (!headers_sent())
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('G5_SET_TIME_LIMIT'))
|
||||
define('G5_SET_TIME_LIMIT', 120);
|
||||
|
||||
$root_path = dirname(dirname(dirname(dirname(__FILE__))));
|
||||
$monitor_host = 'localhost';
|
||||
$monitor_https = false;
|
||||
$monitor_client_ip = '';
|
||||
$monitor_no_external = false;
|
||||
if (isset($argv) && is_array($argv)) {
|
||||
foreach ($argv as $argument) {
|
||||
if (preg_match('/^--host=([A-Za-z0-9.-]+)(:[0-9]+)?$/', $argument, $matches))
|
||||
$monitor_host = $matches[1].(isset($matches[2]) ? $matches[2] : '');
|
||||
elseif ($argument === '--https')
|
||||
$monitor_https = true;
|
||||
elseif (preg_match('/^--client-ip=([0-9.]+)$/', $argument, $matches) && ip2long($matches[1]) !== false)
|
||||
$monitor_client_ip = $matches[1];
|
||||
elseif ($argument === '--no-external')
|
||||
$monitor_no_external = true;
|
||||
}
|
||||
}
|
||||
$_SERVER['HTTP_HOST'] = $monitor_host;
|
||||
$_SERVER['SERVER_NAME'] = $monitor_host;
|
||||
$_SERVER['SERVER_PORT'] = $monitor_https ? '443' : '80';
|
||||
if ($monitor_https)
|
||||
$_SERVER['HTTPS'] = 'on';
|
||||
$_SERVER['REQUEST_URI'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
|
||||
$_SERVER['SCRIPT_NAME'] = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '/shop/inicis/pro/monitor.php';
|
||||
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['SERVER_ADDR'] = $monitor_client_ip !== '' ? $monitor_client_ip : (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '127.0.0.1');
|
||||
|
||||
chdir($root_path);
|
||||
include_once($root_path.'/common.php');
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
include_once(G5_ADMIN_PATH.'/shop_admin/admin.shop.lib.php');
|
||||
|
||||
if ($monitor_no_external) {
|
||||
$default['de_inicis_pro_reconcile_use'] = 0;
|
||||
$default['de_inicis_pro_alert_use'] = 0;
|
||||
}
|
||||
|
||||
if (!inicis_pro_is_enabled()) {
|
||||
echo "INIpay PRO is disabled.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$monitor_ran = check_order_inicis_pro_payments();
|
||||
if (!$monitor_ran) {
|
||||
echo "INIpay PRO monitor is already running.\n";
|
||||
exit;
|
||||
}
|
||||
$monitor = sql_fetch(" select de_inicis_pro_monitor_at, de_inicis_pro_monitor_message from {$g5['g5_shop_default_table']} limit 1 ", false);
|
||||
echo (!empty($monitor['de_inicis_pro_monitor_at']) ? $monitor['de_inicis_pro_monitor_at'].' ' : '').(!empty($monitor['de_inicis_pro_monitor_message']) ? $monitor['de_inicis_pro_monitor_message'] : 'monitor completed')."\n";
|
||||
@@ -0,0 +1,411 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
|
||||
@header('Content-Type: text/plain; charset=UTF-8');
|
||||
@header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
|
||||
if (!function_exists('inicis_pro_noti_result')) {
|
||||
function inicis_pro_noti_result($success, $lock_name)
|
||||
{
|
||||
inicis_pro_unlock($lock_name);
|
||||
echo $success ? 'OK' : 'FAIL';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_pro_noti_fail')) {
|
||||
function inicis_pro_noti_fail($code, $oid, $lock_name)
|
||||
{
|
||||
$oid = inicis_pro_clean_oid($oid);
|
||||
if ($oid !== '') {
|
||||
inicis_pro_audit_write($oid, 'notification', 'notification_failed', array(
|
||||
'event_only' => '1',
|
||||
'source' => 'server',
|
||||
'device' => 'SERVER',
|
||||
'remote_ip' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '',
|
||||
'code' => $code,
|
||||
'message' => '가상계좌 통보 검증 실패'
|
||||
));
|
||||
}
|
||||
|
||||
inicis_pro_noti_result(false, $lock_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_pro_noti_time')) {
|
||||
function inicis_pro_noti_time($auth_date)
|
||||
{
|
||||
$auth_date = preg_replace('/[^0-9]/', '', (string) $auth_date);
|
||||
if (strlen($auth_date) === 12)
|
||||
$auth_date = '20'.$auth_date;
|
||||
if (strlen($auth_date) !== 14)
|
||||
return '';
|
||||
|
||||
return substr($auth_date, 0, 4).'-'.substr($auth_date, 4, 2).'-'.substr($auth_date, 6, 2)
|
||||
.' '.substr($auth_date, 8, 2).':'.substr($auth_date, 10, 2).':'.substr($auth_date, 12, 2);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_pro_noti_saved_device')) {
|
||||
function inicis_pro_noti_saved_device($noti, $pro_log, $pro_data)
|
||||
{
|
||||
if (!isset($pro_log['P_STATUS']) || $pro_log['P_STATUS'] !== '00'
|
||||
|| empty($pro_data['__pro']) || $pro_data['__pro'] !== '1'
|
||||
|| !isset($pro_data['P_NOTI']) || !inicis_pro_equals($pro_data['P_NOTI'], $noti))
|
||||
return '';
|
||||
|
||||
$device = isset($pro_data['__device']) ? strtoupper((string) $pro_data['__device']) : '';
|
||||
|
||||
return in_array($device, array('WEB', 'MOBILE'), true) ? $device : '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_pro_noti_approved_payment_exists')) {
|
||||
function inicis_pro_noti_approved_payment_exists($oid, $tid, $mid, $amount, $pay_type, $pro_log, $pro_data)
|
||||
{
|
||||
global $g5;
|
||||
|
||||
if (!isset($pro_log['P_STATUS']) || $pro_log['P_STATUS'] !== '00'
|
||||
|| empty($pro_data['__pro']) || $pro_data['__pro'] !== '1'
|
||||
|| !isset($pro_data['P_MID']) || $pro_data['P_MID'] !== $mid
|
||||
|| !isset($pro_data['P_OID']) || $pro_data['P_OID'] !== $oid
|
||||
|| !isset($pro_data['P_AMT']) || (int) $pro_data['P_AMT'] !== $amount
|
||||
|| !isset($pro_data['P_TYPE']) || strtoupper($pro_data['P_TYPE']) !== $pay_type
|
||||
|| !isset($pro_data['P_APPL_TID']) || inicis_pro_clean_tid($pro_data['P_APPL_TID']) !== $tid
|
||||
|| $pro_data['P_APPL_TID'] !== $tid)
|
||||
return false;
|
||||
|
||||
$oid_sql = sql_escape_string($oid);
|
||||
$tid_sql = sql_escape_string($tid);
|
||||
$order = sql_fetch(" select od_id, od_receipt_price
|
||||
from {$g5['g5_shop_order_table']}
|
||||
where od_id = '$oid_sql'
|
||||
and od_tno = '$tid_sql'
|
||||
and od_pg = 'inicis' ");
|
||||
if (!empty($order['od_id']) && (int) $order['od_receipt_price'] === $amount)
|
||||
return true;
|
||||
|
||||
$personal = sql_fetch(" select pp_id, pp_receipt_price
|
||||
from {$g5['g5_shop_personalpay_table']}
|
||||
where pp_id = '$oid_sql'
|
||||
and pp_tno = '$tid_sql'
|
||||
and pp_pg = 'inicis'
|
||||
and pp_use = '1' ");
|
||||
|
||||
return !empty($personal['pp_id']) && (int) $personal['pp_receipt_price'] === $amount;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_pro_noti_save_audit')) {
|
||||
function inicis_pro_noti_save_audit($oid, $status, $auth_date, $remote_ip, $payment_status, $payment_message)
|
||||
{
|
||||
$log = inicis_pro_get_log($oid);
|
||||
$data = isset($log['pro_data']) && is_array($log['pro_data']) ? $log['pro_data'] : array();
|
||||
if (empty($data['__pro']) || $data['__pro'] !== '1')
|
||||
return false;
|
||||
|
||||
$data['__noti_status'] = $status;
|
||||
$data['__noti_auth_dt'] = preg_replace('/[^0-9]/', '', (string) $auth_date);
|
||||
$data['__noti_received_at'] = G5_TIME_YMDHIS;
|
||||
$data['__noti_ip'] = $remote_ip;
|
||||
if (!empty($_POST['P_IN_TID']))
|
||||
$data['P_IN_TID'] = inicis_pro_clean_tid($_POST['P_IN_TID']);
|
||||
|
||||
$saved = inicis_pro_save_log($data);
|
||||
$audit_saved = false;
|
||||
if ($saved) {
|
||||
$audit_saved = inicis_pro_audit_write($oid, 'notification', $payment_status, array(
|
||||
'tid' => isset($data['P_APPL_TID']) ? $data['P_APPL_TID'] : '',
|
||||
'auth_tid' => isset($data['P_AUTH_TID']) ? $data['P_AUTH_TID'] : '',
|
||||
'mid' => isset($data['P_MID']) ? $data['P_MID'] : '',
|
||||
'amount' => isset($data['P_AMT']) ? (int) $data['P_AMT'] : 0,
|
||||
'pay_type' => 'VBANK',
|
||||
'device' => 'SERVER',
|
||||
'source' => 'server',
|
||||
'remote_ip' => $remote_ip,
|
||||
'code' => $status,
|
||||
'refund_required' => $payment_status === 'paid_after_cancel' ? '1' : '',
|
||||
'message' => $payment_message
|
||||
));
|
||||
}
|
||||
|
||||
return $saved && $audit_saved;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] !== 'POST')
|
||||
inicis_pro_noti_result(false, '');
|
||||
|
||||
$remote_ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
|
||||
$allowed_ips = inicis_pro_noti_allowed_ips();
|
||||
if (!in_array($remote_ip, $allowed_ips, true))
|
||||
inicis_pro_noti_result(false, '');
|
||||
|
||||
$status = isset($_POST['P_STATUS']) ? trim((string) $_POST['P_STATUS']) : '';
|
||||
$mid = isset($_POST['P_MID']) ? trim((string) $_POST['P_MID']) : '';
|
||||
$oid_raw = isset($_POST['P_OID']) ? trim((string) $_POST['P_OID']) : '';
|
||||
$oid = inicis_pro_clean_oid($oid_raw);
|
||||
$tid_raw = isset($_POST['P_TID']) ? trim((string) $_POST['P_TID']) : '';
|
||||
$tid = inicis_pro_clean_tid($tid_raw);
|
||||
$amount_raw = isset($_POST['P_AMT']) ? trim((string) $_POST['P_AMT']) : '';
|
||||
$pay_type = isset($_POST['P_TYPE']) ? strtoupper(trim((string) $_POST['P_TYPE'])) : '';
|
||||
$noti = isset($_POST['P_NOTI']) ? trim((string) $_POST['P_NOTI']) : '';
|
||||
$auth_date = isset($_POST['P_AUTH_DT']) ? $_POST['P_AUTH_DT'] : '';
|
||||
$hashkey = inicis_pro_get_hashkey($pay_type);
|
||||
$amount = preg_match('/^[0-9]+$/', $amount_raw) ? (int) $amount_raw : 0;
|
||||
$pro_log = array();
|
||||
$pro_data = array();
|
||||
if ($oid !== '' && $oid === $oid_raw) {
|
||||
$pro_log = inicis_pro_get_log($oid);
|
||||
$pro_data = isset($pro_log['pro_data']) && is_array($pro_log['pro_data']) ? $pro_log['pro_data'] : array();
|
||||
}
|
||||
|
||||
$expected_mid = inicis_pro_get_mid($pay_type);
|
||||
if (isset($pro_log['P_STATUS']) && $pro_log['P_STATUS'] === '00'
|
||||
&& !empty($pro_data['__pro']) && $pro_data['__pro'] === '1' && !empty($pro_data['P_MID']))
|
||||
$expected_mid = trim((string) $pro_data['P_MID']);
|
||||
|
||||
if ($mid === '')
|
||||
inicis_pro_noti_fail('MID_EMPTY', $oid, '');
|
||||
if ($mid !== $expected_mid)
|
||||
inicis_pro_noti_fail('MID_MISMATCH', $oid, '');
|
||||
if ($oid === '' || $oid !== $oid_raw)
|
||||
inicis_pro_noti_fail('OID_INVALID', $oid, '');
|
||||
if ($tid === '' || $tid !== $tid_raw)
|
||||
inicis_pro_noti_fail('TID_INVALID', $oid, '');
|
||||
if ($amount <= 0)
|
||||
inicis_pro_noti_fail('AMOUNT_INVALID', $oid, '');
|
||||
if ($pay_type === '' || !preg_match('/^[A-Z0-9_]+$/', $pay_type))
|
||||
inicis_pro_noti_fail('TYPE_INVALID', $oid, '');
|
||||
|
||||
$device = inicis_pro_noti_saved_device($noti, $pro_log, $pro_data);
|
||||
if ($device === '' && $hashkey !== '')
|
||||
$device = inicis_pro_check_noti($noti, $oid, $amount, $hashkey);
|
||||
if ($device === '' && $hashkey === '')
|
||||
inicis_pro_noti_fail('HASHKEY_EMPTY', $oid, '');
|
||||
if ($device === '')
|
||||
inicis_pro_noti_fail('NOTI_SIGNATURE_INVALID', $oid, '');
|
||||
|
||||
// 과거 요청에서 모든 결제수단에 통보 URL을 전달한 경우 카드 등 승인 통보도
|
||||
// 이 URL로 재전송된다. 이미 승인과 주문 저장이 끝난 동일 거래는 변경 없이 확인한다.
|
||||
if ($pay_type !== 'VBANK') {
|
||||
if ($status !== '00')
|
||||
inicis_pro_noti_fail('NON_VBANK_STATUS_INVALID', $oid, '');
|
||||
if (!inicis_pro_noti_approved_payment_exists($oid, $tid, $mid, $amount, $pay_type, $pro_log, $pro_data))
|
||||
inicis_pro_noti_fail('NON_VBANK_ORDER_MISMATCH', $oid, '');
|
||||
|
||||
inicis_pro_audit_write($oid, 'notification', 'notification_acknowledged', array(
|
||||
'event_only' => '1',
|
||||
'tid' => $tid,
|
||||
'mid' => $mid,
|
||||
'amount' => $amount,
|
||||
'pay_type' => $pay_type,
|
||||
'device' => 'SERVER',
|
||||
'source' => 'server',
|
||||
'remote_ip' => $remote_ip,
|
||||
'code' => $status,
|
||||
'message' => '이미 처리된 결제의 서버 통보 확인'
|
||||
));
|
||||
inicis_pro_noti_result(true, '');
|
||||
}
|
||||
|
||||
// 가상계좌 채번 통보는 브라우저 승인 처리와 경쟁시키지 않고 확인 응답만 한다.
|
||||
if ($status === '00') {
|
||||
$issued_saved = inicis_pro_audit_write($oid, 'notification', 'vbank_issued', array(
|
||||
'tid' => $tid,
|
||||
'mid' => $mid,
|
||||
'amount' => $amount,
|
||||
'pay_type' => 'VBANK',
|
||||
'device' => 'SERVER',
|
||||
'source' => 'server',
|
||||
'remote_ip' => $remote_ip,
|
||||
'code' => $status,
|
||||
'vbank_due_at' => !empty($pro_data['P_VACT_DATE'])
|
||||
? substr($pro_data['P_VACT_DATE'], 0, 4).'-'.substr($pro_data['P_VACT_DATE'], 4, 2).'-'.substr($pro_data['P_VACT_DATE'], 6, 2).' '
|
||||
.(!empty($pro_data['P_VACT_TIME']) ? substr($pro_data['P_VACT_TIME'].'000000', 0, 2).':'.substr($pro_data['P_VACT_TIME'].'000000', 2, 2).':'.substr($pro_data['P_VACT_TIME'].'000000', 4, 2) : '23:59:00')
|
||||
: '',
|
||||
'message' => '가상계좌 발급 통보 수신'
|
||||
));
|
||||
inicis_pro_noti_result($issued_saved, '');
|
||||
}
|
||||
if ($status !== '02')
|
||||
inicis_pro_noti_fail('STATUS_UNSUPPORTED', $oid, '');
|
||||
|
||||
$in_tid_raw = isset($_POST['P_IN_TID']) ? trim((string) $_POST['P_IN_TID']) : '';
|
||||
$in_tid = inicis_pro_clean_tid($in_tid_raw);
|
||||
// 상점관리자의 입금통보 테스트 등에서는 P_IN_TID가 빈 값으로 올 수 있다.
|
||||
// 주문 식별에는 채번 TID(P_TID)를 사용하고, 입금 TID는 전달된 경우에만 형식을 검증한다.
|
||||
if ($in_tid_raw !== '' && ($in_tid === '' || $in_tid !== $in_tid_raw))
|
||||
inicis_pro_noti_fail('IN_TID_FORMAT_INVALID', $oid, '');
|
||||
|
||||
$receipt_time = inicis_pro_noti_time($auth_date);
|
||||
if ($receipt_time === '')
|
||||
inicis_pro_noti_fail('AUTH_TIME_INVALID', $oid, '');
|
||||
|
||||
$lock_name = inicis_pro_lock($oid);
|
||||
if ($lock_name === '')
|
||||
inicis_pro_noti_fail('LOCK_BUSY', $oid, '');
|
||||
|
||||
$approved_tid = isset($pro_data['P_APPL_TID']) ? inicis_pro_clean_tid($pro_data['P_APPL_TID']) : '';
|
||||
if (empty($pro_data['__pro']) || $pro_data['__pro'] !== '1')
|
||||
inicis_pro_noti_fail('APPROVAL_LOG_INVALID', $oid, $lock_name);
|
||||
if (!isset($pro_log['P_STATUS']) || $pro_log['P_STATUS'] !== '00')
|
||||
inicis_pro_noti_fail('APPROVAL_STATUS_INVALID', $oid, $lock_name);
|
||||
if (!isset($pro_data['P_MID']) || $pro_data['P_MID'] !== $mid)
|
||||
inicis_pro_noti_fail('APPROVAL_MID_MISMATCH', $oid, $lock_name);
|
||||
if (!isset($pro_data['P_OID']) || $pro_data['P_OID'] !== $oid)
|
||||
inicis_pro_noti_fail('APPROVAL_OID_MISMATCH', $oid, $lock_name);
|
||||
if (!isset($pro_data['P_AMT']) || (int) $pro_data['P_AMT'] !== $amount)
|
||||
inicis_pro_noti_fail('APPROVAL_AMOUNT_MISMATCH', $oid, $lock_name);
|
||||
if (!isset($pro_data['P_TYPE']) || strtoupper($pro_data['P_TYPE']) !== 'VBANK')
|
||||
inicis_pro_noti_fail('APPROVAL_TYPE_MISMATCH', $oid, $lock_name);
|
||||
if ($approved_tid !== $tid)
|
||||
inicis_pro_noti_fail('APPROVAL_TID_MISMATCH', $oid, $lock_name);
|
||||
|
||||
// 환불 완료 후 동일 입금통보가 재전송되면 환불 필요 상태를 다시 만들지 않는다.
|
||||
$audit_tables = inicis_pro_audit_tables();
|
||||
$completed_refund = sql_fetch(" select ip_status, ip_refund_required, ip_tid, ip_amount
|
||||
from `{$audit_tables['summary']}`
|
||||
where ip_oid = '".sql_escape_string($oid)."' ", false);
|
||||
if (!empty($completed_refund['ip_status']) && $completed_refund['ip_status'] === 'refund_completed'
|
||||
&& empty($completed_refund['ip_refund_required'])
|
||||
&& $completed_refund['ip_tid'] === $tid && (int) $completed_refund['ip_amount'] === $amount) {
|
||||
$acknowledged = inicis_pro_audit_write($oid, 'notification', 'notification_acknowledged', array(
|
||||
'event_only' => '1',
|
||||
'tid' => $tid,
|
||||
'mid' => $mid,
|
||||
'amount' => $amount,
|
||||
'pay_type' => 'VBANK',
|
||||
'device' => 'SERVER',
|
||||
'source' => 'server',
|
||||
'remote_ip' => $remote_ip,
|
||||
'code' => $status,
|
||||
'message' => '환불 완료 거래의 중복 입금 통보 확인'
|
||||
));
|
||||
inicis_pro_noti_result($acknowledged, $lock_name);
|
||||
}
|
||||
|
||||
$received_saved = inicis_pro_audit_write($oid, 'notification', 'notification_received', array(
|
||||
'tid' => $tid,
|
||||
'auth_tid' => isset($pro_data['P_AUTH_TID']) ? $pro_data['P_AUTH_TID'] : '',
|
||||
'mid' => $mid,
|
||||
'amount' => $amount,
|
||||
'pay_type' => 'VBANK',
|
||||
'device' => 'SERVER',
|
||||
'order_type' => !empty($pro_data['__order_type']) ? $pro_data['__order_type'] : '',
|
||||
'source' => 'server',
|
||||
'remote_ip' => $remote_ip,
|
||||
'code' => $status,
|
||||
'message' => '가상계좌 입금 통보 수신'
|
||||
));
|
||||
if (!$received_saved)
|
||||
inicis_pro_noti_fail('AUDIT_SUMMARY_FAILED', $oid, $lock_name);
|
||||
|
||||
$oid_sql = sql_escape_string($oid);
|
||||
$tid_sql = sql_escape_string($tid);
|
||||
$time_sql = sql_escape_string($receipt_time);
|
||||
$personal = sql_fetch(" select * from {$g5['g5_shop_personalpay_table']}
|
||||
where pp_id = '$oid_sql'
|
||||
and pp_tno = '$tid_sql'
|
||||
and pp_pg = 'inicis'
|
||||
and pp_settle_case = '가상계좌'
|
||||
and pp_use = '1' ");
|
||||
|
||||
if (!empty($personal['pp_id'])) {
|
||||
if ((int) $personal['pp_price'] !== $amount
|
||||
|| ((int) $personal['pp_receipt_price'] !== 0 && (int) $personal['pp_receipt_price'] !== $amount))
|
||||
inicis_pro_noti_fail('PERSONAL_AMOUNT_MISMATCH', $oid, $lock_name);
|
||||
|
||||
// 연결 주문은 메모의 고유 표식으로 중복 가산을 막는다.
|
||||
if (!empty($personal['od_id'])) {
|
||||
$linked_id = inicis_pro_clean_oid($personal['od_id']);
|
||||
$linked = sql_fetch(" select od_id, od_status, od_cancel_price, od_shop_memo from {$g5['g5_shop_order_table']} where od_id = '".sql_escape_string($linked_id)."' ");
|
||||
if (empty($linked['od_id']))
|
||||
inicis_pro_noti_fail('LINKED_ORDER_MISSING', $oid, $lock_name);
|
||||
if ($linked['od_status'] === '취소' || (int) $linked['od_cancel_price'] > 0) {
|
||||
$processed = inicis_pro_noti_save_audit($oid, $status, $auth_date, $remote_ip, 'paid_after_cancel', '취소된 연결 주문에 가상계좌 입금 확인 - 환불 필요');
|
||||
inicis_pro_noti_result($processed, $lock_name);
|
||||
}
|
||||
|
||||
$marker = '[INIpay PRO personalpay '.$oid.']';
|
||||
if (strpos($linked['od_shop_memo'], $marker) === false) {
|
||||
$memo = "\n".$marker.' 입금완료 - '.$receipt_time;
|
||||
$update_linked = " update {$g5['g5_shop_order_table']}
|
||||
set od_receipt_price = od_receipt_price + '$amount',
|
||||
od_receipt_time = '$time_sql',
|
||||
od_shop_memo = concat(od_shop_memo, '".sql_escape_string($memo)."')
|
||||
where od_id = '".sql_escape_string($linked_id)."' ";
|
||||
if (!sql_query($update_linked, false))
|
||||
inicis_pro_noti_fail('LINKED_ORDER_RECEIPT_UPDATE_FAILED', $oid, $lock_name);
|
||||
}
|
||||
|
||||
$linked_info = get_order_info($linked_id);
|
||||
$linked_status_sql = " update {$g5['g5_shop_order_table']} set od_misu = '".(int) $linked_info['od_misu']."' ";
|
||||
if ((int) $linked_info['od_misu'] === 0)
|
||||
$linked_status_sql .= ", od_status = '입금' ";
|
||||
$linked_status_sql .= " where od_id = '".sql_escape_string($linked_id)."' ";
|
||||
if (!sql_query($linked_status_sql, false))
|
||||
inicis_pro_noti_fail('LINKED_ORDER_STATUS_UPDATE_FAILED', $oid, $lock_name);
|
||||
|
||||
if ((int) $linked_info['od_misu'] === 0
|
||||
&& !sql_query(" update {$g5['g5_shop_cart_table']} set ct_status = '입금' where od_id = '".sql_escape_string($linked_id)."' ", false))
|
||||
inicis_pro_noti_fail('LINKED_CART_STATUS_UPDATE_FAILED', $oid, $lock_name);
|
||||
}
|
||||
|
||||
if (!sql_query(" update {$g5['g5_shop_personalpay_table']}
|
||||
set pp_receipt_price = '$amount',
|
||||
pp_receipt_time = '$time_sql'
|
||||
where pp_id = '$oid_sql'
|
||||
and pp_tno = '$tid_sql' ", false))
|
||||
inicis_pro_noti_fail('PERSONAL_RECEIPT_UPDATE_FAILED', $oid, $lock_name);
|
||||
|
||||
$check_personal = sql_fetch(" select pp_receipt_price from {$g5['g5_shop_personalpay_table']} where pp_id = '$oid_sql' and pp_tno = '$tid_sql' ");
|
||||
$processed = isset($check_personal['pp_receipt_price']) && (int) $check_personal['pp_receipt_price'] === $amount;
|
||||
if ($processed)
|
||||
$processed = inicis_pro_noti_save_audit($oid, $status, $auth_date, $remote_ip, 'paid', '가상계좌 입금 통보 처리 완료');
|
||||
else
|
||||
inicis_pro_noti_fail('PERSONAL_RECEIPT_VERIFY_FAILED', $oid, $lock_name);
|
||||
inicis_pro_noti_result($processed, $lock_name);
|
||||
}
|
||||
|
||||
$order = sql_fetch(" select * from {$g5['g5_shop_order_table']}
|
||||
where od_id = '$oid_sql'
|
||||
and od_tno = '$tid_sql'
|
||||
and od_pg = 'inicis'
|
||||
and od_settle_case = '가상계좌' ");
|
||||
if (empty($order['od_id']))
|
||||
inicis_pro_noti_fail('ORDER_MISSING', $oid, $lock_name);
|
||||
if ($order['od_status'] === '취소' || (int) $order['od_cancel_price'] > 0) {
|
||||
$processed = inicis_pro_noti_save_audit($oid, $status, $auth_date, $remote_ip, 'paid_after_cancel', '취소 주문에 가상계좌 입금 확인 - 환불 필요');
|
||||
inicis_pro_noti_result($processed, $lock_name);
|
||||
}
|
||||
if ((int) $order['od_receipt_price'] !== 0 && (int) $order['od_receipt_price'] !== $amount)
|
||||
inicis_pro_noti_fail('ORDER_RECEIPT_MISMATCH', $oid, $lock_name);
|
||||
|
||||
if (!sql_query(" update {$g5['g5_shop_order_table']}
|
||||
set od_receipt_price = '$amount',
|
||||
od_receipt_time = '$time_sql'
|
||||
where od_id = '$oid_sql'
|
||||
and od_tno = '$tid_sql' ", false))
|
||||
inicis_pro_noti_fail('ORDER_RECEIPT_UPDATE_FAILED', $oid, $lock_name);
|
||||
|
||||
$order_info = get_order_info($oid);
|
||||
$status_sql = " update {$g5['g5_shop_order_table']} set od_misu = '".(int) $order_info['od_misu']."' ";
|
||||
if ((int) $order_info['od_misu'] === 0)
|
||||
$status_sql .= ", od_status = '입금' ";
|
||||
$status_sql .= " where od_id = '$oid_sql' and od_tno = '$tid_sql' ";
|
||||
if (!sql_query($status_sql, false))
|
||||
inicis_pro_noti_fail('ORDER_STATUS_UPDATE_FAILED', $oid, $lock_name);
|
||||
|
||||
if ((int) $order_info['od_misu'] === 0
|
||||
&& !sql_query(" update {$g5['g5_shop_cart_table']} set ct_status = '입금' where od_id = '$oid_sql' ", false))
|
||||
inicis_pro_noti_fail('CART_STATUS_UPDATE_FAILED', $oid, $lock_name);
|
||||
|
||||
$check_order = sql_fetch(" select od_receipt_price, od_misu from {$g5['g5_shop_order_table']} where od_id = '$oid_sql' and od_tno = '$tid_sql' ");
|
||||
$processed = isset($check_order['od_receipt_price']) && (int) $check_order['od_receipt_price'] === $amount;
|
||||
if ($processed)
|
||||
$processed = inicis_pro_noti_save_audit($oid, $status, $auth_date, $remote_ip, 'paid', '가상계좌 입금 통보 처리 완료');
|
||||
else
|
||||
inicis_pro_noti_fail('ORDER_RECEIPT_VERIFY_FAILED', $oid, $lock_name);
|
||||
inicis_pro_noti_result($processed, $lock_name);
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
add_javascript('<script src="https://paypro.inicis.com/std/payment/js/INIPayPro_v2.js" charset="UTF-8"></script>', 10);
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
?>
|
||||
<form name="sm_form" method="post" action="">
|
||||
<input type="hidden" name="good_mny" value="<?php echo isset($tot_price) ? (int) $tot_price : 0; ?>">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function inicis_pro_pay(oid, deviceType)
|
||||
{
|
||||
var requestData = null;
|
||||
var errorMessage = '';
|
||||
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: g5_url + '/shop/inicis/pro/request.php',
|
||||
data: {oid: oid, device_type: deviceType},
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
if (data && data.success) {
|
||||
requestData = data.request;
|
||||
} else {
|
||||
errorMessage = data && data.message ? data.message : '결제 요청 정보를 생성하지 못했습니다.';
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
errorMessage = '결제 요청 정보를 확인하는 중 통신 오류가 발생했습니다.';
|
||||
}
|
||||
});
|
||||
|
||||
if (!requestData) {
|
||||
alert(errorMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof INIPayPro === 'undefined' || typeof INIPayPro.requestPayment !== 'function') {
|
||||
alert('KG이니시스 결제창을 불러오지 못했습니다. 잠시 후 다시 시도해 주십시오.');
|
||||
return false;
|
||||
}
|
||||
|
||||
INIPayPro.requestPayment(requestData);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
|
||||
// === INIpay PRO 승인 실행 위치: 주문 저장 직전 (return.php에서 이관) ===
|
||||
$inicis_pro_ctx = (isset($GLOBALS['inicis_pro_approval_ctx']) && is_array($GLOBALS['inicis_pro_approval_ctx'])) ? $GLOBALS['inicis_pro_approval_ctx'] : array();
|
||||
if ($inicis_pro_ctx) {
|
||||
unset($GLOBALS['inicis_pro_approval_ctx']);
|
||||
$oid = isset($inicis_pro_ctx['oid']) ? $inicis_pro_ctx['oid'] : '';
|
||||
$auth_tid = isset($inicis_pro_ctx['auth_tid']) ? $inicis_pro_ctx['auth_tid'] : '';
|
||||
$idc = isset($inicis_pro_ctx['idc']) ? $inicis_pro_ctx['idc'] : '';
|
||||
$expected_mid = isset($inicis_pro_ctx['expected_mid']) ? $inicis_pro_ctx['expected_mid'] : '';
|
||||
$expected_amount = isset($inicis_pro_ctx['expected_amount']) ? $inicis_pro_ctx['expected_amount'] : 0;
|
||||
$pay_type = isset($inicis_pro_ctx['pay_type']) ? $inicis_pro_ctx['pay_type'] : '';
|
||||
$result_type = isset($inicis_pro_ctx['result_type']) ? $inicis_pro_ctx['result_type'] : '';
|
||||
$noti = isset($inicis_pro_ctx['noti']) ? $inicis_pro_ctx['noti'] : '';
|
||||
$device = isset($inicis_pro_ctx['device']) ? $inicis_pro_ctx['device'] : '';
|
||||
$settle_case = isset($inicis_pro_ctx['settle_case']) ? $inicis_pro_ctx['settle_case'] : '';
|
||||
$is_personal = !empty($inicis_pro_ctx['is_personal']);
|
||||
$lock_name = isset($inicis_pro_ctx['lock_name']) ? $inicis_pro_ctx['lock_name'] : '';
|
||||
$page_return_url = isset($inicis_pro_ctx['page_return_url']) ? $inicis_pro_ctx['page_return_url'] : G5_SHOP_URL;
|
||||
$audit_values = (isset($inicis_pro_ctx['audit_values']) && is_array($inicis_pro_ctx['audit_values'])) ? $inicis_pro_ctx['audit_values'] : array();
|
||||
|
||||
$approval = array();
|
||||
$old_log = inicis_pro_get_log($oid);
|
||||
$old_data = isset($old_log['pro_data']) && is_array($old_log['pro_data']) ? $old_log['pro_data'] : array();
|
||||
$old_is_pro = isset($old_data['__pro']) && $old_data['__pro'] === '1';
|
||||
$old_auth_tid = isset($old_data['P_AUTH_TID']) ? $old_data['P_AUTH_TID'] : '';
|
||||
|
||||
if ($old_is_pro && isset($old_log['P_STATUS']) && $old_log['P_STATUS'] === '00') {
|
||||
if ($old_auth_tid !== $auth_tid) {
|
||||
$duplicate_cancel = inicis_pro_net_cancel($idc, $expected_mid, $auth_tid, $expected_amount, $oid, 'duplicate authorization', $pay_type);
|
||||
$audit_values['event_only'] = '1';
|
||||
inicis_pro_return_error('이미 처리된 주문과 다른 승인정보가 확인되어 새 결제를 중단했습니다.', $page_return_url, $lock_name, $oid, 'cancel', !empty($duplicate_cancel['success']) ? 'canceled' : 'cancel_failed', 'DUPLICATE_AUTH', $audit_values);
|
||||
}
|
||||
$approval = $old_data;
|
||||
} elseif ($old_is_pro && isset($old_log['P_STATUS']) && $old_log['P_STATUS'] === 'processing' && $old_auth_tid === $auth_tid) {
|
||||
$cancel_result = inicis_pro_net_cancel($idc, $expected_mid, $auth_tid, $expected_amount, $oid, 'interrupted approval', $pay_type);
|
||||
if (!empty($cancel_result['success']))
|
||||
sql_query(" update {$g5['g5_shop_inicis_log_table']} set P_STATUS = 'cancel', P_RMESG1 = 'interrupted approval net-cancel' where oid = '".sql_escape_string($oid)."' ", false);
|
||||
inicis_pro_return_error('이전 승인 처리가 중단된 기록이 있어 안전을 위해 결제를 취소했습니다. 주문내역을 확인한 후 다시 시도해 주십시오.', $page_return_url, $lock_name, $oid, 'cancel', !empty($cancel_result['success']) ? 'canceled' : 'cancel_failed', 'INTERRUPTED_APPROVAL', $audit_values);
|
||||
} elseif ($old_is_pro && isset($old_log['P_STATUS']) && $old_log['P_STATUS'] === 'processing') {
|
||||
$old_idc = isset($old_data['P_IDCNAME']) ? strtolower($old_data['P_IDCNAME']) : '';
|
||||
$old_amount = isset($old_data['P_AMT']) ? (int) $old_data['P_AMT'] : 0;
|
||||
$old_cancel_ok = true;
|
||||
if ($old_auth_tid !== '' && $old_amount > 0) {
|
||||
$old_cancel = inicis_pro_net_cancel($old_idc, $expected_mid, $old_auth_tid, $old_amount, $oid, 'stale authorization', $pay_type);
|
||||
$old_cancel_ok = !empty($old_cancel['success']);
|
||||
}
|
||||
$new_cancel = inicis_pro_net_cancel($idc, $expected_mid, $auth_tid, $expected_amount, $oid, 'duplicate authorization', $pay_type);
|
||||
inicis_pro_return_error('동일 주문의 다른 승인 처리가 확인되어 안전을 위해 결제를 중단했습니다.', $page_return_url, $lock_name, $oid, 'cancel', $old_cancel_ok && !empty($new_cancel['success']) ? 'canceled' : 'cancel_failed', 'CONCURRENT_AUTH', $audit_values);
|
||||
}
|
||||
|
||||
if (empty($approval)) {
|
||||
inicis_pro_audit_write($oid, 'approval', 'approval_started', $audit_values);
|
||||
$processing = array(
|
||||
'P_STATUS' => 'processing',
|
||||
'P_RMESG' => 'approval request started',
|
||||
'P_MID' => $expected_mid,
|
||||
'P_OID' => $oid,
|
||||
'P_AUTH_TID' => $auth_tid,
|
||||
'P_AMT' => (string) $expected_amount,
|
||||
'P_TYPE' => $result_type,
|
||||
'P_NOTI' => $noti,
|
||||
'P_IDCNAME' => $idc,
|
||||
'__pro' => '1',
|
||||
'__device' => $device,
|
||||
'__environment' => inicis_pro_environment(),
|
||||
'__easy_pay' => inicis_pro_easypay_name($settle_case),
|
||||
'__order_type' => $is_personal ? 'personal' : 'order'
|
||||
);
|
||||
if (!inicis_pro_save_log($processing))
|
||||
inicis_pro_return_error('결제 승인 준비정보를 저장하지 못했습니다.', $page_return_url, $lock_name, $oid, 'approval', 'approval_failed', 'APPROVAL_LOG_FAILED', $audit_values);
|
||||
|
||||
$approval_response = inicis_pro_http_post(
|
||||
'https://'.inicis_pro_idc_host($idc).'/payment/v1/rest/payAppl.ini',
|
||||
array(
|
||||
'P_MID' => $expected_mid,
|
||||
'P_AUTH_TID' => $auth_tid,
|
||||
'P_AMT' => (string) $expected_amount,
|
||||
'P_CHARSET' => 'UTF-8'
|
||||
)
|
||||
);
|
||||
if (!$approval_response['success']) {
|
||||
$communication_cancel = inicis_pro_net_cancel($idc, $expected_mid, $auth_tid, $expected_amount, $oid, 'approval communication failure', $pay_type);
|
||||
$communication_status = !empty($communication_cancel['success']) ? 'cancel' : 'fail';
|
||||
sql_query(" update {$g5['g5_shop_inicis_log_table']} set P_STATUS = '$communication_status', P_RMESG1 = 'approval communication failure' where oid = '".sql_escape_string($oid)."' ", false);
|
||||
inicis_pro_return_error('KG이니시스 승인 서버와 통신하지 못했습니다. 결제 여부를 관리자에게 문의해 주십시오.', $page_return_url, $lock_name, $oid, 'approval', !empty($communication_cancel['success']) ? 'canceled' : 'communication_failed', 'APPROVAL_COMMUNICATION', $audit_values);
|
||||
}
|
||||
|
||||
$approval = inicis_pro_parse_nvp($approval_response['body']);
|
||||
$approval_message = isset($approval['P_RMESG']) ? inicis_pro_cut($approval['P_RMESG'], 150) : '';
|
||||
if (!isset($approval['P_STATUS']) || $approval['P_STATUS'] !== '00') {
|
||||
$processing['P_STATUS'] = isset($approval['P_STATUS']) ? $approval['P_STATUS'] : 'fail';
|
||||
$processing['P_RMESG'] = $approval_message !== '' ? $approval_message : 'approval failed';
|
||||
inicis_pro_save_log($processing);
|
||||
inicis_pro_return_error('결제 승인 실패: '.$processing['P_RMESG'], $page_return_url, $lock_name, $oid, 'approval', 'approval_failed', $processing['P_STATUS'], $audit_values);
|
||||
}
|
||||
|
||||
$approved_tid = isset($approval['P_APPL_TID']) ? inicis_pro_clean_tid($approval['P_APPL_TID']) : '';
|
||||
$approved_type = isset($approval['P_TYPE']) ? strtoupper($approval['P_TYPE']) : '';
|
||||
$approved_amount = isset($approval['P_AMT']) ? $approval['P_AMT'] : '';
|
||||
$approved_oid = isset($approval['P_OID']) ? inicis_pro_clean_oid($approval['P_OID']) : '';
|
||||
$approved_auth_tid = isset($approval['P_AUTH_TID']) ? inicis_pro_clean_tid($approval['P_AUTH_TID']) : '';
|
||||
$approval_valid = isset($approval['P_MID']) && $approval['P_MID'] === $expected_mid
|
||||
&& $approved_oid === $oid && isset($approval['P_OID']) && $approval['P_OID'] === $approved_oid
|
||||
&& preg_match('/^[0-9]+$/', $approved_amount) && (int) $approved_amount === (int) $expected_amount
|
||||
&& $approved_auth_tid === $auth_tid && isset($approval['P_AUTH_TID']) && $approval['P_AUTH_TID'] === $approved_auth_tid
|
||||
&& $approved_tid !== '' && isset($approval['P_APPL_TID']) && $approval['P_APPL_TID'] === $approved_tid
|
||||
&& inicis_pro_result_type_matches($settle_case, $approved_type);
|
||||
|
||||
if (!$approval_valid) {
|
||||
$mismatch_cancel = inicis_pro_net_cancel($idc, $expected_mid, $auth_tid, $expected_amount, $oid, 'approval result mismatch', $pay_type);
|
||||
$processing['P_STATUS'] = !empty($mismatch_cancel['success']) ? 'cancel' : 'mismatch';
|
||||
$processing['P_RMESG'] = 'approval result mismatch';
|
||||
inicis_pro_save_log($processing);
|
||||
inicis_pro_return_error('승인 결과가 결제요청 정보와 일치하지 않아 주문을 중단했습니다. 취소 여부는 관리자에게 문의해 주십시오.', $page_return_url, $lock_name, $oid, 'validation', !empty($mismatch_cancel['success']) ? 'canceled' : 'cancel_failed', 'APPROVAL_RESULT_MISMATCH', $audit_values);
|
||||
}
|
||||
|
||||
$approval['P_NOTI'] = $noti;
|
||||
$approval['P_IDCNAME'] = $idc;
|
||||
$approval['__pro'] = '1';
|
||||
$approval['__device'] = $device;
|
||||
$approval['__environment'] = inicis_pro_environment();
|
||||
$approval['__easy_pay'] = inicis_pro_easypay_name($settle_case);
|
||||
$approval['__order_type'] = $is_personal ? 'personal' : 'order';
|
||||
if (!inicis_pro_save_log($approval)) {
|
||||
$approval_log_cancel = inicis_pro_net_cancel($idc, $expected_mid, $auth_tid, $expected_amount, $oid, 'approval log failure', $pay_type);
|
||||
inicis_pro_return_error('승인정보를 저장하지 못해 결제를 취소했습니다.', $page_return_url, $lock_name, $oid, 'cancel', !empty($approval_log_cancel['success']) ? 'canceled' : 'cancel_failed', 'APPROVAL_LOG_FAILED', $audit_values);
|
||||
}
|
||||
}
|
||||
|
||||
$audit_values['tid'] = isset($approval['P_APPL_TID']) ? $approval['P_APPL_TID'] : '';
|
||||
$audit_values['pay_type'] = isset($approval['P_TYPE']) ? $approval['P_TYPE'] : $audit_values['pay_type'];
|
||||
$audit_values['code'] = isset($approval['P_STATUS']) ? $approval['P_STATUS'] : '';
|
||||
$audit_values['message'] = isset($approval['P_RMESG']) ? $approval['P_RMESG'] : 'KG이니시스 승인 완료';
|
||||
|
||||
$final_tid = isset($approval['P_APPL_TID']) ? inicis_pro_clean_tid($approval['P_APPL_TID']) : '';
|
||||
if ($final_tid === '' || !isset($approval['P_APPL_TID']) || $approval['P_APPL_TID'] !== $final_tid
|
||||
|| !isset($approval['P_STATUS']) || $approval['P_STATUS'] !== '00'
|
||||
|| !isset($approval['P_MID']) || $approval['P_MID'] !== $expected_mid
|
||||
|| !isset($approval['P_OID']) || $approval['P_OID'] !== $oid
|
||||
|| !isset($approval['P_AMT']) || (int) $approval['P_AMT'] !== (int) $expected_amount
|
||||
|| !isset($approval['P_AUTH_TID']) || $approval['P_AUTH_TID'] !== $auth_tid
|
||||
|| !isset($approval['P_NOTI']) || !inicis_pro_equals($approval['P_NOTI'], $noti)
|
||||
|| !isset($approval['P_IDCNAME']) || $approval['P_IDCNAME'] !== $idc
|
||||
|| !isset($approval['__device']) || $approval['__device'] !== $device
|
||||
|| !isset($approval['P_TYPE']) || !inicis_pro_result_type_matches($settle_case, $approval['P_TYPE'])) {
|
||||
inicis_pro_return_error('저장된 승인정보를 검증하지 못했습니다.', $page_return_url, $lock_name, $oid, 'validation', 'validation_failed', 'SAVED_APPROVAL_INVALID', $audit_values);
|
||||
}
|
||||
|
||||
inicis_pro_audit_write($oid, 'approval', 'approved', $audit_values);
|
||||
|
||||
$_POST['P_TYPE'] = isset($approval['P_TYPE']) ? $approval['P_TYPE'] : '';
|
||||
$_POST['P_AUTH_DT'] = (isset($approval['P_APPL_DT']) ? $approval['P_APPL_DT'] : '').(isset($approval['P_APPL_TM']) ? $approval['P_APPL_TM'] : '');
|
||||
$_POST['P_AUTH_NO'] = isset($approval['P_APPL_NO']) ? $approval['P_APPL_NO'] : '';
|
||||
$_POST['P_HASH'] = md5($final_tid.$expected_mid.$expected_amount);
|
||||
|
||||
set_session('P_TID', $final_tid);
|
||||
set_session('P_AMT', (string) $expected_amount);
|
||||
set_session('P_HASH', $_POST['P_HASH']);
|
||||
set_session('ss_inicis_pro_oid', $oid);
|
||||
}
|
||||
|
||||
|
||||
$pro_oid = isset($_POST['inicis_pro_oid']) ? inicis_pro_clean_oid($_POST['inicis_pro_oid']) : '';
|
||||
$pro_log = inicis_pro_get_log($pro_oid);
|
||||
$pro_data = isset($pro_log['pro_data']) && is_array($pro_log['pro_data']) ? $pro_log['pro_data'] : array();
|
||||
|
||||
if ($pro_oid === '' || empty($pro_data['__pro']) || $pro_data['__pro'] !== '1' || !isset($pro_log['P_STATUS']) || $pro_log['P_STATUS'] !== '00')
|
||||
alert('승인된 INIpay PRO 결제정보를 확인할 수 없습니다.');
|
||||
|
||||
$pro_tid = isset($pro_data['P_APPL_TID']) ? inicis_pro_clean_tid($pro_data['P_APPL_TID']) : '';
|
||||
$pro_mid = isset($pro_data['P_MID']) ? $pro_data['P_MID'] : '';
|
||||
$pro_amount = isset($pro_data['P_AMT']) ? (int) $pro_data['P_AMT'] : 0;
|
||||
$pro_hash = md5($pro_tid.$pro_mid.$pro_amount);
|
||||
$post_hash = isset($_POST['P_HASH']) ? (string) $_POST['P_HASH'] : '';
|
||||
|
||||
if ($pro_tid === '' || $pro_mid !== inicis_pro_get_mid(isset($pro_data['P_TYPE']) ? $pro_data['P_TYPE'] : null) || !isset($pro_data['P_OID']) || $pro_data['P_OID'] !== $pro_oid
|
||||
|| !inicis_pro_equals($pro_hash, $post_hash) || !inicis_pro_equals($pro_hash, (string) get_session('P_HASH'))
|
||||
|| (string) get_session('P_TID') !== $pro_tid || (int) get_session('P_AMT') !== $pro_amount
|
||||
|| (string) get_session('ss_inicis_pro_oid') !== $pro_oid)
|
||||
alert('INIpay PRO 승인정보가 주문정보와 일치하지 않습니다.');
|
||||
|
||||
$tno = $pro_tid;
|
||||
$amount = $pro_amount;
|
||||
$app_time = (isset($pro_data['P_APPL_DT']) ? preg_replace('/[^0-9]/', '', $pro_data['P_APPL_DT']) : '')
|
||||
.(isset($pro_data['P_APPL_TM']) ? preg_replace('/[^0-9]/', '', $pro_data['P_APPL_TM']) : '');
|
||||
$pay_method = isset($pro_data['P_TYPE']) ? strtoupper($pro_data['P_TYPE']) : '';
|
||||
$pay_type = '';
|
||||
switch ($pay_method) {
|
||||
case 'CARD':
|
||||
$pay_type = '신용카드';
|
||||
break;
|
||||
case 'BANK':
|
||||
$pay_type = '계좌이체';
|
||||
break;
|
||||
case 'VBANK':
|
||||
$pay_type = '가상계좌';
|
||||
break;
|
||||
case 'HPP':
|
||||
case 'MOBILE':
|
||||
$pay_type = '휴대폰';
|
||||
break;
|
||||
}
|
||||
|
||||
$depositor = isset($pro_data['P_VACT_NAME']) ? $pro_data['P_VACT_NAME'] : (isset($pro_data['P_UNAME']) ? $pro_data['P_UNAME'] : '');
|
||||
$commid = isset($pro_data['P_HPP_CORP']) ? $pro_data['P_HPP_CORP'] : (isset($pro_data['P_FN_NM']) ? $pro_data['P_FN_NM'] : '');
|
||||
$mobile_no = isset($pro_data['P_HPP_NUM']) ? $pro_data['P_HPP_NUM'] : (isset($pro_data['P_APPL_NUM']) ? $pro_data['P_APPL_NUM'] : '');
|
||||
$app_no = isset($pro_data['P_APPL_NO']) ? $pro_data['P_APPL_NO'] : '';
|
||||
$card_name = isset($pro_data['P_CARD_ISSUER_NAME']) && $pro_data['P_CARD_ISSUER_NAME'] !== '' ? $pro_data['P_CARD_ISSUER_NAME'] : (isset($pro_data['P_FN_NM']) ? $pro_data['P_FN_NM'] : '');
|
||||
$bank_name = isset($pro_data['P_FN_NM']) ? $pro_data['P_FN_NM'] : '';
|
||||
$bankname = $bank_name;
|
||||
$account = isset($pro_data['P_VACT_NUM']) ? $pro_data['P_VACT_NUM'] : '';
|
||||
if (!empty($pro_data['P_VACT_NAME']))
|
||||
$account .= ' '.$pro_data['P_VACT_NAME'];
|
||||
if ($pay_method === 'VBANK' && !empty($pro_data['P_VACT_NUM']))
|
||||
$app_no = $pro_data['P_VACT_NUM'];
|
||||
|
||||
if (!empty($default['de_escrow_use']) && ($pay_method === 'BANK' || $pay_method === 'VBANK'))
|
||||
$escw_yn = 'Y';
|
||||
|
||||
set_session('P_TID', '');
|
||||
set_session('P_AMT', '');
|
||||
set_session('P_HASH', '');
|
||||
set_session('ss_inicis_pro_oid', '');
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST')
|
||||
inicis_pro_json_response(array('success' => false, 'message' => '올바른 요청이 아닙니다.'));
|
||||
|
||||
if (function_exists('check_request_origin'))
|
||||
check_request_origin(G5_SHOP_URL);
|
||||
|
||||
if (!inicis_pro_is_enabled())
|
||||
inicis_pro_json_response(array('success' => false, 'message' => 'INIpay PRO 결제가 활성화되어 있지 않습니다.'));
|
||||
|
||||
$oid = isset($_POST['oid']) ? inicis_pro_clean_oid($_POST['oid']) : '';
|
||||
$device = isset($_POST['device_type']) ? strtoupper(preg_replace('/[^A-Z]/i', '', $_POST['device_type'])) : '';
|
||||
if ($oid === '' || ($device !== 'WEB' && $device !== 'MOBILE'))
|
||||
inicis_pro_json_response(array('success' => false, 'message' => '결제 요청 정보가 올바르지 않습니다.'));
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_order_data_table']}
|
||||
where od_id = '".sql_escape_string($oid)."'
|
||||
and dt_pg = 'inicis'
|
||||
order by dt_time desc
|
||||
limit 1 ";
|
||||
$temp_row = sql_fetch($sql);
|
||||
if (empty($temp_row['od_id']))
|
||||
inicis_pro_json_response(array('success' => false, 'message' => '임시 주문정보가 저장되지 않았습니다.'));
|
||||
|
||||
$order_data = @unserialize(base64_decode($temp_row['dt_data']));
|
||||
if (!is_array($order_data))
|
||||
inicis_pro_json_response(array('success' => false, 'message' => '임시 주문정보를 확인할 수 없습니다.'));
|
||||
|
||||
$is_personal = !empty($order_data['pp_id']);
|
||||
if ($is_personal) {
|
||||
if ((string) get_session('ss_personalpay_id') !== (string) $oid)
|
||||
inicis_pro_json_response(array('success' => false, 'message' => '개인결제 세션이 일치하지 않습니다.'));
|
||||
} else {
|
||||
if ((string) get_session('ss_order_id') !== (string) $oid)
|
||||
inicis_pro_json_response(array('success' => false, 'message' => '주문 세션이 일치하지 않습니다.'));
|
||||
|
||||
$session_member_id = isset($member['mb_id']) ? (string) $member['mb_id'] : '';
|
||||
if ((string) $temp_row['mb_id'] !== $session_member_id)
|
||||
inicis_pro_json_response(array('success' => false, 'message' => '주문 회원정보가 일치하지 않습니다.'));
|
||||
|
||||
$cart_id = preg_replace('/[^0-9]/', '', (string) $temp_row['cart_id']);
|
||||
if ($cart_id === '' || get_cart_count($cart_id) === 0)
|
||||
inicis_pro_json_response(array('success' => false, 'message' => '결제할 장바구니 상품이 없습니다.'));
|
||||
if (function_exists('before_check_cart_price') && !before_check_cart_price($cart_id))
|
||||
inicis_pro_json_response(array('success' => false, 'message' => '상품 가격이 변경되었습니다. 장바구니를 다시 확인해 주십시오.'));
|
||||
}
|
||||
|
||||
$settle_case_key = $is_personal ? 'pp_settle_case' : 'od_settle_case';
|
||||
$settle_case = isset($order_data[$settle_case_key]) ? $order_data[$settle_case_key] : '';
|
||||
$pay_type = inicis_pro_pay_type($settle_case);
|
||||
$easypay_code = inicis_pro_easypay_code($settle_case);
|
||||
$easypay_name = inicis_pro_easypay_name($settle_case);
|
||||
$amount = inicis_pro_expected_amount($order_data, $temp_row);
|
||||
$mid = inicis_pro_get_mid($pay_type);
|
||||
$hashkey = inicis_pro_get_hashkey($pay_type);
|
||||
|
||||
if ($pay_type === '' || $amount <= 0 || $amount > 999999999)
|
||||
inicis_pro_json_response(array('success' => false, 'message' => '결제수단 또는 결제금액이 올바르지 않습니다.'));
|
||||
if ($easypay_code !== '' && !inicis_pro_easypay_is_enabled($settle_case))
|
||||
inicis_pro_json_response(array('success' => false, 'message' => '선택한 간편결제는 현재 사용할 수 없습니다.'));
|
||||
if ($mid === '' || $hashkey === '')
|
||||
inicis_pro_json_response(array('success' => false, 'message' => 'KG이니시스 MID 또는 HashKey가 설정되지 않았습니다.'));
|
||||
if (!function_exists('hash') || !in_array('sha512', hash_algos()))
|
||||
inicis_pro_json_response(array('success' => false, 'message' => '서버에서 SHA-512 해시를 지원하지 않습니다.'));
|
||||
|
||||
$timestamp = inicis_pro_timestamp();
|
||||
$buyer_name = $is_personal ? (isset($order_data['pp_name']) ? $order_data['pp_name'] : '') : (isset($order_data['od_name']) ? $order_data['od_name'] : '');
|
||||
$buyer_email = $is_personal ? (isset($order_data['pp_email']) ? $order_data['pp_email'] : '') : (isset($order_data['od_email']) ? $order_data['od_email'] : '');
|
||||
$buyer_phone = $is_personal ? (isset($order_data['pp_hp']) ? $order_data['pp_hp'] : '') : (!empty($order_data['od_hp']) ? $order_data['od_hp'] : (isset($order_data['od_tel']) ? $order_data['od_tel'] : ''));
|
||||
|
||||
$reserved = array(
|
||||
'email' => inicis_pro_cut($buyer_email, 60),
|
||||
'phonenum' => preg_replace('/[^0-9]/', '', $buyer_phone)
|
||||
);
|
||||
if ($pay_type === 'CARD') {
|
||||
$reserved['quotabase'] = '01:02:03:04:05:06:07:08:09:10:11:12';
|
||||
if ($easypay_code !== '')
|
||||
$reserved['d_easypay'] = $easypay_code;
|
||||
}
|
||||
if ($pay_type === 'BANK')
|
||||
$reserved['bank_receipt'] = 'N';
|
||||
if ($pay_type === 'VBANK') {
|
||||
$reserved['vbank_receipt'] = 'N';
|
||||
$reserved['vbank_dt'] = date('Ymd', G5_SERVER_TIME + (86400 * 3));
|
||||
$reserved['vbank_tm'] = '2359';
|
||||
}
|
||||
if (!empty($default['de_escrow_use']) && ($pay_type === 'BANK' || $pay_type === 'VBANK'))
|
||||
$reserved['useescrow'] = 'Y';
|
||||
|
||||
$base_url = defined('G5_HTTPS_SHOP_URL') && G5_HTTPS_SHOP_URL ? G5_HTTPS_SHOP_URL : G5_SHOP_URL;
|
||||
$noti = inicis_pro_make_noti($oid, $amount, $device, $hashkey);
|
||||
|
||||
$request = array(
|
||||
'P_MID' => $mid,
|
||||
'P_OID' => $oid,
|
||||
'P_PAY_TYPE' => $pay_type,
|
||||
'P_DEVICE_TYPE' => $device,
|
||||
'P_IDCCODE' => 'Y',
|
||||
'P_AMT' => (string) $amount,
|
||||
'P_GOODS' => inicis_pro_goods_name($order_data, $temp_row),
|
||||
'P_UNAME' => inicis_pro_cut($buyer_name, 30),
|
||||
'P_NEXT_URL' => $base_url.'/inicis/pro/return.php',
|
||||
'P_CHARSET' => 'UTF-8',
|
||||
'P_NOTI' => $noti,
|
||||
'P_TIMESTAMP' => $timestamp,
|
||||
'P_CHKFAKE' => inicis_pro_hash($amount, $oid, $timestamp, $hashkey),
|
||||
'P_RESERVED' => inicis_pro_json_encode($reserved)
|
||||
);
|
||||
|
||||
if ($pay_type === 'VBANK')
|
||||
$request['P_NOTI_URL'] = $base_url.'/inicis/pro/noti.php';
|
||||
|
||||
// PC 결제창은 iframe 모달이므로 닫기 URL을 전달하면 주문서 전체가 다시
|
||||
// 로드된다. 모바일은 현재 창에서 결제가 진행되므로 돌아갈 URL을 유지한다.
|
||||
if ($device === 'MOBILE') {
|
||||
if ($is_personal)
|
||||
$request['P_CLOSE_URL'] = G5_SHOP_URL.'/personalpayform.php?pp_id='.$oid;
|
||||
elseif (!empty($order_data['sw_direct']))
|
||||
$request['P_CLOSE_URL'] = G5_SHOP_URL.'/orderform.php?sw_direct=1';
|
||||
else
|
||||
$request['P_CLOSE_URL'] = G5_SHOP_URL.'/orderform.php';
|
||||
}
|
||||
|
||||
if ($pay_type === 'HPP')
|
||||
$request['P_HPP_METHOD'] = '2';
|
||||
if (!empty($default['de_tax_flag_use'])) {
|
||||
$request['P_TAX'] = isset($order_data['comm_vat_mny']) ? (string) (int) $order_data['comm_vat_mny'] : '0';
|
||||
$request['P_TAXFREE'] = isset($order_data['comm_free_mny']) ? (string) (int) $order_data['comm_free_mny'] : '0';
|
||||
}
|
||||
|
||||
inicis_pro_audit_write($oid, 'request', 'request_ready', array(
|
||||
'mid' => $mid,
|
||||
'environment' => inicis_pro_environment(),
|
||||
'member_id' => isset($temp_row['mb_id']) ? $temp_row['mb_id'] : '',
|
||||
'amount' => $amount,
|
||||
'pay_type' => $pay_type,
|
||||
'easy_pay' => $easypay_name,
|
||||
'device' => $device,
|
||||
'order_type' => $is_personal ? 'personal' : 'order',
|
||||
'source' => $device === 'MOBILE' ? 'mobile' : 'web',
|
||||
'vbank_due_at' => $pay_type === 'VBANK' ? date('Y-m-d 23:59:00', G5_SERVER_TIME + (86400 * 3)) : '',
|
||||
'message' => $easypay_code !== '' ? $settle_case.' 결제창 요청정보 생성 완료' : '결제창 요청정보 생성 완료'
|
||||
));
|
||||
|
||||
inicis_pro_json_response(array('success' => true, 'request' => $request));
|
||||
@@ -0,0 +1,278 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
|
||||
@header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
|
||||
if (!function_exists('inicis_pro_return_error')) {
|
||||
function inicis_pro_return_error($message, $return_url, $lock_name, $oid = '', $stage = 'validation', $status = 'validation_failed', $code = '', $values = array())
|
||||
{
|
||||
if (!is_array($values))
|
||||
$values = array();
|
||||
$values['message'] = $message;
|
||||
if ($code !== '')
|
||||
$values['code'] = $code;
|
||||
inicis_pro_audit_write($oid, $stage, $status, $values);
|
||||
inicis_pro_unlock($lock_name);
|
||||
alert($message, $return_url);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('inicis_pro_restore_order_value')) {
|
||||
function inicis_pro_restore_order_value($value, $memo)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
$result = array();
|
||||
foreach ($value as $key => $item) {
|
||||
if (!is_scalar($key))
|
||||
continue;
|
||||
$result[$key] = inicis_pro_restore_order_value($item, false);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (!is_scalar($value))
|
||||
return '';
|
||||
|
||||
$value = stripslashes((string) $value);
|
||||
if ($memo)
|
||||
return clean_xss_tags(strip_tags($value), 0, 0, 0, 0);
|
||||
|
||||
return clean_xss_tags(strip_tags($value));
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] !== 'POST')
|
||||
alert('올바른 결제 결과 요청이 아닙니다.', G5_SHOP_URL);
|
||||
|
||||
if (!inicis_pro_is_enabled())
|
||||
alert('INIpay PRO 결제가 활성화되어 있지 않습니다.', G5_SHOP_URL);
|
||||
|
||||
$status = isset($_POST['P_STATUS']) ? trim((string) $_POST['P_STATUS']) : '';
|
||||
$message = isset($_POST['P_RMESG']) ? inicis_pro_cut($_POST['P_RMESG'], 150) : '';
|
||||
$oid_raw = isset($_POST['P_OID']) ? trim((string) $_POST['P_OID']) : '';
|
||||
$oid = inicis_pro_clean_oid($oid_raw);
|
||||
$mid = isset($_POST['P_MID']) ? trim((string) $_POST['P_MID']) : '';
|
||||
$auth_tid_raw = isset($_POST['P_AUTH_TID']) ? trim((string) $_POST['P_AUTH_TID']) : '';
|
||||
$auth_tid = inicis_pro_clean_tid($auth_tid_raw);
|
||||
$amount_raw = isset($_POST['P_AMT']) ? trim((string) $_POST['P_AMT']) : '';
|
||||
$result_type = isset($_POST['P_TYPE']) ? strtoupper(trim((string) $_POST['P_TYPE'])) : '';
|
||||
$noti = isset($_POST['P_NOTI']) ? trim((string) $_POST['P_NOTI']) : '';
|
||||
$idc = isset($_POST['P_IDCNAME']) ? strtolower(trim((string) $_POST['P_IDCNAME'])) : '';
|
||||
$page_return_url = G5_SHOP_URL.'/orderform.php';
|
||||
$lock_name = '';
|
||||
$session_order_oid = inicis_pro_clean_oid(get_session('ss_order_id'));
|
||||
$session_personal_oid = inicis_pro_clean_oid(get_session('ss_personalpay_id'));
|
||||
$session_matches_oid = $oid !== '' && ($session_order_oid === $oid || $session_personal_oid === $oid);
|
||||
|
||||
// 인증 실패 응답은 주문번호 등 일부 필드가 누락될 수 있으므로 결과코드를 먼저 처리한다.
|
||||
if ($status !== '00') {
|
||||
$error_text = $message !== '' ? $message : '결제 인증에 실패했습니다.';
|
||||
$error_code = substr(preg_replace('/[^A-Za-z0-9_-]/', '', $status), 0, 12);
|
||||
if ($error_code === '')
|
||||
$error_code = '확인불가';
|
||||
|
||||
$failure_return_url = $page_return_url;
|
||||
$session_personal_id = inicis_pro_clean_oid(get_session('ss_personalpay_id'));
|
||||
if ($session_personal_id !== '')
|
||||
$failure_return_url = G5_SHOP_URL.'/personalpayform.php?pp_id='.$session_personal_id;
|
||||
elseif (get_session('ss_direct'))
|
||||
$failure_return_url .= '?sw_direct=1';
|
||||
|
||||
inicis_pro_return_error('결제 인증 실패: '.$error_text.' (코드 '.$error_code.')', $failure_return_url, '', $session_matches_oid ? $oid : '', 'authentication', 'authentication_failed', $error_code, array(
|
||||
'mid' => $mid,
|
||||
'auth_tid' => $auth_tid,
|
||||
'amount' => preg_match('/^[0-9]+$/', $amount_raw) ? (int) $amount_raw : 0,
|
||||
'pay_type' => $result_type,
|
||||
'device' => defined('G5_IS_MOBILE') && G5_IS_MOBILE ? 'MOBILE' : 'WEB',
|
||||
'source' => defined('G5_IS_MOBILE') && G5_IS_MOBILE ? 'mobile' : 'web'
|
||||
));
|
||||
}
|
||||
|
||||
if ($oid === '' || $oid !== $oid_raw)
|
||||
alert('결제 주문번호가 올바르지 않습니다.', G5_SHOP_URL);
|
||||
|
||||
$temp_row = sql_fetch(" select * from {$g5['g5_shop_order_data_table']}
|
||||
where od_id = '".sql_escape_string($oid)."'
|
||||
and dt_pg = 'inicis'
|
||||
order by dt_time desc
|
||||
limit 1 ");
|
||||
if (empty($temp_row['od_id'])) {
|
||||
$exists_order = get_shop_order_data($oid);
|
||||
if (!empty($exists_order['od_tno'])) {
|
||||
inicis_pro_audit_order_saved($oid, $exists_order['od_tno'], 'order', 'system');
|
||||
set_session('ss_order_id', $oid);
|
||||
exists_inicis_shop_order($oid, array(), $exists_order['od_time'], $exists_order['od_ip']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$exists_personal = get_shop_order_data($oid, 'personal');
|
||||
if (!empty($exists_personal['pp_tno'])) {
|
||||
inicis_pro_audit_order_saved($oid, $exists_personal['pp_tno'], 'personal', 'system');
|
||||
set_session('ss_personalpay_id', $oid);
|
||||
set_session('ss_personalpay_hash', md5($exists_personal['pp_id'].$exists_personal['pp_price'].$exists_personal['pp_time']));
|
||||
exists_inicis_shop_order($oid, $exists_personal, $exists_personal['pp_time'], $exists_personal['pp_ip']);
|
||||
exit;
|
||||
}
|
||||
|
||||
inicis_pro_return_error('임시 주문정보가 없어서 결제를 승인할 수 없습니다.', G5_SHOP_URL, '', $oid, 'validation', 'validation_failed', 'TEMP_ORDER_MISSING', array('source' => 'web'));
|
||||
}
|
||||
|
||||
$order_data = @unserialize(base64_decode($temp_row['dt_data']));
|
||||
if (!is_array($order_data))
|
||||
inicis_pro_return_error('임시 주문정보를 확인할 수 없습니다.', G5_SHOP_URL, '', $oid, 'validation', 'validation_failed', 'TEMP_ORDER_INVALID', array('source' => 'web'));
|
||||
|
||||
$is_personal = !empty($order_data['pp_id']);
|
||||
if ($is_personal)
|
||||
$page_return_url = G5_SHOP_URL.'/personalpayform.php?pp_id='.$oid;
|
||||
elseif (!empty($order_data['sw_direct']))
|
||||
$page_return_url .= '?sw_direct=1';
|
||||
|
||||
$settle_key = $is_personal ? 'pp_settle_case' : 'od_settle_case';
|
||||
$settle_case = isset($order_data[$settle_key]) ? $order_data[$settle_key] : '';
|
||||
// MID·HashKey는 PG가 생략할 수 있는 P_TYPE 대신 주문의 결제수단으로 확정해
|
||||
// 결제요청 시점의 서명과 일치시킨다.
|
||||
$pay_type = inicis_pro_pay_type($settle_case);
|
||||
$expected_mid = inicis_pro_get_mid($pay_type);
|
||||
$hashkey = inicis_pro_get_hashkey($pay_type);
|
||||
$expected_amount = inicis_pro_expected_amount($order_data, $temp_row);
|
||||
$device = inicis_pro_check_noti($noti, $oid, $expected_amount, $hashkey);
|
||||
$audit_source = $device === 'MOBILE' ? 'mobile' : 'web';
|
||||
$audit_values = array(
|
||||
'mid' => $mid,
|
||||
'auth_tid' => $auth_tid,
|
||||
'member_id' => isset($temp_row['mb_id']) ? $temp_row['mb_id'] : '',
|
||||
'amount' => $expected_amount,
|
||||
'pay_type' => $result_type !== '' ? $result_type : inicis_pro_pay_type($settle_case),
|
||||
'environment' => inicis_pro_environment(),
|
||||
'easy_pay' => inicis_pro_easypay_name($settle_case),
|
||||
'device' => $device,
|
||||
'order_type' => $is_personal ? 'personal' : 'order',
|
||||
'source' => $audit_source
|
||||
);
|
||||
$validation_audit_oid = ($device !== '' || $session_matches_oid) ? $oid : '';
|
||||
|
||||
if ($expected_mid === '' || $hashkey === '' || $mid !== $expected_mid)
|
||||
inicis_pro_return_error('가맹점 결제정보가 일치하지 않아 주문을 중단했습니다.', $page_return_url, '', $validation_audit_oid, 'validation', 'validation_failed', 'MID_MISMATCH', $audit_values);
|
||||
if ($expected_amount <= 0 || !preg_match('/^[0-9]+$/', $amount_raw) || (int) $amount_raw !== (int) $expected_amount)
|
||||
inicis_pro_return_error('결제금액이 주문정보와 일치하지 않아 주문을 중단했습니다.', $page_return_url, '', $validation_audit_oid, 'validation', 'validation_failed', 'AMOUNT_MISMATCH', $audit_values);
|
||||
if ($auth_tid === '' || $auth_tid !== $auth_tid_raw || inicis_pro_idc_host($idc) === '')
|
||||
inicis_pro_return_error('결제 승인 정보가 올바르지 않아 주문을 중단했습니다.', $page_return_url, '', $validation_audit_oid, 'validation', 'validation_failed', 'AUTH_INFO_INVALID', $audit_values);
|
||||
if ($device === '')
|
||||
inicis_pro_return_error('주문 검증정보가 일치하지 않아 주문을 중단했습니다.', $page_return_url, '', $validation_audit_oid, 'validation', 'validation_failed', 'ORDER_SIGNATURE_MISMATCH', $audit_values);
|
||||
// 일반 인증결과에서는 P_TYPE이 생략될 수 있으며 최종 결제수단은 승인결과에서 검증한다.
|
||||
if ($result_type !== '' && !inicis_pro_result_type_matches($settle_case, $result_type))
|
||||
inicis_pro_return_error('결제수단이 주문정보와 일치하지 않아 주문을 중단했습니다.', $page_return_url, '', $validation_audit_oid, 'validation', 'validation_failed', 'PAY_TYPE_MISMATCH', $audit_values);
|
||||
|
||||
inicis_pro_audit_write($oid, 'authentication', 'authentication_received', $audit_values);
|
||||
|
||||
$lock_name = inicis_pro_lock($oid);
|
||||
if ($lock_name === '')
|
||||
inicis_pro_return_error('주문 처리가 진행 중입니다. 잠시 후 주문내역을 확인해 주십시오.', $page_return_url, '', $oid, 'order', 'order_saving', 'ORDER_LOCK_BUSY', $audit_values);
|
||||
|
||||
$exists_order = get_shop_order_data($oid);
|
||||
if (!empty($exists_order['od_tno'])) {
|
||||
inicis_pro_audit_order_saved($oid, $exists_order['od_tno'], 'order', 'system');
|
||||
inicis_pro_unlock($lock_name);
|
||||
set_session('ss_order_id', $oid);
|
||||
exists_inicis_shop_order($oid, array(), $exists_order['od_time'], $exists_order['od_ip']);
|
||||
exit;
|
||||
}
|
||||
$exists_personal = get_shop_order_data($oid, 'personal');
|
||||
if (!empty($exists_personal['pp_tno'])) {
|
||||
inicis_pro_audit_order_saved($oid, $exists_personal['pp_tno'], 'personal', 'system');
|
||||
inicis_pro_unlock($lock_name);
|
||||
set_session('ss_personalpay_id', $oid);
|
||||
set_session('ss_personalpay_hash', md5($exists_personal['pp_id'].$exists_personal['pp_price'].$exists_personal['pp_time']));
|
||||
exists_inicis_shop_order($oid, $exists_personal, $exists_personal['pp_time'], $exists_personal['pp_ip']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$_POST = array();
|
||||
foreach ($order_data as $key => $value) {
|
||||
if (!is_string($key) || !preg_match('/^[A-Za-z0-9_]+$/', $key))
|
||||
continue;
|
||||
$_POST[$key] = inicis_pro_restore_order_value($value, $key === 'od_memo');
|
||||
}
|
||||
|
||||
$_POST['inicis_pro'] = '1';
|
||||
$_POST['inicis_pro_oid'] = $oid;
|
||||
$_POST['res_cd'] = '00';
|
||||
// 모바일 주문/개인결제의 결제등록 완료 확인(P_HASH 존재 여부)을 PRO 흐름에서도 통과시킨다.
|
||||
// 실제 서명값은 승인 완료 후 pay_result.php에서 다시 채워 넣는다.
|
||||
$_POST['P_HASH'] = '1';
|
||||
|
||||
if ($is_personal) {
|
||||
$pp_row = get_shop_order_data($oid, 'personal');
|
||||
if (empty($pp_row['pp_id']))
|
||||
inicis_pro_return_error('개인결제 정보를 확인할 수 없습니다.', $page_return_url, $lock_name, $oid, 'validation', 'validation_failed', 'PERSONALPAY_MISSING', $audit_values);
|
||||
|
||||
set_session('ss_personalpay_id', $oid);
|
||||
set_session('ss_personalpay_hash', md5($pp_row['pp_id'].$pp_row['pp_price'].$pp_row['pp_time']));
|
||||
set_session('ss_order_id', $oid);
|
||||
} else {
|
||||
set_session('ss_order_id', $oid);
|
||||
set_session('ss_order_inicis_id', $oid);
|
||||
set_session('ss_direct', !empty($order_data['sw_direct']) ? 1 : 0);
|
||||
if (!empty($order_data['sw_direct']))
|
||||
set_session('ss_cart_direct', $temp_row['cart_id']);
|
||||
else
|
||||
set_session('ss_cart_id', $temp_row['cart_id']);
|
||||
}
|
||||
|
||||
if (!empty($temp_row['mb_id'])) {
|
||||
$member = get_member($temp_row['mb_id']);
|
||||
$is_member = !empty($member['mb_id']);
|
||||
if (!$is_member)
|
||||
inicis_pro_return_error('주문 회원정보를 확인할 수 없습니다.', $page_return_url, $lock_name, $oid, 'validation', 'validation_failed', 'MEMBER_MISSING', $audit_values);
|
||||
} else {
|
||||
if (!is_array($member))
|
||||
$member = array();
|
||||
$member['mb_id'] = '';
|
||||
$is_member = false;
|
||||
}
|
||||
|
||||
$field_names = shop_order_data_fields($is_personal ? 1 : 0);
|
||||
foreach ($field_names as $field_name)
|
||||
$$field_name = isset($_POST[$field_name]) ? $_POST[$field_name] : '';
|
||||
|
||||
// 승인은 주문 저장 직전(inicis/pro/pay_result.php)에서 실행하도록 필요한 값을 넘긴다.
|
||||
$GLOBALS['inicis_pro_approval_ctx'] = array(
|
||||
'oid' => $oid,
|
||||
'auth_tid' => $auth_tid,
|
||||
'idc' => $idc,
|
||||
'expected_mid' => $expected_mid,
|
||||
'expected_amount' => $expected_amount,
|
||||
'pay_type' => $pay_type,
|
||||
'result_type' => $result_type,
|
||||
'noti' => $noti,
|
||||
'device' => $device,
|
||||
'settle_case' => $settle_case,
|
||||
'is_personal' => $is_personal,
|
||||
'lock_name' => $lock_name,
|
||||
'page_return_url' => $page_return_url,
|
||||
'audit_values' => $audit_values
|
||||
);
|
||||
|
||||
inicis_pro_audit_write($oid, 'order', 'order_saving', $audit_values);
|
||||
|
||||
if ($is_personal) {
|
||||
$pp_id = $oid;
|
||||
$good_mny = $expected_amount;
|
||||
$_POST['pp_id'] = $oid;
|
||||
$_POST['good_mny'] = $expected_amount;
|
||||
if ($device === 'MOBILE')
|
||||
include G5_MSHOP_PATH.'/personalpayformupdate.php';
|
||||
else
|
||||
include G5_SHOP_PATH.'/personalpayformupdate.php';
|
||||
} else {
|
||||
$od_send_cost = isset($_POST['od_send_cost']) ? (int) $_POST['od_send_cost'] : 0;
|
||||
$od_send_cost2 = isset($_POST['od_send_cost2']) ? (int) $_POST['od_send_cost2'] : 0;
|
||||
if ($device === 'MOBILE')
|
||||
include G5_MSHOP_PATH.'/orderformupdate.php';
|
||||
else
|
||||
include G5_SHOP_PATH.'/orderformupdate.php';
|
||||
}
|
||||
|
||||
inicis_pro_unlock($lock_name);
|
||||
exit;
|
||||
+25
-8
@@ -4,7 +4,7 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
require_once(G5_SHOP_PATH.'/settle_'.$default['de_pg_service'].'.inc.php');
|
||||
require_once(G5_SHOP_PATH.'/settle_kakaopay.inc.php');
|
||||
|
||||
if( $default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use'] ){ //이니시스 Lpay 또는 이니시스 카카오페이 사용시
|
||||
if( empty($inicis_pro_use) && ($default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use']) ){ //이니시스 Lpay 또는 이니시스 카카오페이 사용시
|
||||
require_once(G5_SHOP_PATH.'/inicis/lpay_common.php');
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ if(function_exists('is_use_easypay') && is_use_easypay('global_nhnkcp')){ //
|
||||
// 결제대행사별 코드 include (스크립트 등)
|
||||
require_once(G5_SHOP_PATH.'/'.$default['de_pg_service'].'/orderform.1.php');
|
||||
|
||||
if( $default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use'] ){ //이니시스 L.pay 사용시
|
||||
if( empty($inicis_pro_use) && ($default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use']) ){ //이니시스 L.pay 사용시
|
||||
require_once(G5_SHOP_PATH.'/inicis/lpay_form.1.php');
|
||||
}
|
||||
|
||||
@@ -579,7 +579,7 @@ if($is_kakaopay_use) {
|
||||
$escrow_title = "에스크로<br>";
|
||||
}
|
||||
|
||||
if ($is_kakaopay_use || $default['de_bank_use'] || $default['de_vbank_use'] || $default['de_iche_use'] || $default['de_card_use'] || $default['de_hp_use'] || $default['de_easy_pay_use'] || $default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use']) {
|
||||
if ($is_kakaopay_use || $default['de_bank_use'] || $default['de_vbank_use'] || $default['de_iche_use'] || $default['de_card_use'] || $default['de_hp_use'] || $default['de_easy_pay_use'] || (empty($inicis_pro_use) && ($default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use'])) || (!empty($inicis_pro_use) && is_inicis_simple_pay())) {
|
||||
echo '<fieldset id="sod_frm_paysel">';
|
||||
echo '<legend>결제방법 선택</legend>';
|
||||
}
|
||||
@@ -711,14 +711,23 @@ if($is_kakaopay_use) {
|
||||
echo run_replace('shop_orderform_easypay_buttons', implode(PHP_EOL, $easypay_prints), $easypay_prints, $multi_settle);
|
||||
}
|
||||
|
||||
//이니시스 PRO 삼성페이
|
||||
if(!empty($inicis_pro_use) && $default['de_samsung_pay_use']) {
|
||||
$multi_settle++;
|
||||
echo '<input type="radio" id="od_settle_samsungpay" data-case="samsungpay" name="od_settle_case" value="삼성페이" '.$checked.'> <label for="od_settle_samsungpay" class="samsung_pay lb_icon">삼성페이</label>'.PHP_EOL;
|
||||
$checked = '';
|
||||
}
|
||||
|
||||
//이니시스 Lpay
|
||||
if($default['de_inicis_lpay_use']) {
|
||||
$multi_settle++;
|
||||
echo '<input type="radio" id="od_settle_inicislpay" data-case="lpay" name="od_settle_case" value="lpay" '.$checked.'> <label for="od_settle_inicislpay" class="inicis_lpay lb_icon">L.pay</label>'.PHP_EOL;
|
||||
$checked = '';
|
||||
}
|
||||
|
||||
//이니시스 카카오페이
|
||||
if(isset($default['de_inicis_kakaopay_use']) && $default['de_inicis_kakaopay_use']) {
|
||||
$multi_settle++;
|
||||
echo '<input type="radio" id="od_settle_inicis_kakaopay" data-case="inicis_kakaopay" name="od_settle_case" value="inicis_kakaopay" '.$checked.' title="KG 이니시스 카카오페이"> <label for="od_settle_inicis_kakaopay" class="inicis_kakaopay lb_icon">KG 이니시스 카카오페이<em></em></label>'.PHP_EOL;
|
||||
$checked = '';
|
||||
}
|
||||
@@ -786,7 +795,7 @@ if($is_kakaopay_use) {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if ($is_kakaopay_use || $default['de_bank_use'] || $default['de_vbank_use'] || $default['de_iche_use'] || $default['de_card_use'] || $default['de_hp_use'] || $default['de_easy_pay_use'] || $default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use'] ) {
|
||||
if ($is_kakaopay_use || $default['de_bank_use'] || $default['de_vbank_use'] || $default['de_iche_use'] || $default['de_card_use'] || $default['de_hp_use'] || $default['de_easy_pay_use'] || (empty($inicis_pro_use) && ($default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use'])) || (!empty($inicis_pro_use) && is_inicis_simple_pay())) {
|
||||
echo '</fieldset>';
|
||||
}
|
||||
|
||||
@@ -818,7 +827,7 @@ if($is_kakaopay_use) {
|
||||
</form>
|
||||
|
||||
<?php
|
||||
if( $default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use'] ){ //이니시스 L.pay 또는 이니시스 카카오페이 사용시
|
||||
if( empty($inicis_pro_use) && ($default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use']) ){ //이니시스 L.pay 또는 이니시스 카카오페이 사용시
|
||||
require_once(G5_SHOP_PATH.'/inicis/lpay_order.script.php');
|
||||
}
|
||||
if(function_exists('is_use_easypay') && is_use_easypay('global_nhnkcp')){ // 타 PG 사용시 NHN KCP 네이버페이 사용이 설정되어 있다면
|
||||
@@ -1457,7 +1466,7 @@ function forderform_check(f)
|
||||
|
||||
var form_order_method = '';
|
||||
|
||||
if( settle_method == "lpay" || settle_method == "inicis_kakaopay" ){ //이니시스 L.pay 또는 이니시스 카카오페이 이면 ( 이니시스의 삼성페이는 모바일에서만 단독실행 가능함 )
|
||||
if( (settle_method == "lpay" || settle_method == "inicis_kakaopay") && <?php echo !empty($inicis_pro_use) ? 'false' : 'true'; ?> ){ //이니시스 L.pay 또는 이니시스 카카오페이 이면 ( 이니시스의 삼성페이는 모바일에서만 단독실행 가능함 )
|
||||
form_order_method = 'samsungpay';
|
||||
} else if(settle_method == "간편결제") {
|
||||
if(jQuery("input[name='od_settle_case']:checked" ).attr("data-pay") === "naverpay"){
|
||||
@@ -1593,6 +1602,10 @@ function forderform_check(f)
|
||||
f.gopaymethod.value = "Card";
|
||||
f.acceptmethod.value = f.acceptmethod.value.replace(":useescrow", "");
|
||||
break;
|
||||
case "삼성페이":
|
||||
f.gopaymethod.value = "Card";
|
||||
f.acceptmethod.value = f.acceptmethod.value.replace(":useescrow", "");
|
||||
break;
|
||||
case "간편결제":
|
||||
f.gopaymethod.value = "Kpay";
|
||||
break;
|
||||
@@ -1802,10 +1815,14 @@ function forderform_check(f)
|
||||
return false;
|
||||
}
|
||||
|
||||
<?php if (!empty($inicis_pro_use)) { ?>
|
||||
return inicis_pro_pay("<?php echo $od_id; ?>", "WEB");
|
||||
<?php } else { ?>
|
||||
if(!make_signature(f))
|
||||
return false;
|
||||
|
||||
|
||||
paybtn(f);
|
||||
<?php } ?>
|
||||
} else {
|
||||
f.submit();
|
||||
}
|
||||
@@ -1875,4 +1892,4 @@ $(function(){
|
||||
$("#od_hope_date").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true, yearRange: "c-99:c+99", minDate: "+<?php echo (int)$default['de_hope_date_after']; ?>d;", maxDate: "+<?php echo (int)$default['de_hope_date_after'] + 6; ?>d;" });
|
||||
});
|
||||
<?php } ?>
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -353,7 +353,10 @@ else if ($od_settle_case == "계좌이체")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_SHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -387,7 +390,10 @@ else if ($od_settle_case == "가상계좌")
|
||||
$od_receipt_time = '0000-00-00 00:00:00';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
$od_app_no = $app_no;
|
||||
break;
|
||||
case 'nicepay':
|
||||
@@ -418,7 +424,10 @@ else if ($od_settle_case == "휴대폰")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_SHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -448,7 +457,10 @@ else if ($od_settle_case == "신용카드")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_SHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -470,7 +482,7 @@ else if ($od_settle_case == "신용카드")
|
||||
if($od_misu == 0)
|
||||
$od_status = '입금';
|
||||
}
|
||||
else if ($od_settle_case == "간편결제" || (($od_settle_case == "lpay" || $od_settle_case == "inicis_kakaopay") && $default['de_pg_service'] === 'inicis') )
|
||||
else if ($od_settle_case == "간편결제" || (in_array($od_settle_case, array("삼성페이", "lpay", "inicis_kakaopay")) && $default['de_pg_service'] === 'inicis') )
|
||||
{
|
||||
switch($default['de_pg_service']) {
|
||||
case 'lg':
|
||||
@@ -480,7 +492,10 @@ else if ($od_settle_case == "간편결제" || (($od_settle_case == "lpay" || $od
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_SHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -705,6 +720,9 @@ if(!$result) {
|
||||
die('<p>고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.</p><p>'.strtoupper($od_pg).'를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.');
|
||||
}
|
||||
|
||||
if (!empty($_POST['inicis_pro']) && function_exists('inicis_pro_audit_order_saved'))
|
||||
inicis_pro_audit_order_saved($od_id, $od_tno, 'order', 'web');
|
||||
|
||||
// 회원이면서 포인트를 사용했다면 테이블에 사용을 추가
|
||||
// 동시 주문 race condition 방지 — 회원 단위 GET_LOCK + 잔액 재조회
|
||||
if ($is_member && $od_receipt_point) {
|
||||
|
||||
@@ -27,10 +27,30 @@ $ct = sql_fetch($sql);
|
||||
|
||||
$uid = function_exists('get_shop_uid') ? get_shop_uid('order', $od['od_id'], $od['od_time'], $od['od_ip']) : md5($od['od_id'].$od['od_time'].$od['od_ip']);
|
||||
|
||||
// 비회원은 주문조회 인증을 통과한 본인 주문만 취소할 수 있다.
|
||||
if (empty($member['mb_id']) && (string) $uid !== (string) get_session('ss_orderview_uid'))
|
||||
alert("본인 주문만 취소할 수 있습니다.", G5_SHOP_URL);
|
||||
|
||||
if($od['od_cancel_price'] > 0 || $od['od_status'] != '주문' || $ct['od_count1'] != $ct['od_count2']) {
|
||||
alert("취소할 수 있는 주문이 아닙니다.", G5_SHOP_URL."/orderinquiryview.php?od_id=$od_id&uid=$uid");
|
||||
}
|
||||
|
||||
// INIpay PRO 가상계좌 입금통보와 주문자 취소가 동시에 처리되지 않도록
|
||||
// PG 취소부터 로컬 주문 취소 완료까지 동일 주문 잠금을 유지한다.
|
||||
$inicis_pro_order_lock = '';
|
||||
if (!empty($od['od_tno']) && $od['od_pg'] === 'inicis') {
|
||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
$inicis_pro_tables = inicis_pro_audit_tables();
|
||||
$inicis_pro_order = sql_fetch(" select ip_id from `{$inicis_pro_tables['summary']}`
|
||||
where ip_oid = '".sql_escape_string($od['od_id'])."'
|
||||
and ip_tid = '".sql_escape_string($od['od_tno'])."' ", false);
|
||||
if (!empty($inicis_pro_order['ip_id'])) {
|
||||
$inicis_pro_order_lock = inicis_pro_lock($od['od_id']);
|
||||
if ($inicis_pro_order_lock === '')
|
||||
alert('동일 주문의 결제 또는 통보 처리가 진행 중입니다. 잠시 후 다시 취소해 주십시오.', G5_SHOP_URL."/orderinquiryview.php?od_id=$od_id&uid=$uid");
|
||||
}
|
||||
}
|
||||
|
||||
// PG 결제 취소
|
||||
if($od['od_tno']) {
|
||||
switch($od['od_pg']) {
|
||||
@@ -75,6 +95,8 @@ if($od['od_tno']) {
|
||||
$args = array(
|
||||
'paymethod' => get_type_inicis_paymethod($od['od_settle_case']),
|
||||
'tid' => $od['od_tno'],
|
||||
'audit_oid' => $od['od_id'],
|
||||
'audit_source' => 'web',
|
||||
'msg' => $cancel_msg
|
||||
);
|
||||
|
||||
@@ -187,4 +209,7 @@ if ($od['od_receipt_point'] > 0 && $affected) {
|
||||
insert_point($member['mb_id'], $od['od_receipt_point'], "주문번호 $od_id 본인 취소", '@shop_order', $od_id, 'cancel');
|
||||
}
|
||||
|
||||
if ($inicis_pro_order_lock !== '')
|
||||
inicis_pro_unlock($inicis_pro_order_lock);
|
||||
|
||||
goto_url(G5_SHOP_URL."/orderinquiryview.php?od_id=$od_id&uid=$uid");
|
||||
|
||||
@@ -421,10 +421,14 @@ function forderform_check(f)
|
||||
return false;
|
||||
}
|
||||
|
||||
<?php if (!empty($inicis_pro_use)) { ?>
|
||||
return inicis_pro_pay("<?php echo $od_id; ?>", "WEB");
|
||||
<?php } else { ?>
|
||||
if(!make_signature(f))
|
||||
return false;
|
||||
|
||||
paybtn(f);
|
||||
<?php } ?>
|
||||
} else {
|
||||
f.submit();
|
||||
}
|
||||
@@ -470,4 +474,4 @@ function forderform_check(f)
|
||||
<?php } ?>
|
||||
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -49,7 +49,10 @@ if ($pp_settle_case == "계좌이체")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_SHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -77,7 +80,10 @@ else if ($pp_settle_case == "가상계좌")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_SHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -105,7 +111,10 @@ else if ($pp_settle_case == "휴대폰")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_SHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -131,7 +140,10 @@ else if ($pp_settle_case == "신용카드")
|
||||
include G5_SHOP_PATH.'/toss/toss_result.php';
|
||||
break;
|
||||
case 'inicis':
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
if (!empty($_POST['inicis_pro']))
|
||||
include G5_SHOP_PATH.'/inicis/pro/pay_result.php';
|
||||
else
|
||||
include G5_SHOP_PATH.'/inicis/inistdpay_result.php';
|
||||
break;
|
||||
case 'nicepay':
|
||||
include G5_SHOP_PATH.'/nicepay/nicepay_result.php';
|
||||
@@ -215,7 +227,7 @@ if(!$result) {
|
||||
break;
|
||||
}
|
||||
|
||||
die("<p>$sql<p>" . sql_error_info() . "<p>error file : {$_SERVER['SCRIPT_NAME']}");
|
||||
die('개인결제 정보를 처리하는 중 오류가 발생했습니다. 결제 취소 여부를 관리자에게 문의해 주십시오.');
|
||||
}
|
||||
|
||||
// 주문번호가 있으면 결제정보 반영
|
||||
@@ -259,7 +271,7 @@ if($pp_receipt_price > 0 && $pp['pp_id'] && $pp['od_id']) {
|
||||
break;
|
||||
}
|
||||
|
||||
die("<p>$sql<p>" . sql_error_info() . "<p>error file : {$_SERVER['SCRIPT_NAME']}");
|
||||
die('주문 결제정보를 처리하는 중 오류가 발생했습니다. 결제 취소 여부를 관리자에게 문의해 주십시오.');
|
||||
}
|
||||
|
||||
// 미수금 정보 업데이트
|
||||
@@ -282,6 +294,9 @@ if($pp_receipt_price > 0 && $pp['pp_id'] && $pp['od_id']) {
|
||||
}
|
||||
|
||||
// 개인결제번호제거
|
||||
if (!empty($_POST['inicis_pro']) && function_exists('inicis_pro_audit_order_saved'))
|
||||
inicis_pro_audit_order_saved($pp['pp_id'], $pp_tno, 'personal', 'web');
|
||||
|
||||
set_session('ss_personalpay_id', '');
|
||||
set_session('ss_personalpay_hash', '');
|
||||
|
||||
@@ -315,4 +330,4 @@ goto_url(G5_SHOP_URL.'/personalpayresult.php?pp_id='.$pp['pp_id'].'&uid='.$u
|
||||
document.onkeydown = noRefresh ;
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
$useescrow = '';
|
||||
$inicis_pro_use = isset($default['de_inicis_pro_use']) && (int) $default['de_inicis_pro_use'] === 1;
|
||||
|
||||
if ($default['de_card_test']) {
|
||||
if ($default['de_escrow_use'] == 1) {
|
||||
@@ -42,6 +43,8 @@ else {
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/INIStdPayUtil.php');
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/sha256.inc.php');
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/inicis_youngcart_fn.php');
|
||||
if ($inicis_pro_use)
|
||||
require_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
||||
|
||||
$mid = $default['de_inicis_mid'];
|
||||
$signKey = $default['de_inicis_sign_key'];
|
||||
@@ -134,4 +137,4 @@ $PAY_METHOD = array(
|
||||
'DirectBank' => '계좌이체',
|
||||
'HPP' => '휴대폰',
|
||||
'VBank' => '가상계좌'
|
||||
);
|
||||
);
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
define('G5_VERSION', '그누보드5');
|
||||
define('G5_GNUBOARD_VER', '5.6.32');
|
||||
define('G5_GNUBOARD_VER', '5.6.33');
|
||||
// 그누보드5.4.5.5 버전과 영카트5.4.5.5.1 버전을 합쳐서 그누보드5.4.6 버전에서 시작함 (kagla-210617)
|
||||
// G5_YOUNGCART_VER 이 상수를 사용하는 곳이 있으므로 주석 처리 해제함
|
||||
// 그누보드5.4.6 이상 버전 부터는 영카트를 그누보드에 포함하여 배포하므로 영카트5의 버전은 의미가 없습니다.
|
||||
|
||||
Reference in New Issue
Block a user