벌써 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년 전 | 1312 | ||
| 7729 | 10년 전 | 1159 | ||
| 7728 |
잘살아보자
|
10년 전 | 607 | |
| 7727 |
잘살아보자
|
10년 전 | 504 | |
| 7726 |
잘살아보자
|
10년 전 | 834 | |
| 7725 |
잘살아보자
|
10년 전 | 565 | |
| 7724 |
잘살아보자
|
10년 전 | 476 | |
| 7723 |
잘살아보자
|
10년 전 | 542 | |
| 7722 |
잘살아보자
|
10년 전 | 483 | |
| 7721 |
잘살아보자
|
10년 전 | 513 | |
| 7720 |
잘살아보자
|
10년 전 | 473 | |
| 7719 |
비긴어게인
|
10년 전 | 695 | |
| 7718 |
|
10년 전 | 2544 | |
| 7717 |
잘살아보자
|
10년 전 | 659 | |
| 7716 |
잘살아보자
|
10년 전 | 409 | |
| 7715 |
잘살아보자
|
10년 전 | 436 | |
| 7714 |
잘살아보자
|
10년 전 | 504 | |
| 7713 | 10년 전 | 1790 | ||
| 7712 | 10년 전 | 1721 | ||
| 7711 | 10년 전 | 1109 | ||
| 7710 | 10년 전 | 1407 | ||
| 7709 | 10년 전 | 1525 | ||
| 7708 | 10년 전 | 1463 | ||
| 7707 | 10년 전 | 863 | ||
| 7706 |
별지기천사
|
10년 전 | 575 | |
| 7705 | 10년 전 | 1083 | ||
| 7704 |
ICONdesignstudio
|
10년 전 | 628 | |
| 7703 | 10년 전 | 597 | ||
| 7702 |
|
10년 전 | 734 | |
| 7701 | 10년 전 | 1426 | ||
| 7700 | 10년 전 | 1114 | ||
| 7699 | 10년 전 | 585 | ||
| 7698 | 10년 전 | 1153 | ||
| 7697 | 10년 전 | 5174 | ||
| 7696 | 10년 전 | 666 | ||
| 7695 | 10년 전 | 1692 | ||
| 7694 | 10년 전 | 1071 | ||
| 7693 | 10년 전 | 1561 | ||
| 7692 | 10년 전 | 1304 | ||
| 7691 | 10년 전 | 829 | ||
| 7690 | 10년 전 | 1395 | ||
| 7689 | 10년 전 | 1022 | ||
| 7688 | 10년 전 | 627 | ||
| 7687 |
파랑새1597
|
10년 전 | 605 | |
| 7686 | 10년 전 | 861 | ||
| 7685 | 10년 전 | 1348 | ||
| 7684 | 10년 전 | 805 | ||
| 7683 | 10년 전 | 1110 | ||
| 7682 | 10년 전 | 1033 | ||
| 7681 | 10년 전 | 675 | ||
| 7680 | 10년 전 | 995 | ||
| 7679 | 10년 전 | 512 | ||
| 7678 | 10년 전 | 747 | ||
| 7677 | 10년 전 | 648 | ||
| 7676 |
|
10년 전 | 954 | |
| 7675 |
|
10년 전 | 1182 | |
| 7674 | 10년 전 | 1056 | ||
| 7673 | 10년 전 | 759 | ||
| 7672 | 10년 전 | 1097 | ||
| 7671 | 10년 전 | 900 | ||
| 7670 | 10년 전 | 667 | ||
| 7669 |
mashmellow
|
10년 전 | 1237 | |
| 7668 | 10년 전 | 725 | ||
| 7667 | 10년 전 | 1019 | ||
| 7666 |
senseme
|
10년 전 | 663 | |
| 7665 | 10년 전 | 519 | ||
| 7664 | 10년 전 | 1901 | ||
| 7663 |
mixx애교
|
10년 전 | 986 | |
| 7662 | 10년 전 | 1048 | ||
| 7661 |
hkhkah
|
10년 전 | 799 | |
| 7660 | 10년 전 | 1075 | ||
| 7659 |
커네드커네드
|
10년 전 | 940 | |
| 7658 |
바람돌이팡
|
10년 전 | 682 | |
| 7657 | 10년 전 | 1171 | ||
| 7656 | 10년 전 | 1585 | ||
| 7655 | 10년 전 | 1001 | ||
| 7654 |
개발짜증나
|
10년 전 | 864 | |
| 7653 |
네이비칼라
|
10년 전 | 885 | |
| 7652 |
밥먹고합시다
|
10년 전 | 815 | |
| 7651 |
플라이SINJI
|
10년 전 | 1515 | |
| 7650 |
개발짜증나
|
10년 전 | 1425 | |
| 7649 | 10년 전 | 456 | ||
| 7648 |
이미영ㅇㅇ
|
10년 전 | 872 | |
| 7647 | 10년 전 | 447 | ||
| 7646 | 10년 전 | 817 | ||
| 7645 | 10년 전 | 2327 | ||
| 7644 | 10년 전 | 825 | ||
| 7643 |
|
10년 전 | 2875 | |
| 7642 | 10년 전 | 1518 | ||
| 7641 | 10년 전 | 1144 | ||
| 7640 |
개발짜증나
|
10년 전 | 479 | |
| 7639 |
|
10년 전 | 818 | |
| 7638 |
개발짜증나
|
10년 전 | 1141 | |
| 7637 | 10년 전 | 1558 | ||
| 7636 | 10년 전 | 2918 | ||
| 7635 | 10년 전 | 1706 | ||
| 7634 | 10년 전 | 1891 | ||
| 7633 | 10년 전 | 2349 | ||
| 7632 | 10년 전 | 3957 | ||
| 7631 |
|
10년 전 | 1545 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기