벌써 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개
방법을 제시 하는 글입니다 ㅎㅎㅎ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7930 | 9년 전 | 397 | ||
| 7929 | 9년 전 | 314 | ||
| 7928 | 9년 전 | 406 | ||
| 7927 | 9년 전 | 326 | ||
| 7926 | 9년 전 | 657 | ||
| 7925 | 9년 전 | 340 | ||
| 7924 | 9년 전 | 328 | ||
| 7923 | 9년 전 | 333 | ||
| 7922 | 9년 전 | 368 | ||
| 7921 | 9년 전 | 394 | ||
| 7920 | 9년 전 | 312 | ||
| 7919 | 9년 전 | 330 | ||
| 7918 | 9년 전 | 485 | ||
| 7917 | 9년 전 | 323 | ||
| 7916 | 9년 전 | 398 | ||
| 7915 | 9년 전 | 396 | ||
| 7914 | 9년 전 | 403 | ||
| 7913 | 9년 전 | 559 | ||
| 7912 | 9년 전 | 406 | ||
| 7911 | 9년 전 | 354 | ||
| 7910 | 9년 전 | 397 | ||
| 7909 | 9년 전 | 498 | ||
| 7908 | 9년 전 | 411 | ||
| 7907 | 9년 전 | 356 | ||
| 7906 | 9년 전 | 377 | ||
| 7905 | 9년 전 | 354 | ||
| 7904 | 9년 전 | 341 | ||
| 7903 | 9년 전 | 341 | ||
| 7902 | 9년 전 | 547 | ||
| 7901 |
|
9년 전 | 726 | |
| 7900 | 9년 전 | 568 | ||
| 7899 | 9년 전 | 366 | ||
| 7898 | 9년 전 | 377 | ||
| 7897 | 9년 전 | 329 | ||
| 7896 | 9년 전 | 349 | ||
| 7895 | 9년 전 | 459 | ||
| 7894 | 9년 전 | 374 | ||
| 7893 | 9년 전 | 323 | ||
| 7892 | 9년 전 | 372 | ||
| 7891 | 9년 전 | 751 | ||
| 7890 | 9년 전 | 1187 | ||
| 7889 | 9년 전 | 741 | ||
| 7888 |
limsy1987
|
9년 전 | 540 | |
| 7887 | 9년 전 | 534 | ||
| 7886 | 9년 전 | 422 | ||
| 7885 | 9년 전 | 394 | ||
| 7884 | 9년 전 | 398 | ||
| 7883 | 9년 전 | 393 | ||
| 7882 | 9년 전 | 435 | ||
| 7881 | 9년 전 | 426 | ||
| 7880 | 9년 전 | 547 | ||
| 7879 | 9년 전 | 447 | ||
| 7878 | 9년 전 | 1205 | ||
| 7877 | 9년 전 | 738 | ||
| 7876 | 9년 전 | 470 | ||
| 7875 | 9년 전 | 548 | ||
| 7874 |
|
9년 전 | 797 | |
| 7873 | 9년 전 | 509 | ||
| 7872 | 9년 전 | 662 | ||
| 7871 | 9년 전 | 471 | ||
| 7870 | 9년 전 | 597 | ||
| 7869 | 9년 전 | 420 | ||
| 7868 | 9년 전 | 429 | ||
| 7867 | 9년 전 | 408 | ||
| 7866 | 9년 전 | 476 | ||
| 7865 | 9년 전 | 439 | ||
| 7864 | 9년 전 | 503 | ||
| 7863 | 9년 전 | 498 | ||
| 7862 | 9년 전 | 459 | ||
| 7861 | 9년 전 | 616 | ||
| 7860 | 9년 전 | 608 | ||
| 7859 | 9년 전 | 398 | ||
| 7858 | 9년 전 | 693 | ||
| 7857 | 9년 전 | 1059 | ||
| 7856 | 9년 전 | 507 | ||
| 7855 | 9년 전 | 730 | ||
| 7854 | 9년 전 | 721 | ||
| 7853 | 9년 전 | 570 | ||
| 7852 | 9년 전 | 499 | ||
| 7851 | 9년 전 | 491 | ||
| 7850 | 9년 전 | 576 | ||
| 7849 | 9년 전 | 351 | ||
| 7848 | 9년 전 | 402 | ||
| 7847 | 9년 전 | 638 | ||
| 7846 | 9년 전 | 445 | ||
| 7845 | 9년 전 | 401 | ||
| 7844 | 9년 전 | 385 | ||
| 7843 | 9년 전 | 401 | ||
| 7842 | 9년 전 | 389 | ||
| 7841 | 9년 전 | 374 | ||
| 7840 | 9년 전 | 390 | ||
| 7839 | 9년 전 | 425 | ||
| 7838 | 9년 전 | 507 | ||
| 7837 | 9년 전 | 344 | ||
| 7836 | 9년 전 | 390 | ||
| 7835 | 9년 전 | 461 | ||
| 7834 |
|
9년 전 | 1184 | |
| 7833 | 9년 전 | 412 | ||
| 7832 | 9년 전 | 405 | ||
| 7831 | 9년 전 | 544 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기