벌써 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개
방법을 제시 하는 글입니다 ㅎㅎㅎ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 230 | 20년 전 | 2066 | ||
| 229 | 20년 전 | 3141 | ||
| 228 | 20년 전 | 3325 | ||
| 227 | 20년 전 | 2398 | ||
| 226 | 20년 전 | 5480 | ||
| 225 | 20년 전 | 2525 | ||
| 224 | 20년 전 | 2970 | ||
| 223 | 20년 전 | 4207 | ||
| 222 | 20년 전 | 2606 | ||
| 221 | 20년 전 | 2290 | ||
| 220 | 20년 전 | 3680 | ||
| 219 | 20년 전 | 2077 | ||
| 218 | 20년 전 | 3566 | ||
| 217 | 20년 전 | 2483 | ||
| 216 | 20년 전 | 2914 | ||
| 215 | 20년 전 | 2227 | ||
| 214 | 20년 전 | 3338 | ||
| 213 | 20년 전 | 2919 | ||
| 212 | 20년 전 | 3053 | ||
| 211 | 20년 전 | 2149 | ||
| 210 | 20년 전 | 1897 | ||
| 209 | 20년 전 | 2358 | ||
| 208 | 20년 전 | 1982 | ||
| 207 | 20년 전 | 1677 | ||
| 206 | 20년 전 | 1856 | ||
| 205 | 20년 전 | 3952 | ||
| 204 | 20년 전 | 1678 | ||
| 203 | 20년 전 | 2011 | ||
| 202 | 20년 전 | 2360 | ||
| 201 | 20년 전 | 1828 | ||
| 200 | 20년 전 | 2957 | ||
| 199 | 20년 전 | 2005 | ||
| 198 | 20년 전 | 2088 | ||
| 197 | 20년 전 | 3655 | ||
| 196 | 20년 전 | 2986 | ||
| 195 | 20년 전 | 2095 | ||
| 194 | 20년 전 | 10251 | ||
| 193 | 20년 전 | 2248 | ||
| 192 | 20년 전 | 1607 | ||
| 191 | 20년 전 | 2669 | ||
| 190 | 20년 전 | 2294 | ||
| 189 | 20년 전 | 1686 | ||
| 188 | 20년 전 | 1483 | ||
| 187 | 20년 전 | 1908 | ||
| 186 | 20년 전 | 1726 | ||
| 185 | 20년 전 | 1770 | ||
| 184 | 20년 전 | 2356 | ||
| 183 | 20년 전 | 1562 | ||
| 182 | 20년 전 | 1487 | ||
| 181 | 20년 전 | 1626 | ||
| 180 | 20년 전 | 2723 | ||
| 179 | 20년 전 | 1808 | ||
| 178 | 20년 전 | 1862 | ||
| 177 | 20년 전 | 1987 | ||
| 176 | 20년 전 | 1808 | ||
| 175 | 20년 전 | 1872 | ||
| 174 | 20년 전 | 1694 | ||
| 173 | 20년 전 | 2061 | ||
| 172 | 20년 전 | 1787 | ||
| 171 | 20년 전 | 2566 | ||
| 170 | 20년 전 | 2274 | ||
| 169 | 20년 전 | 2555 | ||
| 168 | 20년 전 | 1488 | ||
| 167 | 20년 전 | 1578 | ||
| 166 | 20년 전 | 2160 | ||
| 165 | 20년 전 | 1631 | ||
| 164 | 20년 전 | 3772 | ||
| 163 | 20년 전 | 2668 | ||
| 162 | 20년 전 | 2086 | ||
| 161 | 20년 전 | 2795 | ||
| 160 | 20년 전 | 1735 | ||
| 159 | 20년 전 | 1617 | ||
| 158 | 20년 전 | 2568 | ||
| 157 | 20년 전 | 1489 | ||
| 156 | 20년 전 | 1744 | ||
| 155 | 20년 전 | 3231 | ||
| 154 | 20년 전 | 1902 | ||
| 153 | 20년 전 | 1625 | ||
| 152 | 20년 전 | 4954 | ||
| 151 | 20년 전 | 4579 | ||
| 150 | 20년 전 | 3516 | ||
| 149 | 20년 전 | 3802 | ||
| 148 | 20년 전 | 7079 | ||
| 147 | 20년 전 | 3552 | ||
| 146 | 20년 전 | 2626 | ||
| 145 | 20년 전 | 2623 | ||
| 144 | 20년 전 | 7169 | ||
| 143 | 20년 전 | 4602 | ||
| 142 | 20년 전 | 1900 | ||
| 141 | 20년 전 | 3253 | ||
| 140 | 20년 전 | 1963 | ||
| 139 | 20년 전 | 1586 | ||
| 138 | 20년 전 | 2309 | ||
| 137 | 20년 전 | 1782 | ||
| 136 | 20년 전 | 1457 | ||
| 135 | 20년 전 | 1786 | ||
| 134 | 20년 전 | 2969 | ||
| 133 | 20년 전 | 2452 | ||
| 132 | 20년 전 | 1707 | ||
| 131 | 20년 전 | 1643 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기