function dispInipaystandardForm() { $oEpayController = getController('epay'); $reviewOutput = $oEpayController->reviewOrder(); if (!$reviewOutput->toBool()) { return $reviewOutput; } $payment_method = Context::get('payment_method'); $_SESSION['inipaystandard']['payment_method'] = $payment_method; $_SESSION['inipaystandard']['transaction_srl'] = $reviewOutput->transaction_srl; $_SESSION['inipaystandard']['price'] = $reviewOutput->price; $_SESSION['inipaystandard']['error_return_url'] = Context::get('error_return_url'); Context::set('order_srl', $reviewOutput->order_srl); Context::set('review_form', $reviewOutput->review_form); Context::set('item_name', $reviewOutput->item_name); Context::set('price', $reviewOutput->price); Context::set('purchaser_name', $reviewOutput->purchaser_name); Context::set('purchaser_email', $reviewOutput->purchaser_email); Context::set('purchaser_telnum', '010-0000-0000'); //payment method switch ($payment_method) { case "CC": $payment_method = "Card"; break; case "IB": $payment_method = "DirectBank"; break; case "VA": $payment_method = "VBank"; break; case "MP": $payment_method = "HPP"; break; default: $payment_method = "Card"; } Context::set('payment_method', $payment_method); if ($this->module_info->method_mobilephone == 'Y') { $HPP = '1'; } if ($this->module_info->method_mobilephone == 'M') { $HPP = '2'; } $acceptmethod = sprintf("HPP(%s):Card(0):OCB:receipt:cardpoint", $HPP); if (!$this->module_info->va_receipt || $this->module_info->va_receipt == 'Y') { $acceptmethod .= ':va_receipt'; } Context::set('acceptmethod', $acceptmethod); require_once 'libs/INIStdPayUtil.php'; $SignatureUtil = new INIStdPayUtil(); if ($this->module_info->ini_payment_test_mode == 'Y') { $inipay_mid = 'INIpayTest'; $inipay_signkey = 'SU5JTElURV9UUklQTEVERVNfS0VZU1RS'; } else { $inipay_mid = $this->module_info->inipay_mid; $inipay_signkey = $this->module_info->inipay_signkey; } $timestamp = $SignatureUtil->getTimestamp(); Context::set('timestamp', $timestamp); Context::set('pay_mid', $inipay_mid); $mKey = $SignatureUtil->makeHash($inipay_signkey, "sha256"); Context::set('mKey', $mKey); $params = array("oid" => $reviewOutput->order_srl, "price" => $reviewOutput->price, "timestamp" => $timestamp); $sign = $SignatureUtil->makeSignature($params, "sha256"); Context::set('sign', $sign); //template $template_path = sprintf("%sskins/%s/", $this->module_path, $this->module_info->skin); if (!is_dir($template_path) || !$this->module_info->skin) { $this->module_info->skin = 'default'; $template_path = sprintf("%sskins/%s/", $this->module_path, $this->module_info->skin); } $this->setTemplatePath($template_path); $this->setTemplateFile('pay'); }
// 가맹점 주문번호(가맹점에서 직접 설정) //$price = "1000"; // 상품가격(특수기호 제외, 가맹점에서 직접 설정) $price = $_POST['item_amount']; $goodsname = $_POST['item_name']; $buyername = $_POST['buyername']; $buyertel = $_POST['buyertel']; $buyeremail = $_POST['buyeremail']; $merchantData = $goodsname . '***' . $_POST['item_name'] . '***' . $price . '***' . $buyername . '***' . $buyertel . '***' . $buyeremail . '***' . $orderNumber; $cardNoInterestQuota = "11-2:3:,34-5:12,14-6:12:24,12-12:36,06-9:12,01-3:4"; // 카드 무이자 여부 설정(가맹점에서 직접 설정) $cardQuotaBase = "2:3:4:5:6:11:12:24:36"; // 가맹점에서 사용할 할부 개월수 설정 //################################### // 2. 가맹점 확인을 위한 signKey를 해시값으로 변경 (SHA-256방식 사용) //################################### $mKey = $SignatureUtil->makeHash($signKey, "sha256"); $params = array("oid" => $orderNumber, "price" => $price, "timestamp" => $timestamp); $sign = $SignatureUtil->makeSignature($params, "sha256"); /* 기타 */ $referer = $_SERVER['HTTP_REFERER']; $siteDomain = site_url() . '/wp-content/plugins/simple_inicis/INIStdPaySample'; //가맹점 도메인 입력 // 페이지 URL에서 고정된 부분을 적는다. // Ex) returnURL이 http://localhost:8082/demo/INIpayStdSample/INIStdPayReturn.jsp 라면 // http://localhost:8082/demo/INIpayStdSample 까지만 기입한다. ?> <!DOCTYPE html> <html> <head> <script> function myFunction()
function wp_ajax_generate_payment_form() { global $woocommerce, $inicis_payment; $orderid = $_REQUEST['orderid']; if (!empty($this->id)) { switch ($this->id) { case 'inicis_card': case 'inicis_bank': case 'inicis_vbank': case 'inicis_hpp': case 'inicis_kpay': case 'inicis_escrow_bank': //라이브러리 존재여부 체크 if (!file_exists($inicis_payment->plugin_path() . "/lib/inipay50/INILib.php")) { wp_send_json_error(__('에러 : INILib.php 파일이 없습니다. 사이트 관리자에게 문의하여 주십시오.', 'inicis_payment')); } try { require_once $inicis_payment->plugin_path() . "/lib/inipay50/INILib.php"; } catch (Exception $e) { wp_send_json_error(__('에러 : INILib.php 파일이 없습니다. 사이트 관리자에게 문의하여 주십시오.', 'inicis_payment') . ' [' . $e->getMessage() . ']'); } //SSL 체크 $use_ssl = get_option('woocommerce_force_ssl_checkout'); //결제옵션 가져오기 $acceptmethod = $this->get_accpetmethod(); $userid = get_current_user_id(); $order = new WC_Order($orderid); $txnid = $this->make_txnid($order); $productinfo = $this->make_product_info($order); $order_total = $this->inicis_get_order_total($order); $inipay = new INIpay50(); $inipay->SetField("inipayhome", $this->settings['libfolder']); $inipay->SetField("type", "chkfake"); $inipay->SetField("debug", "true"); $inipay->SetField("enctype", "asym"); $inipay->SetField("admin", "1111"); $inipay->SetField("checkopt", "false"); $inipay->SetField("mid", $this->merchant_id); $inipay->SetField("price", $order_total); $inipay->SetField("nointerest", $this->settings['nointerest']); $inipay->SetField("quotabase", mb_convert_encoding($this->settings['quotabase'], "EUC-KR", "UTF-8")); $inipay->startAction(); if ($inipay->GetResult("ResultCode") != "00") { wp_send_json_error($inipay->GetResult("ResultMsg")); } update_post_meta($orderid, "ini_rn", $inipay->GetResult("rn")); update_post_meta($orderid, "ini_enctype", $inipay->GetResult("enctype")); if (wp_is_mobile()) { $str = "{$this->merchant_id}|{$txnid}||{$order_total}|{$productinfo}|{$order->billing_first_name}|{$order->billing_email}|||||||||||"; $hash = hash('sha512', $str); $notification = $this->encrypt_notification($txnid, $hash); ob_start(); include $inicis_payment->plugin_path() . '/templates/payment_form_mobile.php'; $form_tag = ob_get_clean(); } else { $str = "{$this->merchant_id}|{$txnid}|{$userid}|{$order_total}|{$productinfo}|{$order->billing_first_name}|{$order->billing_email}|||||||||||"; $hash = hash('sha512', $str); ob_start(); include $inicis_payment->plugin_path() . '/templates/payment_form_pc.php'; $form_tag = ob_get_clean(); } break; case 'inicis_stdcard': //웹표준 //라이브러리 존재여부 체크 if (!file_exists($inicis_payment->plugin_path() . "/lib/inistd/INIStdPayUtil.php")) { wp_send_json_error(__('에러 : INIStdPayUtil.php 파일이 없습니다. 사이트 관리자에게 문의하여 주십시오.', 'inicis_payment')); } try { require_once $inicis_payment->plugin_path() . "/lib/inistd/INIStdPayUtil.php"; } catch (Exception $e) { wp_send_json_error(__('에러 : INIStdPayUtil.php 파일이 없습니다. 사이트 관리자에게 문의하여 주십시오.', 'inicis_payment') . ' [' . $e->getMessage() . ']'); } $use_ssl = get_option('woocommerce_force_ssl_checkout'); //SSL 체크 $SignatureUtil = new INIStdPayUtil(); $mid = $this->settings['merchant_id']; if (empty($this->settings['signkey'])) { $signKey = 'SU5JTElURV9UUklQTEVERVNfS0VZU1RS'; //INIpayTest 기본값 } else { $signKey = $this->settings['signkey']; } $timestamp = $SignatureUtil->getTimestamp(); //타임스탬프 //결제옵션 가져오기 $acceptmethod = $this->get_accpetmethod(); $cardNoInterestQuota = $this->settings['nointerest']; //카드무이자 여부 설정 $cardQuotaBase = $this->settings['quotabase']; //가맹점에서 사용할 할부 개월수 설정 $mKey = $SignatureUtil->makeHash($signKey, "sha256"); $userid = get_current_user_id(); $order = new WC_Order($orderid); $txnid = $this->make_txnid($order); $productinfo = $this->make_product_info($order); $price = $this->inicis_get_order_total($order); $order_total = $this->inicis_get_order_total($order); $params = array("oid" => $txnid, "price" => $price, "timestamp" => $timestamp); $sign = $SignatureUtil->makeSignature($params, "sha256"); $str = "{$this->merchant_id}|{$txnid}|{$userid}|{$order_total}|{$productinfo}|{$order->billing_first_name}|{$order->billing_email}|||||||||||"; $hash = hash('sha512', $str); $notification = $this->encrypt_notification($txnid, $hash); $payView_type = 'overlay'; ob_start(); include $inicis_payment->plugin_path() . '/templates/payment_form_std.php'; $form_tag = ob_get_clean(); break; default: wp_send_json_error(__('결제오류 : 결제 수단이 선택되지 않았습니다 사이트 관리자에게 문의하여 주십시오', 'inicis_payment')); break; } } else { wp_send_json_error(__('결제오류 : 결제 수단이 선택되지 않았습니다 사이트 관리자에게 문의하여 주십시오', 'inicis_payment')); } wp_send_json_success('<div data-id="mshop-payment-form" style="display:none">' . $form_tag . '</div>'); }