KG이니시스 IDC 센터코드 검증 추가

This commit is contained in:
thisgun
2025-06-05 16:10:55 +09:00
parent dc4c2a79d9
commit bb1f69e86c
2 changed files with 36 additions and 15 deletions

View File

@ -3,9 +3,12 @@ include_once('./_common.php');
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
require_once(G5_SHOP_PATH.'/inicis/libs/HttpClient.php');
require_once(G5_SHOP_PATH.'/inicis/libs/json_lib.php');
require_once(G5_SHOP_PATH.'/inicis/libs/properties.php');
$inicis_pay_result = false;
$prop = new properties();
try {
//#############################
@ -37,6 +40,18 @@ try {
///$mKey = $util->makeHash(signKey, "sha256"); // 가맹점 확인을 위한 signKey를 해시값으로 변경 (SHA-256방식 사용)
$mKey = hash("sha256", $signKey);
//##########################################################################
// 승인요청 API url (authUrl) 리스트 는 properties 에 세팅하여 사용합니다.
// idc_name 으로 수신 받은 센터 네임을 properties 에서 include 하여 승인요청하시면 됩니다.
//##########################################################################
$idc_name = $_REQUEST["idc_name"];
$authUrl = $prop->getAuthUrl($idc_name);
if (strcmp($authUrl, $_REQUEST["authUrl"]) != 0) {
die("authUrl check Fail\n");
}
//#####################
// 2.signature 생성
//#####################
@ -172,22 +187,28 @@ try {
//#####################
$netcancelResultString = ""; // 망취소 요청 API url(고정, 임의 세팅 금지)
if ($httpUtil->processHTTP($netCancel, $authMap)) {
$netcancelResultString = $httpUtil->body;
} else {
echo "Http Connect Error\n";
echo $httpUtil->errormsg;
$netCancel = $prop->getNetCancel($idc_name);
if (strcmp($netCancel, $_REQUEST["netCancelUrl"]) == 0) {
if ($httpUtil->processHTTP($netCancel, $authMap)) {
$netcancelResultString = $httpUtil->body;
} else {
echo "Http Connect Error\n";
echo $httpUtil->errormsg;
throw new Exception("Http Connect Error");
throw new Exception("Http Connect Error");
}
echo "<br/>## 망취소 API 결과 ##<br/>";
/*##XML output##*/
//$netcancelResultString = str_replace("<", "&lt;", $$netcancelResultString);
//$netcancelResultString = str_replace(">", "&gt;", $$netcancelResultString);
// 취소 결과 확인
echo "<p>". $netcancelResultString . "</p>";
}
echo "## 망취소 API 결과 ##";
$netcancelResultString = str_replace("<", "&lt;", $$netcancelResultString);
$netcancelResultString = str_replace(">", "&gt;", $$netcancelResultString);
echo "<pre>", $netcancelResultString . "</pre>";
// 취소 결과 확인
}
} else {