From 84669cb47fe830bd6d56e883ab39fad7cc9db8e8 Mon Sep 17 00:00:00 2001 From: thisgun Date: Wed, 3 Apr 2024 10:42:04 +0900 Subject: [PATCH] =?UTF-8?q?=EB=82=98=EC=9D=B4=EC=8A=A4=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=20=EA=B2=B0=EC=A0=9C=EC=88=98=EB=8B=A8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adm/css/admin.css | 2 + adm/shop_admin/admin.shop.lib.php | 15 ++ adm/shop_admin/configform.php | 53 +++++- adm/shop_admin/configformupdate.php | 4 + adm/shop_admin/orderform.php | 26 ++- adm/shop_admin/orderformcartupdate.php | 30 +++- css/default_shop.css | 7 +- css/mobile_shop.css | 16 +- img/skpay11_icon.png | Bin 0 -> 7920 bytes img/ssgpay_icon.png | Bin 0 -> 1887 bytes install/gnuboard5shop.sql | 2 + lib/shop.lib.php | 18 ++ mobile/shop/nicepay/_common.php | 6 + mobile/shop/nicepay/index.php | 2 + mobile/shop/nicepay/nicepay_result.php | 192 ++++++++++++++++++++ mobile/shop/nicepay/orderform.1.php | 140 +++++++++++++++ mobile/shop/nicepay/orderform.2.php | 17 ++ mobile/shop/nicepay/orderform.3.php | 2 + mobile/shop/nicepay/return_url_result.php | 89 ++++++++++ mobile/shop/orderform.sub.php | 136 +++++++++++++-- mobile/shop/orderformupdate.php | 19 ++ mobile/shop/orderinquiryview.php | 19 +- mobile/shop/personalpayform.sub.php | 51 ++++++ mobile/shop/personalpayformupdate.php | 16 ++ mobile/shop/personalpayresult.php | 6 + mobile/shop/settle_nicepay.inc.php | 6 + shop/nicepay/_common.php | 2 + shop/nicepay/cancel_process.php | 57 ++++++ shop/nicepay/createsigndata.php | 26 +++ shop/nicepay/escrow.register.php | 77 ++++++++ shop/nicepay/index.php | 0 shop/nicepay/nicepay_result.php | 204 ++++++++++++++++++++++ shop/nicepay/orderform.1.php | 98 +++++++++++ shop/nicepay/orderform.2.php | 49 ++++++ shop/nicepay/orderform.3.php | 12 ++ shop/nicepay/orderform.4.php | 2 + shop/nicepay/orderpartcancel.inc.php | 61 +++++++ shop/nicepay/taxsave_form.php | 203 +++++++++++++++++++++ shop/nicepay/taxsave_result.php | 185 ++++++++++++++++++++ shop/orderform.sub.php | 146 ++++++++++++++-- shop/orderformupdate.php | 29 +++ shop/orderinquirycancel.php | 30 ++++ shop/orderinquiryview.php | 21 ++- shop/personalpayform.php | 4 +- shop/personalpayform.sub.php | 68 +++++++- shop/personalpayformupdate.php | 16 ++ shop/personalpayresult.php | 6 + shop/settle_nicepay.inc.php | 70 ++++++++ shop/settle_nicepay_common.php | 176 +++++++++++++++++++ shop/taxsave.php | 6 + theme/basic/css/default_shop.css | 7 +- theme/basic/css/mobile_shop.css | 16 +- theme/basic/shop/orderinquiryview.php | 23 ++- 53 files changed, 2403 insertions(+), 65 deletions(-) create mode 100644 img/skpay11_icon.png create mode 100644 img/ssgpay_icon.png create mode 100644 mobile/shop/nicepay/_common.php create mode 100644 mobile/shop/nicepay/index.php create mode 100644 mobile/shop/nicepay/nicepay_result.php create mode 100644 mobile/shop/nicepay/orderform.1.php create mode 100644 mobile/shop/nicepay/orderform.2.php create mode 100644 mobile/shop/nicepay/orderform.3.php create mode 100644 mobile/shop/nicepay/return_url_result.php create mode 100644 mobile/shop/settle_nicepay.inc.php create mode 100644 shop/nicepay/_common.php create mode 100644 shop/nicepay/cancel_process.php create mode 100644 shop/nicepay/createsigndata.php create mode 100644 shop/nicepay/escrow.register.php create mode 100644 shop/nicepay/index.php create mode 100644 shop/nicepay/nicepay_result.php create mode 100644 shop/nicepay/orderform.1.php create mode 100644 shop/nicepay/orderform.2.php create mode 100644 shop/nicepay/orderform.3.php create mode 100644 shop/nicepay/orderform.4.php create mode 100644 shop/nicepay/orderpartcancel.inc.php create mode 100644 shop/nicepay/taxsave_form.php create mode 100644 shop/nicepay/taxsave_result.php create mode 100644 shop/settle_nicepay.inc.php create mode 100644 shop/settle_nicepay_common.php diff --git a/adm/css/admin.css b/adm/css/admin.css index c896d6815..75763206a 100644 --- a/adm/css/admin.css +++ b/adm/css/admin.css @@ -624,6 +624,7 @@ a.lg_btn{display:inline-block;margin:5px 0 0;padding:5px 10px;background:#ED008C a.kg_btn{display:inline-block;margin:5px 0 0;padding:5px 10px;background:#4A2C7C;color:#fff;font-weight:normal;text-decoration:none} a.kakao_btn{display:inline-block;margin:5px 0 0;padding:5px 10px;background:#FDDC2F;color:#3B1E1E;font-weight:normal;text-decoration:none} a.naver_btn {display:inline-block;margin:5px 0 0;padding:5px 10px;background:#00C73C;color:#fff;font-weight:normal;text-decoration:none} +a.nicepay_btn{display:inline-block;margin:5px 0 0;padding:5px 10px;background:#0057bf;color:#fff;font-weight:normal;text-decoration:none} .scf_cardtest {margin:5px 0 0} .scf_cardtest_btn {margin-left:5px;vertical-align:middle} @@ -666,6 +667,7 @@ ul.de_pg_tab li.tab-current a{background:#2CC185;color:#fff} .inicis_info_fld th{background-color:#F6F1FF} .kakao_info_fld th{background-color:#FFFCED} .naver_info_fld th{background-color:#F3FFF3} +.nicepay_info_fld th{background-color:#d1e6ff} /* 주문내역 */ #sodr_list td {text-align:center} diff --git a/adm/shop_admin/admin.shop.lib.php b/adm/shop_admin/admin.shop.lib.php index 4aa2ba405..247cc282e 100644 --- a/adm/shop_admin/admin.shop.lib.php +++ b/adm/shop_admin/admin.shop.lib.php @@ -156,6 +156,21 @@ function pg_setting_check($is_print=false){ } } +function is_cancel_shop_pg_order($od){ + + $is_od_pg_cancel = false; + + if (($od['od_settle_case'] == '신용카드' || $od['od_settle_case'] == '간편결제' || $od['od_settle_case'] == 'KAKAOPAY') || ($od['od_pg'] == 'inicis' && is_inicis_order_pay($od['od_settle_case']))) { + $is_od_pg_cancel = true; + } + + if ($od['od_pg'] === 'nicepay' && in_array($od['od_settle_case'], array('계좌이체', '휴대폰'))) { + $is_od_pg_cancel = true; + } + + return $is_od_pg_cancel; +} + function check_order_inicis_tmps(){ global $g5, $config, $default, $member; diff --git a/adm/shop_admin/configform.php b/adm/shop_admin/configform.php index 27ef34840..68117e382 100644 --- a/adm/shop_admin/configform.php +++ b/adm/shop_admin/configform.php @@ -207,6 +207,14 @@ if( ! isset($default['de_inicis_iniapi_key']) ){ sql_query($sql, false); } +// NICEPAY mid, key 추가 +if (! isset($default['de_nicepay_mid'])) { + $sql = "ALTER TABLE `{$g5['g5_shop_default_table']}` + ADD COLUMN `de_nicepay_mid` VARCHAR(20) NOT NULL DEFAULT '' AFTER `de_inicis_cartpoint_use`, + ADD COLUMN `de_nicepay_key` VARCHAR(150) NOT NULL DEFAULT '' AFTER `de_nicepay_mid`; "; + sql_query($sql, false); +} + if( function_exists('pg_setting_check') ){ pg_setting_check(true); } @@ -633,6 +641,12 @@ if(!$default['de_kakaopay_cancelpwd']){ KG이니시스 관리자 > 거래내역 > 가상계좌 > 입금통보방식선택 > URL 수신 설정에 넣으셔야 상점에 자동으로 입금 통보됩니다."); ?> /settle_inicis_common.php + + NICEPAY 가상계좌 입금통보 URL + + NICEPAY 관리자 > 가맹점관리자페이지 설정 (메인화면 → 가맹점정보 클릭)에 넣으셔야 상점에 자동으로 입금 통보됩니다."); ?> + /settle_nicepay_common.php + @@ -763,6 +777,7 @@ if(!$default['de_kakaopay_cancelpwd']){
  • NHN KCP
  • 토스페이먼츠
  • KG이니시스
  • +
  • NICEPAY
  • @@ -918,7 +933,7 @@ if(!$default['de_kakaopay_cancelpwd']){ - + KG 이니시스의 SIRK****** 아이디를 받은 상점만 해당됩니다.", 50); ?> @@ -932,6 +947,38 @@ if(!$default['de_kakaopay_cancelpwd']){ + + +
    NICEPAY 신청하기 + + NICEPAY로 부터 발급 받으신 상점MID를 SR 을 제외한 나머지 자리를 입력 합니다.
    NICEPAY 상점관리자 > 가맹점정보 > KEY관리에서 확인 할수 있습니다.
    만약, 상점아이디가 SR로 시작하지 않는다면 계약담당자에게 변경 요청을 해주시기 바랍니다. 예) SRpaytestm
    + SR + + 영문소문자(숫자포함 가능) + + + + + + + + + + + + + 간편결제는 테스트결제가 되지 않습니다. 실결제에만 정상작동 합니다.\n애플페이는 IOS 기기에 모바일결제만 가능합니다."); ?> + >
    + >
    + >
    + >
    + >
    + >
    + >
    + > + + + @@ -1728,6 +1775,10 @@ function fconfig_check(f) if( f.de_inicis_mid.value && f.de_inicis_sign_key.value && parseInt(f.de_card_test.value) > 0 ){ pg_msg = "KG이니시스"; } + } else if ( f.de_pg_service.value == "nicepay" ) { + if( f.de_nicepay_mid.value && f.de_nicepay_key.value && parseInt(f.de_card_test.value) > 0 ){ + pg_msg = "NICEPAY"; + } } if( pg_msg ){ diff --git a/adm/shop_admin/configformupdate.php b/adm/shop_admin/configformupdate.php index ac122d997..edbe82937 100644 --- a/adm/shop_admin/configformupdate.php +++ b/adm/shop_admin/configformupdate.php @@ -167,6 +167,8 @@ $check_sanitize_keys = array( 'de_inicis_lpay_use', //KG이니시스 Lpay 사용 'de_inicis_kakaopay_use', //KG이니시스 카카오페이 사용 'de_inicis_cartpoint_use', //KG이니시스 신용카드 포인트 결제 +'de_nicepay_mid', //NICEPAY 상점아이디 +'de_nicepay_key', //NICEPAY 상점키 'de_kakaopay_mid', //카카오페이 상점MID 'de_kakaopay_key', //카카오페이 상점키 'de_kakaopay_enckey', //카카오페이 상점 EncKey @@ -377,6 +379,8 @@ $sql = " update {$g5['g5_shop_default_table']} de_inicis_lpay_use = '{$de_inicis_lpay_use}', de_inicis_kakaopay_use = '{$de_inicis_kakaopay_use}', de_inicis_cartpoint_use = '{$de_inicis_cartpoint_use}', + de_nicepay_mid = '{$de_nicepay_mid}', + de_nicepay_key = '{$de_nicepay_key}', de_card_noint_use = '{$de_card_noint_use}', de_card_point = '{$de_card_point}', de_settle_min_point = '{$de_settle_min_point}', diff --git a/adm/shop_admin/orderform.php b/adm/shop_admin/orderform.php index eff46e977..d546f8076 100644 --- a/adm/shop_admin/orderform.php +++ b/adm/shop_admin/orderform.php @@ -107,6 +107,12 @@ if($od['od_pg'] == 'lg') { } } +$print_od_deposit_name = $od['od_deposit_name']; +// nicepay 로 주문하고 가상계좌인 경우 +if ($od['od_pg'] === 'nicepay' && $od['od_settle_case'] === '가상계좌' && $od['od_deposit_name']){ + $print_od_deposit_name .= '_NICE'; +} + // add_javascript('js 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨 add_javascript(G5_POSTCODE_JS, 0); //다음 주소 js ?> @@ -408,7 +414,7 @@ add_javascript(G5_POSTCODE_JS, 0); //다음 주소 js 입금자 - + 입금확인일시 @@ -519,6 +525,10 @@ add_javascript(G5_POSTCODE_JS, 0); //다음 주소 js $pg_url = 'https://mms.cnspay.co.kr'; $pg_test = 'KAKAOPAY'; break; + case 'nicepay': + $pg_url = 'https://npg.nicepay.co.kr/'; + $pg_test = 'NICEPAY'; + break; default: $pg_url = 'http://admin8.kcp.co.kr'; $pg_test = 'KCP'; @@ -623,6 +633,18 @@ add_javascript(G5_POSTCODE_JS, 0); //다음 주소 js } else if($od['od_pg'] == 'inicis') { $cash = unserialize($od['od_cash_info']); $cash_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/Cash_mCmReceipt.jsp?noTid='.$cash['TID'].'&clpaymethod=22\',\'showreceipt\',\'width=380,height=540,scrollbars=no,resizable=no\');'; + } else if($od['od_pg'] == 'nicepay') { + + $od_tid = $od['od_tno']; + $cash_type = 0; + + if (! $od_tid) { + $cash = unserialize($od['od_cash_info']); + $od_tid = isset($cash['TID']) ? $cash['TID'] : ''; + $cash_type = $od_tid ? 1 : 0; + } + + $cash_receipt_script = 'window.open(\'https://npg.nicepay.co.kr/issue/IssueLoader.do?type='.$cash_type.'&TID='.$od_tid.'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; } else { require G5_SHOP_PATH.'/settle_kcp.inc.php'; @@ -1075,7 +1097,7 @@ function form_submit(f) var msg = ""; - + if(status == "취소" || status == "반품" || status == "품절") { var $ct_chk = $("input[name^=ct_chk]"); var chk_cnt = $ct_chk.length; diff --git a/adm/shop_admin/orderformcartupdate.php b/adm/shop_admin/orderformcartupdate.php index 43454803a..4d47da98b 100644 --- a/adm/shop_admin/orderformcartupdate.php +++ b/adm/shop_admin/orderformcartupdate.php @@ -191,7 +191,7 @@ if (in_array($_POST['ct_status'], $status_cancel)) { $sql = " select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' "; $od = sql_fetch($sql); - if($od['od_tno'] && ($od['od_settle_case'] == '신용카드' || $od['od_settle_case'] == '간편결제' || $od['od_settle_case'] == 'KAKAOPAY') || ($od['od_pg'] == 'inicis' && is_inicis_order_pay($od['od_settle_case']) )) { + if ($od['od_tno'] && is_cancel_shop_pg_order($od)) { switch($od['od_pg']) { case 'lg': include_once(G5_SHOP_PATH.'/settle_lg.inc.php'); @@ -243,6 +243,32 @@ if (in_array($_POST['ct_status'], $status_cancel)) { $pg_res_msg = 'curl 로 데이터를 받지 못했습니다.'; } + break; + case 'nicepay': + include_once(G5_SHOP_PATH.'/settle_nicepay.inc.php'); + $cancel_msg = '쇼핑몰 운영자 승인 취소'; + + $tno = $od['od_tno']; + + $cancelAmt = $od['od_receipt_price']; + + // 0:전체 취소, 1:부분 취소(별도 계약 필요) + $partialCancelCode = 0; + + + include G5_SHOP_PATH.'/nicepay/cancel_process.php'; + + if (isset($result['ResultCode'])) { + // 실패했다면 + if ($result['ResultCode'] !== '2001') { + $pg_res_cd = $result['ResultCode']; + $pg_res_msg = $result['ResultMsg']; + } + } else { + $pg_res_cd = ''; + $pg_res_msg = 'curl 로 데이터를 받지 못하거나 통신에 실패했습니다.'; + } + break; case 'KAKAOPAY': include_once(G5_SHOP_PATH.'/settle_kakaopay.inc.php'); @@ -296,7 +322,7 @@ if (in_array($_POST['ct_status'], $status_cancel)) { // PG 취소요청 성공했으면 if($pg_res_cd == '') { - $pg_cancel_log = ' PG 신용카드 승인취소 처리'; + $pg_cancel_log = ' PG '.$od['od_settle_case'].' 승인취소 처리'; $sql = " update {$g5['g5_shop_order_table']} set od_refund_price = '{$od['od_receipt_price']}' where od_id = '$od_id' "; diff --git a/css/default_shop.css b/css/default_shop.css index bc8d361cd..ec5188f20 100644 --- a/css/default_shop.css +++ b/css/default_shop.css @@ -806,12 +806,15 @@ box-shadow: 1px 2px 2px #eee;} #sod_frm_paysel legend {position:absolute;font-size:0;line-height:0;overflow:hidden} #sod_frm_paysel .KPAY{background:url('../img/kpay.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} #sod_frm_paysel .PAYNOW{background:url('../img/paynow.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} -#sod_frm_paysel .PAYCO{background:url('../img/payco.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} -#sod_frm_paysel .inicis_lpay{background:url('../img/lpay_logo.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .PAYCO, #sod_frm_paysel .paycopay_icon{background:url('../img/payco.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .inicis_lpay, #sod_frm_paysel .lpay_icon{background:url('../img/lpay_logo.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} #sod_frm_paysel .inicis_kakaopay{position:relative;overflow:hidden;text-indent:-999px} #sod_frm_paysel .inicis_kakaopay em{position:absolute;top:15px;left:45px;width:70px;height:30px;background:url('../img/kakao.png') no-repeat 50% 50% #ffeb00;overflow:hidden;text-indent:-999px;border-radius:30px} #sod_frm_paysel .kakaopay_icon{background:url('../img/kakao.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} #sod_frm_paysel .naverpay_icon{background:url('../img/ico-default-naverpay.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .samsungpay_icon{background:url('../img/samsungpay.png') no-repeat 50% 50% #fff;display:inline-block;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .ssgpay_icon{background:url('../img/ssgpay_icon.png') no-repeat 50% 50% #fff;display:inline-block;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .skpay_icon{background:url('../img/skpay11_icon.png') no-repeat 50% 50% #fff; background-size: 70px;display:inline-block;overflow:hidden;text-indent:-999px} #sod_frm_paysel .bank_icon{background:url('../img/pay_icon1.png') no-repeat 15px 50% #fff} #sod_frm_paysel .vbank_icon{background:url('../img/pay_icon2.png') no-repeat 15px 50% #fff;padding-top:13px} #sod_frm_paysel .iche_icon{background:url('../img/pay_icon2.png') no-repeat 15px 50% #fff;padding-top:13px} diff --git a/css/mobile_shop.css b/css/mobile_shop.css index 2f97473e2..07849cb09 100644 --- a/css/mobile_shop.css +++ b/css/mobile_shop.css @@ -223,13 +223,15 @@ box-shadow: 0 0 6px rgba(0,0,0,0.2);} #m_sod_frm_paysel li {float:left;padding:5px;width:46%;height:35px} #m_sod_frm_paysel .KPAY{background:url('../img/kpay.png') no-repeat;width:37px;height:15px;overflow:hidden;text-indent:-999px;display:inline-block;background-size:100%} #m_sod_frm_paysel .PAYNOW{background:url('../img/paynow.png') no-repeat;width:46px;height:15px;overflow:hidden;text-indent:-999px;display:inline-block;background-size:100%;} -#m_sod_frm_paysel .PAYCO{background:url('../img/payco.png') no-repeat 1px;width:50px;height:15px;overflow:hidden;text-indent:-999px;display:inline-block;background-size:100%} -#m_sod_frm_paysel .inicis_lpay{background:url('../img/lpay_logo.png') no-repeat;width:35px;height:12px;overflow:hidden;text-indent:-999px;display:inline-block;background-size:100%;} +#m_sod_frm_paysel .PAYCO, #m_sod_frm_paysel .paycopay_icon{background:url('../img/payco.png') no-repeat 1px;width:50px;height:15px;overflow:hidden;text-indent:-999px;display:inline-block;background-size:100%} +#m_sod_frm_paysel .inicis_lpay, #m_sod_frm_paysel .lpay_icon{background:url('../img/lpay_logo.png') no-repeat;width:35px;height:12px;overflow:hidden;text-indent:-999px;display:inline-block;background-size:100%;} #m_sod_frm_paysel .inicis_kakaopay{background:url('../img/kakao.png') no-repeat 50% 50% #ffeb00;border-radius:30px;height:26px;width:74px;display:inline-block;overflow:hidden;text-indent:-999px;background-size:36px auto} #m_sod_frm_paysel .kakaopay_icon{background:url('../img/ico-mobile-kakaopay.png') no-repeat #fff;height:23px;width:63px;display:inline-block;overflow:hidden;text-indent:-999px;background-size:45px auto;background-position: 10% 40%} #m_sod_frm_paysel .naverpay_icon{background:url('../img/ico-mobile-naverpay.png') no-repeat #fff;height:23px;width:60px;display:inline-block;overflow:hidden;text-indent:-999px;background-size:45px auto;background-position: 0% 30%} #m_sod_frm_paysel .applepay_icon{background:url('../img/ico-mobile-applepay.png') no-repeat #fff;height:30px;width:60px;display:inline-block;overflow:hidden;text-indent:-999px;background-size:43px auto} -#m_sod_frm_paysel .samsung_pay{margin-left:-23px;background:url('../img/samsungpay.png') no-repeat 24px 3px;height:25px;width:106px;display:inline-block;overflow:hidden;text-indent:-999px} +#m_sod_frm_paysel .ssgpay_icon{background:url('../img/ssgpay_icon.png') no-repeat 0px 3px #fff;width:55px;height:20px;background-size:100%;display:inline-block;overflow:hidden;text-indent:-999px} +#m_sod_frm_paysel .skpay_icon{background:url('../img/skpay11_icon.png') no-repeat 0px 3px #fff;width:55px;height:20px;background-size:100%;display:inline-block;overflow:hidden;text-indent:-999px} +#m_sod_frm_paysel .samsung_pay, #m_sod_frm_paysel .samsungpay_icon{margin-left:-23px;background:url('../img/samsungpay.png') no-repeat 24px 7px;height:25px;width:106px;display:inline-block;overflow:hidden;text-indent:-999px} #sod_frm_pay{padding:10px;;border-top:1px solid #f3f3f3} #sod_frm_pay h2{margin:10px 0;font-size:1.25em} @@ -907,10 +909,14 @@ box-shadow:0 0 8px rgba(65,98,255,0.8)} #sod_frm_paysel legend {position:absolute;font-size:0;line-height:0;overflow:hidden} #sod_frm_paysel .KPAY{background:url('../img/kpay.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} #sod_frm_paysel .PAYNOW{background:url('../img/paynow.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} -#sod_frm_paysel .PAYCO{background:url('../img/payco.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} -#sod_frm_paysel .inicis_lpay{background:url('../img/lpay_logo.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .PAYCO, #sod_frm_paysel .paycopay_icon{background:url('../img/payco.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .inicis_lpay, #sod_frm_paysel .lpay_icon{background:url('../img/lpay_logo.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} #sod_frm_paysel .inicis_kakaopay{background:url('../img/kakao.png') no-repeat 50% 50% #f4dc34;overflow:hidden;text-indent:-999px} #sod_frm_paysel .kakaopay_icon{background:url('../img/kakao.png') no-repeat 50% 50% #f4dc34;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .naverpay_icon{background:url('../img/ico-default-naverpay.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .samsungpay_icon{background:url('../img/samsungpay.png') no-repeat 50% 50% #fff;display:inline-block;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .ssgpay_icon{background:url('../img/ssgpay_icon.png') no-repeat 50% 50% #fff;display:inline-block;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .skpay_icon{background:url('../img/skpay11_icon.png') no-repeat 50% 50% #fff; background-size: 70px;display:inline-block;overflow:hidden;text-indent:-999px} #sod_frm_paysel .bank_icon{background:url('../img/pay_icon1.png') no-repeat 15px 50% #fff} #sod_frm_paysel .vbank_icon{background:url('../img/pay_icon2.png') no-repeat 15px 50% #fff;padding-top:13px} #sod_frm_paysel .iche_icon{background:url('../img/pay_icon2.png') no-repeat 15px 50% #fff;padding-top:13px} diff --git a/img/skpay11_icon.png b/img/skpay11_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..d6f9a29e87ab9e2fe5d1af9d9a270f0b310971cd GIT binary patch literal 7920 zcmVVjg0KbUBHTI)QvhF2hc|cOXz26xT!xH{6OIBh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dtKt^_iE~ayTQSgsgPC$w(S^7{sfs5n?MF*^D*FZB{S6(MPu(&FDlJt|axE!X&MTIAHJ@DqbD5&Z zxqopOdGn=Y2NCLCpa5i@38IqkUeZ7}uEE6en7I%2INMDWxA9EAZc?O*KV8nm-_(g@ z8W%+$wVhjiH?s(bH))cd#RoW4#4s3LN=Z_w-nG4f=Aztkqk)3xjL;qqU2Ft zgzTr~En$i^jkjE530-P=bj>pYR2`4cJD4}#K z+$p2zV%%%Ji|k_)7b_mJ6Mzd!{XAVvu=|FQ+yNEL!$ZBmIl*g3>-~X;P9=3@oOAyb ZU;xqruZ35tT)O}O002ovPDHLkV1n2raT5Rl literal 0 HcmV?d00001 diff --git a/install/gnuboard5shop.sql b/install/gnuboard5shop.sql index 658d9d792..e431e7a95 100644 --- a/install/gnuboard5shop.sql +++ b/install/gnuboard5shop.sql @@ -360,6 +360,8 @@ CREATE TABLE IF NOT EXISTS `g5_shop_default` ( `de_inicis_lpay_use` tinyint(4) NOT NULL DEFAULT '0', `de_inicis_kakaopay_use` tinyint(4) NOT NULL DEFAULT '0', `de_inicis_cartpoint_use` tinyint(4) NOT NULL DEFAULT '0', + `de_nicepay_mid` varchar(30) NOT NULL DEFAULT '', + `de_nicepay_key` varchar(255) NOT NULL DEFAULT '', `de_item_use_use` tinyint(4) NOT NULL DEFAULT '0', `de_item_use_write` tinyint(4) NOT NULL DEFAULT '0', `de_code_dup_use` tinyint(4) NOT NULL DEFAULT '0', diff --git a/lib/shop.lib.php b/lib/shop.lib.php index 5f7377682..7f028e93e 100644 --- a/lib/shop.lib.php +++ b/lib/shop.lib.php @@ -2487,6 +2487,15 @@ function shop_is_taxsave($od, $is_view_receipt=false){ return 0; } +// 해당 주문에 현금영수증이 발급되었다면 마이페이지 주문 +function is_order_cashreceipt($od) { + if ($od['od_cash'] && $od['od_cash_no'] && $od['od_cash_info'] && $od['od_receipt_price'] && in_array($od['od_settle_case'], array('무통장', '계좌이체', '가상계좌'))) { + return true; + } + + return false; +} + // 장바구니 금액 체크 $is_price_update 가 true 이면 장바구니 가격 업데이트한다. function before_check_cart_price($s_cart_id, $is_ct_select_condition=false, $is_price_update=false, $is_item_cache=false){ global $g5, $default, $config; @@ -2642,6 +2651,15 @@ function make_order_field($data, $exclude) return $field; } +function shop_order_data_fields($is_personal=0) { + + if ($is_personal){ + return array('pp_name', 'pp_email', 'pp_hp', 'pp_settle_case'); + } + + return array('od_price', 'od_name', 'od_tel', 'od_hp', 'od_email', 'od_memo', 'od_settle_case', 'max_temp_point', 'od_temp_point', 'od_bank_account', 'od_deposit_name', 'od_test', 'od_ip', 'od_zip', 'od_addr1', 'od_addr2', 'od_addr3', 'od_addr_jibeon', 'od_b_name', 'od_b_tel', 'od_b_hp', 'od_b_addr1', 'od_b_addr2', 'od_b_addr3', 'od_b_addr_jibeon', 'od_b_zip', 'od_send_cost', 'od_send_cost2', 'od_hope_date'); +} + // 주문요청기록 로그를 남깁니다. function add_order_post_log($msg='', $code='error'){ global $g5, $member; diff --git a/mobile/shop/nicepay/_common.php b/mobile/shop/nicepay/_common.php new file mode 100644 index 000000000..c23a5573f --- /dev/null +++ b/mobile/shop/nicepay/_common.php @@ -0,0 +1,6 @@ +쇼핑몰 설치 후 이용해 주십시오.

    '); +define('_SHOP_', true); \ No newline at end of file diff --git a/mobile/shop/nicepay/index.php b/mobile/shop/nicepay/index.php new file mode 100644 index 000000000..b245a2e93 --- /dev/null +++ b/mobile/shop/nicepay/index.php @@ -0,0 +1,2 @@ + +**************************************************************************************** +*/ +$authResultCode = isset($_POST['AuthResultCode']) ? clean_xss_tags($_POST['AuthResultCode']) : ''; // authentication result code 0000:success +$authResultMsg = isset($_POST['AuthResultMsg']) ? clean_xss_tags($_POST['AuthResultMsg']) : ''; // authentication result message +$nextAppURL = isset($_POST['NextAppURL']) ? clean_xss_tags($_POST['NextAppURL']) : ''; // authorization request URL +$txTid = isset($_POST['TxTid']) ? clean_xss_tags($_POST['TxTid']) : ''; // transaction ID +$authToken = isset($_POST['AuthToken']) ? clean_xss_tags($_POST['AuthToken']) : ''; // authentication TOKEN +$payMethod = isset($_POST['PayMethod']) ? clean_xss_tags($_POST['PayMethod']) : ''; // payment method +$mid = isset($_POST['MID']) ? clean_xss_tags($_POST['MID']) : ''; // merchant id +$moid = isset($_POST['Moid']) ? clean_xss_tags($_POST['Moid']) : ''; // order number +$amt = isset($_POST['Amt']) ? (int) preg_replace('/[^0-9]/', '', $_POST['Amt']) : 0; // Amount of payment +$reqReserved = isset($_POST['ReqReserved']) ? clean_xss_tags($_POST['ReqReserved']) : ''; // mall custom field +$netCancelURL = isset($_POST['NetCancelURL']) ? clean_xss_tags($_POST['NetCancelURL']) : ''; // netCancelURL + +if (isset($pp['pp_id']) && $pp['pp_id']) { //개인결제 + $session_order_id = get_session('ss_personalpay_id'); + $order_price = (int) $pp['pp_price']; +} else { + $session_order_id = get_session('ss_order_id'); // 쇼핑몰 일반결제 +} + +if ($session_order_id != $moid){ + alert("요청한 주문번호가 틀려서 결제를 진행할수 없습니다.\\n다시 장바구니에서 시도해 주세요.", G5_SHOP_URL); +} + +if ($default['de_nicepay_mid'] != $mid) { + alert("요청한 상점 mid와 설정된 mid가 틀리므로 결제를 진행할수 없습니다.", G5_SHOP_URL); +} + +if ($order_price != $amt) { + alert("요청한 결제금액이 틀리므로 결제를 진행할수 없습니다.", G5_SHOP_URL); +} + +// API CALL foreach example +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='') { + $response_val = isset($data[$key]) ? $data[$key] : $default_val; + + return ($response_val ? $response_val : $default_val); + } +} + +/* +**************************************************************************************** +* +**************************************************************************************** +*/ +$response = ""; + +if($authResultCode === "0000"){ + /* + **************************************************************************************** + * (do not modify) + **************************************************************************************** + */ + $ediDate = preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS); + $merchantKey = $default['de_nicepay_key']; // 상점키 + $signData = bin2hex(hash('sha256', $authToken . $mid . $amt . $ediDate . $merchantKey, true)); + + try{ + $data = Array( + 'TID' => $txTid, + 'AuthToken' => $authToken, + 'MID' => $mid, + 'Amt' => $amt, + 'EdiDate' => $ediDate, + 'SignData' => $signData, + 'CharSet' => 'utf-8' + ); + /* + **************************************************************************************** + * + * authorization through server to server communication. + **************************************************************************************** + + // 3001 : 신용카드 성공코드 + // 4000 : 계좌이체 성공코드 + // 4100 : 가상계좌 발급 성공코드 + // A000 : 휴대폰 소액결제 성공코드 + // 7001 : 현금영수증 + // https://developers.nicepay.co.kr/manual-auth.php + */ + $response = nicepay_reqPost($data, $nextAppURL); + $respArr = json_decode($response, true); + + $ResultCode = nicepay_res('ResultCode', $respArr); + $ResultMsg = nicepay_res('ResultMsg', $respArr); + $tno = nicepay_res('TID', $respArr); + $amount = (int) nicepay_res('Amt', $respArr, 0); + $app_time = nicepay_res('AuthDate', $respArr); + $pay_method = nicepay_res('PayMethod', $respArr); + $od_app_no = $app_no = nicepay_res('AuthCode', $respArr); // 승인 번호 (신용카드, 계좌이체, 휴대폰) + $pay_type = $NICEPAY_METHOD[$pay_method]; + + // 승인된 코드가 아니면 결제가 되지 않게 합니다. + if (! in_array($ResultCode, array('3001', '4000', '4100', 'A000', '7001'))) { + alert($ResultMsg.' 코드 : '.$ResultCode, G5_SHOP_URL); + die(); + } + + if ($ResultCode == '3001') { // 신용카드 + + $card_cd = nicepay_res('CardCode', $respArr); // 카드사 코드 + $card_name = nicepay_res('CardName', $respArr); // 카드 종류 + + } else if ($ResultCode == '4100') { // 가상계좌 + + $bank_name = $bankname = nicepay_res('VbankBankName', $respArr); + $account = nicepay_res('VbankNum', $respArr); + $va_date = nicepay_res('VbankExpDate', $respArr).' '.nicepay_res('VbankExpTime', $respArr); // 가상계좌 입금마감시간 + $app_no = nicepay_res('VbankNum', $respArr); + + if ($default['de_escrow_use'] == 1) + $escw_yn = 'Y'; + + } else if ($ResultCode == '4000') { // 계좌이체 + $bank_name = $bankname = nicepay_res('BankName', $respArr); + $bank_code = nicepay_res('BankCode', $respArr); + + $RcptType = nicepay_res('RcptType', $respArr); // 현금영수증타입 (0:발행안함,1:소득공제,2:지출증빙) + $RcptTID = nicepay_res('RcptTID', $respArr); // 현금영수증 TID, 현금영수증 거래인 경우 리턴 + $RcptAuthCode = nicepay_res('RcptAuthCode', $respArr); // 현금영수증 승인번호, 현금영수증 거래인 경우 리턴 + $AuthDate = nicepay_res('AuthDate', $respArr); // 현금영수증 승인번호, 현금영수증 거래인 경우 리턴 + + // 현금영수증 발급시 1 또는 2 이면 + if ($RcptType) { + $pg_receipt_infos['od_cash'] = 1; // 현금영수증 발급인것으로 처리 + $pg_receipt_infos['od_cash_no'] = $RcptAuthCode; // 현금영수증 승인번호 + $pg_receipt_infos['od_cash_info'] = serialize(array('TID'=>$RcptTID, 'ApplNum'=>$RcptAuthCode, 'AuthDate'=>$AuthDate)); + } + + if ($default['de_escrow_use'] == 1) + $escw_yn = 'Y'; + + } + $depositor = ''; // 입금할 계좌 예금주 (나이스페이 경우 가상계좌의 예금주명을 리턴받지 못합니다. ) + $account = nicepay_res('VbankNum', $respArr); + $commid = ''; // 통신사 코드 + $mobile_no = ''; // 휴대폰결제시 휴대폰번호 (나이스페이 경우 결제한 휴대폰번호를 리턴받지 못합니다.) + $card_name = nicepay_res('CardName', $respArr); + + } catch(Exception $e) { + $e->getMessage(); + $data = Array( + 'TID' => $txTid, + 'AuthToken' => $authToken, + 'MID' => $mid, + 'Amt' => $amt, + 'EdiDate' => $ediDate, + 'SignData' => $signData, + 'NetCancel' => '1', + 'CharSet' => 'utf-8' + ); + /* + ************************************************************************************* + * + * If an exception occurs during communication, cancelation is recommended + ************************************************************************************* + */ + $response = nicepay_reqPost($data, $netCancelURL); + // jsonRespDump($response); + + alert("결제 오류로 더 이상 진행할수 없습니다."); + } + +} else { + //When authentication fail + $ResultCode = $authResultCode; + $ResultMsg = $authResultMsg; + + alert($ResultMsg.' 실패 코드 : '.$ResultCode); +} diff --git a/mobile/shop/nicepay/orderform.1.php b/mobile/shop/nicepay/orderform.1.php new file mode 100644 index 000000000..458ce71a6 --- /dev/null +++ b/mobile/shop/nicepay/orderform.1.php @@ -0,0 +1,140 @@ + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    \ No newline at end of file diff --git a/mobile/shop/nicepay/orderform.2.php b/mobile/shop/nicepay/orderform.2.php new file mode 100644 index 000000000..b0176fa95 --- /dev/null +++ b/mobile/shop/nicepay/orderform.2.php @@ -0,0 +1,17 @@ + + + + + + + + + + +
    + + + 취소 +
    \ No newline at end of file diff --git a/mobile/shop/nicepay/orderform.3.php b/mobile/shop/nicepay/orderform.3.php new file mode 100644 index 000000000..1d2effef5 --- /dev/null +++ b/mobile/shop/nicepay/orderform.3.php @@ -0,0 +1,2 @@ +$value) { + if(is_array($value)) { + foreach($value as $k=>$v) { + $_POST[$key][$k] = $params[$key][$k] = clean_xss_tags(strip_tags($v)); + } + } else { + if(in_array($key, array('od_memo'))){ + $_POST[$key] = $params[$key] = clean_xss_tags(strip_tags($value), 0, 0, 0, 0); + } else { + $_POST[$key] = $params[$key] = clean_xss_tags(strip_tags($value)); + } + } +} + +// 성공했다면 +if ($authResultCode === '0000') { + + if(isset($data['pp_id']) && $data['pp_id']) { //개인결제 + + foreach($params as $key=>$value){ + + if( in_array($key, shop_order_data_fields(1)) ){ + + $var_datas[$key] = $value; + + $$key = $value; + } + + } + + include_once(G5_MSHOP_PATH.'/personalpayformupdate.php'); + + } else { //상점주문 + + foreach($params as $key=>$value){ + + if( in_array($key, shop_order_data_fields()) ){ + + $var_datas[$key] = $value; + + $$key = $value; + } + + } + + $od_send_cost = (int) $_POST['od_send_cost']; + $od_send_cost2 = (int) $_POST['od_send_cost2']; + + include_once(G5_MSHOP_PATH.'/orderformupdate.php'); + } + +} else { + // 실패시 + + alert('오류 : '.$authResultMsg.' 코드 : '.$authResultCode, $page_return_url); +} \ No newline at end of file diff --git a/mobile/shop/orderform.sub.php b/mobile/shop/orderform.sub.php index 038ab9a0c..308e44c32 100644 --- a/mobile/shop/orderform.sub.php +++ b/mobile/shop/orderform.sub.php @@ -613,19 +613,49 @@ if($is_kakaopay_use) { $multi_settle++; - if($default['de_pg_service'] === 'kcp' && isset($default['de_easy_pay_services']) && $default['de_easy_pay_services']){ + if (in_array($default['de_pg_service'], array('kcp', 'nicepay')) && isset($default['de_easy_pay_services']) && $default['de_easy_pay_services']) { $de_easy_pay_service_array = explode(',', $default['de_easy_pay_services']); - if( in_array('nhnkcp_payco', $de_easy_pay_service_array) ){ - $easypay_prints['nhnkcp_payco'] = '
  • '; + + if ($default['de_pg_service'] === 'kcp') { + if( in_array('nhnkcp_payco', $de_easy_pay_service_array) ){ + $easypay_prints['nhnkcp_payco'] = '
  • '; + } + if( in_array('nhnkcp_naverpay', $de_easy_pay_service_array) ){ + $easypay_prints['nhnkcp_naverpay'] = '
  • '; + } + if( in_array('nhnkcp_kakaopay', $de_easy_pay_service_array) ){ + $easypay_prints['nhnkcp_kakaopay'] = '
  • '; + } + } else if ($default['de_pg_service'] === 'nicepay') { + if( in_array('nicepay_samsungpay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_samsungpay'] = '
  • '; + } + if( in_array('nicepay_naverpay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_naverpay'] = '
  • '; + } + if( in_array('nicepay_kakaopay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_kakaopay'] = '
  • '; + } + if( in_array('nicepay_paycopay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_paycopay'] = '
  • '; + } + if( in_array('nicepay_skpay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_skpay'] = '
  • '; + } + if( in_array('nicepay_ssgpay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_ssgpay'] = '
  • '; + } + if( in_array('nicepay_lpay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_lpay'] = '
  • '; + } } - if( in_array('nhnkcp_naverpay', $de_easy_pay_service_array) ){ - $easypay_prints['nhnkcp_naverpay'] = '
  • '; - } - if( in_array('nhnkcp_kakaopay', $de_easy_pay_service_array) ){ - $easypay_prints['nhnkcp_kakaopay'] = '
  • '; - } - if( in_array('nhnkcp_applepay', $de_easy_pay_service_array) && preg_match('~^(?:(?:(?:Mozilla/\d\.\d\s*\()+|Mobile\s*Safari\s*\d+\.\d+(\.\d+)?\s*)(?:iPhone(?:\s+Simulator)?|iPad|iPod);\s*(?:U;\s*)?(?:[a-z]+(?:-[a-z]+)?;\s*)?CPU\s*(?:iPhone\s*)?(?:OS\s*\d+_\d+(?:_\d+)?\s*)?(?:like|comme)\s*Mac\s*O?S?\s*X(?:;\s*[a-z]+(?:-[a-z]+)?)?\)\s*)?(?:AppleWebKit/\d+(?:\.\d+(?:\.\d+)?|\s*\+)?\s*)?(?:\(KHTML,\s*(?:like|comme)\s*Gecko\s*\)\s*)?(?:Version/\d+\.\d+(?:\.\d+)?\s*)?(?:Mobile/\w+\s*)?(?:Safari/\d+\.\d+(?:\.\d+)?.*)?$~', $_SERVER['HTTP_USER_AGENT']) ){ - $easypay_prints['nhnkcp_applepay'] = '
  • '; + + if( (in_array('nhnkcp_applepay', $de_easy_pay_service_array) || in_array('nicepay_applepay', $de_easy_pay_service_array)) && preg_match('~^(?:(?:(?:Mozilla/\d\.\d\s*\()+|Mobile\s*Safari\s*\d+\.\d+(\.\d+)?\s*)(?:iPhone(?:\s+Simulator)?|iPad|iPod);\s*(?:U;\s*)?(?:[a-z]+(?:-[a-z]+)?;\s*)?CPU\s*(?:iPhone\s*)?(?:OS\s*\d+_\d+(?:_\d+)?\s*)?(?:like|comme)\s*Mac\s*O?S?\s*X(?:;\s*[a-z]+(?:-[a-z]+)?)?\)\s*)?(?:AppleWebKit/\d+(?:\.\d+(?:\.\d+)?|\s*\+)?\s*)?(?:\(KHTML,\s*(?:like|comme)\s*Gecko\s*\)\s*)?(?:Version/\d+\.\d+(?:\.\d+)?\s*)?(?:Mobile/\w+\s*)?(?:Safari/\d+\.\d+(?:\.\d+)?.*)?$~', $_SERVER['HTTP_USER_AGENT']) ){ + if ($default['de_pg_service'] === 'kcp' && in_array('nhnkcp_applepay', $de_easy_pay_service_array)) { + $easypay_prints['nhnkcp_applepay'] = '
  • '; + } else if ($default['de_pg_service'] === 'nicepay' && in_array('nicepay_applepay', $de_easy_pay_service_array)) { + $easypay_prints['nicepay_applepay'] = '
  • '; + } } } else { $easypay_prints[strtolower($pg_easy_pay_name)] = '
  • '; @@ -1263,7 +1293,7 @@ function pay_approval() var send_coupon = parseInt(pf.od_send_coupon.value); f.good_mny.value = od_price + send_cost + send_cost2 - send_coupon - temp_point; } - + // 카카오페이 지불 if(settle_method == "KAKAOPAY") { @@ -1417,6 +1447,86 @@ function pay_approval() f.P_RETURN_URL.value = ""; f.action = "https://mobile.inicis.com/smart/" + paymethod + "/"; + + + f.Amt.value = f.good_mny.value; + f.BuyerName.value = pf.od_name.value; + f.BuyerEmail.value = pf.od_email.value; + f.BuyerTel.value = pf.od_hp.value ? pf.od_hp.value : pf.od_tel.value; + + f.DirectShowOpt.value = ""; // 간편결제 요청 값 초기화 + f.DirectEasyPay.value = ""; // 간편결제 요청 값 초기화 + f.NicepayReserved.value = ""; // 간편결제 요청 값 초기화 + f.EasyPayMethod.value = ""; // 간편결제 요청 값 초기화 + + + f.TransType.value = "1"; + + + switch(settle_method) { + case "계좌이체": + paymethod = "BANK"; + break; + case "가상계좌": + paymethod = "VBANK"; + break; + case "휴대폰": + paymethod = "CELLPHONE"; + break; + case "신용카드": + paymethod = "CARD"; + break; + case "간편결제": + paymethod = "CARD"; + f.DirectShowOpt.value = "CARD"; + f.TransType.value = "0"; // 간편결제의 경우 에스크로를 사용할수 없다. + + var nicepay_easy_pay = jQuery("input[name='od_settle_case']:checked" ).attr("data-pay"); + + if(nicepay_easy_pay === "nice_naverpay"){ + if(typeof f.DirectEasyPay !== "undefined") f.DirectEasyPay.value = "E020"; + + + + if(typeof f.EasyPayMethod !== "undefined") f.EasyPayMethod.value = "E020=CARD"; + + } else if(nicepay_easy_pay === "nice_kakaopay"){ + if(typeof f.NicepayReserved !== "undefined") f.NicepayReserved.value = "DirectKakao=Y"; + } else if(nicepay_easy_pay === "nice_samsungpay"){ + if(typeof f.DirectEasyPay !== "undefined") f.DirectEasyPay.value = "E021"; + } else if(nicepay_easy_pay === "nice_applepay"){ + if(typeof f.DirectEasyPay !== "undefined") f.DirectEasyPay.value = "E022"; + } else if(nicepay_easy_pay === "nice_paycopay"){ + if(typeof f.NicepayReserved !== "undefined") f.NicepayReserved.value = "DirectPayco=Y"; + } else if(nicepay_easy_pay === "nice_skpay"){ + if(typeof f.NicepayReserved !== "undefined") f.NicepayReserved.value = "DirectPay11=Y"; + } else if(nicepay_easy_pay === "nice_ssgpay"){ + if(typeof f.DirectEasyPay !== "undefined") f.DirectEasyPay.value = "E007"; + } else if(nicepay_easy_pay === "nice_lpay"){ + if(typeof f.DirectEasyPay !== "undefined") f.DirectEasyPay.value = "E018"; + } + + break; + default: + paymethod = "무통장"; + break; + } + + f.PayMethod.value = paymethod; + + + f.SupplyAmt.value = pf.comm_tax_mny.value; + f.GoodsVat.value = pf.comm_vat_mny.value; + f.TaxFreeAmt.value = pf.comm_free_mny.value; + + + if (! nicepay_create_signdata(f)) { + return false; + } // 주문 정보 임시저장 @@ -1438,7 +1548,7 @@ function pay_approval() return false; } - f.submit(); + nicepayStart(f); } return false; diff --git a/mobile/shop/orderformupdate.php b/mobile/shop/orderformupdate.php index a68f76f4d..067885784 100644 --- a/mobile/shop/orderformupdate.php +++ b/mobile/shop/orderformupdate.php @@ -360,6 +360,9 @@ else if ($od_settle_case == "계좌이체") case 'inicis': include G5_MSHOP_PATH.'/inicis/pay_result.php'; break; + case 'nicepay': + include G5_MSHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_MSHOP_PATH.'/kcp/pp_ax_hub.php'; $bank_name = iconv("cp949", "utf-8", $bank_name); @@ -386,6 +389,9 @@ else if ($od_settle_case == "가상계좌") case 'inicis': include G5_MSHOP_PATH.'/inicis/pay_result.php'; break; + case 'nicepay': + include G5_MSHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_MSHOP_PATH.'/kcp/pp_ax_hub.php'; $bankname = iconv("cp949", "utf-8", $bankname); @@ -412,6 +418,9 @@ else if ($od_settle_case == "휴대폰") case 'inicis': include G5_MSHOP_PATH.'/inicis/pay_result.php'; break; + case 'nicepay': + include G5_MSHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_MSHOP_PATH.'/kcp/pp_ax_hub.php'; break; @@ -436,6 +445,9 @@ else if ($od_settle_case == "신용카드") case 'inicis': include G5_MSHOP_PATH.'/inicis/pay_result.php'; break; + case 'nicepay': + include G5_MSHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_MSHOP_PATH.'/kcp/pp_ax_hub.php'; $card_name = iconv("cp949", "utf-8", $card_name); @@ -462,6 +474,9 @@ else if ($od_settle_case == "간편결제") case 'inicis': include G5_MSHOP_PATH.'/inicis/pay_result.php'; break; + case 'nicepay': + include G5_MSHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_MSHOP_PATH.'/kcp/pp_ax_hub.php'; $card_name = iconv("cp949", "utf-8", $card_name); @@ -530,6 +545,10 @@ if($tno) { case 'inicis': include G5_SHOP_PATH.'/inicis/inipay_cancel.php'; break; + case 'nicepay': + $cancelAmt = (int)$pg_price; + include G5_SHOP_PATH.'/nicepay/cancel_process.php'; + break; case 'KAKAOPAY': $_REQUEST['TID'] = $tno; $_REQUEST['Amt'] = $amount; diff --git a/mobile/shop/orderinquiryview.php b/mobile/shop/orderinquiryview.php index 48fd10495..c3f328c1a 100644 --- a/mobile/shop/orderinquiryview.php +++ b/mobile/shop/orderinquiryview.php @@ -248,6 +248,7 @@ if($od['od_pg'] == 'lg') { $app_no_subj = '승인번호'; $app_no = $od['od_app_no']; $disp_bank = false; + $disp_receipt = true; } else if($od['od_settle_case'] == '휴대폰') { $app_no_subj = '휴대폰번호'; $app_no = $od['od_bank_account']; @@ -297,7 +298,7 @@ if($od['od_pg'] == 'lg') { } // 승인번호, 휴대폰번호, 거래번호 - if($app_no_subj && $app_no) + if($app_no_subj && trim($app_no)) { ?> @@ -339,6 +340,8 @@ if($od['od_pg'] == 'lg') { $hp_receipt_script = 'showReceiptByTID(\''.$LGD_MID.'\', \''.$LGD_TID.'\', \''.$LGD_HASHDATA.'\');'; } else if($od['od_pg'] == 'inicis') { $hp_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; + } else if($od['od_pg'] == 'nicepay') { + $hp_receipt_script = 'window.open(\'https://npg.nicepay.co.kr/issue/IssueLoader.do?type=0&TID='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; } else { $hp_receipt_script = 'window.open(\''.G5_BILL_RECEIPT_URL.'mcash_bill&tno='.$od['od_tno'].'&order_no='.$od['od_id'].'&trade_mony='.$od['od_receipt_price'].'\', \'winreceipt\', \'width=500,height=690,scrollbars=yes,resizable=yes\');'; } @@ -347,7 +350,7 @@ if($od['od_pg'] == 'lg') { 현금영수증 @@ -430,6 +435,8 @@ if($od['od_pg'] == 'lg') { } else if($od['od_pg'] == 'inicis') { $cash = unserialize($od['od_cash_info']); $cash_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/Cash_mCmReceipt.jsp?noTid='.$cash['TID'].'&clpaymethod=22\',\'showreceipt\',\'width=380,height=540,scrollbars=no,resizable=no\');'; + } else if($od['od_pg'] == 'nicepay') { + $cash_receipt_script = 'window.open(\'https://npg.nicepay.co.kr/issue/IssueLoader.do?type=1&TID='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; } else { require_once G5_SHOP_PATH.'/settle_kcp.inc.php'; @@ -440,7 +447,7 @@ if($od['od_pg'] == 'lg') { 현금영수증 확인하기 현금영수증을 발급하시려면 클릭하십시오. diff --git a/mobile/shop/personalpayform.sub.php b/mobile/shop/personalpayform.sub.php index 5837e6943..3034a7b00 100644 --- a/mobile/shop/personalpayform.sub.php +++ b/mobile/shop/personalpayform.sub.php @@ -206,6 +206,52 @@ function pay_approval() f.P_RETURN_URL.value = ""; f.action = "https://mobile.inicis.com/smart/" + paymethod + "/"; + + + f.Amt.value = f.good_mny.value; + f.BuyerName.value = pf.pp_name.value; + f.BuyerEmail.value = pf.pp_email.value; + f.BuyerTel.value = pf.pp_hp.value; + + f.DirectShowOpt.value = ""; // 간편결제 요청 값 초기화 + f.DirectEasyPay.value = ""; // 간편결제 요청 값 초기화 + f.NicepayReserved.value = ""; // 간편결제 요청 값 초기화 + f.EasyPayMethod.value = ""; // 간편결제 요청 값 초기화 + + + f.TransType.value = "1"; + + + switch(settle_method) { + case "계좌이체": + paymethod = "BANK"; + break; + case "가상계좌": + paymethod = "VBANK"; + break; + case "휴대폰": + paymethod = "CELLPHONE"; + break; + case "신용카드": + paymethod = "CARD"; + break; + default: + paymethod = "무통장"; + break; + } + + f.PayMethod.value = paymethod; + + + f.SupplyAmt.value = pf.comm_tax_mny.value; + f.GoodsVat.value = pf.comm_vat_mny.value; + f.TaxFreeAmt.value = pf.comm_free_mny.value; + + + if (! nicepay_create_signdata(f)) { + return false; + } + //var new_win = window.open("about:blank", "tar_opener", "scrollbars=yes,resizable=yes"); @@ -229,7 +275,12 @@ function pay_approval() alert(save_result); return false; } + + + nicepayStart(f); + return; + f.submit(); } diff --git a/mobile/shop/personalpayformupdate.php b/mobile/shop/personalpayformupdate.php index 21a8a8454..aa3acace8 100644 --- a/mobile/shop/personalpayformupdate.php +++ b/mobile/shop/personalpayformupdate.php @@ -57,6 +57,9 @@ if ($pp_settle_case == "계좌이체") case 'inicis': include G5_MSHOP_PATH.'/inicis/pay_result.php'; break; + case 'nicepay': + include G5_MSHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_MSHOP_PATH.'/kcp/pp_ax_hub.php'; $bank_name = iconv("cp949", "utf-8", $bank_name); @@ -79,6 +82,9 @@ else if ($pp_settle_case == "가상계좌") case 'inicis': include G5_MSHOP_PATH.'/inicis/pay_result.php'; break; + case 'nicepay': + include G5_MSHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_MSHOP_PATH.'/kcp/pp_ax_hub.php'; $bankname = iconv("cp949", "utf-8", $bankname); @@ -102,6 +108,9 @@ else if ($pp_settle_case == "휴대폰") case 'inicis': include G5_MSHOP_PATH.'/inicis/pay_result.php'; break; + case 'nicepay': + include G5_MSHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_MSHOP_PATH.'/kcp/pp_ax_hub.php'; break; @@ -122,6 +131,9 @@ else if ($pp_settle_case == "신용카드") case 'inicis': include G5_MSHOP_PATH.'/inicis/pay_result.php'; break; + case 'nicepay': + include G5_MSHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_MSHOP_PATH.'/kcp/pp_ax_hub.php'; $card_name = iconv("cp949", "utf-8", $card_name); @@ -150,6 +162,10 @@ if((int)$pp['pp_price'] !== (int)$pg_price) { case 'inicis': include G5_SHOP_PATH.'/inicis/inipay_cancel.php'; break; + case 'nicepay': + $cancelAmt = (int)$pg_price; + include G5_SHOP_PATH.'/nicepay/cancel_process.php'; + break; default: include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php'; break; diff --git a/mobile/shop/personalpayresult.php b/mobile/shop/personalpayresult.php index 4655814e2..4e15dab76 100644 --- a/mobile/shop/personalpayresult.php +++ b/mobile/shop/personalpayresult.php @@ -147,6 +147,8 @@ if($pp['pp_pg'] == 'lg') { $hp_receipt_script = 'showReceiptByTID(\''.$LGD_MID.'\', \''.$LGD_TID.'\', \''.$LGD_HASHDATA.'\');'; } else if($pp['pp_pg'] == 'inicis') { $hp_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid='.$pp['pp_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; + } else if($pp['pp_pg'] == 'nicepay') { + $hp_receipt_script = 'window.open(\'https://npg.nicepay.co.kr/issue/IssueLoader.do?type=0&TID='.$pp['pp_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; } else { $hp_receipt_script = 'window.open(\''.G5_BILL_RECEIPT_URL.'mcash_bill&tno='.$pp['pp_tno'].'&order_no='.$pp['pp_id'].'&trade_mony='.$pp['pp_receipt_price'].'\', \'winreceipt\', \'width=500,height=690,scrollbars=yes,resizable=yes\');'; } @@ -164,6 +166,8 @@ if($pp['pp_pg'] == 'lg') { $LGD_HASHDATA = md5($LGD_MID.$LGD_TID.$LGD_MERTKEY); $card_receipt_script = 'showReceiptByTID(\''.$LGD_MID.'\', \''.$LGD_TID.'\', \''.$LGD_HASHDATA.'\');'; + } else if($pp['pp_pg'] == 'nicepay') { + $card_receipt_script = 'window.open(\'https://npg.nicepay.co.kr/issue/IssueLoader.do?type=0&TID='.$pp['pp_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; } else if($pp['pp_pg'] == 'inicis') { $card_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid='.$pp['pp_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; } else { @@ -220,6 +224,8 @@ if($pp['pp_pg'] == 'lg') { } else if($pp['pp_pg'] == 'inicis') { $cash = unserialize($pp['pp_cash_info']); $cash_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/Cash_mCmReceipt.jsp?noTid='.$cash['TID'].'&clpaymethod=22\',\'showreceipt\',\'width=380,height=540,scrollbars=no,resizable=no\');'; + } else if($pp['pp_pg'] == 'nicepay') { + $cash_receipt_script = 'window.open(\'https://npg.nicepay.co.kr/issue/IssueLoader.do?type=1&TID='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; } else { require_once G5_SHOP_PATH.'/settle_kcp.inc.php'; diff --git a/mobile/shop/settle_nicepay.inc.php b/mobile/shop/settle_nicepay.inc.php new file mode 100644 index 000000000..0a9a9f360 --- /dev/null +++ b/mobile/shop/settle_nicepay.inc.php @@ -0,0 +1,6 @@ + +* The sample page only shows basic (required) parameters. +**************************************************************************************** +*/ +$merchantKey = $default['de_nicepay_key']; +$mid = $default['de_nicepay_mid']; +$moid = isset($od_id) ? $od_id : get_session('ss_order_id'); +$cancelMsg = $cancel_msg; +$tid = $tno; +$partialCancelCode = isset($partialCancelCode) ? (int) $partialCancelCode : 0; + +/* +**************************************************************************************** +* (do not modify) +* SHA-256 hash encryption is a way to prevent forgery. +**************************************************************************************** +*/ +$ediDate = preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS); +$signData = bin2hex(hash('sha256', $mid . $cancelAmt . $ediDate . $merchantKey, true)); + +try{ + $data = Array( + 'TID' => $tid, + 'MID' => $mid, + 'Moid' => $moid, + 'CancelAmt' => $cancelAmt, + 'CancelMsg' => iconv("UTF-8", "EUC-KR", $cancelMsg), + 'PartialCancelCode' => $partialCancelCode, + 'EdiDate' => $ediDate, + 'SignData' => $signData, + 'CharSet' => 'utf-8' + ); + + if (function_exists('add_log')) add_log($data); + + /* + **************************************************************************************** + * + **************************************************************************************** + */ + $response = nicepay_reqPost($data, "https://pg-api.nicepay.co.kr/webapi/cancel_process.jsp"); //Cancel API call + + $result = json_decode($response, true); + + if (function_exists('add_log')) add_log(array('1'=>1)); + if (function_exists('add_log')) add_log($result, true, 'cc'); + +}catch(Exception $e){ + $e->getMessage(); + $ResultCode = "9999"; + $ResultMsg = "통신실패"; +} diff --git a/shop/nicepay/createsigndata.php b/shop/nicepay/createsigndata.php new file mode 100644 index 000000000..227159ca5 --- /dev/null +++ b/shop/nicepay/createsigndata.php @@ -0,0 +1,26 @@ +'올바른 방법으로 이용해 주십시오.'))); +} + +if (function_exists('add_log')) add_log($_POST, false, 'ajax'); + +$price = preg_replace('#[^0-9]#', '', $_POST['price']); + +if (strlen($price) < 1) { + die(json_encode(array('error'=>'가격이 올바르지 않습니다.'))); +} + +$ediDate = preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS); +$hashString = bin2hex(hash('sha256', $ediDate.$default['de_nicepay_mid'].$price.$default['de_nicepay_key'], true)); + +die(json_encode(array('error'=>'', 'ediDate'=>$ediDate, 'SignData'=>$hashString))); \ No newline at end of file diff --git a/shop/nicepay/escrow.register.php b/shop/nicepay/escrow.register.php new file mode 100644 index 000000000..eac90b908 --- /dev/null +++ b/shop/nicepay/escrow.register.php @@ -0,0 +1,77 @@ + (수정하지 마세요) +* SHA-256 해쉬암호화는 거래 위변조를 막기위한 방법입니다. +******************************************************* +*/ +$ediDate = preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS); +$signData = bin2hex(hash('sha256', $tid.$mid.$reqType.$ediDate.$default['de_nicepay_key'], true)); + +$response = ""; + +$data = array( + 'MID' => $mid, + 'TID' => $tid, + 'EdiDate' => $ediDate, + 'SignData' => $signData, + 'ReqType' => $reqType, + 'DeliveryCoNm' => $deliveryCoNm, + 'BuyerAddr' => $buyerAddr, + 'InvoiceNum' => $invoiceNum, + 'RegisterName' => $registerName, + 'ConfirmMail' => $confirmMail, + 'CharSet' => $charSet +); + +$response = nicepay_reqPost($data, $escrowRequestURL); + +$nice_result = json_decode($response, true); + +if (function_exists('add_log')) add_log($nice_result, true, 'es'); + +// 성공이면 +if (isset($nice_result['ResultCode']) && $nice_result['ResultCode'] === 'C000') { + +} else { + // C000 이 아니면 다 실패 + + /* + C002 에스크로 가맹점 아님 + C003 에스크로 거래만 배송등록 가능 + C004 에스크로결제 신청내역 미존재 + C005 에스크로배송등록 불가상태 + C006 거래내역이 존재하지 않음. + C007 취소된 거래는 배송등록 불가 + */ + +} + +/********************** + * 4. 배송 등록 결과 * + **********************/ + +$resultCode = $nice_result['ResultCode']; // 결과코드 ("00"이면 지불 성공) +$resultMsg = $nice_result['ResultMsg']; // 결과내용 (지불결과에 대한 설명) +$dlv_date = $nice_result['ProcessDate']; +$dlv_time = $nice_result['ProcessTime']; + +echo "에스크로배송"; +exit; \ No newline at end of file diff --git a/shop/nicepay/index.php b/shop/nicepay/index.php new file mode 100644 index 000000000..e69de29bb diff --git a/shop/nicepay/nicepay_result.php b/shop/nicepay/nicepay_result.php new file mode 100644 index 000000000..69fcf34b8 --- /dev/null +++ b/shop/nicepay/nicepay_result.php @@ -0,0 +1,204 @@ + +**************************************************************************************** +*/ +$authResultCode = isset($_POST['AuthResultCode']) ? clean_xss_tags($_POST['AuthResultCode']) : ''; // authentication result code 0000:success +$authResultMsg = isset($_POST['AuthResultMsg']) ? clean_xss_tags($_POST['AuthResultMsg']) : ''; // authentication result message +$nextAppURL = isset($_POST['NextAppURL']) ? clean_xss_tags($_POST['NextAppURL']) : ''; // authorization request URL +$txTid = isset($_POST['TxTid']) ? clean_xss_tags($_POST['TxTid']) : ''; // transaction ID +$authToken = isset($_POST['AuthToken']) ? clean_xss_tags($_POST['AuthToken']) : ''; // authentication TOKEN +$payMethod = isset($_POST['PayMethod']) ? clean_xss_tags($_POST['PayMethod']) : ''; // payment method +$mid = isset($_POST['MID']) ? clean_xss_tags($_POST['MID']) : ''; // merchant id +$moid = isset($_POST['Moid']) ? clean_xss_tags($_POST['Moid']) : ''; // order number +$amt = isset($_POST['Amt']) ? (int) preg_replace('/[^0-9]/', '', $_POST['Amt']) : 0; // Amount of payment +$reqReserved = isset($_POST['ReqReserved']) ? clean_xss_tags($_POST['ReqReserved']) : ''; // mall custom field +$netCancelURL = isset($_POST['NetCancelURL']) ? clean_xss_tags($_POST['NetCancelURL']) : ''; // netCancelURL +$Signature = isset($_POST['Signature']) ? clean_xss_tags($_POST['Signature']) : ''; // netCancelURL + +if (isset($pp['pp_id']) && $pp['pp_id']) { //개인결제 + $session_order_id = get_session('ss_personalpay_id'); + $order_price = (int) $pp['pp_price']; +} else { + $session_order_id = get_session('ss_order_id'); // 쇼핑몰 일반결제 +} + +if ($session_order_id != $moid){ + alert("요청한 주문번호가 틀려서 결제를 진행할수 없습니다.\\n다시 장바구니에서 시도해 주세요.", G5_SHOP_URL); +} + +if ($default['de_nicepay_mid'] != $mid) { + alert("요청한 상점 mid와 설정된 mid가 틀리므로 결제를 진행할수 없습니다.", G5_SHOP_URL); +} + +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("유효성 검증이 틀려서 결제를 진행할수 없습니다."); +} + +// API CALL foreach example +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='') { + $response_val = isset($data[$key]) ? $data[$key] : $default_val; + + return ($response_val ? $response_val : $default_val); + } +} + +/* +**************************************************************************************** +* +**************************************************************************************** +*/ +$response = ""; + +if($authResultCode === "0000"){ + /* + **************************************************************************************** + * (do not modify) + **************************************************************************************** + */ + $ediDate = preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS); + $merchantKey = $default['de_nicepay_key']; // 상점키 + $signData = bin2hex(hash('sha256', $authToken . $mid . $amt . $ediDate . $merchantKey, true)); + + try { + $data = Array( + 'TID' => $txTid, + 'AuthToken' => $authToken, + 'MID' => $mid, + 'Amt' => $amt, + 'EdiDate' => $ediDate, + 'SignData' => $signData, + 'CharSet' => 'utf-8' + ); + /* + **************************************************************************************** + * + * authorization through server to server communication. + **************************************************************************************** + + // 3001 : 신용카드 성공코드 + // 4000 : 계좌이체 성공코드 + // 4100 : 가상계좌 발급 성공코드 + // A000 : 휴대폰 소액결제 성공코드 + // 7001 : 현금영수증 + // https://developers.nicepay.co.kr/manual-auth.php + */ + $response = nicepay_reqPost($data, $nextAppURL); + + if (! $response) { + alert('응답이 없거나 잘못된 url 입니다.', G5_SHOP_URL); + } + + $respArr = json_decode($response, true); + + if (function_exists('add_log')) add_log($respArr); + + $ResultCode = nicepay_res('ResultCode', $respArr); + $ResultMsg = nicepay_res('ResultMsg', $respArr); + $tno = nicepay_res('TID', $respArr); + $amount = (int) nicepay_res('Amt', $respArr, 0); + $app_time = nicepay_res('AuthDate', $respArr); + $pay_method = nicepay_res('PayMethod', $respArr); + $od_app_no = $app_no = nicepay_res('AuthCode', $respArr); // 승인 번호 (신용카드, 계좌이체, 휴대폰) + $pay_type = $NICEPAY_METHOD[$pay_method]; + + // 승인된 코드가 아니면 결제가 되지 않게 합니다. + if (! in_array($ResultCode, array('3001', '4000', '4100', 'A000', '7001'))) { + alert($ResultMsg.' 코드 : '.$ResultCode, G5_SHOP_URL); + die(); + } + + if ($ResultCode == '3001') { // 신용카드 + + $card_cd = nicepay_res('CardCode', $respArr); // 카드사 코드 + $card_name = nicepay_res('CardName', $respArr); // 카드 종류 + + } else if ($ResultCode == '4100') { // 가상계좌 + + $bank_name = $bankname = nicepay_res('VbankBankName', $respArr); + $account = nicepay_res('VbankNum', $respArr); + $va_date = nicepay_res('VbankExpDate', $respArr).' '.nicepay_res('VbankExpTime', $respArr); // 가상계좌 입금마감시간 + $app_no = nicepay_res('VbankNum', $respArr); + if ($default['de_escrow_use'] == 1) + $escw_yn = 'Y'; + + } else if ($ResultCode == '4000') { // 계좌이체 + $bank_name = $bankname = nicepay_res('BankName', $respArr); + $bank_code = nicepay_res('BankCode', $respArr); + + $RcptType = nicepay_res('RcptType', $respArr); // 현금영수증타입 (0:발행안함,1:소득공제,2:지출증빙) + $RcptTID = nicepay_res('RcptTID', $respArr); // 현금영수증 TID, 현금영수증 거래인 경우 리턴 + $RcptAuthCode = nicepay_res('RcptAuthCode', $respArr); // 현금영수증 승인번호, 현금영수증 거래인 경우 리턴 + $AuthDate = nicepay_res('AuthDate', $respArr); // 현금영수증 승인번호, 현금영수증 거래인 경우 리턴 + + // 현금영수증 발급시 1 또는 2 이면 + if ($RcptType) { + $pg_receipt_infos['od_cash'] = 1; // 현금영수증 발급인것으로 처리 + $pg_receipt_infos['od_cash_no'] = $RcptAuthCode; // 현금영수증 승인번호 + $pg_receipt_infos['od_cash_info'] = serialize(array('TID'=>$RcptTID, 'ApplNum'=>$RcptAuthCode, 'AuthDate'=>$AuthDate)); + } + + if ($default['de_escrow_use'] == 1) + $escw_yn = 'Y'; + + } + $depositor = ''; // 입금할 계좌 예금주 (나이스페이 경우 가상계좌의 예금주명을 리턴받지 못합니다. ) + $account = nicepay_res('VbankNum', $respArr); + $commid = ''; // 통신사 코드 + $mobile_no = ''; // 휴대폰결제시 휴대폰번호 (나이스페이 경우 결제한 휴대폰번호를 리턴받지 못합니다.) + $card_name = nicepay_res('CardName', $respArr); + + } catch(Exception $e) { + $e->getMessage(); + $data = Array( + 'TID' => $txTid, + 'AuthToken' => $authToken, + 'MID' => $mid, + 'Amt' => $amt, + 'EdiDate' => $ediDate, + 'SignData' => $signData, + 'NetCancel' => '1', + 'CharSet' => 'utf-8' + ); + /* + ************************************************************************************* + * + * If an exception occurs during communication, cancelation is recommended + ************************************************************************************* + */ + $response = nicepay_reqPost($data, $netCancelURL); + // jsonRespDump($response); + + alert("결제 오류로 더 이상 진행할수 없습니다."); + } + +} else { + //When authentication fail + $ResultCode = $authResultCode; + $ResultMsg = $authResultMsg; + + alert($ResultMsg.' 실패 코드 : '.$ResultCode); +} diff --git a/shop/nicepay/orderform.1.php b/shop/nicepay/orderform.1.php new file mode 100644 index 000000000..6ab60fd93 --- /dev/null +++ b/shop/nicepay/orderform.1.php @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +*/ +?> \ No newline at end of file diff --git a/shop/nicepay/orderform.3.php b/shop/nicepay/orderform.3.php new file mode 100644 index 000000000..76d01ebfc --- /dev/null +++ b/shop/nicepay/orderform.3.php @@ -0,0 +1,12 @@ + + +
    + + 취소 +
    + \ No newline at end of file diff --git a/shop/nicepay/orderform.4.php b/shop/nicepay/orderform.4.php new file mode 100644 index 000000000..1d2effef5 --- /dev/null +++ b/shop/nicepay/orderform.4.php @@ -0,0 +1,2 @@ + + + + +
    +

    + +
    +

    주문정보

    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    주문 번호
    상품 정보
    주문자 이름
    주문자 E-Mail
    주문자 전화번호
    +
    +
    + +
    +

    현금영수증 발급 정보

    + +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    원 거래 시각
    발행 용도 + + + + +
    + + + ("-" 생략) +
    거래금액 총합
    공급가액
    부가가치세
    비과세공급가액
    봉사료
    +
    + +
    + + + + +
    + +
    +
    + +
    \ No newline at end of file diff --git a/shop/nicepay/taxsave_result.php b/shop/nicepay/taxsave_result.php new file mode 100644 index 000000000..3ff768230 --- /dev/null +++ b/shop/nicepay/taxsave_result.php @@ -0,0 +1,185 @@ +개인결제 내역이 존재하지 않습니다.

    '); + + if($od['pp_cash'] == 1) + alert('이미 등록된 현금영수증 입니다.'); + + $buyername = $od['pp_name']; + $goodname = $od['pp_name'].'님 개인결제'; + $amt_tot = (int)$od['pp_receipt_price']; + $amt_sup = (int)round(($amt_tot * 10) / 11); + $amt_svc = 0; + $amt_tax = (int)($amt_tot - $amt_sup); +} else { + $od = sql_fetch(" select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' "); + if (!$od) + die('

    주문서가 존재하지 않습니다.

    '); + + if($od['od_cash'] == 1) + alert('이미 등록된 현금영수증 입니다.'); + + $buyername = $od['od_name']; + $goods = get_goods($od['od_id']); + $goodname = $goods['full_name']; + $amt_tot = (int)$od['od_tax_mny'] + (int)$od['od_vat_mny'] + (int)$od['od_free_mny']; + $amt_tax = (int)$od['od_vat_mny']; + $amt_svc = 0; + $amt_sup = (int)$od['od_tax_mny']; + $amt_free = (int)$od['od_free_mny']; +} + + +$reg_num = $id_info; +$useopt = $tr_code; +$currency = 'WON'; + +//step1. 요청을 위한 파라미터 설정 +$goodName = $goodname; // 상품명 +$crPrice = $amt_tot;// 총 현금결제 금액 +$supPrice = $amt_sup;// 공급가액 +$tax = $amt_tax;// 부가세 +$srcvPrice = $amt_svc;// 봉사료 +$buyerName = $buyername;// 구매자 성명 +$buyerEmail = $buyeremail;// 구매자 이메일 주소 +$buyerTel = $buyertel;// 구매자 전화번호 +$useOpt = $useopt;// 현금영수증 발행용도 ("1" - 소비자 소득공제용, "2" - 사업자 지출증빙용) +$regNum = $reg_num;// 현금결제자 주민등록번호 + +$ediDate = preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS); + +// 04 (현금영수증), 01 (매체구분 일반), 시간정보 (12자리), 랜덤 4자리숫자 +$tid = $default['de_nicepay_mid'].'04'.'01'.substr($ediDate, 2).rand(1000, 9999); +$signData = bin2hex(hash('sha256', $default['de_nicepay_mid'].$amt_tot.$ediDate.$od['od_id'].$default['de_nicepay_key'], true)); + +$data = array( + 'MID' => $default['de_nicepay_mid'], + 'TID' => $tid, + 'EdiDate' => $ediDate, + 'Moid' => $od['od_id'], + 'SignData' => $signData, + 'GoodsName' => iconv('utf-8', 'euc-kr', $goodName), + 'ReceiptAmt' => $amt_tot, + 'ReceiptType' => ($useopt > 1) ? 2 : 1, + 'ReceiptTypeNo' => $regNum, + 'ReceiptSupplyAmt' => $supPrice, + 'ReceiptVAT' => $tax, + 'ReceiptServiceAmt' => $srcvPrice, + 'ReceiptTaxFreeAmt' => (int)$od['od_free_mny'], + 'CharSet' => 'utf-8', +); + +$response = nicepay_reqPost($data, "https://pg-api.nicepay.co.kr/webapi/cash_receipt.jsp"); + +$result = json_decode($response, true); + +if (function_exists('add_log')) add_log($result, true, 'rr'); + +// 성공이면 +if (isset($result['ResultCode']) && $result['ResultCode'] === '7001') { + + // DB 반영 + $cash_no = $result['AuthCode']; // 현금영수증 승인번호 + + $cash = array(); + $cash['TID'] = $result['TID']; + $cash['ApplNum'] = $cash_no; + $cash['AuthDate'] = $result['AuthDate']; + $cash_info = serialize($cash); + + if($tx == 'personalpay') { + $sql = " update {$g5['g5_shop_personalpay_table']} + set pp_cash = '1', + pp_cash_no = '$cash_no', + pp_cash_info = '$cash_info' + where pp_id = '$od_id' "; + } else { + $sql = " update {$g5['g5_shop_order_table']} + set od_cash = '1', + od_cash_no = '$cash_no', + od_cash_info = '$cash_info' + where od_id = '$od_id' "; + } + + $sql_result = sql_query($sql, false); + +} else { + //2)API 요청 실패 화면처리 + + $msg = '현금영수증 발급 요청처리가 정상적으로 완료되지 않았습니다.'; + $msg .= '\\nTX Response_code = '.$result['ResultCode']; + $msg .= '\\nTX Response_msg = '.$result['ResultMsg']; + + alert($msg); +} + +$g5['title'] = '현금영수증 발급'; +include_once(G5_PATH.'/head.sub.php'); +?> + + + +
    +

    현금영수증 - 나이스페이

    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    결과코드
    결과 메세지
    현금영수증 거래번호
    현금영수증 승인번호
    승인시간
    현금영수증 URL + +
    +
    + +
    + + '; - } - if( in_array('nhnkcp_naverpay', $de_easy_pay_service_array) ){ - $easypay_prints['nhnkcp_naverpay'] = ' '; - } - if( in_array('nhnkcp_kakaopay', $de_easy_pay_service_array) ){ - $easypay_prints['nhnkcp_kakaopay'] = ' '; + + if ($default['de_pg_service'] === 'kcp') { + if( in_array('nhnkcp_payco', $de_easy_pay_service_array) ){ + $easypay_prints['nhnkcp_payco'] = ' '; + } + if( in_array('nhnkcp_naverpay', $de_easy_pay_service_array) ){ + $easypay_prints['nhnkcp_naverpay'] = ' '; + } + if( in_array('nhnkcp_kakaopay', $de_easy_pay_service_array) ){ + $easypay_prints['nhnkcp_kakaopay'] = ' '; + } + } else if ($default['de_pg_service'] === 'nicepay') { + if( in_array('nicepay_samsungpay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_samsungpay'] = ' '; + } + if( in_array('nicepay_naverpay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_naverpay'] = ' '; + } + if( in_array('nicepay_kakaopay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_kakaopay'] = ' '; + } + if( in_array('nicepay_paycopay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_paycopay'] = ' '; + } + if( in_array('nicepay_skpay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_skpay'] = ' '; + } + if( in_array('nicepay_ssgpay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_ssgpay'] = ' '; + } + if( in_array('nicepay_lpay', $de_easy_pay_service_array) ){ + $easypay_prints['nicepay_lpay'] = ' '; + } } } else { $easypay_prints[strtolower($pg_easy_pay_name)] = ' '; @@ -1492,7 +1517,7 @@ function forderform_check(f) f.LGD_CUSTOM_FIRSTPAY.value = "무통장"; break; } - + switch(settle_method) { case "계좌이체": @@ -1523,8 +1548,67 @@ function forderform_check(f) f.gopaymethod.value = "무통장"; break; } - + + f.DirectShowOpt.value = ""; // 간편결제 요청 값 초기화 + f.DirectEasyPay.value = ""; // 간편결제 요청 값 초기화 + f.NicepayReserved.value = ""; // 간편결제 요청 값 초기화 + f.EasyPayMethod.value = ""; // 간편결제 요청 값 초기화 + + f.TransType.value = "1"; + + switch(settle_method) + { + case "계좌이체": + f.PayMethod.value = "BANK"; + break; + case "가상계좌": + f.PayMethod.value = "VBANK"; + break; + case "휴대폰": + f.PayMethod.value = "CELLPHONE"; + break; + case "신용카드": + f.PayMethod.value = "CARD"; + break; + case "간편결제": + f.PayMethod.value = "CARD"; + f.DirectShowOpt.value = "CARD"; + f.TransType.value = "0"; // 간편결제의 경우 에스크로를 사용할수 없다. + + var nicepay_easy_pay = jQuery("input[name='od_settle_case']:checked" ).attr("data-pay"); + + if(nicepay_easy_pay === "nice_naverpay"){ + if(typeof f.DirectEasyPay !== "undefined") f.DirectEasyPay.value = "E020"; + + + + if(typeof f.EasyPayMethod !== "undefined") f.EasyPayMethod.value = "E020=CARD"; + + } else if(nicepay_easy_pay === "nice_kakaopay"){ + if(typeof f.NicepayReserved !== "undefined") f.NicepayReserved.value = "DirectKakao=Y"; + } else if(nicepay_easy_pay === "nice_samsungpay"){ + if(typeof f.DirectEasyPay !== "undefined") f.DirectEasyPay.value = "E021"; + } else if(nicepay_easy_pay === "nice_paycopay"){ + if(typeof f.NicepayReserved !== "undefined") f.NicepayReserved.value = "DirectPayco=Y"; + } else if(nicepay_easy_pay === "nice_skpay"){ + if(typeof f.NicepayReserved !== "undefined") f.NicepayReserved.value = "DirectPay11=Y"; + } else if(nicepay_easy_pay === "nice_ssgpay"){ + if(typeof f.DirectEasyPay !== "undefined") f.DirectEasyPay.value = "E007"; + } else if(nicepay_easy_pay === "nice_lpay"){ + if(typeof f.DirectEasyPay !== "undefined") f.DirectEasyPay.value = "E018"; + } + + break; + default: + f.PayMethod.value = "무통장"; + break; + } + // 결제정보설정 f.buyr_name.value = f.od_name.value; @@ -1610,6 +1694,46 @@ function forderform_check(f) f.submit(); } + + f.Amt.value = f.good_mny.value; + + f.SupplyAmt.value = f.comm_tax_mny.value; + f.GoodsVat.value = f.comm_vat_mny.value; + f.TaxFreeAmt.value = f.comm_free_mny.value; + + f.BuyerName.value = f.od_name.value; + f.BuyerEmail.value = f.od_email.value; + f.BuyerTel.value = f.od_hp.value ? f.od_hp.value : f.od_tel.value; + + if(f.PayMethod.value != "무통장") { + // 주문정보 임시저장 + var order_data = $(f).serialize(); + var save_result = ""; + $.ajax({ + type: "POST", + data: order_data, + url: g5_url+"/shop/ajax.orderdatasave.php", + cache: false, + async: false, + success: function(data) { + save_result = data; + } + }); + + if(save_result) { + alert(save_result); + return false; + } + + if(!nicepay_create_signdata(f)) + return false; + + nicepayStart(f); + } else { + f.submit(); + } + + } } diff --git a/shop/orderformupdate.php b/shop/orderformupdate.php index 349294285..1e47843a5 100644 --- a/shop/orderformupdate.php +++ b/shop/orderformupdate.php @@ -306,6 +306,13 @@ if ($od_temp_point) $i_price = $i_price + $i_send_cost + $i_send_cost2 - $i_temp_point - $i_send_coupon; $order_price = $tot_od_price + $send_cost + $send_cost2 - $tot_sc_cp_price - $od_temp_point; +// PG사의 가상계좌 또는 계좌이체의 자동 현금영수증 초기배열값 +$pg_receipt_infos = array( + 'od_cash' => 0, + 'od_cash_no' => '', + 'od_cash_info' => '', +); + $od_status = '주문'; $od_tno = ''; @@ -332,6 +339,9 @@ else if ($od_settle_case == "계좌이체") case 'inicis': include G5_SHOP_PATH.'/inicis/inistdpay_result.php'; break; + case 'nicepay': + include G5_SHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_SHOP_PATH.'/kcp/pp_ax_hub.php'; $bank_name = iconv("cp949", "utf-8", $bank_name); @@ -360,6 +370,9 @@ else if ($od_settle_case == "가상계좌") include G5_SHOP_PATH.'/inicis/inistdpay_result.php'; $od_app_no = $app_no; break; + case 'nicepay': + include G5_SHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_SHOP_PATH.'/kcp/pp_ax_hub.php'; $bankname = iconv("cp949", "utf-8", $bankname); @@ -384,6 +397,9 @@ else if ($od_settle_case == "휴대폰") case 'inicis': include G5_SHOP_PATH.'/inicis/inistdpay_result.php'; break; + case 'nicepay': + include G5_SHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_SHOP_PATH.'/kcp/pp_ax_hub.php'; break; @@ -408,6 +424,9 @@ else if ($od_settle_case == "신용카드") case 'inicis': include G5_SHOP_PATH.'/inicis/inistdpay_result.php'; break; + case 'nicepay': + include G5_SHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_SHOP_PATH.'/kcp/pp_ax_hub.php'; $card_name = iconv("cp949", "utf-8", $card_name); @@ -434,6 +453,9 @@ else if ($od_settle_case == "간편결제" || (($od_settle_case == "lpay" || $od case 'inicis': include G5_SHOP_PATH.'/inicis/inistdpay_result.php'; break; + case 'nicepay': + include G5_SHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_SHOP_PATH.'/kcp/pp_ax_hub.php'; $card_name = iconv("cp949", "utf-8", $card_name); @@ -490,6 +512,10 @@ if($tno) { case 'inicis': include G5_SHOP_PATH.'/inicis/inipay_cancel.php'; break; + case 'nicepay': + $cancelAmt = (int)$pg_price; + include G5_SHOP_PATH.'/nicepay/cancel_process.php'; + break; case 'KAKAOPAY': $_REQUEST['TID'] = $tno; $_REQUEST['Amt'] = $amount; @@ -604,6 +630,9 @@ $sql = " insert {$g5['g5_shop_order_table']} od_ip = '$REMOTE_ADDR', od_settle_case = '$od_settle_case', od_other_pay_type = '$od_other_pay_type', + od_cash = '{$pg_receipt_infos['od_cash']}', + od_cash_no = '{$pg_receipt_infos['od_cash_no']}', + od_cash_info = '{$pg_receipt_infos['od_cash_info']}', od_test = '{$default['de_card_test']}' "; $result = sql_query($sql, false); diff --git a/shop/orderinquirycancel.php b/shop/orderinquirycancel.php index 0791df696..aefa943a1 100644 --- a/shop/orderinquirycancel.php +++ b/shop/orderinquirycancel.php @@ -92,6 +92,36 @@ if($od['od_tno']) { alert($res_msg.' 코드 : '.$res_cd); } break; + case 'nicepay': + include_once(G5_SHOP_PATH.'/settle_nicepay.inc.php'); + $cancel_msg = '주문자 본인 취소-'.$cancel_memo; + + $tno = $od['od_tno']; + + $cancelAmt = $od['od_receipt_price']; + + // 0:전체 취소, 1:부분 취소(별도 계약 필요) + $partialCancelCode = 0; + + include G5_SHOP_PATH.'/nicepay/cancel_process.php'; + + $res_cd = ''; + $res_msg = 'curl 로 데이터를 받지 못하거나 통신에 실패했습니다.'; + + if (isset($result['ResultCode'])) { + + $res_cd = $result['ResultCode']; + + // 실패했다면 + if ($result['ResultCode'] !== '2001') { + $res_msg = $result['ResultMsg']; + } + } + + if($res_cd != '2001') { + alert($res_msg.' 코드 : '.$res_cd); + } + break; default: require_once('./settle_kcp.inc.php'); diff --git a/shop/orderinquiryview.php b/shop/orderinquiryview.php index 2eaf9317d..297c5208d 100644 --- a/shop/orderinquiryview.php +++ b/shop/orderinquiryview.php @@ -27,6 +27,11 @@ if (! (isset($od['od_id']) && $od['od_id']) || (!$is_member && md5($od['od_id']. alert("조회하실 주문서가 없습니다.", G5_SHOP_URL); } +// nicepay 로 주문하고 가상계좌인 경우 +if ($od['od_pg'] === 'nicepay' && $od['od_settle_case'] === '가상계좌' && $od['od_deposit_name']){ + $od['od_deposit_name'] .= '_NICE'; +} + // 결제방법 $settle_case = $od['od_settle_case']; @@ -289,7 +294,7 @@ if($od['od_pg'] == 'lg') { } // 승인번호, 휴대폰번호, 거래번호 - if($app_no_subj && $app_no) + if($app_no_subj && trim($app_no)) { ?> @@ -331,6 +336,8 @@ if($od['od_pg'] == 'lg') { $hp_receipt_script = 'showReceiptByTID(\''.$LGD_MID.'\', \''.$LGD_TID.'\', \''.$LGD_HASHDATA.'\');'; } else if($od['od_pg'] == 'inicis') { $hp_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; + } else if($od['od_pg'] == 'nicepay') { + $hp_receipt_script = 'window.open(\'https://npg.nicepay.co.kr/issue/IssueLoader.do?type=0&TID='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; } else { $hp_receipt_script = 'window.open(\''.G5_BILL_RECEIPT_URL.'mcash_bill&tno='.$od['od_tno'].'&order_no='.$od['od_id'].'&trade_mony='.$od['od_receipt_price'].'\', \'winreceipt\', \'width=500,height=690,scrollbars=yes,resizable=yes\');'; } @@ -339,7 +346,7 @@ if($od['od_pg'] == 'lg') { 현금영수증 @@ -423,6 +432,8 @@ if($od['od_pg'] == 'lg') { } else if($od['od_pg'] == 'inicis') { $cash = unserialize($od['od_cash_info']); $cash_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/Cash_mCmReceipt.jsp?noTid='.$cash['TID'].'&clpaymethod=22\',\'showreceipt\',\'width=380,height=540,scrollbars=no,resizable=no\');'; + } else if($od['od_pg'] == 'nicepay') { + $cash_receipt_script = 'window.open(\'https://npg.nicepay.co.kr/issue/IssueLoader.do?type=1&TID='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; } else { require_once G5_SHOP_PATH.'/settle_kcp.inc.php'; @@ -433,7 +444,7 @@ if($od['od_pg'] == 'lg') { 현금영수증 확인하기 현금영수증을 발급하시려면 클릭하십시오. diff --git a/shop/personalpayform.php b/shop/personalpayform.php index 462daabfd..7f897490d 100644 --- a/shop/personalpayform.php +++ b/shop/personalpayform.php @@ -10,10 +10,10 @@ $sql = " select * from {$g5['g5_shop_personalpay_table']} where pp_id = '$pp_id' $pp = sql_fetch($sql); if(! (isset($pp['pp_id']) && $pp['pp_id'])) - alert('개인결제 정보가 존재하지 않습니다.'); + alert('개인결제 정보가 존재하지 않습니다.', G5_SHOP_URL); if($pp['pp_tno']) - alert('이미 결제하신 개인결제 내역입니다.'); + alert('이미 결제하신 개인결제 내역입니다.', G5_SHOP_URL); $pp['pp_name'] = strip_tags($pp['pp_name']); diff --git a/shop/personalpayform.sub.php b/shop/personalpayform.sub.php index d87ad2d2c..a80153d8d 100644 --- a/shop/personalpayform.sub.php +++ b/shop/personalpayform.sub.php @@ -252,8 +252,34 @@ function forderform_check(f) f.gopaymethod.value = "무통장"; break; } - + + f.DirectShowOpt.value = ""; // 간편결제 요청 값 초기화 + f.DirectEasyPay.value = ""; // 간편결제 요청 값 초기화 + f.NicepayReserved.value = ""; // 간편결제 요청 값 초기화 + f.EasyPayMethod.value = ""; // 간편결제 요청 값 초기화 + + f.TransType.value = "1"; + + switch(settle_method) + { + case "계좌이체": + f.PayMethod.value = "BANK"; + break; + case "가상계좌": + f.PayMethod.value = "VBANK"; + break; + case "휴대폰": + f.PayMethod.value = "CELLPHONE"; + break; + case "신용카드": + f.PayMethod.value = "CARD"; + break; + default: + f.PayMethod.value = "무통장"; + break; + } + // 결제정보설정 f.buyr_name.value = f.pp_name.value; @@ -318,5 +344,45 @@ function forderform_check(f) f.submit(); } + + f.Amt.value = f.good_mny.value; + + f.SupplyAmt.value = f.comm_tax_mny.value; + f.GoodsVat.value = f.comm_vat_mny.value; + f.TaxFreeAmt.value = f.comm_free_mny.value; + + f.BuyerName.value = f.pp_name.value; + f.BuyerEmail.value = f.pp_email.value; + f.BuyerTel.value = f.pp_hp.value; + + if(f.PayMethod.value != "무통장") { + // 주문정보 임시저장 + var order_data = $(f).serialize(); + var save_result = ""; + $.ajax({ + type: "POST", + data: order_data, + url: g5_url+"/shop/ajax.orderdatasave.php", + cache: false, + async: false, + success: function(data) { + save_result = data; + } + }); + + if(save_result) { + alert(save_result); + return false; + } + + if(!nicepay_create_signdata(f)) + return false; + + nicepayStart(f); + } else { + f.submit(); + } + + } \ No newline at end of file diff --git a/shop/personalpayformupdate.php b/shop/personalpayformupdate.php index 30d61c621..6a25e8af6 100644 --- a/shop/personalpayformupdate.php +++ b/shop/personalpayformupdate.php @@ -34,6 +34,9 @@ if ($pp_settle_case == "계좌이체") case 'inicis': include G5_SHOP_PATH.'/inicis/inistdpay_result.php'; break; + case 'nicepay': + include G5_SHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_SHOP_PATH.'/kcp/pp_ax_hub.php'; $bank_name = iconv("cp949", "utf-8", $bank_name); @@ -56,6 +59,9 @@ else if ($pp_settle_case == "가상계좌") case 'inicis': include G5_SHOP_PATH.'/inicis/inistdpay_result.php'; break; + case 'nicepay': + include G5_SHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_SHOP_PATH.'/kcp/pp_ax_hub.php'; $bankname = iconv("cp949", "utf-8", $bankname); @@ -78,6 +84,9 @@ else if ($pp_settle_case == "휴대폰") case 'inicis': include G5_SHOP_PATH.'/inicis/inistdpay_result.php'; break; + case 'nicepay': + include G5_SHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_SHOP_PATH.'/kcp/pp_ax_hub.php'; break; @@ -98,6 +107,9 @@ else if ($pp_settle_case == "신용카드") case 'inicis': include G5_SHOP_PATH.'/inicis/inistdpay_result.php'; break; + case 'nicepay': + include G5_SHOP_PATH.'/nicepay/nicepay_result.php'; + break; default: include G5_SHOP_PATH.'/kcp/pp_ax_hub.php'; $card_name = iconv("cp949", "utf-8", $card_name); @@ -125,6 +137,10 @@ if((int)$pp['pp_price'] !== (int)$pg_price) { case 'inicis': include G5_SHOP_PATH.'/inicis/inipay_cancel.php'; break; + case 'nicepay': + $cancelAmt = (int)$pg_price; + include G5_SHOP_PATH.'/nicepay/cancel_process.php'; + break; default: include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php'; break; diff --git a/shop/personalpayresult.php b/shop/personalpayresult.php index 6ff820ead..9113bd97d 100644 --- a/shop/personalpayresult.php +++ b/shop/personalpayresult.php @@ -151,6 +151,8 @@ if($pp['pp_pg'] == 'lg') { $hp_receipt_script = 'showReceiptByTID(\''.$LGD_MID.'\', \''.$LGD_TID.'\', \''.$LGD_HASHDATA.'\');'; } else if($pp['pp_pg'] == 'inicis') { $hp_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid='.$pp['pp_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; + } else if($pp['pp_pg'] == 'nicepay') { + $hp_receipt_script = 'window.open(\'https://npg.nicepay.co.kr/issue/IssueLoader.do?type=0&TID='.$pp['pp_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; } else { $hp_receipt_script = 'window.open(\''.G5_BILL_RECEIPT_URL.'mcash_bill&tno='.$pp['pp_tno'].'&order_no='.$pp['pp_id'].'&trade_mony='.$pp['pp_receipt_price'].'\', \'winreceipt\', \'width=500,height=690,scrollbars=yes,resizable=yes\');'; } @@ -170,6 +172,8 @@ if($pp['pp_pg'] == 'lg') { $card_receipt_script = 'showReceiptByTID(\''.$LGD_MID.'\', \''.$LGD_TID.'\', \''.$LGD_HASHDATA.'\');'; } else if($pp['pp_pg'] == 'inicis') { $card_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid='.$pp['pp_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; + } else if($pp['pp_pg'] == 'nicepay') { + $card_receipt_script = 'window.open(\'https://npg.nicepay.co.kr/issue/IssueLoader.do?type=0&TID='.$pp['pp_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; } else { $card_receipt_script = 'window.open(\''.G5_BILL_RECEIPT_URL.'card_bill&tno='.$pp['pp_tno'].'&order_no='.$pp['pp_id'].'&trade_mony='.$pp['pp_receipt_price'].'\', \'winreceipt\', \'width=470,height=815,scrollbars=yes,resizable=yes\');'; } @@ -224,6 +228,8 @@ if($pp['pp_pg'] == 'lg') { } else if($pp['pp_pg'] == 'inicis') { $cash = unserialize($pp['pp_cash_info']); $cash_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/Cash_mCmReceipt.jsp?noTid='.$cash['TID'].'&clpaymethod=22\',\'showreceipt\',\'width=380,height=540,scrollbars=no,resizable=no\');'; + } else if($pp['pp_pg'] == 'nicepay') { + $cash_receipt_script = 'window.open(\'https://npg.nicepay.co.kr/issue/IssueLoader.do?type=1&TID='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; } else { require_once G5_SHOP_PATH.'/settle_kcp.inc.php'; diff --git a/shop/settle_nicepay.inc.php b/shop/settle_nicepay.inc.php new file mode 100644 index 000000000..2a07fc1ed --- /dev/null +++ b/shop/settle_nicepay.inc.php @@ -0,0 +1,70 @@ + '신용카드', + 'BANK' => '계좌이체', + 'VBANK' => '가상계좌', + 'CELLPHONE' => '휴대폰' +); + +if (! function_exists('nicepay_reqPost')) { + //Post api call + function nicepay_reqPost($data, $url){ + $url_data = parse_url($url); + + // 나이스페이 url이 맞는지 체크하여 틀리면 false를 리턴합니다. + if (! (isset($url_data['host']) && preg_match('#\.nicepay\.co\.kr$#i', $url_data['host']))) { + return false; + } + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); //connection timeout 15 + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); //POST data + curl_setopt($ch, CURLOPT_POST, true); + $response = curl_exec($ch); + curl_close($ch); + return $response; + } +} \ No newline at end of file diff --git a/shop/settle_nicepay_common.php b/shop/settle_nicepay_common.php new file mode 100644 index 000000000..e4b18b38b --- /dev/null +++ b/shop/settle_nicepay_common.php @@ -0,0 +1,176 @@ +$RcptTID, 'ApplNum'=>$RcptAuthCode, 'AuthDate'=>$AuthDate))."' + "; + } + + $sql = " update {$g5['g5_shop_order_table']} + set od_misu = '{$info['od_misu']}' $add_update_sql "; + if($info['od_misu'] == 0) + $sql .= " , od_status = '입금' "; + $sql .= " where od_id = '$od_id' "; + sql_query($sql, FALSE); + + // 장바구니 상태변경 + if($info['od_misu'] == 0) { + $sql = " update {$g5['g5_shop_cart_table']} + set ct_status = '입금' + where od_id = '$od_id' "; + sql_query($sql, FALSE); + } + + } + } + + if($NICEPAY_payLog) { + $logfile = fopen( $NICEPAY_log_path . "/nice_vacct_noti_result.log", "a+" ); + + fwrite( $logfile,"************************************************\r\n"); + fwrite( $logfile,"PayMethod : ".$PayMethod."\r\n"); + fwrite( $logfile,"MID : ".$MID."\r\n"); + fwrite( $logfile,"MallUserID : ".$MallUserID."\r\n"); + fwrite( $logfile,"Amt : ".$Amt."\r\n"); + fwrite( $logfile,"name : ".$name."\r\n"); + fwrite( $logfile,"GoodsName : ".$GoodsName."\r\n"); + fwrite( $logfile,"TID : ".$TID."\r\n"); + fwrite( $logfile,"MOID : ".$MOID."\r\n"); + fwrite( $logfile,"AuthDate : ".$AuthDate."\r\n"); + fwrite( $logfile,"ResultCode : ".$ResultCode."\r\n"); + fwrite( $logfile,"ResultMsg : ".$ResultMsg."\r\n"); + fwrite( $logfile,"VbankNum : ".$VbankNum."\r\n"); + fwrite( $logfile,"FnCd : ".$FnCd."\r\n"); + fwrite( $logfile,"VbankName : ".$VbankName."\r\n"); + fwrite( $logfile,"VbankInputName : ".$VbankInputName."\r\n"); + fwrite( $logfile,"RcptTID : ".$RcptTID."\r\n"); + fwrite( $logfile,"RcptType : ".$RcptType."\r\n"); + fwrite( $logfile,"RcptAuthCode : ".$RcptAuthCode."\r\n"); + fwrite( $logfile,"CancelDate : ".$CancelDate."\r\n"); + fwrite( $logfile,"************************************************\r\n"); + + fclose( $logfile ); + } + + + //************************************************************************************ + + //위에서 상점 데이터베이스에 등록 성공유무에 따라서 성공시에는 "OK"를 이니시스로 + //리턴하셔야합니다. 아래 조건에 데이터베이스 성공시 받는 FLAG 변수를 넣으세요 + //(주의) OK를 리턴하지 않으시면 이니시스 지불 서버는 "OK"를 수신할때까지 계속 재전송을 시도합니다 + //기타 다른 형태의 PRINT( echo )는 하지 않으시기 바랍니다 + + if ($result) + { + echo "OK"; // 절대로 지우지마세요 + } + else + { + echo "FAIL"; // 절대로 지우지마세요 + } + + //************************************************************************************* + + } + + +} \ No newline at end of file diff --git a/shop/taxsave.php b/shop/taxsave.php index 49cbb3df2..98de1c15f 100644 --- a/shop/taxsave.php +++ b/shop/taxsave.php @@ -48,6 +48,12 @@ if($tx == 'personalpay') { $amt_sup = (int)$od['od_tax_mny'] + (int)$od['od_free_mny']; $amt_tax = (int)$od['od_vat_mny']; $amt_svc = 0; + $amt_free = 0; + + if ($od['od_pg'] === 'nicepay') { + $amt_sup = (int)$od['od_tax_mny']; + $amt_free = (int)$od['od_free_mny']; + } } $trad_time = date("YmdHis"); diff --git a/theme/basic/css/default_shop.css b/theme/basic/css/default_shop.css index 140570ee9..a2d440793 100644 --- a/theme/basic/css/default_shop.css +++ b/theme/basic/css/default_shop.css @@ -796,12 +796,15 @@ box-shadow: 1px 2px 2px #eee;} #sod_frm_paysel legend {position:absolute;font-size:0;line-height:0;overflow:hidden} #sod_frm_paysel .KPAY{background:url('../../../img/kpay.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} #sod_frm_paysel .PAYNOW{background:url('../../../img/paynow.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} -#sod_frm_paysel .PAYCO{background:url('../../../img/payco.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} -#sod_frm_paysel .inicis_lpay{background:url('../../../img/lpay_logo.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .PAYCO, #sod_frm_paysel .paycopay_icon{background:url('../../../img/payco.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .inicis_lpay, #sod_frm_paysel .lpay_icon{background:url('../../../img/lpay_logo.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} #sod_frm_paysel .inicis_kakaopay{position:relative;overflow:hidden;text-indent:-999px} #sod_frm_paysel .inicis_kakaopay em{position:absolute;top:15px;left:45px;width:70px;height:30px;background:url('../../../img/kakao.png') no-repeat 50% 50% #ffeb00;overflow:hidden;text-indent:-999px;border-radius:30px} #sod_frm_paysel .kakaopay_icon{background:url('../../../img/kakao.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} #sod_frm_paysel .naverpay_icon{background:url('../../../img/ico-default-naverpay.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .samsungpay_icon{background:url('../../../img/samsungpay.png') no-repeat 50% 50% #fff;display:inline-block;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .ssgpay_icon{background:url('../../../img/ssgpay_icon.png') no-repeat 50% 50% #fff;display:inline-block;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .skpay_icon{background:url('../../../img/skpay11_icon.png') no-repeat 50% 50% #fff; background-size: 70px;display:inline-block;overflow:hidden;text-indent:-999px} #sod_frm_paysel .bank_icon{background:url('../../../img/pay_icon1.png') no-repeat 15px 50% #fff} #sod_frm_paysel .vbank_icon{background:url('../../../img/pay_icon2.png') no-repeat 15px 50% #fff} #sod_frm_paysel .iche_icon{background:url('../../../img/pay_icon2.png') no-repeat 15px 50% #fff} diff --git a/theme/basic/css/mobile_shop.css b/theme/basic/css/mobile_shop.css index 80c31b4f1..72a1dd1c3 100644 --- a/theme/basic/css/mobile_shop.css +++ b/theme/basic/css/mobile_shop.css @@ -221,13 +221,16 @@ box-shadow: 0 0 6px rgba(0,0,0,0.2);} #m_sod_frm_paysel li {float:left;padding:5px;width:46%;height:35px} #m_sod_frm_paysel .KPAY{background:url('../../../img/kpay.png') no-repeat;width:37px;height:15px;overflow:hidden;text-indent:-999px;display:inline-block;background-size:100%} #m_sod_frm_paysel .PAYNOW{background:url('../../../img/paynow.png') no-repeat;width:46px;height:15px;overflow:hidden;text-indent:-999px;display:inline-block;background-size:100%;} -#m_sod_frm_paysel .PAYCO{background:url('../../../img/payco.png') no-repeat 1px;width:50px;height:15px;overflow:hidden;text-indent:-999px;display:inline-block;background-size:100%} -#m_sod_frm_paysel .inicis_lpay{background:url('../../../img/lpay_logo.png') no-repeat;width:35px;height:12px;overflow:hidden;text-indent:-999px;display:inline-block;background-size:100%;} +#m_sod_frm_paysel .PAYCO, #m_sod_frm_paysel .paycopay_icon{background:url('../../../img/payco.png') no-repeat 1px;width:50px;height:15px;overflow:hidden;text-indent:-999px;display:inline-block;background-size:100%} +#m_sod_frm_paysel .inicis_lpay, #m_sod_frm_paysel .lpay_icon{background:url('../../../img/lpay_logo.png') no-repeat;width:35px;height:12px;overflow:hidden;text-indent:-999px;display:inline-block;background-size:100%;} #m_sod_frm_paysel .inicis_kakaopay{background:url('../../../img/kakao.png') no-repeat 50% 50% #ffeb00;border-radius:30px;height:26px;width:74px;display:inline-block;overflow:hidden;text-indent:-999px;background-size:36px auto} #m_sod_frm_paysel .kakaopay_icon{background:url('../../../img/ico-mobile-kakaopay.png') no-repeat #fff;height:23px;width:63px;display:inline-block;overflow:hidden;text-indent:-999px;background-size:45px auto;background-position: 10% 40%} #m_sod_frm_paysel .naverpay_icon{background:url('../../../img/ico-mobile-naverpay.png') no-repeat #fff;height:23px;width:60px;display:inline-block;overflow:hidden;text-indent:-999px;background-size:45px auto;background-position: 0% 30%} #m_sod_frm_paysel .applepay_icon{background:url('../../../img/ico-mobile-applepay.png') no-repeat #fff;height:30px;width:60px;display:inline-block;overflow:hidden;text-indent:-999px;background-size:43px auto} -#m_sod_frm_paysel .samsung_pay{margin-left:-23px;background:url('../../../img/samsungpay.png') no-repeat 24px 3px;height:25px;width:106px;display:inline-block;overflow:hidden;text-indent:-999px} +#m_sod_frm_paysel .applepay_icon{background:url('../../../img/ico-mobile-applepay.png') no-repeat #fff;height:30px;width:60px;display:inline-block;overflow:hidden;text-indent:-999px;background-size:43px auto} +#m_sod_frm_paysel .ssgpay_icon{background:url('../../../img/ssgpay_icon.png') no-repeat 0px 3px #fff;width:55px;height:20px;background-size:100%;display:inline-block;overflow:hidden;text-indent:-999px} +#m_sod_frm_paysel .skpay_icon{background:url('../../../img/skpay11_icon.png') no-repeat 0px 3px #fff;width:55px;height:20px;background-size:100%;display:inline-block;overflow:hidden;text-indent:-999px} +#m_sod_frm_paysel .samsung_pay, #m_sod_frm_paysel .samsungpay_icon{margin-left:-23px;background:url('../../../img/samsungpay.png') no-repeat 24px 7px;height:25px;width:106px;display:inline-block;overflow:hidden;text-indent:-999px} #sod_frm_pay{padding:10px;;border-top:1px solid #f3f3f3} #sod_frm_pay h2{margin:10px 0;font-size:1.25em} @@ -905,11 +908,14 @@ box-shadow:0 0 8px rgba(65,98,255,0.8)} #sod_frm_paysel legend {position:absolute;font-size:0;line-height:0;overflow:hidden} #sod_frm_paysel .KPAY{background:url('../../../img/kpay.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} #sod_frm_paysel .PAYNOW{background:url('../../../img/paynow.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} -#sod_frm_paysel .PAYCO{background:url('../../../img/payco.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} -#sod_frm_paysel .inicis_lpay{background:url('../../../img/lpay_logo.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .PAYCO, #sod_frm_paysel .paycopay_icon{background:url('../../../img/payco.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .inicis_lpay, #sod_frm_paysel .lpay_icon{background:url('../../../img/lpay_logo.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} #sod_frm_paysel .inicis_kakaopay{background:url('../../../img/kakao.png') no-repeat 50% 50% #f4dc34;overflow:hidden;text-indent:-999px} #sod_frm_paysel .kakaopay_icon{background:url('../../../img/kakao.png') no-repeat 50% 50% #f4dc34;overflow:hidden;text-indent:-999px} #sod_frm_paysel .naverpay_icon{background:url('../../../img/ico-default-naverpay.png') no-repeat 50% 50% #fff;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .samsungpay_icon{background:url('../../../img/samsungpay.png') no-repeat 50% 50% #fff;display:inline-block;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .ssgpay_icon{background:url('../../../img/ssgpay_icon.png') no-repeat 50% 50% #fff;display:inline-block;overflow:hidden;text-indent:-999px} +#sod_frm_paysel .skpay_icon{background:url('../../../img/skpay11_icon.png') no-repeat 50% 50% #fff; background-size: 70px;display:inline-block;overflow:hidden;text-indent:-999px} #sod_frm_paysel .bank_icon{background:url('../../../img/pay_icon1.png') no-repeat 15px 50% #fff} #sod_frm_paysel .vbank_icon{background:url('../../../img/pay_icon2.png') no-repeat 15px 50% #fff} #sod_frm_paysel .iche_icon{background:url('../../../img/pay_icon2.png') no-repeat 15px 50% #fff} diff --git a/theme/basic/shop/orderinquiryview.php b/theme/basic/shop/orderinquiryview.php index 48f9823a6..f248543c6 100644 --- a/theme/basic/shop/orderinquiryview.php +++ b/theme/basic/shop/orderinquiryview.php @@ -194,6 +194,7 @@ if($od['od_pg'] == 'lg') { $app_no_subj = '승인번호'; $app_no = $od['od_app_no']; $disp_bank = false; + $disp_receipt = true; } else if($od['od_settle_case'] == '휴대폰') { $app_no_subj = '휴대폰번호'; $app_no = $od['od_bank_account']; @@ -462,7 +463,9 @@ if($od['od_pg'] == 'lg') { $hp_receipt_script = 'showReceiptByTID(\''.$LGD_MID.'\', \''.$LGD_TID.'\', \''.$LGD_HASHDATA.'\');'; } else if($od['od_pg'] == 'inicis') { $hp_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; - } else { + } else if($od['od_pg'] == 'nicepay') { + $hp_receipt_script = 'window.open(\'https://npg.nicepay.co.kr/issue/IssueLoader.do?type=0&TID='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; + } else { $hp_receipt_script = 'window.open(\''.G5_BILL_RECEIPT_URL.'mcash_bill&tno='.$od['od_tno'].'&order_no='.$od['od_id'].'&trade_mony='.$od['od_receipt_price'].'\', \'winreceipt\', \'width=500,height=690,scrollbars=yes,resizable=yes\');'; } ?> @@ -470,7 +473,7 @@ if($od['od_pg'] == 'lg') { @@ -524,10 +529,10 @@ if($od['od_pg'] == 'lg') {
  • 현금영수증 @@ -553,7 +558,9 @@ if($od['od_pg'] == 'lg') { } else if($od['od_pg'] == 'inicis') { $cash = unserialize($od['od_cash_info']); $cash_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/Cash_mCmReceipt.jsp?noTid='.$cash['TID'].'&clpaymethod=22\',\'showreceipt\',\'width=380,height=540,scrollbars=no,resizable=no\');'; - } else { + } else if($od['od_pg'] == 'nicepay') { + $cash_receipt_script = 'window.open(\'https://npg.nicepay.co.kr/issue/IssueLoader.do?type=1&TID='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');'; + } else { require_once G5_SHOP_PATH.'/settle_kcp.inc.php'; $cash = unserialize($od['od_cash_info']); @@ -563,7 +570,7 @@ if($od['od_pg'] == 'lg') { 현금영수증 확인하기 현금영수증을 발급하시려면 클릭하십시오.