벌써 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개
방법을 제시 하는 글입니다 ㅎㅎㅎ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7630 | 10년 전 | 655 | ||
| 7629 |
|
10년 전 | 2398 | |
| 7628 | 10년 전 | 795 | ||
| 7627 |
|
10년 전 | 1038 | |
| 7626 |
|
10년 전 | 1795 | |
| 7625 | 10년 전 | 718 | ||
| 7624 | 10년 전 | 734 | ||
| 7623 |
|
10년 전 | 3099 | |
| 7622 | 10년 전 | 735 | ||
| 7621 |
leeleeleelee
|
10년 전 | 590 | |
| 7620 | 10년 전 | 542 | ||
| 7619 | 10년 전 | 495 | ||
| 7618 | 10년 전 | 1032 | ||
| 7617 | 10년 전 | 729 | ||
| 7616 | 10년 전 | 658 | ||
| 7615 | 10년 전 | 729 | ||
| 7614 | 10년 전 | 1270 | ||
| 7613 |
|
10년 전 | 2086 | |
| 7612 | 10년 전 | 1153 | ||
| 7611 | 10년 전 | 1423 | ||
| 7610 |
|
10년 전 | 1907 | |
| 7609 |
|
10년 전 | 1357 | |
| 7608 |
mwdkim
|
10년 전 | 1138 | |
| 7607 |
|
10년 전 | 1057 | |
| 7606 |
mwdkim
|
10년 전 | 3938 | |
| 7605 | 10년 전 | 695 | ||
| 7604 | 10년 전 | 1032 | ||
| 7603 | 10년 전 | 1658 | ||
| 7602 |
|
10년 전 | 1082 | |
| 7601 |
AniNest
|
10년 전 | 2796 | |
| 7600 |
port443
|
10년 전 | 1039 | |
| 7599 | 10년 전 | 950 | ||
| 7598 | 10년 전 | 1026 | ||
| 7597 | 10년 전 | 4579 | ||
| 7596 |
SeungYeon
|
10년 전 | 896 | |
| 7595 |
untitled
|
10년 전 | 2431 | |
| 7594 |
프로그래머7
|
10년 전 | 1737 | |
| 7593 |
untitled
|
10년 전 | 2381 | |
| 7592 |
untitled
|
10년 전 | 1949 | |
| 7591 |
untitled
|
10년 전 | 2681 | |
| 7590 |
아리마2001
|
10년 전 | 857 | |
| 7589 | 10년 전 | 1115 | ||
| 7588 |
|
10년 전 | 2925 | |
| 7587 | 10년 전 | 1310 | ||
| 7586 | 10년 전 | 675 | ||
| 7585 | 10년 전 | 1700 | ||
| 7584 | 10년 전 | 1414 | ||
| 7583 |
leeleeleelee
|
10년 전 | 1167 | |
| 7582 |
|
10년 전 | 1123 | |
| 7581 | 10년 전 | 1359 | ||
| 7580 | 10년 전 | 1010 | ||
| 7579 |
|
10년 전 | 611 | |
| 7578 | 10년 전 | 1433 | ||
| 7577 |
|
10년 전 | 1877 | |
| 7576 | 10년 전 | 1392 | ||
| 7575 |
멋진남자임
|
10년 전 | 1468 | |
| 7574 | 10년 전 | 2125 | ||
| 7573 | 10년 전 | 3260 | ||
| 7572 | 10년 전 | 765 | ||
| 7571 |
|
10년 전 | 785 | |
| 7570 |
|
10년 전 | 1320 | |
| 7569 | 10년 전 | 1556 | ||
| 7568 |
this1mg
|
10년 전 | 1055 | |
| 7567 |
|
10년 전 | 766 | |
| 7566 | 10년 전 | 920 | ||
| 7565 |
Angel하늘
|
10년 전 | 1014 | |
| 7564 |
seoldi
|
10년 전 | 1251 | |
| 7563 |
|
10년 전 | 1394 | |
| 7562 |
멋진남자임
|
10년 전 | 2093 | |
| 7561 | 10년 전 | 716 | ||
| 7560 |
leeleeleelee
|
10년 전 | 916 | |
| 7559 | 10년 전 | 5053 | ||
| 7558 |
RinaP
|
10년 전 | 790 | |
| 7557 |
|
10년 전 | 1253 | |
| 7556 | 10년 전 | 1198 | ||
| 7555 |
hyohyojj1234
|
10년 전 | 1669 | |
| 7554 | 10년 전 | 1100 | ||
| 7553 |
senseme
|
10년 전 | 1341 | |
| 7552 |
ehdltdoit
|
10년 전 | 1441 | |
| 7551 |
|
10년 전 | 1833 | |
| 7550 |
leeleeleelee
|
10년 전 | 1595 | |
| 7549 | 10년 전 | 2431 | ||
| 7548 | 10년 전 | 1848 | ||
| 7547 |
멋진남자임
|
10년 전 | 1967 | |
| 7546 | 10년 전 | 1011 | ||
| 7545 |
ILMare1003
|
10년 전 | 1295 | |
| 7544 |
|
10년 전 | 1258 | |
| 7543 | 10년 전 | 893 | ||
| 7542 | 10년 전 | 662 | ||
| 7541 |
울라라라우
|
10년 전 | 870 | |
| 7540 | 10년 전 | 1601 | ||
| 7539 | 10년 전 | 942 | ||
| 7538 |
|
10년 전 | 1836 | |
| 7537 | 10년 전 | 3618 | ||
| 7536 |
Gaumi
|
10년 전 | 1419 | |
| 7535 |
프로그램은어려워
|
10년 전 | 1279 | |
| 7534 |
senseme
|
10년 전 | 1210 | |
| 7533 | 10년 전 | 1206 | ||
| 7532 | 10년 전 | 868 | ||
| 7531 | 10년 전 | 2061 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기