Update orderpay.step2.pgkcp.php

This commit is contained in:
Namhyeon Go 2018-11-11 03:54:02 +09:00 committed by GitHub
parent 50be46089e
commit 856b400d7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,9 @@ if(check_token_abuse_by_requests("_token", "_POST")) {
show_errors();
}
loadHelper("webpagetool"); // load webpage tools
loadHelper("networktool"); // load network tools
loadHelper("string.utl"); // load string utility
loadHelper("pgkcp.lnk"); // load KCP PG Helper
loadHelper("JSLoader.class"); // load javascript loader
@ -29,66 +31,77 @@ load_pgkcp_library();
// 01. 지불 요청 정보 설정
$payres = array();
$payinfo = array(
"req_tx" => get_requested_value("req_tx"),
"tran_cd" => get_requested_value("tran_cd"),
"cust_ip" => get_network_client_addr(),
"ordr_idxx" => get_requested_value("ordr_idxx"),
"good_name" => get_requested_value("good_name"),
"res_cd" => "",
"res_msg" => "",
"res_en_msg" => "",
"tno" => get_requested_value("tno"),
"buyr_name" => get_requested_value("buyr_name"),
"buyr_tel1" => get_requested_value("buyr_tel1"),
"buyr_tel2" => get_requested_value("buyr_tel2"),
"buyr_mail" => get_requested_value("buyr_mail"),
"use_pay_method_alias" => "",
"use_pay_method" => get_requested_value("use_pay_method"),
"bSucc" => "",
"app_time" => "",
"amount" => "",
"total_amount" => 0,
"coupon_mny" => "",
"app_time" => "",
"amount" => "",
"total_amount" => 0,
"coupon_mny" => "",
"card_cd" => "",
"card_name" => "",
"app_no" => "",
"noinf" => "",
"quota" => "",
"partcanc_yn" => "",
"card_bin_type_01" => "",
"card_bin_type_02" => "",
"card_mny" => "",
"bank_name" => "",
"bank_code" => "",
"bk_mny" => "",
"bankname" => "",
"depositor" => "",
"account" => "",
"va_date" => "",
"pnt_issue" => "",
"pnt_amount" => "",
"pnt_app_time" => "",
"pnt_app_no" => "",
"add_pnt" => "",
"use_pnt" => "",
"rsv_pnt" => "",
"commid" => "",
"mobile_no" => "",
"shop_user_id" => get_requested_value("shop_user_id"),
"tk_van_code" => "",
"tk_app_no" => "",
"cash_yn" => get_requested_value("cash_yn"),
"cash_authno" => "",
"cash_tr_code" => get_requested_value("cash_tr_code"),
"cash_id_info" => get_requested_value("cash_id_info"),
"cash_no" => get_requested_value("cash_no"),
"pay_data" => get_requested_value("pay_data")
$payinfo = array();
$fieldnames = array(
"req_tx",
"tran_cd",
"cust_ip",
"ordr_idxx",
"good_name",
"res_cd",
"res_msg",
"res_en_msg",
"tno",
"buyr_name",
"buyr_tel1",
"buyr_tel2",
"buyr_mail",
"pay_method_alias",
"pay_method",
"use_pay_method",
"bSucc",
"app_time",
"amount",
"total_amount",
"coupon_mny",
"app_time",
"amount",
"total_amount",
"coupon_mny",
"card_cd",
"card_name",
"app_no",
"noinf",
"quota",
"partcanc_yn",
"card_bin_type_01",
"card_bin_type_02",
"card_mny",
"bank_name",
"bank_code",
"bk_mny",
"bankname",
"depositor",
"account",
"va_date",
"pnt_issue",
"pnt_amount",
"pnt_app_time",
"pnt_app_no",
"add_pnt",
"use_pnt",
"rsv_pnt",
"commid",
"mobile_no",
"shop_user_id",
"tk_van_code",
"tk_app_no",
"cash_yn",
"cash_authno",
"cash_tr_code",
"cash_id_info",
"cash_no",
"pay_data"
);
foreach($fieldnames as $name) {
$payinfo[$name] = make_safe_argument(get_requested_value($name));
}
// set current ip address
$payinfo['cust_ip'] = get_network_client_addr();
// set converted result message
$payinfo['res_msg'] = get_converted_string($payinfo['res_msg'], "utf-8", "cp949");
// extract payinfo
extract($payinfo);
@ -210,11 +223,9 @@ if($req_tx == "pay") {
}
}
// extract result
extract($payres);
// process database
$use_pay_method_alias = get_value_in_array("use_pay_method_alias", $payinfo, "");
// checking vaild payment method
$res_succ_flag = false;
$pay_method_alias = get_value_in_array("pay_method_alias", $payinfo, "");
$pay_method_rules = array(
"CRE" => "100000000000", // 신용카드
"ACC" => "010000000000", // 계좌이체
@ -223,18 +234,20 @@ $pay_method_rules = array(
"PHO" => "000010000000", // 휴대폰
"GIF" => "000000001000", // 상품권
"ARS" => "000000000010", // ARS
"CAV" => "111000000000" // 신용카드/계좌이체/가상계좌
"CAV" => "111000000000", // 신용카드/계좌이체/가상계좌
"NOP" => "" // 수기결제/무통장입금
);
if(in_array($pay_method_rules, array_values($pay_method_rules))) {
foreach($pay_method_rules as $k=>$v) {
if($use_pay_method == $v) {
$use_pay_method_alias = $k;
foreach($pay_method_rules as $k=>$v) {
if($pay_method_alias == $k) {
$payres['use_pay_method_alias'] = $k;
$res_succ_flag = true;
break;
}
}
$payres['bSucc'] = "true";
} else {
$payres['bSucc'] = "false";
}
$payres['bSucc'] = $res_succ_flag ? "true" : "false";
// set result
extract($payres);
// cancel payment when failed
if($req_tx == "pay") {
@ -261,13 +274,14 @@ if($req_tx == "pay") {
}
} // End of [res_cd = "0000"]
// extract result
// set result
extract($payres);
// 08. 폼 구성 및 결과페이지 호출
// set javascript files
$jsloader = new JSLoader();
$jsloader->add_scripts(get_webproxy_url("https://code.jquery.com/jquery-3.3.1.min.js"));
$jsloader->add_scripts(base_url() . "view/public/js/route/orderpay.step2.pgkcp.js");
$jsoutput = $jsloader->get_output();
$data['jsoutput'] = $jsoutput;