벌써 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개
방법을 제시 하는 글입니다 ㅎㅎㅎ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7830 | 9년 전 | 374 | ||
| 7829 |
|
9년 전 | 551 | |
| 7828 | 9년 전 | 485 | ||
| 7827 | 9년 전 | 371 | ||
| 7826 | 9년 전 | 378 | ||
| 7825 | 9년 전 | 432 | ||
| 7824 | 9년 전 | 416 | ||
| 7823 | 9년 전 | 319 | ||
| 7822 | 9년 전 | 315 | ||
| 7821 | 9년 전 | 261 | ||
| 7820 | 9년 전 | 315 | ||
| 7819 |
|
9년 전 | 716 | |
| 7818 | 10년 전 | 335 | ||
| 7817 | 10년 전 | 451 | ||
| 7816 | 10년 전 | 354 | ||
| 7815 | 10년 전 | 559 | ||
| 7814 | 10년 전 | 381 | ||
| 7813 | 10년 전 | 319 | ||
| 7812 | 10년 전 | 343 | ||
| 7811 | 10년 전 | 361 | ||
| 7810 | 10년 전 | 489 | ||
| 7809 | 10년 전 | 431 | ||
| 7808 | 10년 전 | 288 | ||
| 7807 | 10년 전 | 352 | ||
| 7806 |
프로그래머7
|
10년 전 | 1306 | |
| 7805 | 10년 전 | 1217 | ||
| 7804 |
zahir1312
|
10년 전 | 742 | |
| 7803 |
|
10년 전 | 1343 | |
| 7802 | 10년 전 | 399 | ||
| 7801 | 10년 전 | 826 | ||
| 7800 | 10년 전 | 1043 | ||
| 7799 | 10년 전 | 499 | ||
| 7798 | 10년 전 | 447 | ||
| 7797 | 10년 전 | 449 | ||
| 7796 | 10년 전 | 300 | ||
| 7795 | 10년 전 | 452 | ||
| 7794 | 10년 전 | 477 | ||
| 7793 | 10년 전 | 995 | ||
| 7792 | 10년 전 | 402 | ||
| 7791 | 10년 전 | 487 | ||
| 7790 | 10년 전 | 453 | ||
| 7789 |
fbastore
|
10년 전 | 1398 | |
| 7788 | 10년 전 | 484 | ||
| 7787 | 10년 전 | 349 | ||
| 7786 | 10년 전 | 500 | ||
| 7785 | 10년 전 | 519 | ||
| 7784 | 10년 전 | 586 | ||
| 7783 | 10년 전 | 390 | ||
| 7782 | 10년 전 | 444 | ||
| 7781 | 10년 전 | 845 | ||
| 7780 | 10년 전 | 775 | ||
| 7779 | 10년 전 | 746 | ||
| 7778 | 10년 전 | 315 | ||
| 7777 | 10년 전 | 394 | ||
| 7776 | 10년 전 | 401 | ||
| 7775 | 10년 전 | 338 | ||
| 7774 | 10년 전 | 599 | ||
| 7773 | 10년 전 | 320 | ||
| 7772 | 10년 전 | 662 | ||
| 7771 | 10년 전 | 326 | ||
| 7770 | 10년 전 | 610 | ||
| 7769 | 10년 전 | 327 | ||
| 7768 | 10년 전 | 546 | ||
| 7767 | 10년 전 | 1115 | ||
| 7766 | 10년 전 | 443 | ||
| 7765 | 10년 전 | 471 | ||
| 7764 |
잘살아보자
|
10년 전 | 324 | |
| 7763 |
|
10년 전 | 1399 | |
| 7762 |
Tosea
|
10년 전 | 1018 | |
| 7761 | 10년 전 | 612 | ||
| 7760 |
잘살아보자
|
10년 전 | 597 | |
| 7759 |
잘살아보자
|
10년 전 | 409 | |
| 7758 |
잘살아보자
|
10년 전 | 528 | |
| 7757 | 10년 전 | 1178 | ||
| 7756 |
ITBANK
|
10년 전 | 1216 | |
| 7755 | 10년 전 | 1893 | ||
| 7754 | 10년 전 | 994 | ||
| 7753 | 10년 전 | 841 | ||
| 7752 | 10년 전 | 1344 | ||
| 7751 |
잘살아보자
|
10년 전 | 470 | |
| 7750 |
잘살아보자
|
10년 전 | 438 | |
| 7749 |
잘살아보자
|
10년 전 | 434 | |
| 7748 |
잘살아보자
|
10년 전 | 418 | |
| 7747 |
잘살아보자
|
10년 전 | 506 | |
| 7746 |
잘살아보자
|
10년 전 | 625 | |
| 7745 |
잘살아보자
|
10년 전 | 868 | |
| 7744 |
잘살아보자
|
10년 전 | 386 | |
| 7743 | 10년 전 | 912 | ||
| 7742 |
starbros
|
10년 전 | 785 | |
| 7741 |
잘살아보자
|
10년 전 | 599 | |
| 7740 |
잘살아보자
|
10년 전 | 474 | |
| 7739 |
잘살아보자
|
10년 전 | 431 | |
| 7738 |
잘살아보자
|
10년 전 | 486 | |
| 7737 |
잘살아보자
|
10년 전 | 443 | |
| 7736 |
잘살아보자
|
10년 전 | 466 | |
| 7735 |
잘살아보자
|
10년 전 | 800 | |
| 7734 |
잘살아보자
|
10년 전 | 391 | |
| 7733 |
잘살아보자
|
10년 전 | 490 | |
| 7732 |
잘살아보자
|
10년 전 | 647 | |
| 7731 |
잘살아보자
|
10년 전 | 575 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기