벌써 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개
방법을 제시 하는 글입니다 ㅎㅎㅎ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7730 | 10년 전 | 1305 | ||
| 7729 | 10년 전 | 1133 | ||
| 7728 |
잘살아보자
|
10년 전 | 588 | |
| 7727 |
잘살아보자
|
10년 전 | 490 | |
| 7726 |
잘살아보자
|
10년 전 | 814 | |
| 7725 |
잘살아보자
|
10년 전 | 539 | |
| 7724 |
잘살아보자
|
10년 전 | 455 | |
| 7723 |
잘살아보자
|
10년 전 | 522 | |
| 7722 |
잘살아보자
|
10년 전 | 466 | |
| 7721 |
잘살아보자
|
10년 전 | 500 | |
| 7720 |
잘살아보자
|
10년 전 | 450 | |
| 7719 |
비긴어게인
|
10년 전 | 685 | |
| 7718 |
|
10년 전 | 2529 | |
| 7717 |
잘살아보자
|
10년 전 | 644 | |
| 7716 |
잘살아보자
|
10년 전 | 391 | |
| 7715 |
잘살아보자
|
10년 전 | 427 | |
| 7714 |
잘살아보자
|
10년 전 | 479 | |
| 7713 | 10년 전 | 1780 | ||
| 7712 | 10년 전 | 1702 | ||
| 7711 | 10년 전 | 1094 | ||
| 7710 | 10년 전 | 1390 | ||
| 7709 | 10년 전 | 1511 | ||
| 7708 | 10년 전 | 1452 | ||
| 7707 | 10년 전 | 854 | ||
| 7706 |
별지기천사
|
10년 전 | 566 | |
| 7705 | 10년 전 | 1065 | ||
| 7704 |
ICONdesignstudio
|
10년 전 | 607 | |
| 7703 | 10년 전 | 584 | ||
| 7702 |
|
10년 전 | 719 | |
| 7701 | 10년 전 | 1402 | ||
| 7700 | 10년 전 | 1098 | ||
| 7699 | 10년 전 | 579 | ||
| 7698 | 10년 전 | 1133 | ||
| 7697 | 10년 전 | 5150 | ||
| 7696 | 10년 전 | 642 | ||
| 7695 | 10년 전 | 1681 | ||
| 7694 | 10년 전 | 1052 | ||
| 7693 | 10년 전 | 1548 | ||
| 7692 | 10년 전 | 1285 | ||
| 7691 | 10년 전 | 808 | ||
| 7690 | 10년 전 | 1383 | ||
| 7689 | 10년 전 | 1004 | ||
| 7688 | 10년 전 | 605 | ||
| 7687 |
파랑새1597
|
10년 전 | 579 | |
| 7686 | 10년 전 | 841 | ||
| 7685 | 10년 전 | 1336 | ||
| 7684 | 10년 전 | 795 | ||
| 7683 | 10년 전 | 1076 | ||
| 7682 | 10년 전 | 995 | ||
| 7681 | 10년 전 | 648 | ||
| 7680 | 10년 전 | 983 | ||
| 7679 | 10년 전 | 497 | ||
| 7678 | 10년 전 | 724 | ||
| 7677 | 10년 전 | 625 | ||
| 7676 |
|
10년 전 | 939 | |
| 7675 |
|
10년 전 | 1161 | |
| 7674 | 10년 전 | 1042 | ||
| 7673 | 10년 전 | 745 | ||
| 7672 | 10년 전 | 1088 | ||
| 7671 | 10년 전 | 880 | ||
| 7670 | 10년 전 | 649 | ||
| 7669 |
mashmellow
|
10년 전 | 1228 | |
| 7668 | 10년 전 | 711 | ||
| 7667 | 10년 전 | 995 | ||
| 7666 |
senseme
|
10년 전 | 647 | |
| 7665 | 10년 전 | 498 | ||
| 7664 | 10년 전 | 1889 | ||
| 7663 |
mixx애교
|
10년 전 | 980 | |
| 7662 | 10년 전 | 1032 | ||
| 7661 |
hkhkah
|
10년 전 | 782 | |
| 7660 | 10년 전 | 1055 | ||
| 7659 |
커네드커네드
|
10년 전 | 924 | |
| 7658 |
바람돌이팡
|
10년 전 | 670 | |
| 7657 | 10년 전 | 1163 | ||
| 7656 | 10년 전 | 1566 | ||
| 7655 | 10년 전 | 976 | ||
| 7654 |
개발짜증나
|
10년 전 | 853 | |
| 7653 |
네이비칼라
|
10년 전 | 876 | |
| 7652 |
밥먹고합시다
|
10년 전 | 812 | |
| 7651 |
플라이SINJI
|
10년 전 | 1507 | |
| 7650 |
개발짜증나
|
10년 전 | 1406 | |
| 7649 | 10년 전 | 450 | ||
| 7648 |
이미영ㅇㅇ
|
10년 전 | 862 | |
| 7647 | 10년 전 | 425 | ||
| 7646 | 10년 전 | 792 | ||
| 7645 | 10년 전 | 2307 | ||
| 7644 | 10년 전 | 813 | ||
| 7643 |
|
10년 전 | 2864 | |
| 7642 | 10년 전 | 1504 | ||
| 7641 | 10년 전 | 1127 | ||
| 7640 |
개발짜증나
|
10년 전 | 468 | |
| 7639 |
|
10년 전 | 810 | |
| 7638 |
개발짜증나
|
10년 전 | 1128 | |
| 7637 | 10년 전 | 1542 | ||
| 7636 | 10년 전 | 2909 | ||
| 7635 | 10년 전 | 1683 | ||
| 7634 | 10년 전 | 1872 | ||
| 7633 | 10년 전 | 2326 | ||
| 7632 | 10년 전 | 3934 | ||
| 7631 |
|
10년 전 | 1527 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기