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"; }