From c4b54a621974a0983cadccde33ab3f71066d5686 Mon Sep 17 00:00:00 2001 From: thisgun Date: Thu, 11 Jun 2026 10:10:23 +0000 Subject: [PATCH] =?UTF-8?q?=EB=82=98=EC=9D=B4=EC=8A=A4=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=20=EC=8B=A4=ED=8C=A8=20=EC=9D=91=EB=8B=B5=20=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=20=EB=B3=B4=EA=B0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 1caea3176ef8d3fd6057fc9a7e6646878cdf3e0c) --- mobile/shop/nicepay/nicepay_result.php | 38 +++++++++---------- shop/nicepay/nicepay_result.php | 52 +++++++++++++------------- shop/settle_nicepay_common.php | 4 ++ 3 files changed, 50 insertions(+), 44 deletions(-) diff --git a/mobile/shop/nicepay/nicepay_result.php b/mobile/shop/nicepay/nicepay_result.php index 0d8a3fe2a..249046363 100644 --- a/mobile/shop/nicepay/nicepay_result.php +++ b/mobile/shop/nicepay/nicepay_result.php @@ -41,21 +41,6 @@ if ($order_price != $amt) { alert("요청한 결제금액이 틀리므로 결제를 진행할수 없습니다.", G5_SHOP_URL); } -// hex(sha256(AuthToken+MID+Amt+MerchantKey)), 위변조 검증 데이터 -$authSignData = bin2hex(hash('sha256', $authToken. $default['de_nicepay_mid'] . $order_price . $default['de_nicepay_key'], true)); - -if ($Signature != $authSignData) { - 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 if (! function_exists('jsonRespDump')) { function jsonRespDump($resp){ @@ -81,10 +66,25 @@ if (! function_exists('nicepay_res')) { */ $response = ""; -if($authResultCode === "0000"){ - /* - **************************************************************************************** - * (do not modify) +if($authResultCode === "0000"){ + // hex(sha256(AuthToken+MID+Amt+MerchantKey)), 위변조 검증 데이터 + $authSignData = bin2hex(hash('sha256', $authToken. $default['de_nicepay_mid'] . $order_price . $default['de_nicepay_key'], true)); + + if ($Signature != $authSignData) { + 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); + } + + /* + **************************************************************************************** + * (do not modify) **************************************************************************************** */ $ediDate = preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS); diff --git a/shop/nicepay/nicepay_result.php b/shop/nicepay/nicepay_result.php index 86860a258..3fc30df1f 100644 --- a/shop/nicepay/nicepay_result.php +++ b/shop/nicepay/nicepay_result.php @@ -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."
"; - } -} +if (! function_exists('jsonRespDump')) { + function jsonRespDump($resp){ + $respArr = json_decode($resp); + foreach ( $respArr as $key => $value ){ + echo "$key=". $value."
"; + } + } +} 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"){ - /* - **************************************************************************************** - * (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); + } + + /* + **************************************************************************************** + * (do not modify) **************************************************************************************** */ $ediDate = preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS); diff --git a/shop/settle_nicepay_common.php b/shop/settle_nicepay_common.php index ac6a5967f..82036f16d 100644 --- a/shop/settle_nicepay_common.php +++ b/shop/settle_nicepay_common.php @@ -211,7 +211,11 @@ if (in_array($_SERVER['REMOTE_ADDR'], $pg_allow_ips)) { //************************************************************************************* + } else { + echo "FAIL"; } +} else { + echo "FAIL"; }