나이스페이 실패 응답 처리 보강

(cherry picked from commit 1caea3176ef8d3fd6057fc9a7e6646878cdf3e0c)
This commit is contained in:
thisgun
2026-08-24 07:44:22 +00:00
parent 8e7ec335c3
commit c4b54a6219
3 changed files with 50 additions and 44 deletions
+27 -25
View File
@@ -41,28 +41,15 @@ if ($order_price != $amt) {
alert("요청한 결제금액이 틀리므로 결제를 진행할수 없습니다.", G5_SHOP_URL);
}
// hex(sha256(AuthToken+MID+Amt+MerchantKey)), 위변조 검증 데이터
$signData = bin2hex(hash('sha256', $authToken. $default['de_nicepay_mid'] . $order_price . $default['de_nicepay_key'], true));
if ($Signature != $signData) {
alert("유효성 검증이 틀려서 결제를 진행할수 없습니다.");
}
if (! nicepay_is_allowed_api_url($nextAppURL, array('/webapi/pay_process.jsp'))) {
alert("승인 요청 url이 올바르지 않습니다.", G5_SHOP_URL);
}
if (! nicepay_is_allowed_api_url($netCancelURL, array('/webapi/cancel_process.jsp'))) {
alert("망취소 요청 url이 올바르지 않습니다.", G5_SHOP_URL);
}
// API CALL foreach example
function jsonRespDump($resp){
$respArr = json_decode($resp);
foreach ( $respArr as $key => $value ){
echo "$key=". $value."<br />";
}
}
if (! function_exists('jsonRespDump')) {
function jsonRespDump($resp){
$respArr = json_decode($resp);
foreach ( $respArr as $key => $value ){
echo "$key=". $value."<br />";
}
}
}
if (! function_exists('nicepay_res')) {
function nicepay_res($key, $data, $default_val='') {
@@ -79,10 +66,25 @@ if (! function_exists('nicepay_res')) {
*/
$response = "";
if($authResultCode === "0000"){
/*
****************************************************************************************
* <Hash encryption> (do not modify)
if($authResultCode === "0000"){
// hex(sha256(AuthToken+MID+Amt+MerchantKey)), 위변조 검증 데이터
$signData = bin2hex(hash('sha256', $authToken. $default['de_nicepay_mid'] . $order_price . $default['de_nicepay_key'], true));
if ($Signature != $signData) {
alert("유효성 검증이 틀려서 결제를 진행할수 없습니다.");
}
if (! nicepay_is_allowed_api_url($nextAppURL, array('/webapi/pay_process.jsp'))) {
alert("승인 요청 url이 올바르지 않습니다.", G5_SHOP_URL);
}
if (! nicepay_is_allowed_api_url($netCancelURL, array('/webapi/cancel_process.jsp'))) {
alert("망취소 요청 url이 올바르지 않습니다.", G5_SHOP_URL);
}
/*
****************************************************************************************
* <Hash encryption> (do not modify)
****************************************************************************************
*/
$ediDate = preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS);
+4
View File
@@ -211,7 +211,11 @@ if (in_array($_SERVER['REMOTE_ADDR'], $pg_allow_ips)) {
//*************************************************************************************
} else {
echo "FAIL";
}
} else {
echo "FAIL";
}