source: branches/version-1/data/downloads/module/mdl_remise/card.php @ 17077

Revision 17077, 6.4 KB checked in by adachi, 14 years ago (diff)

モバイルカード/コンビニ決済実装

Line 
1<?php
2/*
3 * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7require_once("../require.php");
8require_once(MODULE_PATH . "mdl_remise/mdl_remise.inc");
9
10class LC_Page {
11    function LC_Page() {
12        /** ɬ¤º»ØÄꤹ¤ë **/
13        $template = GC_MobileUserAgent::isMobile()
14            ? MODULE_PATH . 'mdl_remise/card_mobile.tpl'
15            : MODULE_PATH . 'mdl_remise/card.tpl';
16        $this->tpl_mainpage = $template;            // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
17        $this->tpl_title = "¥«¡¼¥É·èºÑ";
18        /*
19         session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
20         ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£
21         private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
22        */
23        session_cache_limiter('private-no-expire');
24    }
25}
26
27$objPage = new LC_Page();
28$objView = GC_MobileUserAgent::isMobile() ? new SC_MobileView() : new SC_SiteView();
29$arrInfo = sf_getBasisData();
30
31// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
32$objFormParam = new SC_FormParam();
33// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
34lfInitParam();
35// POSTÃͤμèÆÀ
36$objFormParam->setParam($_POST);
37
38// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
39$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
40
41// ¥«¡¼¥È½¸·×½èÍý
42$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
43
44// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆɹþ
45$arrData = sfGetOrderTemp($uniqid);
46
47// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
48$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
49
50$sql = "SELECT module_id, memo01, memo02, memo03, memo04, memo05, memo06, memo07, memo08, memo09, memo10 ".
51    "FROM dtb_payment WHERE payment_id = ? ";
52
53// »Ùʧ¤¤¾ðÊó¤ò¼èÆÀ
54$arrPayment = $objQuery->getall($sql, array($arrData["payment_id"]));
55
56// ²èÌÌÁ«°ÜȽÄê
57switch($_POST["mode"]){
58    //Ìá¤ë
59    case 'return':
60        // Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
61        $objSiteSess->setRegistFlag();
62        // ³Îǧ¥Ú¡¼¥¸¤Ø°ÜÆ°
63        $url = GC_MobileUserAgent::isMobile()
64            ? gfAddSessionId(MOBILE_URL_SHOP_COMFIRM)
65            : URL_SHOP_COMPLETE;
66        header("Location: " . $url);
67        exit;
68        break;
69}
70
71// ¥ë¥ß¡¼¥º¥µ¥¤¥È¤Î¥«¡¼¥ÉÆþÎϲèÌ̤«¤éÁ«°Ü¤·¤¿¾ì¹ç(POST¤ÇÁ«°Ü¤¹¤ë/PC¤Î¤ß¡£¥â¥Ð¥¤¥ë¤Ï¥ë¥ß¡¼¥ºÂ¦¤Ç´°·ë¤¹¤ë)
72if (isset($_POST["X-R_CODE"])) {
73
74    $err_detail = "";
75
76    // ÄÌ¿®»þ¥¨¥é¡¼
77    if ($_POST["X-R_CODE"] != $arrRemiseErrorWord["OK"]) {
78        $err_detail = $_POST["X-R_CODE"];
79        sfDispSiteError(FREE_ERROR_MSG, "", false, "¹ØÆþ½èÍýÃæ¤Ë°Ê²¼¤Î¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£<br /><br /><br />¡¦" . $err_detail);
80
81    // ÄÌ¿®·ë²ÌÀµ¾ï
82    } else {
83
84        $log_path = DATA_PATH . "logs/remise_card_finish.log";
85        gfPrintLog("remise card finish start----------", $log_path);
86        foreach($_POST as $key => $val){
87            gfPrintLog( "\t" . $key . " => " . $val, $log_path);
88        }
89        gfPrintLog("remise card finish end  ----------", $log_path);
90
91        // ¶â³Û¤ÎÀ°¹çÀ­¥Á¥§¥Ã¥¯
92        if ($arrData["payment_total"] != $_POST["X-TOTAL"] && $arrData["credit_result"] != $_POST["X-TRANID"]) {
93            sfDispSiteError(FREE_ERROR_MSG, "", false, "¹ØÆþ½èÍýÃæ¤Ë°Ê²¼¤Î¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£<br /><br /><br />¡¦ÀÁµá¶â³Û¤È»Ùʧ¤¤¶â³Û¤¬°ã¤¤¤Þ¤¹¡£");
94        }
95
96        // Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
97        $objSiteSess->setRegistFlag();
98
99        // POST¥Ç¡¼¥¿¤òÊݸ
100        $arrVal["credit_result"] = $_POST["X-TRANID"];
101        $arrVal["memo01"] = PAYMENT_CREDIT_ID;
102        $arrVal["memo03"] = $arrPayment[0]["module_id"];
103        $arrVal["memo04"] = $_POST["X-TRANID"];
104
105        // ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥³¡¼¥É
106        $arrMemo["trans_code"] = array("name"=>"Remise¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥³¡¼¥É", "value" => $_POST["X-TRANID"]);
107        $arrVal["memo02"] = serialize($arrMemo);
108
109        // ·èºÑÁ÷¿®¥Ç¡¼¥¿ºîÀ®
110        $arrModule['module_id'] = MDL_REMISE_ID;
111        $arrModule['payment_total'] = $arrData["payment_total"];
112        $arrModule['payment_id'] = PAYMENT_CREDIT_ID;
113        $arrVal['memo05'] = serialize($arrModule);
114
115        // ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë¹¹¿·
116        sfRegistTempOrder($uniqid, $arrVal);
117
118        // ´°Î»²èÌ̤Ø
119        header("Location: " .  URL_SHOP_COMPLETE);
120        exit;
121    }
122}
123
124// »Ùʧ¤¤Êýˡɽ¼¨½èÍý
125$objFormParam->setValue("credit_method", $arrPayment[0]["memo08"]);
126$objFormParam->splitParamCheckBoxes("credit_method");
127$arrUseCreMet = $objFormParam->getValue("credit_method");
128
129foreach($arrUseCreMet as $key => $val) {
130    $arrCreMet[$val] = $arrCredit[$val];
131}
132
133// ʬ³ä²ó¿ôɽ¼¨½èÍý(´ÉÍý²èÌ̤ǤÎÀßÄê²ó¿ô°ÊÆâ¤Þ¤Çɽ¼¨)
134foreach($arrCreditDivide as $key => $val) {
135    if ($arrPayment[0]["memo09"] >= $val) {
136        $arrCreDiv[$val] = $val;
137    }
138}
139
140$objPage->arrCreMet = $arrCreMet;
141$objPage->arrCreDiv = $arrCreDiv;
142$objPage->arrSendData = lfCreateSendData($arrData, $arrPayment, $uniqid);;
143
144$objView->assignobj($objPage);
145
146// ½ÐÎÏÆâÍƤòSJIS¤Ë¤¹¤ë(¥ë¥ß¡¼¥ºÂбþ)
147mb_http_output(REMISE_SEND_ENCODE);
148$objView->display(SITE_FRAME);
149//---------------------------------------------------------------------------------------------------------------------------------------------------------
150
151//¥Ñ¥é¥á¡¼¥¿¤Î½é´ü²½
152function lfInitParam() {
153    global $objFormParam;
154    $objFormParam->addParam("»Ùʧ¤¤ÊýË¡", "credit_method");
155}
156
157function lfCreateSendData($arrData, $arrPayment, $uniqid) {
158    $arrSendData = array(
159        'S_TORIHIKI_NO' => $arrData["order_id"],        // ¥ª¡¼¥À¡¼ÈÖ¹æ
160        'MAIL'          => $arrData["order_email"],     // ¥á¡¼¥ë¥¢¥É¥ì¥¹
161        'AMOUNT'        => $arrData["payment_total"],   // ¶â³Û
162        'TAX'           => '0',                         // Á÷ÎÁ + ÀÇ
163        'TOTAL'         => $arrData["payment_total"],   // ¹ç·×¶â³Û
164        'SHOPCO'        => $arrPayment[0]["memo01"],    // ŹÊÞ¥³¡¼¥É
165        'HOSTID'        => $arrPayment[0]["memo02"],    // ¥Û¥¹¥ÈID
166        'JOB'           => REMISE_PAYMENT_JOB_CODE,     // ¥¸¥ç¥Ö¥³¡¼¥É
167        'ITEM'          => '0000120',                   // ¾¦ÉÊ¥³¡¼¥É(¥ë¥ß¡¼¥º¸ÇÄê)
168        'REMARKS3'      => MDL_REMISE_POST_VALUE,
169    );
170
171    if (GC_MobileUserAgent::isMobile()) {
172        $arrSendData['SEND_URL'] = $arrPayment[0]["memo06"];
173        $arrSendData['TMPURL']   = ''; // ¥ë¥ß¡¼¥ºÂ¦¤Ç½èÍý¤ò´°·ë¤µ¤»¤ë¤¿¤á¡¢¶õ¤ÎÃͤòÆþ¤ì¤ë
174        $arrSendData['OPT']      = $uniqid;
175        $arrSendData['EXITURL']  = SITE_URL;
176
177    } else {
178        $arrSendData['SEND_URL']  = $arrPayment[0]["memo04"];
179        $arrSendData['RETURL']    = SSL_URL . 'shopping/load_payment_module.php';
180        $arrSendData['NG_RETURL'] = SSL_URL . 'shopping/load_payment_module.php';
181        $arrSendData['EXITURL']   = SSL_URL . 'shopping/load_payment_module.php';
182    }
183
184    return $arrSendData;
185}
186?>
Note: See TracBrowser for help on using the repository browser.