벌써 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개
방법을 제시 하는 글입니다 ㅎㅎㅎ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6330 |
|
12년 전 | 1801 | |
| 6329 |
내가짱니네가짱
|
12년 전 | 1226 | |
| 6328 |
AMDbest
|
12년 전 | 492 | |
| 6327 | 12년 전 | 1703 | ||
| 6326 | 12년 전 | 1335 | ||
| 6325 | 12년 전 | 7623 | ||
| 6324 |
AMDbest
|
12년 전 | 2205 | |
| 6323 |
|
12년 전 | 1977 | |
| 6322 | 12년 전 | 2036 | ||
| 6321 | 12년 전 | 2485 | ||
| 6320 |
senseme
|
12년 전 | 591 | |
| 6319 | 12년 전 | 3735 | ||
| 6318 | 12년 전 | 1382 | ||
| 6317 |
kiplayer
|
12년 전 | 6418 | |
| 6316 | 12년 전 | 1016 | ||
| 6315 | 12년 전 | 975 | ||
| 6314 |
상엽나르도
|
12년 전 | 1286 | |
| 6313 |
검은고양이1983
|
12년 전 | 654 | |
| 6312 | 12년 전 | 3115 | ||
| 6311 | 12년 전 | 1414 | ||
| 6310 |
testers
|
12년 전 | 1482 | |
| 6309 | 12년 전 | 988 | ||
| 6308 | 12년 전 | 2602 | ||
| 6307 | 12년 전 | 1655 | ||
| 6306 | 12년 전 | 438 | ||
| 6305 | 12년 전 | 3500 | ||
| 6304 | 12년 전 | 998 | ||
| 6303 | 12년 전 | 823 | ||
| 6302 | 12년 전 | 1190 | ||
| 6301 | 12년 전 | 5568 | ||
| 6300 |
|
12년 전 | 1197 | |
| 6299 |
AMDbest
|
12년 전 | 2805 | |
| 6298 |
AMDbest
|
12년 전 | 2250 | |
| 6297 |
프리랜서개발자
|
12년 전 | 476 | |
| 6296 | 12년 전 | 2931 | ||
| 6295 |
SUPERMANs
|
12년 전 | 1385 | |
| 6294 | 12년 전 | 1293 | ||
| 6293 | 12년 전 | 1345 | ||
| 6292 |
오늘도망했다
|
12년 전 | 3268 | |
| 6291 |
senseme
|
12년 전 | 2030 | |
| 6290 |
senseme
|
12년 전 | 3688 | |
| 6289 |
senseme
|
12년 전 | 8580 | |
| 6288 |
senseme
|
12년 전 | 4173 | |
| 6287 |
senseme
|
12년 전 | 3745 | |
| 6286 |
senseme
|
12년 전 | 1365 | |
| 6285 |
senseme
|
12년 전 | 1437 | |
| 6284 |
프로프리랜서
|
12년 전 | 3160 | |
| 6283 |
프로프리랜서
|
12년 전 | 3990 | |
| 6282 |
프로프리랜서
|
12년 전 | 4395 | |
| 6281 |
프로프리랜서
|
12년 전 | 1604 | |
| 6280 | 12년 전 | 1289 | ||
| 6279 |
AMDbest
|
12년 전 | 879 | |
| 6278 | 12년 전 | 981 | ||
| 6277 |
senseme
|
12년 전 | 2717 | |
| 6276 |
senseme
|
12년 전 | 2735 | |
| 6275 |
senseme
|
12년 전 | 1261 | |
| 6274 |
|
12년 전 | 2806 | |
| 6273 | 12년 전 | 1279 | ||
| 6272 | 12년 전 | 8461 | ||
| 6271 |
senseme
|
12년 전 | 1512 | |
| 6270 |
senseme
|
12년 전 | 3772 | |
| 6269 |
senseme
|
12년 전 | 6380 | |
| 6268 |
senseme
|
12년 전 | 1565 | |
| 6267 | 12년 전 | 2843 | ||
| 6266 | 12년 전 | 579 | ||
| 6265 | 12년 전 | 1302 | ||
| 6264 | 12년 전 | 1157 | ||
| 6263 |
senseme
|
12년 전 | 1317 | |
| 6262 |
senseme
|
12년 전 | 3312 | |
| 6261 |
senseme
|
12년 전 | 1089 | |
| 6260 |
senseme
|
12년 전 | 1830 | |
| 6259 |
senseme
|
12년 전 | 1260 | |
| 6258 |
senseme
|
12년 전 | 919 | |
| 6257 | 12년 전 | 1407 | ||
| 6256 | 12년 전 | 2100 | ||
| 6255 |
senseme
|
12년 전 | 1381 | |
| 6254 |
senseme
|
12년 전 | 1266 | |
| 6253 |
senseme
|
12년 전 | 1788 | |
| 6252 |
kiplayer
|
12년 전 | 14778 | |
| 6251 | 12년 전 | 1073 | ||
| 6250 | 12년 전 | 870 | ||
| 6249 | 12년 전 | 2728 | ||
| 6248 |
senseme
|
12년 전 | 8965 | |
| 6247 | 12년 전 | 1290 | ||
| 6246 |
프로프리랜서
|
12년 전 | 1170 | |
| 6245 |
프로프리랜서
|
12년 전 | 1628 | |
| 6244 |
프로프리랜서
|
12년 전 | 1130 | |
| 6243 |
프로프리랜서
|
12년 전 | 1260 | |
| 6242 |
프로프리랜서
|
12년 전 | 3550 | |
| 6241 |
프로프리랜서
|
12년 전 | 1456 | |
| 6240 |
프로프리랜서
|
12년 전 | 2124 | |
| 6239 |
softhead
|
12년 전 | 1141 | |
| 6238 |
senseme
|
12년 전 | 1310 | |
| 6237 |
senseme
|
12년 전 | 3028 | |
| 6236 | 12년 전 | 875 | ||
| 6235 | 12년 전 | 1343 | ||
| 6234 | 12년 전 | 1605 | ||
| 6233 | 12년 전 | 2033 | ||
| 6232 | 12년 전 | 2139 | ||
| 6231 | 12년 전 | 2566 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기