벌써 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개
방법을 제시 하는 글입니다 ㅎㅎㅎ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6630 |
차가운바람
|
12년 전 | 1164 | |
| 6629 | 12년 전 | 1163 | ||
| 6628 |
put777
|
12년 전 | 648 | |
| 6627 |
|
12년 전 | 701 | |
| 6626 | 12년 전 | 1617 | ||
| 6625 |
|
12년 전 | 723 | |
| 6624 |
미켈란젤로의왼손
|
12년 전 | 491 | |
| 6623 |
|
12년 전 | 1047 | |
| 6622 | 12년 전 | 1401 | ||
| 6621 |
차가운바람
|
12년 전 | 636 | |
| 6620 | 12년 전 | 741 | ||
| 6619 |
|
12년 전 | 975 | |
| 6618 | 12년 전 | 1746 | ||
| 6617 | 12년 전 | 643 | ||
| 6616 |
차가운바람
|
12년 전 | 902 | |
| 6615 | 12년 전 | 2856 | ||
| 6614 | 12년 전 | 618 | ||
| 6613 |
강명구베드로
|
12년 전 | 533 | |
| 6612 |
|
12년 전 | 426 | |
| 6611 | 12년 전 | 1211 | ||
| 6610 | 12년 전 | 1029 | ||
| 6609 | 12년 전 | 3680 | ||
| 6608 |
|
12년 전 | 834 | |
| 6607 | 12년 전 | 697 | ||
| 6606 | 12년 전 | 567 | ||
| 6605 | 12년 전 | 458 | ||
| 6604 | 12년 전 | 977 | ||
| 6603 |
geektoo
|
12년 전 | 704 | |
| 6602 | 12년 전 | 843 | ||
| 6601 | 12년 전 | 369 | ||
| 6600 | 12년 전 | 417 | ||
| 6599 | 12년 전 | 572 | ||
| 6598 | 12년 전 | 948 | ||
| 6597 | 12년 전 | 945 | ||
| 6596 | 12년 전 | 432 | ||
| 6595 | 12년 전 | 796 | ||
| 6594 | 12년 전 | 4577 | ||
| 6593 | 12년 전 | 2582 | ||
| 6592 | 12년 전 | 831 | ||
| 6591 | 12년 전 | 596 | ||
| 6590 |
|
12년 전 | 1404 | |
| 6589 | 12년 전 | 777 | ||
| 6588 |
GINUSSOFT
|
12년 전 | 5132 | |
| 6587 | 12년 전 | 6215 | ||
| 6586 | 12년 전 | 1051 | ||
| 6585 | 12년 전 | 810 | ||
| 6584 | 12년 전 | 470 | ||
| 6583 |
|
12년 전 | 985 | |
| 6582 | 12년 전 | 875 | ||
| 6581 | 12년 전 | 847 | ||
| 6580 | 12년 전 | 621 | ||
| 6579 |
알랑가몰라
|
12년 전 | 937 | |
| 6578 | 12년 전 | 1336 | ||
| 6577 | 12년 전 | 1509 | ||
| 6576 |
경dragon
|
12년 전 | 781 | |
| 6575 | 12년 전 | 1892 | ||
| 6574 | 12년 전 | 690 | ||
| 6573 | 12년 전 | 993 | ||
| 6572 |
|
12년 전 | 1675 | |
| 6571 |
CTOMAN
|
12년 전 | 1969 | |
| 6570 | 12년 전 | 1739 | ||
| 6569 | 12년 전 | 1897 | ||
| 6568 | 12년 전 | 2410 | ||
| 6567 | 12년 전 | 1034 | ||
| 6566 |
lainfox
|
12년 전 | 1538 | |
| 6565 | 12년 전 | 3661 | ||
| 6564 |
제주프라이스
|
12년 전 | 1543 | |
| 6563 | 12년 전 | 1576 | ||
| 6562 |
프로프리랜서
|
12년 전 | 1355 | |
| 6561 |
프로프리랜서
|
12년 전 | 973 | |
| 6560 |
프로프리랜서
|
12년 전 | 1232 | |
| 6559 |
프로프리랜서
|
12년 전 | 1143 | |
| 6558 |
프로프리랜서
|
12년 전 | 1362 | |
| 6557 |
프로프리랜서
|
12년 전 | 1986 | |
| 6556 |
프로프리랜서
|
12년 전 | 1531 | |
| 6555 |
프로프리랜서
|
12년 전 | 1373 | |
| 6554 |
프로프리랜서
|
12년 전 | 3895 | |
| 6553 |
프로프리랜서
|
12년 전 | 1518 | |
| 6552 | 12년 전 | 858 | ||
| 6551 |
왕초보sasa
|
12년 전 | 1547 | |
| 6550 |
왕초보sasa
|
12년 전 | 645 | |
| 6549 |
왕초보sasa
|
12년 전 | 914 | |
| 6548 | 12년 전 | 1303 | ||
| 6547 | 12년 전 | 1205 | ||
| 6546 | 12년 전 | 5169 | ||
| 6545 | 12년 전 | 2526 | ||
| 6544 |
AnnieK
|
12년 전 | 1790 | |
| 6543 |
베르무트7
|
12년 전 | 652 | |
| 6542 |
오늘도망했다
|
12년 전 | 2241 | |
| 6541 | 12년 전 | 823 | ||
| 6540 | 12년 전 | 1146 | ||
| 6539 | 12년 전 | 854 | ||
| 6538 |
senseme
|
12년 전 | 3383 | |
| 6537 | 12년 전 | 783 | ||
| 6536 | 12년 전 | 3671 | ||
| 6535 | 12년 전 | 1357 | ||
| 6534 | 12년 전 | 1627 | ||
| 6533 | 12년 전 | 2255 | ||
| 6532 |
냐옹이사범
|
12년 전 | 2313 | |
| 6531 | 12년 전 | 572 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기