벌써 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개
방법을 제시 하는 글입니다 ㅎㅎㅎ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6830 |
112211dd
|
11년 전 | 787 | |
| 6829 |
진짜다진짜가나타남
|
11년 전 | 1186 | |
| 6828 | 11년 전 | 817 | ||
| 6827 |
봉보로봉봉
|
11년 전 | 899 | |
| 6826 |
jinion
|
11년 전 | 815 | |
| 6825 | 11년 전 | 797 | ||
| 6824 |
yunkiri486
|
11년 전 | 713 | |
| 6823 |
2donggalbi
|
11년 전 | 847 | |
| 6822 | 11년 전 | 843 | ||
| 6821 | 11년 전 | 793 | ||
| 6820 | 11년 전 | 3100 | ||
| 6819 | 11년 전 | 1248 | ||
| 6818 | 11년 전 | 514 | ||
| 6817 |
|
11년 전 | 601 | |
| 6816 | 11년 전 | 2070 | ||
| 6815 | 11년 전 | 1208 | ||
| 6814 | 11년 전 | 851 | ||
| 6813 | 11년 전 | 598 | ||
| 6812 |
|
11년 전 | 979 | |
| 6811 | 11년 전 | 574 | ||
| 6810 | 11년 전 | 1534 | ||
| 6809 |
낚시가좋아
|
11년 전 | 1044 | |
| 6808 | 11년 전 | 437 | ||
| 6807 | 11년 전 | 757 | ||
| 6806 |
Unhappy
|
11년 전 | 1766 | |
| 6805 | 11년 전 | 1589 | ||
| 6804 | 11년 전 | 1115 | ||
| 6803 | 11년 전 | 550 | ||
| 6802 |
asdfg
|
11년 전 | 1130 | |
| 6801 |
아트귀농인
|
11년 전 | 498 | |
| 6800 | 11년 전 | 2551 | ||
| 6799 | 11년 전 | 1351 | ||
| 6798 | 11년 전 | 1466 | ||
| 6797 | 11년 전 | 623 | ||
| 6796 |
purple63
|
11년 전 | 424 | |
| 6795 | 11년 전 | 2630 | ||
| 6794 |
커네드커네드
|
11년 전 | 955 | |
| 6793 | 11년 전 | 399 | ||
| 6792 | 11년 전 | 2486 | ||
| 6791 | 11년 전 | 505 | ||
| 6790 | 11년 전 | 2248 | ||
| 6789 |
리아빌리티
|
11년 전 | 3090 | |
| 6788 | 11년 전 | 1341 | ||
| 6787 | 11년 전 | 670 | ||
| 6786 | 11년 전 | 386 | ||
| 6785 | 11년 전 | 714 | ||
| 6784 |
|
11년 전 | 837 | |
| 6783 | 11년 전 | 577 | ||
| 6782 | 11년 전 | 3651 | ||
| 6781 |
리아빌리티
|
11년 전 | 476 | |
| 6780 | 11년 전 | 517 | ||
| 6779 | 11년 전 | 475 | ||
| 6778 | 11년 전 | 4674 | ||
| 6777 |
바보온달123
|
11년 전 | 607 | |
| 6776 | 11년 전 | 921 | ||
| 6775 | 11년 전 | 722 | ||
| 6774 |
DANet
|
11년 전 | 631 | |
| 6773 | 11년 전 | 1557 | ||
| 6772 | 11년 전 | 1349 | ||
| 6771 | 11년 전 | 609 | ||
| 6770 | 11년 전 | 1154 | ||
| 6769 | 11년 전 | 943 | ||
| 6768 | 11년 전 | 680 | ||
| 6767 | 11년 전 | 575 | ||
| 6766 | 11년 전 | 1258 | ||
| 6765 |
크림나이트
|
11년 전 | 989 | |
| 6764 | 11년 전 | 1530 | ||
| 6763 | 11년 전 | 2590 | ||
| 6762 | 11년 전 | 522 | ||
| 6761 |
|
11년 전 | 777 | |
| 6760 |
|
11년 전 | 705 | |
| 6759 | 11년 전 | 3337 | ||
| 6758 | 11년 전 | 1004 | ||
| 6757 | 11년 전 | 1265 | ||
| 6756 | 11년 전 | 887 | ||
| 6755 |
|
11년 전 | 566 | |
| 6754 |
|
11년 전 | 708 | |
| 6753 |
|
11년 전 | 1373 | |
| 6752 | 11년 전 | 597 | ||
| 6751 |
|
11년 전 | 646 | |
| 6750 |
|
11년 전 | 2012 | |
| 6749 | 11년 전 | 1205 | ||
| 6748 |
|
11년 전 | 1110 | |
| 6747 | 11년 전 | 1154 | ||
| 6746 | 11년 전 | 826 | ||
| 6745 |
|
11년 전 | 902 | |
| 6744 | 11년 전 | 845 | ||
| 6743 | 11년 전 | 1272 | ||
| 6742 | 11년 전 | 525 | ||
| 6741 |
Abilityarch
|
11년 전 | 599 | |
| 6740 | 11년 전 | 638 | ||
| 6739 |
leewin20
|
11년 전 | 1227 | |
| 6738 | 11년 전 | 500 | ||
| 6737 | 11년 전 | 1210 | ||
| 6736 | 11년 전 | 1248 | ||
| 6735 | 11년 전 | 544 | ||
| 6734 | 11년 전 | 1277 | ||
| 6733 |
RipperTNT
|
11년 전 | 1835 | |
| 6732 |
|
11년 전 | 1334 | |
| 6731 |
|
11년 전 | 1384 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기