벌써 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년 전 | 407 | ||
| 7829 |
|
9년 전 | 588 | |
| 7828 | 9년 전 | 520 | ||
| 7827 | 9년 전 | 410 | ||
| 7826 | 9년 전 | 417 | ||
| 7825 | 10년 전 | 461 | ||
| 7824 | 10년 전 | 435 | ||
| 7823 | 10년 전 | 355 | ||
| 7822 | 10년 전 | 340 | ||
| 7821 | 10년 전 | 296 | ||
| 7820 | 10년 전 | 336 | ||
| 7819 |
|
10년 전 | 743 | |
| 7818 | 10년 전 | 372 | ||
| 7817 | 10년 전 | 495 | ||
| 7816 | 10년 전 | 394 | ||
| 7815 | 10년 전 | 594 | ||
| 7814 | 10년 전 | 414 | ||
| 7813 | 10년 전 | 362 | ||
| 7812 | 10년 전 | 381 | ||
| 7811 | 10년 전 | 383 | ||
| 7810 | 10년 전 | 548 | ||
| 7809 | 10년 전 | 474 | ||
| 7808 | 10년 전 | 363 | ||
| 7807 | 10년 전 | 393 | ||
| 7806 |
프로그래머7
|
10년 전 | 1324 | |
| 7805 | 10년 전 | 1262 | ||
| 7804 |
zahir1312
|
10년 전 | 765 | |
| 7803 |
|
10년 전 | 1360 | |
| 7802 | 10년 전 | 449 | ||
| 7801 | 10년 전 | 854 | ||
| 7800 | 10년 전 | 1077 | ||
| 7799 | 10년 전 | 537 | ||
| 7798 | 10년 전 | 492 | ||
| 7797 | 10년 전 | 492 | ||
| 7796 | 10년 전 | 333 | ||
| 7795 | 10년 전 | 491 | ||
| 7794 | 10년 전 | 528 | ||
| 7793 | 10년 전 | 1036 | ||
| 7792 | 10년 전 | 451 | ||
| 7791 | 10년 전 | 533 | ||
| 7790 | 10년 전 | 491 | ||
| 7789 |
fbastore
|
10년 전 | 1435 | |
| 7788 | 10년 전 | 525 | ||
| 7787 | 10년 전 | 387 | ||
| 7786 | 10년 전 | 558 | ||
| 7785 | 10년 전 | 563 | ||
| 7784 | 10년 전 | 625 | ||
| 7783 | 10년 전 | 427 | ||
| 7782 | 10년 전 | 478 | ||
| 7781 | 10년 전 | 885 | ||
| 7780 | 10년 전 | 803 | ||
| 7779 | 10년 전 | 767 | ||
| 7778 | 10년 전 | 353 | ||
| 7777 | 10년 전 | 438 | ||
| 7776 | 10년 전 | 443 | ||
| 7775 | 10년 전 | 385 | ||
| 7774 | 10년 전 | 623 | ||
| 7773 | 10년 전 | 369 | ||
| 7772 | 10년 전 | 716 | ||
| 7771 | 10년 전 | 364 | ||
| 7770 | 10년 전 | 635 | ||
| 7769 | 10년 전 | 364 | ||
| 7768 | 10년 전 | 588 | ||
| 7767 | 10년 전 | 1154 | ||
| 7766 | 10년 전 | 485 | ||
| 7765 | 10년 전 | 504 | ||
| 7764 |
잘살아보자
|
10년 전 | 364 | |
| 7763 |
|
10년 전 | 1435 | |
| 7762 |
Tosea
|
10년 전 | 1045 | |
| 7761 | 10년 전 | 632 | ||
| 7760 |
잘살아보자
|
10년 전 | 665 | |
| 7759 |
잘살아보자
|
10년 전 | 483 | |
| 7758 |
잘살아보자
|
10년 전 | 575 | |
| 7757 | 10년 전 | 1226 | ||
| 7756 |
ITBANK
|
10년 전 | 1243 | |
| 7755 | 10년 전 | 1919 | ||
| 7754 | 10년 전 | 1042 | ||
| 7753 | 10년 전 | 870 | ||
| 7752 | 10년 전 | 1378 | ||
| 7751 |
잘살아보자
|
10년 전 | 512 | |
| 7750 |
잘살아보자
|
10년 전 | 468 | |
| 7749 |
잘살아보자
|
10년 전 | 467 | |
| 7748 |
잘살아보자
|
10년 전 | 461 | |
| 7747 |
잘살아보자
|
10년 전 | 561 | |
| 7746 |
잘살아보자
|
10년 전 | 670 | |
| 7745 |
잘살아보자
|
10년 전 | 900 | |
| 7744 |
잘살아보자
|
10년 전 | 407 | |
| 7743 | 10년 전 | 937 | ||
| 7742 |
starbros
|
10년 전 | 822 | |
| 7741 |
잘살아보자
|
10년 전 | 656 | |
| 7740 |
잘살아보자
|
10년 전 | 514 | |
| 7739 |
잘살아보자
|
10년 전 | 454 | |
| 7738 |
잘살아보자
|
10년 전 | 518 | |
| 7737 |
잘살아보자
|
10년 전 | 479 | |
| 7736 |
잘살아보자
|
10년 전 | 503 | |
| 7735 |
잘살아보자
|
10년 전 | 832 | |
| 7734 |
잘살아보자
|
10년 전 | 421 | |
| 7733 |
잘살아보자
|
10년 전 | 529 | |
| 7732 |
잘살아보자
|
10년 전 | 682 | |
| 7731 |
잘살아보자
|
10년 전 | 605 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기