벌써 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개
방법을 제시 하는 글입니다 ㅎㅎㅎ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 430 | 19년 전 | 4114 | ||
| 429 | 19년 전 | 3310 | ||
| 428 | 19년 전 | 4134 | ||
| 427 | 19년 전 | 3481 | ||
| 426 | 19년 전 | 3108 | ||
| 425 | 19년 전 | 3412 | ||
| 424 | 19년 전 | 2441 | ||
| 423 | 19년 전 | 2869 | ||
| 422 | 19년 전 | 2356 | ||
| 421 | 19년 전 | 3710 | ||
| 420 | 19년 전 | 4744 | ||
| 419 | 19년 전 | 3807 | ||
| 418 |
|
19년 전 | 1753 | |
| 417 | 19년 전 | 2754 | ||
| 416 | 19년 전 | 2395 | ||
| 415 | 19년 전 | 2610 | ||
| 414 | 19년 전 | 4417 | ||
| 413 |
|
19년 전 | 2607 | |
| 412 | 19년 전 | 3053 | ||
| 411 |
|
19년 전 | 2997 | |
| 410 |
|
19년 전 | 3693 | |
| 409 |
|
19년 전 | 3643 | |
| 408 |
|
19년 전 | 1861 | |
| 407 | 19년 전 | 2237 | ||
| 406 | 19년 전 | 2789 | ||
| 405 | 19년 전 | 2458 | ||
| 404 | 19년 전 | 4313 | ||
| 403 | 19년 전 | 3306 | ||
| 402 |
NeoGenesis
|
19년 전 | 4097 | |
| 401 | 19년 전 | 2611 | ||
| 400 |
|
19년 전 | 2504 | |
| 399 | 19년 전 | 2962 | ||
| 398 | 19년 전 | 2490 | ||
| 397 | 19년 전 | 2788 | ||
| 396 | 19년 전 | 2490 | ||
| 395 | 19년 전 | 3193 | ||
| 394 | 19년 전 | 1733 | ||
| 393 | 19년 전 | 2997 | ||
| 392 | 19년 전 | 2269 | ||
| 391 | 19년 전 | 2182 | ||
| 390 | 19년 전 | 2291 | ||
| 389 | 19년 전 | 2648 | ||
| 388 | 19년 전 | 2190 | ||
| 387 | 19년 전 | 4488 | ||
| 386 |
|
19년 전 | 2695 | |
| 385 |
|
19년 전 | 2494 | |
| 384 | 19년 전 | 3031 | ||
| 383 | 19년 전 | 3062 | ||
| 382 | 19년 전 | 3114 | ||
| 381 |
|
19년 전 | 2639 | |
| 380 |
|
19년 전 | 3027 | |
| 379 | 19년 전 | 2551 | ||
| 378 | 19년 전 | 2214 | ||
| 377 | 19년 전 | 2784 | ||
| 376 | 19년 전 | 2473 | ||
| 375 |
|
19년 전 | 2567 | |
| 374 | 19년 전 | 3823 | ||
| 373 | 19년 전 | 3277 | ||
| 372 | 19년 전 | 4997 | ||
| 371 |
세은아빠2
|
19년 전 | 2420 | |
| 370 | 19년 전 | 4504 | ||
| 369 | 19년 전 | 3109 | ||
| 368 | 19년 전 | 2910 | ||
| 367 | 19년 전 | 3734 | ||
| 366 | 19년 전 | 2661 | ||
| 365 | 19년 전 | 3750 | ||
| 364 | 19년 전 | 4023 | ||
| 363 | 19년 전 | 3451 | ||
| 362 | 19년 전 | 3489 | ||
| 361 | 19년 전 | 4111 | ||
| 360 |
hwatta
|
19년 전 | 2368 | |
| 359 | 19년 전 | 5112 | ||
| 358 | 19년 전 | 3660 | ||
| 357 | 19년 전 | 2608 | ||
| 356 |
sdesign1s
|
20년 전 | 2285 | |
| 355 | 20년 전 | 2761 | ||
| 354 | 20년 전 | 3031 | ||
| 353 | 20년 전 | 2799 | ||
| 352 |
|
20년 전 | 5778 | |
| 351 |
|
20년 전 | 2710 | |
| 350 |
|
20년 전 | 4302 | |
| 349 |
hwatta
|
20년 전 | 2187 | |
| 348 | 20년 전 | 7311 | ||
| 347 | 20년 전 | 2418 | ||
| 346 | 20년 전 | 3509 | ||
| 345 | 20년 전 | 4316 | ||
| 344 | 20년 전 | 2659 | ||
| 343 | 20년 전 | 3925 | ||
| 342 | 20년 전 | 3073 | ||
| 341 | 20년 전 | 4098 | ||
| 340 |
|
20년 전 | 5148 | |
| 339 |
|
20년 전 | 4241 | |
| 338 | 20년 전 | 5882 | ||
| 337 | 20년 전 | 2051 | ||
| 336 |
|
20년 전 | 3330 | |
| 335 |
|
20년 전 | 3546 | |
| 334 |
|
20년 전 | 2938 | |
| 333 |
hwatta
|
20년 전 | 2444 | |
| 332 | 20년 전 | 4658 | ||
| 331 | 20년 전 | 2283 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기