source: branches/feature-module-gmo-pg/data/downloads/module/mdl_gmo-pg/mdl_gmo-pg.inc @ 16178

Revision 16178, 5.1 KB checked in by naka, 15 years ago (diff)
Line 
1<?php
2/**
3 *
4 * @copyright   2000-2007 LOCKON CO.,LTD. All Rights Reserved.
5 * @version CVS: $Id: mdl_epsilon.inc 7162 2006-11-18 09:53:33Z kakinaka $
6 * @link        http://www.lockon.co.jp/
7 *
8 */
9require_once(DATA_PATH . "module/Request.php");
10
11/**** ¢§Äê¿ôÀë¸À *********************************************************************************************/
12
13define("MDL_GMOPG_ID", 11);
14
15/** ¥¯¥ì¥¸¥Ã¥È·èºÑ(»î¸³ÍÑ) **/
16define ("GMO_ENTRY_URL", "http://mod-i.ccsware.net/ohayou/EntryTran.php");
17define ("GMO_EXEC_URL", "http://mod-i.ccsware.net/ohayou/ExecTran.php");
18define ("GMO_SHOPID", 'test000003087');
19define ("GMO_SHOPPASS", 'lockon');
20define ("GMO_TENANTNO", "111111111");
21// ¥À¥ß¡¼¤Ç¤è¤¤¤Î¤ÇÆþ¤ì¤Æ¤ª¤«¤Ê¤¤¤ÈÀµ¤·¤¯Æ°¤«¤Ê¤¤
22define ("GMO_RETURL", SITE_URL . "mod-i/recv.php");
23
24// ¥¯¥ì¥¸¥Ã¥Èʬ³ä²ó¿ô
25$arrPaymentClass = array(
26    '01' => '°ì³çʧ¤¤',
27    '03' => '3²óʧ¤¤',
28    '05' => '5²óʧ¤¤',
29    '06' => '6²óʧ¤¤',
30    '10' => '10²óʧ¤¤'     
31);
32
33// Á÷¿®¥Ñ¥é¥á¡¼¥¿
34define ("SECURE_LINK_URL", "https://linkpt.cardservice.co.jp/cgi-bin/secure.cgi");
35
36// ʸ»ú¿ôÀ©¸Â
37define ("CLIENTIP_LEN", 5);
38define ("SEND_LEN", 20);
39
40/**************************************************************************************************************
41 * ´Ø¿ô̾   ¡§sfGetPaymentDB
42 * ½èÍýÆâÍÆ ¡§É¬Íפʥǡ¼¥¿¤ò¼èÆÀ¤¹¤ë¡£
43 * °ú¿ô1    ¡§
44 * °ú¿ô2    ¡§
45 * °ú¿ô3    ¡§
46 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
47 **************************************************************************************************************/
48function sfGetPaymentDB($module_id, $where = "", $arrWhereVal = array()){
49    $objQuery = new SC_Query();
50       
51    $arrVal = array($module_id);
52    $arrVal = array_merge($arrVal, $arrWhereVal);
53   
54    $arrRet = array();
55    $sql = "SELECT
56                module_id,
57                memo01 as clientip
58            FROM dtb_payment WHERE module_id = ? " . $where;
59    $arrRet = $objQuery->getall($sql, $arrVal);
60
61    return $arrRet[0];
62}
63
64/**************************************************************************************************************
65 * ´Ø¿ô̾   ¡§sfPostPaymentData
66 * ½èÍýÆâÍÆ ¡§·èºÑ¥Ç¡¼¥¿Á÷¿®½èÍý
67 * °ú¿ô1    ¡§
68 * °ú¿ô2    ¡§
69 * °ú¿ô3    ¡§
70 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
71 **************************************************************************************************************/
72function sfPostPaymentData($arrData, $arrInput, $quick_chage = false){
73    $arrPaymentDB = sfGetPaymentDB(MDL_GMOPG_ID);
74   
75    if(!$quick_chage) {
76        $arrPost = array(
77            'clientip' => $arrPaymentDB['clientip'],
78            'cardnumber' =>  $arrInput['card_no01'].$arrInput['card_no02'].$arrInput['card_no03'].$arrInput['card_no04'],
79            'expyy' => $arrInput['card_year'],
80            'expmm' => $arrInput['card_month'],
81            'telno' => $arrData['order_tel01'].$arrData['order_tel02'].$arrData['order_tel03'],
82            'email' => $arrData['order_email'],
83            'sendid' => $arrData['order_id'],
84            'username' => $arrInput['card_name01'].$arrInput['card_name02'],
85            'money' => $arrData['total'],
86            'sendpoint' => 'eccube',
87            'send' => 'mall',
88            'pubsec' => '',
89            'div' => $arrInput['payment_class']
90        );
91    } else {
92        // ¥¯¥¤¥Ã¥¯¥Á¥ã¡¼¥¸¤òÍøÍѤ¹¤ë¾ì¹ç
93        $objQuery = new SC_Query();
94        $objQuery->setlimit(1);
95        $objQuery->setorder("create_date DESC");
96        $col = "order_id, order_tel01, order_tel02, order_tel03";
97        $where = "memo01 = ? AND memo03 = ? AND customer_id = ?";
98        $arrRet = $objQuery->select($col, "dtb_order", $where, array(MDL_GMOPG_ID, 'Success_order', $arrData['customer_id']));
99       
100        $arrPost = array(
101            'send' => 'mall',
102            'clientip' => $arrPaymentDB['clientip'],
103            'money' => $arrData['total'],
104            'telno' => $arrRet[0]['order_tel01'].$arrRet[0]['order_tel02'].$arrRet[0]['order_tel03'],
105            'sendid' => $arrRet[0]['order_id'],
106            'cardnumber' => '8888888888888888',
107            'email' => $arrData['order_email'],
108            'sendpoint' => 'eccube',
109            'expyy' => '01',    // ¥À¥ß¡¼ÃÍ
110            'expmm' => '01',    // ¥À¥ß¡¼ÃÍ
111            'div' => '01',
112            'entry' => 'non',
113            'pubsec' => 'yes'           
114        );
115       
116        sfPrintR($arrPost);
117    }
118   
119    $req = new HTTP_Request(SECURE_LINK_URL);
120    $req->setMethod(HTTP_REQUEST_METHOD_POST);
121    $req->addPostDataArray($arrPost);
122   
123    if (!PEAR::isError($req->sendRequest())) {
124        $response = $req->getResponseBody();
125        $response = mb_convert_encoding($response, "EUC-JP", "Shift-JIS");
126    }
127    $req->clearPostData();
128    gfPrintLog("¥¼¥¦¥¹±þÅú·ë²Ì¡§".$response);
129
130    // ¼õÃí¥Æ¡¼¥Ö¥ë¤Ëµ­Ï¿¤¹¤ë
131    $arrVal["memo01"] = MDL_GMOPG_ID;   // ¥â¥¸¥å¡¼¥ëID
132    $arrVal["memo03"] = $response;      // ½èÍý·ë²Ì
133    // ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë¹¹¿·
134    sfRegistTempOrder($arrData['order_temp_id'], $arrVal);
135   
136    if(ereg('Success_order', $response)) {
137        return true;
138    } else {
139        return false;
140    }
141    return $arrVal;
142}
143/**************************************************************************************************************
144 * ´Ø¿ô̾   ¡§sfZeusDisp
145 * ½èÍýÆâÍÆ ¡§¶¦Ä̤Îɽ¼¨½èÍý
146 * °ú¿ô1    ¡§
147 * °ú¿ô2    ¡§
148 * °ú¿ô3    ¡§
149 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
150 **************************************************************************************************************/
151function sfZeusDisp($objPage, $payment_id) {
152    $objQuery = new SC_Query();
153    // »Ùʧ¤¤ÊýË¡¤ÎÀâÌÀ²èÁü¤ò¼èÆÀ¤¹¤ë¡£
154    $arrRet = $objQuery->select("payment_method, payment_image", "dtb_payment", "payment_id = ?", array($payment_id));
155    $objPage->tpl_payment_method = $arrRet[0]['payment_method'];
156    $objPage->tpl_payment_image = $arrRet[0]['payment_image'];
157    return $objPage;
158}
159?>
Note: See TracBrowser for help on using the repository browser.