source: branches/feature-module-paygent/data/downloads/module/mdl_paygent/mdl_paygent.php @ 15230

Revision 15230, 10.4 KB checked in by adachi, 15 years ago (diff)

typo修正

Line 
1<?php
2/**
3 *
4 * @copyright   2000-2007 LOCKON CO.,LTD. All Rights Reserved.
5 * @version CVS: $Id: mdl_epsilon.php 1.2 2006-12-04 06:08:28Z kakinaka $
6 * @link        http://www.lockon.co.jp/
7 *
8 */
9
10require_once(MODULE_PATH . "mdl_paygent/mdl_paygent.inc");
11
12$arrPayment = array(
13    1 => '¥¯¥ì¥¸¥Ã¥È',
14    2 => '¥³¥ó¥Ó¥Ë',
15    3 => 'ATM·èºÑ',
16    4 => '¶ä¹Ô¥Í¥Ã¥È'
17);
18
19$arrCredit = array(
20    1 => 'VISA, MASTER, Diners',
21    2 => 'JCB, AMEX'
22);
23   
24//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
25class LC_Page {
26    //¥³¥ó¥¹¥È¥é¥¯¥¿
27    function LC_Page() {
28        //¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
29        $this->tpl_mainpage = MODULE_PATH . 'mdl_paygent/mdl_paygent.tpl';
30        $this->tpl_subtitle = '¥Ú¥¤¥¸¥§¥ó¥È·èºÑ¥â¥¸¥å¡¼¥ë';
31        global $arrPayment;
32        $this->arrPayment = $arrPayment;
33        global $arrCredit;
34        $this->arrCredit = $arrCredit;
35        global $arrConvenience;
36        $this->arrConvenience = $arrConvenience;
37    }
38}
39$objPage = new LC_Page();
40$objView = new SC_AdminView();
41$objQuery = new SC_Query();
42
43// ¥³¥ó¥Ó¥ËÆþ¶â¥Á¥§¥Ã¥¯
44lfEpsilonCheck();
45
46// ǧ¾Ú³Îǧ
47$objSess = new SC_Session();
48sfIsSuccess($objSess);
49
50// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
51$objFormParam = new SC_FormParam();
52$objFormParam = lfInitParam($objFormParam);
53// POSTÃͤμèÆÀ
54$objFormParam->setParam($_POST);
55
56// ÈÆÍѹàÌܤòÄɲÃ(ɬ¿Ü¡ª¡ª)
57sfAlterMemo();
58
59switch($_POST['mode']) {
60case 'edit':
61    // ÆþÎÏ¥¨¥é¡¼È½Äê
62    $objPage->arrErr = lfCheckError();
63
64    // ¥¨¥é¡¼¤Ê¤·¤Î¾ì¹ç¤Ë¤Ï¥Ç¡¼¥¿¤ò¹¹¿·
65    if(count($objPage->arrErr) == 0) {
66        // ¥Ç¡¼¥¿¹¹¿·
67        lfUpdPaymentDB(MDL_PAYGENT_ID);
68       
69        // javascript¼Â¹Ô
70        $objPage->tpl_onload = 'alert("ÅÐÏ¿´°Î»¤·¤Þ¤·¤¿¡£\n´ðËܾðÊó¡ä»ÙʧÊýË¡ÀßÄê¤è¤ê¾ÜºÙÀßÄê¤ò¤·¤Æ¤¯¤À¤µ¤¤¡£"); window.close();';
71    }
72    break;
73case 'module_del':
74    // ÈÆÍѹàÌܤθºß¥Á¥§¥Ã¥¯
75    if(sfColumnExists("dtb_payment", "memo01")){
76        // ¥Ç¡¼¥¿¤Îºï½ü¥Õ¥é¥°¤ò¤¿¤Æ¤ë
77        $objQuery->query("UPDATE dtb_payment SET del_flg = 1 WHERE module_id = ?", array(MDL_EPSILON_ID));
78    }
79    break;
80default:
81    // ¥Ç¡¼¥¿¤Î¥í¡¼¥É
82    lfLoadData();   
83    break;
84}
85
86$objPage->arrForm = $objFormParam->getFormParamList();
87
88$objView->assignobj($objPage);                  //ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
89$objView->display($objPage->tpl_mainpage);      //¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
90//-------------------------------------------------------------------------------------------------------
91/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
92function lfInitParam($objFormParam) {
93    $arrSiteInfo = sf_getBasisData();
94    // ¥Ç¥Õ¥©¥ë¥ÈÃÍ
95    $arrDefault  = array(
96        'conveni_limit_date' => 15,
97        'atm_limit_date'     => 30,
98        'payment_detail' => $arrSiteInfo['shop_kana'],
99        'claim_kanji'    => $arrSiteInfo['shop_name'],
100        'claim_kana'     => $arrSiteInfo['shop_kana']
101    );
102    $objFormParam->addParam("¥Þ¡¼¥Á¥ã¥ó¥ÈID", "merchant_id", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
103    $objFormParam->addParam("ÀܳID", "connect_id", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
104    $objFormParam->addParam("Àܳ¥Ñ¥¹¥ï¡¼¥É", "connect_password", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
105    $objFormParam->addParam("»Ùʧ´ü¸ÂÆü", "conveni_limit_date", 2, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrDefault['conveni_limit_date']);
106    $objFormParam->addParam("»Ùʧ´ü¸ÂÆü", "atm_limit_date", 2, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrDefault['atm_limit_date']);
107    $objFormParam->addParam("»ÙʧÀâÌÀʸ(¥«¥Ê)", "payment_detail", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK", "KANA_CHECK"), $arrDefault['payment_detail']);
108    $objFormParam->addParam("»ÙʧÀâÌÀʸ(´Á»ú)", "claim_kanji", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"), $arrDefault['claim_kanji']);
109    $objFormParam->addParam("»ÙʧÀâÌÀʸ(¥«¥Ê)", "claim_kana", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK", "KANA_CHECK"), $arrDefault['claim_kana']);
110    $objFormParam->addParam("ÍøÍÑ·èºÑ", "payment", "", "", array("EXIST_CHECK"));
111    return $objFormParam;
112}
113   
114// ¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
115function lfCheckError(){
116    global $objFormParam;
117    $arrErr = $objFormParam->checkError();
118    if($_POST['conveni_limit_date'] != "" && !($_POST['conveni_limit_date'] >= 1 &&  $_POST['conveni_limit_date'] <= 60)) {
119            $arrErr['conveni_limit_date'] = "¢¨ »Ùʧ´ü¸ÂÆü¤Ï¡¢1¡Á60Æü¤Þ¤Ç¤Î´Ö¤ÇÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£<br>";
120    }
121    if($_POST['atm_limit_date'] != "" && !($_POST['atm_limit_date'] >= 0 &&  $_POST['atm_limit_date'] <= 60)) {
122            $arrErr['atm_limit_date'] = "¢¨ »Ùʧ´ü¸ÂÆü¤Ï¡¢0¡Á60Æü¤Þ¤Ç¤Î´Ö¤ÇÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£<br>";
123    }
124   
125    /** ¶¦ÄÌÅÅʸ **/   
126    // ¥Þ¡¼¥Á¥ã¥ó¥ÈID
127    $arrParam['merchant_id'] = $objFormParam->getValue('merchant_id');
128    // ÀܳID
129    $arrParam['connect_id'] = $objFormParam->getValue('connect_id');
130    // Àܳ¥Ñ¥¹¥ï¡¼¥É
131    $arrParam['connect_password'] = $objFormParam->getValue('connect_password');
132
133    // Àܳ¥Æ¥¹¥È¤ò¼Â¹Ô¤¹¤ë¡£
134    if(!sfPaygentTest($arrParam)) {
135        $arrErr['err'] = "¢¨ Àܳ»î¸³¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
136    }   
137   
138    return $arrErr;
139}
140
141// ÅÐÏ¿¥Ç¡¼¥¿¤òÆɤ߹þ¤à
142function lfLoadData(){
143    global $objFormParam;
144   
145    //¥Ç¡¼¥¿¤ò¼èÆÀ
146    $arrRet = sfGetPaymentDB(MDL_PAYGENT_ID, "AND del_flg = '0'");
147    $objFormParam->setParam($arrRet[0]);
148   
149   
150    // ²èÌÌɽ¼¨ÍѤ˥ǡ¼¥¿¤òÊÑ´¹
151    $arrDisp = array();
152   
153    foreach($arrRet as $key => $val){
154        // ÍøÍÑ·èºÑ¤òɽ¼¨ÍѤËÊÑ´¹
155        $arrDisp["payment"][$key] = $val["payment"];
156       
157        switch($val['payment']) {
158        // ¥¯¥ì¥¸¥Ã¥È
159        case '1':
160            break;
161        // ¥³¥ó¥Ó¥Ë
162        case '2':
163            $arrParam = unserialize($val['other_param']);
164            $arrDisp['conveni_limit_date'] = $arrParam['payment_limit_date'];
165            break;
166        // ATM·èºÑ
167        case '3':
168            $arrParam = unserialize($val['other_param']);
169            $arrDisp['payment_detail'] = $arrParam['payment_detail'];
170            $arrDisp['atm_limit_date'] = $arrParam['payment_limit_date'];
171            break;
172        // ¥Í¥Ã¥È¥Ð¥ó¥¯
173        case '4':
174            $arrParam = unserialize($val['other_param']);
175            $arrDisp['claim_kana'] = $arrParam['claim_kana'];
176            $arrDisp['claim_kanji'] = $arrParam['claim_kanji'];
177            break;                 
178        }
179    }   
180   
181    $objFormParam->setParam($arrDisp);
182}
183
184// ¥Ç¡¼¥¿¤Î¹¹¿·½èÍý
185function lfUpdPaymentDB($module_id){
186    global $objQuery;
187    global $objSess;
188       
189    // ´ØÏ¢¤¹¤ë»Ùʧ¤¤ÊýË¡¤Îdel_flg¤òºï½ü¤Ë¤·¤Æ¤ª¤¯
190    $del_sql = "UPDATE dtb_payment SET del_flg = 1 WHERE module_id = ? ";
191    $arrDel = array($module_id);
192    $objQuery->query($del_sql, $arrDel);
193   
194    // ¥Ç¡¼¥¿ÅÐÏ¿
195    foreach($_POST["payment"] as $key => $val){
196        // ¥é¥ó¥¯¤ÎºÇÂçÃͤò¼èÆÀ¤¹¤ë
197        $max_rank = $objQuery->getone("SELECT max(rank) FROM dtb_payment");
198
199        // »ÙʧÊýË¡¥Ç¡¼¥¿¤ò¼èÆÀ         
200        $arrPaymentData = sfGetPaymentDB(MDL_PAYGENT_ID, "AND memo03 = ?", array($val));
201       
202        // ¥¯¥ì¥¸¥Ã¥È¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤ì¤Ð¥¯¥ì¥¸¥Ã¥È¤òÅÐÏ¿¤¹¤ë
203        if($val == 1){
204            $arrData = array(           
205                "payment_method" => "PAYGENT¥¯¥ì¥¸¥Ã¥È"
206                ,"fix" => 3
207                ,"creator_id" => $objSess->member_id
208                ,"create_date" => "now()"
209                ,"update_date" => "now()"
210                ,"upper_rule" => 500000
211                ,"module_id" => $module_id
212                ,"module_path" => MODULE_PATH . "mdl_paygent/paygent_credit.php"
213                ,"memo01" => $_POST["merchant_id"]
214                ,"memo02" => $_POST["connect_id"]
215                ,"memo03" => $val
216                ,"memo04" => $_POST["connect_password"]
217                ,"memo05" => ""
218                ,"del_flg" => "0"
219                ,"charge_flg" => "2"
220                ,"upper_rule_max" => CHARGE_MAX
221               
222            );
223        }
224       
225        // ¥³¥ó¥Ó¥Ë¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤ì¤Ð¥³¥ó¥Ó¥Ë¤òÅÐÏ¿¤¹¤ë
226        if($val == 2){
227            $arrParam = array();
228            $arrParam['payment_limit_date'] = $_POST['conveni_limit_date'];
229           
230            $arrData = array(
231                "payment_method" => "PAYGENT¥³¥ó¥Ó¥Ë"
232                ,"fix" => 3
233                ,"creator_id" => $objSess->member_id
234                ,"create_date" => "now()"
235                ,"update_date" => "now()"
236                ,"upper_rule" => $upper_rule
237                ,"module_id" => $module_id
238                ,"module_path" => MODULE_PATH . "mdl_paygent/paygent_conveni.php"
239                ,"memo01" => $_POST["merchant_id"]
240                ,"memo02" => $_POST["connect_id"]
241                ,"memo03" => $val
242                ,"memo04" => $_POST["connect_password"]
243                ,"memo05" => serialize($arrParam)
244                ,"del_flg" => "0"
245                ,"charge_flg" => "1"
246                ,"upper_rule_max" => $upper_rule_max
247            );
248        }
249       
250        // ATM·èºÑ¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤ì¤ÐATM·èºÑ¤òÅÐÏ¿¤¹¤ë
251        if($val == 3){
252            $arrParam = array();
253            $arrParam['payment_detail'] = $_POST['payment_detail'];
254            $arrParam['payment_limit_date'] = $_POST['atm_limit_date'];
255           
256            $arrData = array(
257                "payment_method" => "PAYGENTATM·èºÑ"
258                ,"fix" => 3
259                ,"creator_id" => $objSess->member_id
260                ,"create_date" => "now()"
261                ,"update_date" => "now()"
262                ,"upper_rule" => $upper_rule
263                ,"module_id" => $module_id
264                ,"module_path" => MODULE_PATH . "mdl_paygent/paygent_atm.php"
265                ,"memo01" => $_POST["merchant_id"]
266                ,"memo02" => $_POST["connect_id"]
267                ,"memo03" => $val
268                ,"memo04" => $_POST["connect_password"]
269                ,"memo05" => serialize($arrParam)
270                ,"del_flg" => "0"
271                ,"charge_flg" => "1"
272                ,"upper_rule_max" => $upper_rule_max
273            );
274        }
275       
276        // ¶ä¹ÔNET¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤ì¤ÐATM·èºÑ¤òÅÐÏ¿¤¹¤ë
277        if($val == 4){
278            $arrParam = array();
279            $arrParam['claim_kana'] = $_POST['claim_kana'];
280            $arrParam['claim_kanji'] = $_POST['claim_kanji'];
281            $arrData = array(
282                "payment_method" => "PAYGENT¶ä¹Ô¥Í¥Ã¥È"
283                ,"fix" => 3
284                ,"creator_id" => $objSess->member_id
285                ,"create_date" => "now()"
286                ,"update_date" => "now()"
287                ,"upper_rule" => $upper_rule
288                ,"module_id" => $module_id
289                ,"module_path" => MODULE_PATH . "mdl_paygent/paygent_bank.php"
290                ,"memo01" => $_POST["merchant_id"]
291                ,"memo02" => $_POST["connect_id"]
292                ,"memo03" => $val
293                ,"memo04" => $_POST["connect_password"]
294                ,"memo05" => serialize($arrParam)
295                ,"del_flg" => "0"
296                ,"charge_flg" => "1"
297                ,"upper_rule_max" => $upper_rule_max
298            );
299        }
300       
301       
302        // ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤ì¤ÐUPDATE¡¢Ìµ¤±¤ì¤ÐINSERT
303        if(count($arrPaymentData) > 0){
304            $objQuery->update("dtb_payment", $arrData, " module_id = '" . $module_id . "' AND memo03 = '" . $val ."'");
305        }else{
306            $arrData["rank"] = $max_rank + 1;
307            $objQuery->insert("dtb_payment", $arrData);
308        }
309    }
310}
311
312// ¥³¥ó¥Ó¥ËÆþ¶â³Îǧ½èÍý
313function lfEpsilonCheck(){
314    global $objQuery;
315   
316    // trans_code ¤ò»ØÄꤵ¤ì¤Æ¤¤¤Æ³î¤Ä¡¢Æþ¶âºÑ¤ß¤Î¾ì¹ç
317    if($_POST["trans_code"] != "" and $_POST["paid"] == 1 and $_POST["order_number"] != ""){
318        // ¥¹¥Æ¡¼¥¿¥¹¤òÆþ¶âºÑ¤ß¤ËÊѹ¹¤¹¤ë
319        $sql = "UPDATE dtb_order SET status = 6, update_date = now() WHERE order_id = ? AND memo04 = ? ";
320        $objQuery->query($sql, array($_POST["order_number"], $_POST["trans_code"]));
321       
322        // POST¤ÎÆâÍƤòÁ´¤Æ¥í¥°Êݸ
323        $log_path = DATA_PATH . "logs/epsilon.log";
324        gfPrintLog("epsilon conveni start---------------------------------------------------------", $log_path);
325        foreach($_POST as $key => $val){
326            gfPrintLog( "\t" . $key . " => " . $val, $log_path);
327        }
328        gfPrintLog("epsilon conveni end-----------------------------------------------------------", $log_path);
329       
330        //±þÅú·ë²Ì¤òɽ¼¨
331        echo "1";
332    }
333}
334
335?>
Note: See TracBrowser for help on using the repository browser.