Changeset 1875347
- Timestamp:
- 05/16/2018 10:39:30 AM (8 years ago)
- Location:
- gnupay-kcp/trunk
- Files:
-
- 16 edited
-
classes/admin_metabox.class.php (modified) (1 diff)
-
classes/kcp_ajax.class.php (modified) (1 diff)
-
classes/kcp_card_gateway.class.php (modified) (6 diffs)
-
classes/kcp_pay_gateway.class.php (modified) (1 diff)
-
classes/kcp_user_cancel.class.php (modified) (2 diffs)
-
classes/kcp_user_order_details.class.php (modified) (1 diff)
-
classes/kcp_virtualaccount.class.php (modified) (2 diffs)
-
config.php (modified) (1 diff)
-
gnupay-kcp.php (modified) (1 diff)
-
js/kcp_pay.js (modified) (1 diff)
-
kcp/m_order_approval_form.php (modified) (3 diffs)
-
kcp/m_orderform.2.php (modified) (1 diff)
-
kcp/orderform.2.php (modified) (1 diff)
-
kcp/pp_ax_hub_lib.php (modified) (1 diff)
-
lib/functions.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
gnupay-kcp/trunk/classes/admin_metabox.class.php
r1403518 r1875347 42 42 $pay_ids = gnupay_kcp_get_settings('pay_ids'); 43 43 44 if( !empty($order->payment_method) && in_array($order->payment_method, $pay_ids) ){ 45 $config = gnupay_kcp_get_config_payment( $order->id ); 44 if( !empty($order->get_payment_method()) && in_array($order->get_payment_method(), $pay_ids) ){ 45 $order_id = $order->get_order_number(); 46 $config = gnupay_kcp_get_config_payment( $order_id ); 46 47 47 $payment_method = $order-> payment_method;48 $payment_method = $order->get_payment_method(); 48 49 $pg_url = 'http://admin8.kcp.co.kr'; 49 50 $pg_test = 'KCP'; 50 51 51 $od_pg = get_post_meta($order ->id, '_od_pg', true); //결제 pg사를 저장52 $od_pay_method = get_post_meta($order ->id, '_od_pay_method', true); //결제 pg사를 저장53 $od_tno = get_post_meta($order ->id, '_od_tno', true); //결제 pg사를 주문번호54 $od_app_no = get_post_meta($order ->id, '_od_app_no', true); //결제 승인 번호55 $od_receipt_price = get_post_meta($order ->id, '_od_receipt_price', true); //결제 금액56 $od_test = get_post_meta($order ->id, '_od_test', true); //테스트체크57 $od_escrow = get_post_meta($order ->id, '_od_escrow', true); //에스크로52 $od_pg = get_post_meta($order_id, '_od_pg', true); //결제 pg사를 저장 53 $od_pay_method = get_post_meta($order_id, '_od_pay_method', true); //결제 pg사를 저장 54 $od_tno = get_post_meta($order_id, '_od_tno', true); //결제 pg사를 주문번호 55 $od_app_no = get_post_meta($order_id, '_od_app_no', true); //결제 승인 번호 56 $od_receipt_price = get_post_meta($order_id, '_od_receipt_price', true); //결제 금액 57 $od_test = get_post_meta($order_id, '_od_test', true); //테스트체크 58 $od_escrow = get_post_meta($order_id, '_od_escrow', true); //에스크로 58 59 ?> 59 60 <div> -
gnupay-kcp/trunk/classes/kcp_ajax.class.php
r1439770 r1875347 68 68 69 69 } 70 70 71 71 echo json_encode($res); 72 72 exit; -
gnupay-kcp/trunk/classes/kcp_card_gateway.class.php
r1830610 r1875347 119 119 if( $result ){ 120 120 if( $this->id == $this->gnupay_kcp_card ){ //카드일때만 실행; 121 $options = apply_filters( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->sett tings );121 $options = apply_filters( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->settings ); 122 122 123 123 $pay_ids = gnupay_kcp_get_settings('pay_ids'); … … 307 307 } 308 308 309 include_once(GNUPAY_KCP_PATH.'kcp/settle_kcp.inc.php'); 310 311 // locale ko_KR.euc-kr 로 설정 312 setlocale(LC_CTYPE, 'ko_KR.euc-kr'); 313 314 // 부분취소 실행 315 $g_conf_site_cd = $config['de_kcp_mid']; 316 $g_conf_site_key = $config['de_kcp_site_key']; 317 $g_conf_home_dir = GNUPAY_KCP_PATH.'/kcp'; 318 $g_conf_key_dir = ''; 319 $g_conf_log_dir = ''; 320 321 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') 322 { 323 $g_conf_log_dir = sir_get_upload_path().'/log/refund'; 324 $g_conf_key_dir = GNUPAY_KCP_PATH.'kcp/bin/pub.key'; 325 } 326 327 if (preg_match("/^T000/", $g_conf_site_cd) || $config['de_card_test']) { 328 $g_conf_gw_url = "testpaygw.kcp.co.kr"; 329 } 330 else { 331 $g_conf_gw_url = "paygw.kcp.co.kr"; 332 if (!preg_match("/^SR/", $g_conf_site_cd)) { 333 return new WP_Error('kcp_refund_error', __("SR 로 시작하지 않는 KCP SITE CODE 는 지원하지 않습니다.", GNUPAY_NAME)); 334 } 335 } 336 337 include_once(GNUPAY_KCP_PATH.'kcp/pp_cli_hub_lib.php'); 338 339 $tno = get_post_meta( $order_id, '_od_tno', true ); 340 $req_tx = 'mod'; 341 $mod_desc = gp_iconv_euckr($mod_memo); 342 $cust_ip = getenv('REMOTE_ADDR'); 343 //$rem_mny = $order->get_remaining_refund_amount(); // 취소 가능 잔액 ( 이렇게 하면 안됨 ) 344 $rem_mny = $order->get_total() - $order->get_total_refunded() + (int) $amount; // 취소 가능 잔액 345 $mod_mny = (int)$tax_mny; 346 $mod_free_mny = (int)$free_mny; 347 $mod_type = 'RN07'; 348 349 if( $payment_method == $pay_ids['bank'] ) //계좌이체 350 $mod_type = 'STPA'; 351 352 if($od_tax_flag) { 353 $mod_mny = $tax_mny + $free_mny; 354 } 355 356 $c_PayPlus = new C_PAYPLUS_CLI; 357 $c_PayPlus->mf_clear(); 358 359 360 if ( $req_tx == "mod" ) 361 { 362 $tran_cd = "00200000"; 363 364 $c_PayPlus->mf_set_modx_data( "tno" , $tno ); // KCP 원거래 거래번호 365 $c_PayPlus->mf_set_modx_data( "mod_type" , $mod_type ); // 원거래 변경 요청 종류 366 $c_PayPlus->mf_set_modx_data( "mod_ip" , $cust_ip ); // 변경 요청자 IP 367 $c_PayPlus->mf_set_modx_data( "mod_desc" , $mod_desc ); // 변경 사유 368 $c_PayPlus->mf_set_modx_data( "rem_mny" , strval($rem_mny) ); // 취소 가능 잔액 369 $c_PayPlus->mf_set_modx_data( "mod_mny" , strval($mod_mny) ); // 취소 요청 금액 370 371 if($od_tax_flag) 309 $is_refund_success = false; // 환불 성공/실패 플래그 변수 초기화 310 311 // 환불할 금액이 주문금액과 같고, 취소하면 남은잔액이 0원이면 312 if( $order->get_total() && (int) $amount === (int) $order->get_total() && (int) $order->get_remaining_refund_amount() === 0 ){ 313 314 // 전액 환불 처리합니다. 315 $is_refund_success = $this->order_kcp_refund($order->get_id(), $amount, $reason); 316 317 } else { // 부분환불 처리 318 319 include_once(GNUPAY_KCP_PATH.'kcp/settle_kcp.inc.php'); 320 321 // locale ko_KR.euc-kr 로 설정 322 setlocale(LC_CTYPE, 'ko_KR.euc-kr'); 323 324 // 부분취소 실행 325 $g_conf_site_cd = $config['de_kcp_mid']; 326 $g_conf_site_key = $config['de_kcp_site_key']; 327 $g_conf_home_dir = GNUPAY_KCP_PATH.'/kcp'; 328 $g_conf_key_dir = ''; 329 $g_conf_log_dir = ''; 330 331 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') 372 332 { 373 $mod_tax_mny = round((int)$tax_mny / 1.1); 374 $mod_vat_mny = (int)$tax_mny - $mod_tax_mny; 375 376 $c_PayPlus->mf_set_modx_data( "tax_flag" , "TG03" ); // 복합과세 구분 377 $c_PayPlus->mf_set_modx_data( "mod_tax_mny" , strval($mod_tax_mny) ); // 공급가 부분 취소 요청 금액 378 $c_PayPlus->mf_set_modx_data( "mod_vat_mny" , strval($mod_vat_mny) ); // 부과세 부분 취소 요청 금액 379 $c_PayPlus->mf_set_modx_data( "mod_free_mny" , strval($mod_free_mny) ); // 비관세 부분 취소 요청 금액 380 } 381 } 382 383 if ( $tran_cd != "" ) 384 { 385 $c_PayPlus->mf_do_tx( "", $g_conf_home_dir, $g_conf_site_cd, 386 $g_conf_site_key, $tran_cd, "", 387 $g_conf_gw_url, $g_conf_gw_port, "payplus_cli_slib", 388 isset($ordr_idxx) ? $ordr_idxx : '', $cust_ip, $g_conf_log_level, 389 "", 0, $g_conf_key_dir, 390 $g_conf_log_dir ); 391 392 $res_cd = $c_PayPlus->m_res_cd; // 결과 코드 393 $res_msg = $c_PayPlus->m_res_msg; // 결과 메시지 394 /* $res_en_msg = $c_PayPlus->mf_get_res_data( "res_en_msg" ); // 결과 영문 메세지 */ 395 } 396 else 397 { 398 $c_PayPlus->m_res_cd = "9562"; 399 $c_PayPlus->m_res_msg = __("연동 오류|Payplus Plugin이 설치되지 않았거나 tran_cd값이 설정되지 않았습니다.", GNUPAY_NAME); 400 } 401 402 if ($res_cd != '0000') 403 { 404 $res_msg = iconv("euc-kr", "utf-8", $res_msg); 405 406 return new WP_Error('kcp_refund_error', "$res_cd : $res_msg" ); 407 } 408 409 /* ============================================================================== */ 410 /* = 취소 결과 처리 = */ 411 /* = -------------------------------------------------------------------------- = */ 412 if ( $req_tx == "mod" ) 413 { 414 if ( $res_cd == "0000" ) 333 $g_conf_log_dir = sir_get_upload_path().'/log/refund'; 334 $g_conf_key_dir = GNUPAY_KCP_PATH.'kcp/bin/pub.key'; 335 } 336 337 if (preg_match("/^T000/", $g_conf_site_cd) || $config['de_card_test']) { 338 $g_conf_gw_url = "testpaygw.kcp.co.kr"; 339 } 340 else { 341 $g_conf_gw_url = "paygw.kcp.co.kr"; 342 if (!preg_match("/^SR/", $g_conf_site_cd)) { 343 return new WP_Error('kcp_refund_error', __("SR 로 시작하지 않는 KCP SITE CODE 는 지원하지 않습니다.", GNUPAY_NAME)); 344 } 345 } 346 347 include_once(GNUPAY_KCP_PATH.'kcp/pp_cli_hub_lib.php'); 348 349 $tno = get_post_meta( $order_id, '_od_tno', true ); 350 $req_tx = 'mod'; 351 $mod_desc = gp_iconv_euckr($mod_memo); 352 $cust_ip = getenv('REMOTE_ADDR'); 353 //$rem_mny = $order->get_remaining_refund_amount(); // 취소 가능 잔액 ( 이렇게 하면 안됨 ) 354 $rem_mny = $order->get_total() - $order->get_total_refunded() + (int) $amount; // 취소 가능 잔액 355 $mod_mny = (int)$tax_mny; 356 $mod_free_mny = (int)$free_mny; 357 $mod_type = 'RN07'; 358 359 if( $payment_method == $pay_ids['bank'] ) //계좌이체 360 $mod_type = 'STPA'; 361 362 if($od_tax_flag) { 363 $mod_mny = $tax_mny + $free_mny; 364 } 365 366 $c_PayPlus = new C_PAYPLUS_CLI; 367 $c_PayPlus->mf_clear(); 368 369 370 if ( $req_tx == "mod" ) 415 371 { 416 $tno = $c_PayPlus->mf_get_res_data( "tno" ); // KCP 거래 고유 번호 417 $amount = $c_PayPlus->mf_get_res_data( "amount" ); // 원 거래금액 418 $mod_mny = $c_PayPlus->mf_get_res_data( "panc_mod_mny" ); // 취소요청된 금액 419 $rem_mny = $c_PayPlus->mf_get_res_data( "panc_rem_mny" ); // 취소요청후 잔액 420 421 // 환불금액기록 422 423 $payment_gateways = gnupay_kcp_get_gateways(); 424 425 $current_user = wp_get_current_user(); 426 $order->add_order_note( sprintf(__( '%s 님이 %s, ( %s ) 이유로 가격 %s 를 취소하셨습니다.', GNUPAY_NAME ), 427 $current_user->user_login.' ( '.$current_user->ID.' ) ', 428 isset( $payment_gateways[ $payment_method ] ) ? esc_html( $payment_gateways[ $payment_method ]->get_title() ) : esc_html( $payment_method ), 429 $reason, 430 wc_price($mod_mny) 431 ) ); 432 433 // 미수금 등의 정보 업데이트 434 435 } // End of [res_cd = "0000"] 436 437 /* = -------------------------------------------------------------------------- = */ 438 /* = 취소 실패 결과 처리 = */ 439 /* = -------------------------------------------------------------------------- = */ 372 $tran_cd = "00200000"; 373 374 $c_PayPlus->mf_set_modx_data( "tno" , $tno ); // KCP 원거래 거래번호 375 $c_PayPlus->mf_set_modx_data( "mod_type" , $mod_type ); // 원거래 변경 요청 종류 376 $c_PayPlus->mf_set_modx_data( "mod_ip" , $cust_ip ); // 변경 요청자 IP 377 $c_PayPlus->mf_set_modx_data( "mod_desc" , $mod_desc ); // 변경 사유 378 $c_PayPlus->mf_set_modx_data( "rem_mny" , strval($rem_mny) ); // 취소 가능 잔액 379 $c_PayPlus->mf_set_modx_data( "mod_mny" , strval($mod_mny) ); // 취소 요청 금액 380 381 if($od_tax_flag) 382 { 383 $mod_tax_mny = round((int)$tax_mny / 1.1); 384 $mod_vat_mny = (int)$tax_mny - $mod_tax_mny; 385 386 $c_PayPlus->mf_set_modx_data( "tax_flag" , "TG03" ); // 복합과세 구분 387 $c_PayPlus->mf_set_modx_data( "mod_tax_mny" , strval($mod_tax_mny) ); // 공급가 부분 취소 요청 금액 388 $c_PayPlus->mf_set_modx_data( "mod_vat_mny" , strval($mod_vat_mny) ); // 부과세 부분 취소 요청 금액 389 $c_PayPlus->mf_set_modx_data( "mod_free_mny" , strval($mod_free_mny) ); // 비관세 부분 취소 요청 금액 390 } 391 } 392 393 if ( $tran_cd != "" ) 394 { 395 $c_PayPlus->mf_do_tx( "", $g_conf_home_dir, $g_conf_site_cd, 396 $g_conf_site_key, $tran_cd, "", 397 $g_conf_gw_url, $g_conf_gw_port, "payplus_cli_slib", 398 isset($ordr_idxx) ? $ordr_idxx : '', $cust_ip, $g_conf_log_level, 399 "", 0, $g_conf_key_dir, 400 $g_conf_log_dir ); 401 402 $res_cd = $c_PayPlus->m_res_cd; // 결과 코드 403 $res_msg = $c_PayPlus->m_res_msg; // 결과 메시지 404 /* $res_en_msg = $c_PayPlus->mf_get_res_data( "res_en_msg" ); // 결과 영문 메세지 */ 405 } 440 406 else 441 407 { 442 return new WP_Error('kcp_refund_error', __("알수 없는 이유로 환불 할수 없습니다.", GNUPAY_NAME) ); 443 } 444 } 445 446 // locale 설정 초기화 447 setlocale(LC_CTYPE, ''); 408 $c_PayPlus->m_res_cd = "9562"; 409 $c_PayPlus->m_res_msg = __("연동 오류|Payplus Plugin이 설치되지 않았거나 tran_cd값이 설정되지 않았습니다.", GNUPAY_NAME); 410 } 411 412 if ($res_cd != '0000') 413 { 414 $res_msg = iconv("euc-kr", "utf-8", $res_msg); 415 416 return new WP_Error('kcp_refund_error', "$res_cd : $res_msg" ); 417 } 418 419 /* ============================================================================== */ 420 /* = 취소 결과 처리 = */ 421 /* = -------------------------------------------------------------------------- = */ 422 if ( $req_tx == "mod" ) 423 { 424 if ( $res_cd == "0000" ) 425 { 426 $tno = $c_PayPlus->mf_get_res_data( "tno" ); // KCP 거래 고유 번호 427 $amount = $c_PayPlus->mf_get_res_data( "amount" ); // 원 거래금액 428 $mod_mny = $c_PayPlus->mf_get_res_data( "panc_mod_mny" ); // 취소요청된 금액 429 $rem_mny = $c_PayPlus->mf_get_res_data( "panc_rem_mny" ); // 취소요청후 잔액 430 431 // 환불금액기록 432 433 $payment_gateways = gnupay_kcp_get_gateways(); 434 435 $current_user = wp_get_current_user(); 436 $order->add_order_note( sprintf(__( '%s 님이 %s, ( %s ) 이유로 가격 %s 를 취소하셨습니다.', GNUPAY_NAME ), 437 $current_user->user_login.' ( '.$current_user->ID.' ) ', 438 isset( $payment_gateways[ $payment_method ] ) ? esc_html( $payment_gateways[ $payment_method ]->get_title() ) : esc_html( $payment_method ), 439 $reason, 440 wc_price($mod_mny) 441 ) ); 442 443 $is_refund_success = true; // 부분환불 성공시 444 445 // 미수금 등의 정보 업데이트 446 447 } // End of [res_cd = "0000"] 448 449 /* = -------------------------------------------------------------------------- = */ 450 /* = 취소 실패 결과 처리 = */ 451 /* = -------------------------------------------------------------------------- = */ 452 else 453 { 454 return new WP_Error('kcp_refund_error', __("알수 없는 이유로 환불 할수 없습니다.", GNUPAY_NAME) ); 455 } 456 } 457 458 // locale 설정 초기화 459 setlocale(LC_CTYPE, ''); 460 461 } //end if 462 463 if ( is_wp_error( $is_refund_success ) ) { 464 return $is_refund_success; 465 } 466 467 if( !$is_refund_success ){ 468 return new WP_Error('kcp_refund_error', __( '환불에 실패하였습니다.', GNUPAY_INICIS ) ); 469 } 470 448 471 return true; 449 472 … … 529 552 } 530 553 554 $is_position = is_admin() ? __('쇼핑몰 운영자 페이지') : __('사용자 페이지'); 555 531 556 $current_user = wp_get_current_user(); 532 557 $order->add_order_note( sprintf(__( '%s 님의 요청으로 인해 %s 이 환불되었습니다.', GNUPAY_NAME ), 533 $ current_user->user_login.' ( '.$current_user->ID.' ) ',558 $is_position.' '.$current_user->user_login.' ( '.$current_user->ID.' ) ', 534 559 wc_price($amount) 535 560 ) ); … … 554 579 555 580 public function kcp_pay_check(){ 556 581 557 582 //체크아웃일때만 작동 558 583 if( !is_checkout() ) … … 560 585 561 586 //요청이 있을때 동작합니다. 562 if( isset($_REQUEST['checkout_nonce']) && wp_verify_nonce( $_REQUEST['checkout_nonce'], 'kcp_form_nonce' ) ){ 563 587 if( isset($_REQUEST['checkout_nonce']) && gp_ft_nonce_is_valid( $_REQUEST['checkout_nonce'], 'kcp_form_nonce' ) ){ 564 588 565 589 $pay_ids = gnupay_kcp_get_settings('pay_ids'); … … 1139 1163 $res = wp_parse_args(array( 1140 1164 'result' => 'success', 1141 'order_id' => $order-> id,1142 'order_key' => $order-> order_key,1165 'order_id' => $order->get_order_number(), 1166 'order_key' => $order->get_order_key(), 1143 1167 'redirect' => $this->get_return_url( $order ) 1144 1168 ), gnupay_kcp_process_payment($order, $this->config)); -
gnupay-kcp/trunk/classes/kcp_pay_gateway.class.php
r1403518 r1875347 63 63 return array( 64 64 'result' => 'success', 65 'order_id' => $order-> id,65 'order_id' => $order->get_order_number(), 66 66 'order_key' => $order->order_key, 67 67 'redirect' => $this->get_return_url( $order ) -
gnupay-kcp/trunk/classes/kcp_user_cancel.class.php
r1439770 r1875347 35 35 $payment_gateways = $this->get_gateways(); 36 36 37 $payment_method = get_post_meta( $order-> id, '_payment_method', true );37 $payment_method = get_post_meta( $order->get_order_number(), '_payment_method', true ); 38 38 39 39 $file_path = plugin_dir_path( __FILE__ ).'classes/kcp_card_gateway.class.php'; … … 88 88 $payment_gateways = $this->get_gateways(); 89 89 90 $payment_method = get_post_meta( $order-> id, '_payment_method', true );90 $payment_method = get_post_meta( $order->get_order_number(), '_payment_method', true ); 91 91 92 92 if( !in_array($payment_method, gnupay_kcp_get_settings('pay_ids')) ){ -
gnupay-kcp/trunk/classes/kcp_user_order_details.class.php
r1403518 r1875347 13 13 public function order_table($order){ 14 14 15 $order_id = $order-> id;15 $order_id = $order->get_order_number(); 16 16 17 17 if( ! gp_kcp_order_can_view($order_id) ){ //볼수 있는 권한이 없으면 -
gnupay-kcp/trunk/classes/kcp_virtualaccount.class.php
r1568404 r1875347 213 213 $order_tno = get_post_meta( $order_id, '_od_tno', true ); 214 214 $pay_options = get_option( $this->plugin_id . $this->id . '_settings' ); 215 if( ! isset($order->id) || empty($order->id) ){215 if( ! $order->get_order_number() ){ 216 216 return; 217 217 } … … 298 298 299 299 if( $result ){ 300 $options = apply_filters( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->sett tings );300 $options = apply_filters( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->settings ); 301 301 302 302 $kcp_options = get_option( $this->plugin_id . $this->gnupay_kcp_card . '_settings' ); -
gnupay-kcp/trunk/config.php
r1830610 r1875347 4 4 Class GNUPAY_KCP_WOO_CONSTANTS { 5 5 public function __construct() { 6 define( 'GNUPAY_VERSION', '1. 2.3' );6 define( 'GNUPAY_VERSION', '1.3.0' ); 7 7 define( 'GNUPAY_NAME', 'gnupay-kcp' ); 8 8 define( 'GNUPAY_KCP_ORDER_TMP', '_order_tmp_kcp' ); -
gnupay-kcp/trunk/gnupay-kcp.php
r1830610 r1875347 6 6 * Author: SIR Soft 7 7 * Author URI: http://sir.kr 8 * Version: 1. 2.39 * Tested up to: 4. 58 * Version: 1.3.0 9 * Tested up to: 4.9.5 10 10 * Text Domain: gnupay-kcp 11 11 */ -
gnupay-kcp/trunk/js/kcp_pay.js
r1439770 r1875347 207 207 }, 208 208 kcp_pay_submit: function(f, json){ 209 210 209 // 금액체크 211 210 -
gnupay-kcp/trunk/kcp/m_order_approval_form.php
r1568404 r1875347 7 7 //$return_url = add_query_arg( array('kcppay'=>'return'), $checkout_url); 8 8 9 $return_url = wp_nonce_url(add_query_arg( array('kcppay'=>'return'), $checkout_url), 'kcp_form_nonce', 'checkout_nonce');9 $return_url = add_query_arg( array('kcppay'=>'return', 'checkout_nonce'=>gp_ft_nonce_create('kcp_form_nonce')), $checkout_url); 10 10 11 11 /* ============================================================================== */ … … 235 235 236 236 echo gc_make_order_field($data, $exclude); 237 wp_nonce_field( 'kcp_form_nonce', 'checkout_nonce' );237 echo '<input type="hidden" name="checkout_nonce" value="'.gp_ft_nonce_create('kcp_form_nonce').'">'.PHP_EOL; 238 238 foreach($_POST as $key=>$value) { 239 239 echo '<input type="hidden" name="'.$key.'" value="'.$value.'">'.PHP_EOL; … … 245 245 246 246 <form name="gnupay_kcp_form" method="POST" accept-charset="euc-kr"> 247 < ?php wp_nonce_field( 'kcp_form_nonce', 'checkout_nonce' ); ?>247 <input type="hidden" name="checkout_nonce" value="<?php echo gp_ft_nonce_create('kcp_form_nonce');?>"> 248 248 <input type="hidden" name="good_name" value="<?php echo sanitize_title(esc_attr($good_name)); ?>"> 249 249 <input type="hidden" name="good_mny" value="<?php echo esc_attr($good_mny); ?>" > -
gnupay-kcp/trunk/kcp/m_orderform.2.php
r1403518 r1875347 18 18 <div style="display:none"> 19 19 <form name="gnupay_kcp_form" id="gnupay_kcp_form" method="POST"> 20 < ?php wp_nonce_field( 'kcp_form_nonce', 'checkout_nonce' ); ?>20 <input type="hidden" name="checkout_nonce" value="<?php echo gp_ft_nonce_create('kcp_form_nonce');?>"> 21 21 <input type="hidden" name="kcppay" value="return"> 22 22 <input type="hidden" name="good_name" value="<?php echo $goods; ?>"> -
gnupay-kcp/trunk/kcp/orderform.2.php
r1403518 r1875347 20 20 <div style="display:none"> 21 21 <form name="gnupay_kcp_form" id="gnupay_kcp_form" method="POST" accept-charset="UTF-8"> 22 < ?php wp_nonce_field( 'kcp_form_nonce', 'checkout_nonce' ); ?>22 <input type="hidden" name="checkout_nonce" value="<?php echo gp_ft_nonce_create('kcp_form_nonce');?>"> 23 23 <?php 24 24 /* ============================================================================== */ -
gnupay-kcp/trunk/kcp/pp_ax_hub_lib.php
r1403518 r1875347 285 285 $exec_cmd = array_shift( $arg ); 286 286 287 while ( list(,$i) = each($arg) ) 288 { 289 $exec_cmd .= " " . escapeshellarg( $i ); 287 foreach( $arg as $i ){ 288 $exec_cmd .= " " . escapeshellarg( $i ); 290 289 } 291 290 -
gnupay-kcp/trunk/lib/functions.php
r1568404 r1875347 1 1 <?php 2 2 if( ! defined( 'GNUPAY_NAME' ) ) exit; // 개별 페이지 접근 불가 3 4 if(!function_exists('gp_ft_get_secret_key')){ 5 function gp_ft_get_secret_key($secret){ 6 return md5(NONCE_SALT.DB_PASSWORD.session_id().$secret); 7 } 8 } 9 10 // This method creates an nonce. It should be called by one of the previous two functions. 11 if(!function_exists('gp_ft_nonce_create')){ 12 function gp_ft_nonce_create( $action = '',$user='', $timeoutSeconds=3600 ){ 13 14 $secret = gp_ft_get_secret_key($action.$user); 15 16 $salt = gp_ft_nonce_generate_hash(); 17 $time = time(); 18 $maxTime = $time + $timeoutSeconds; 19 $nonce = $salt . "|" . $maxTime . "|" . sha1( $salt . $secret . $maxTime ); 20 return $nonce; 21 22 } 23 } 24 25 // This method validates an nonce 26 if(!function_exists('gp_ft_nonce_is_valid')){ 27 function gp_ft_nonce_is_valid( $nonce, $action = '', $user='' ){ 28 29 $secret = gp_ft_get_secret_key($action.$user); 30 31 if (is_string($nonce) == false) { 32 return false; 33 } 34 $a = explode('|', $nonce); 35 if (count($a) != 3) { 36 return false; 37 } 38 $salt = $a[0]; 39 $maxTime = intval($a[1]); 40 $hash = $a[2]; 41 $back = sha1( $salt . $secret . $maxTime ); 42 if ($back != $hash) { 43 return false; 44 } 45 if (time() > $maxTime) { 46 return false; 47 } 48 return true; 49 } 50 } 51 52 // This method generates the nonce timestamp 53 if(!function_exists('ft_nonce_generate_hash')){ 54 function gp_ft_nonce_generate_hash(){ 55 $length = 10; 56 $chars='1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'; 57 $ll = strlen($chars)-1; 58 $o = ''; 59 while (strlen($o) < $length) { 60 $o .= $chars[ rand(0, $ll) ]; 61 } 62 return $o; 63 } 64 } 3 65 4 66 if( ! function_exists('gp_get_stype_names') ){ … … 261 323 function gnupay_kcp_process_payment($order, $config){ 262 324 263 $res = array(); 264 $crr = array( 265 'order_key', 266 'payment_method', 267 'payment_method_title', 268 'billing_last_name', 269 'billing_first_name', 270 'billing_company', 271 'billing_address_1', 272 'billing_address_2', 273 'billing_city', 274 'billing_state', 275 'billing_postcode', 276 'billing_country', 277 'billing_email', 278 'billing_phone', 279 'shipping_last_name', 280 'shipping_first_name', 281 'shipping_company', 282 'shipping_address_1', 283 'shipping_address_2', 284 'shipping_city', 285 'shipping_state', 286 'shipping_postcode', 287 'shipping_country', 288 'shipping_email', 289 'shipping_phone', 325 $res = array( 326 'order_key' => $order->get_order_key(), 327 'payment_method' => $order->get_payment_method(), 328 'payment_method_title' => $order->get_payment_method_title(), 329 'billing_last_name' => $order->get_billing_last_name(), 330 'billing_first_name' => $order->get_billing_first_name(), 331 'billing_company' => $order->get_billing_company(), 332 'billing_address_1' => $order->get_billing_address_1(), 333 'billing_address_2' => $order->get_billing_address_2(), 334 'billing_city' => $order->get_billing_city(), 335 'billing_state' => $order->get_billing_state(), 336 'billing_postcode' => $order->get_billing_postcode(), 337 'billing_country' => $order->get_billing_country(), 338 'billing_email' => $order->get_billing_email(), 339 'billing_phone' => $order->get_billing_phone(), 340 'shipping_last_name' => $order->get_shipping_last_name(), 341 'shipping_first_name' => $order->get_shipping_first_name(), 342 'shipping_company' => $order->get_shipping_company(), 343 'shipping_address_1' => $order->get_shipping_address_1(), 344 'shipping_address_2' => $order->get_shipping_address_2(), 345 'shipping_city' => $order->get_shipping_city(), 346 'shipping_state' => $order->get_shipping_state(), 347 'shipping_postcode' => $order->get_shipping_postcode(), 348 'shipping_country' => $order->get_shipping_country(), 349 'shipping_email' => '', 350 'shipping_phone' => '', 290 351 ); 291 292 foreach($crr as $v){293 $res[$v] = isset($order->$v) ? $order->$v : '';294 }295 352 296 $res['order_id'] = $order-> id;353 $res['order_id'] = $order->get_order_number(); 297 354 298 355 $goods = ''; -
gnupay-kcp/trunk/readme.txt
r1830610 r1875347 5 5 Tags: woocommerce, payment, kcp, nhn-kcp, nhnkcp, sirsoft, card, bank, korea, korean, kagla 6 6 Requires at least: 4.0 7 Tested up to: 4. 58 Stable tag: 1. 2.37 Tested up to: 4.9.5 8 Stable tag: 1.3.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.