벌써 payment 작업만 20번이 넘어 가네요.
조금씩 수정 하며 공용으로 사용 할 수 있는 플러그인화 작업도 진화 되고 있습니다.
참고 하시라고 소스를 첨부 합니다.
payment.class.php
[code]
<?php
class TBpayment {
# 기본환경 설정
public function set($Payment, $code='', $key='', $mode='real') {
global $config;
/*
$code: payment에서 발급되는 아이디 혹은 코드
$key: payment에서 발급되는 키
*/
# 필수값 확인
if($mode == 'real')
if(!$Payment || !$code || !$key) die('환경설정 부에 누락 된 값이 있습니다.');
# 경로 설정 (경로를 잡으면서 윈도우 \를 변환)
$RootDir = str_replace(chr(92), '/', $_SERVER['DOCUMENT_ROOT']);
$ModulePath = str_replace(chr(92), '/', dirname(__FILE__));
# 모듈 경로의 URL을 생성
$http = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='off')?'https://':'http://';
$ModuleDir = str_replace($RootDir, '', $ModulePath);
$ModuleDir = rtrim($ModuleDir, '/');
$ModuleUrl = $http.$_SERVER['HTTP_HOST'].$ModuleDir;
# 정보를 배열에 담는다.
$this->config['module_path'] = $ModulePath;
$this->config['module_url'] = $ModuleUrl;
$this->config['payment'] = $Payment;
$this->config['mode'] = $mode;
$this->config['path'] = $ModulePath.'/'.$Payment;
$this->config['url'] = $ModuleUrl.'/'.$Payment;
$this->config['code'] = $code;
$this->config['key'] = $key;
if(file_exists($this->config['path'].'/config.php'))
include_once($this->config['path'].'/config.php');
else die('payment config file not exists!!');
}
# 환경설정 확인
public function config() {
return $this->config;
}
}
[/code]
./module/payment/kcp/config.php
[code]
<?php
# BIN 절대 경로 입력 (bin전까지 설정
$GLOBALS['g_conf_home_dir'] = $this->config['path'].'/';
# log 경로 지정
$GLOBALS['g_conf_log_path'] = $GLOBALS['g_conf_home_dir'].'log';
# g_conf_gw_url 설정
if($mode == 'test') $GLOBALS['g_conf_gw_url'] = 'testpaygw.kcp.co.kr';
else $GLOBALS['g_conf_gw_url'] = 'paygw.kcp.co.kr';
# g_conf_js_url 설정
if($mode == 'test') {
if((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='off')) {
$GLOBALS['g_conf_js_url'] = 'https://pay.kcp.co.kr/plugin/payplus_test_un.js';
}
else {
$GLOBALS['g_conf_js_url'] = 'http://pay.kcp.co.kr/plugin/payplus_test_un.js';
}
}
else {
if((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='off')) {
$GLOBALS['g_conf_js_url'] = 'https://pay.kcp.co.kr/plugin/payplus_un.js';
}
else {
$GLOBALS['g_conf_js_url'] = 'http://pay.kcp.co.kr/plugin/payplus_un.js';
}
}
#스마트폰 SOAP 통신 설정
if($mode == 'test') $GLOBALS['g_wsdl'] = "KCPPaymentService.wsdl";
else $GLOBALS['g_wsdl'] = "real_KCPPaymentService.wsdl";
# g_conf_site_cd, g_conf_site_key 설정
if($mode == 'test') {
$GLOBALS['g_conf_site_cd'] = "T0000"; // T0007 은 결제 테스트 안됨
$GLOBALS['g_conf_site_key'] = "3grptw1.zW0GSo4PQdaGvsF__"; // 4Ho4YsuOZlLXUZUdOxM1Q7X__ 은 결제 테스트 안됨
}
else {
$GLOBALS['g_conf_site_cd'] = $this->config['code'];
$GLOBALS['g_conf_site_key'] = $this->config['key'];
}
# g_conf_site_name 설정
if($mode == 'test') $GLOBALS['g_conf_site_name'] = $config['cf_title']." Test";
else $GLOBALS['g_conf_site_name'] = $config['cf_title'];
# 지불 데이터 셋업 (변경 불가)
$GLOBALS['g_conf_log_level'] = "3";
$GLOBALS['g_conf_gw_port'] = "8090"; // 포트번호(변경불가)
$GLOBALS['module_type'] = "01"; // 변경불가
[/code]
호출과 사용
[code]
include_once(realpath(__DIR__).'/payment.class.php');
$PayMode = 'test'; // real or test
$tbPay = new TBpayment;
$tbPay->set('kcp', '아이디 또는 코드값', '키값', $PayMode);
$PayConfig = $tbPay->config();
[/code]
댓글 5개
방법을 제시 하는 글입니다 ㅎㅎㅎ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8130 | 9년 전 | 505 | ||
| 8129 |
|
9년 전 | 651 | |
| 8128 | 9년 전 | 518 | ||
| 8127 |
|
9년 전 | 574 | |
| 8126 | 9년 전 | 505 | ||
| 8125 | 9년 전 | 765 | ||
| 8124 |
|
9년 전 | 513 | |
| 8123 | 9년 전 | 499 | ||
| 8122 | 9년 전 | 431 | ||
| 8121 | 9년 전 | 536 | ||
| 8120 | 9년 전 | 462 | ||
| 8119 | 9년 전 | 546 | ||
| 8118 |
|
9년 전 | 628 | |
| 8117 |
|
9년 전 | 397 | |
| 8116 |
PASKRAN
|
9년 전 | 466 | |
| 8115 | 9년 전 | 456 | ||
| 8114 |
kiplayer
|
9년 전 | 596 | |
| 8113 | 9년 전 | 439 | ||
| 8112 |
|
9년 전 | 557 | |
| 8111 | 9년 전 | 406 | ||
| 8110 | 9년 전 | 441 | ||
| 8109 | 9년 전 | 362 | ||
| 8108 |
|
9년 전 | 538 | |
| 8107 |
|
9년 전 | 436 | |
| 8106 |
|
9년 전 | 432 | |
| 8105 | 9년 전 | 474 | ||
| 8104 |
|
9년 전 | 428 | |
| 8103 |
|
9년 전 | 427 | |
| 8102 |
|
9년 전 | 391 | |
| 8101 |
snshero
|
9년 전 | 780 | |
| 8100 | 9년 전 | 835 | ||
| 8099 | 9년 전 | 807 | ||
| 8098 | 9년 전 | 711 | ||
| 8097 | 9년 전 | 513 | ||
| 8096 | 9년 전 | 711 | ||
| 8095 | 9년 전 | 840 | ||
| 8094 | 9년 전 | 511 | ||
| 8093 | 9년 전 | 793 | ||
| 8092 | 9년 전 | 755 | ||
| 8091 | 9년 전 | 1139 | ||
| 8090 | 9년 전 | 764 | ||
| 8089 | 9년 전 | 970 | ||
| 8088 | 9년 전 | 639 | ||
| 8087 | 9년 전 | 757 | ||
| 8086 | 9년 전 | 516 | ||
| 8085 | 9년 전 | 485 | ||
| 8084 | 9년 전 | 607 | ||
| 8083 | 9년 전 | 581 | ||
| 8082 | 9년 전 | 752 | ||
| 8081 | 9년 전 | 468 | ||
| 8080 | 9년 전 | 565 | ||
| 8079 | 9년 전 | 516 | ||
| 8078 | 9년 전 | 447 | ||
| 8077 | 9년 전 | 527 | ||
| 8076 | 9년 전 | 406 | ||
| 8075 | 9년 전 | 435 | ||
| 8074 | 9년 전 | 394 | ||
| 8073 | 9년 전 | 447 | ||
| 8072 | 9년 전 | 441 | ||
| 8071 |
o1o111
|
9년 전 | 891 | |
| 8070 | 9년 전 | 399 | ||
| 8069 | 9년 전 | 334 | ||
| 8068 | 9년 전 | 582 | ||
| 8067 | 9년 전 | 388 | ||
| 8066 | 9년 전 | 423 | ||
| 8065 | 9년 전 | 378 | ||
| 8064 | 9년 전 | 361 | ||
| 8063 | 9년 전 | 335 | ||
| 8062 | 9년 전 | 305 | ||
| 8061 | 9년 전 | 349 | ||
| 8060 | 9년 전 | 386 | ||
| 8059 | 9년 전 | 319 | ||
| 8058 | 9년 전 | 254 | ||
| 8057 | 9년 전 | 382 | ||
| 8056 | 9년 전 | 304 | ||
| 8055 | 9년 전 | 339 | ||
| 8054 | 9년 전 | 361 | ||
| 8053 | 9년 전 | 413 | ||
| 8052 | 9년 전 | 291 | ||
| 8051 | 9년 전 | 327 | ||
| 8050 | 9년 전 | 388 | ||
| 8049 | 9년 전 | 318 | ||
| 8048 | 9년 전 | 432 | ||
| 8047 | 9년 전 | 353 | ||
| 8046 | 9년 전 | 298 | ||
| 8045 | 9년 전 | 255 | ||
| 8044 | 9년 전 | 344 | ||
| 8043 | 9년 전 | 288 | ||
| 8042 | 9년 전 | 292 | ||
| 8041 | 9년 전 | 343 | ||
| 8040 | 9년 전 | 269 | ||
| 8039 | 9년 전 | 317 | ||
| 8038 | 9년 전 | 267 | ||
| 8037 | 9년 전 | 400 | ||
| 8036 | 9년 전 | 481 | ||
| 8035 | 9년 전 | 424 | ||
| 8034 | 9년 전 | 384 | ||
| 8033 | 9년 전 | 348 | ||
| 8032 | 9년 전 | 431 | ||
| 8031 | 9년 전 | 345 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기