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

Revision 15199, 9.6 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.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    $objFormParam->addParam("¥Þ¡¼¥Á¥ã¥ó¥ÈID", "merchant_id", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
94    $objFormParam->addParam("ÀܳID", "connect_id", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
95    $objFormParam->addParam("Àܳ¥Ñ¥¹¥ï¡¼¥É", "connect_password", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
96    $objFormParam->addParam("»Ùʧ´ü¸ÂÆü", "conveni_limit_date", 2, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
97    $objFormParam->addParam("»Ùʧ´ü¸ÂÆü", "atm_limit_date", 2, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
98    $objFormParam->addParam("»ÙʧÀâÌÀʸ(¥«¥Ê)", "payment_detail", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK", "KANA_CHECK"), "¥ª¥ó¥é¥¤¥ó¥·¥ç¥Ã¥Ô¥ó¥°");
99    $objFormParam->addParam("»ÙʧÀâÌÀʸ(´Á»ú)", "claim_kanji", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"), "¥ª¥ó¥é¥¤¥ó¥·¥ç¥Ã¥Ô¥ó¥°"); 
100    $objFormParam->addParam("»ÙʧÀâÌÀʸ(¥«¥Ê)", "claim_kana", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK", "KANA_CHECK"), "¥ª¥ó¥é¥¤¥ó¥·¥ç¥Ã¥Ô¥ó¥°");     
101    $objFormParam->addParam("ÍøÍÑ·èºÑ", "payment", "", "", array("EXIST_CHECK"));
102    return $objFormParam;
103}
104   
105// ¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
106function lfCheckError(){
107    global $objFormParam;
108    $arrErr = $objFormParam->checkError();
109    if($_POST['conveni_limit_date'] != "" && !($_POST['conveni_limit_date'] >= 1 &&  $_POST['conveni_limit_date'] <= 60)) {
110            $arrErr['conveni_limit_date'] = "¢¨ »Ùʧ´ü¸ÂÆü¤Ï¡¢1¡Á60Æü¤Þ¤Ç¤Î´Ö¤ÇÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£<br>";
111    }
112    if($_POST['atm_limit_date'] != "" && !($_POST['atm_limit_date'] >= 0 &&  $_POST['atm_limit_date'] <= 60)) {
113            $arrErr['atm_limit_date'] = "¢¨ »Ùʧ´ü¸ÂÆü¤Ï¡¢0¡Á60Æü¤Þ¤Ç¤Î´Ö¤ÇÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£<br>";
114    }
115    return $arrErr;
116}
117
118// ÅÐÏ¿¥Ç¡¼¥¿¤òÆɤ߹þ¤à
119function lfLoadData(){
120    global $objFormParam;
121   
122    //¥Ç¡¼¥¿¤ò¼èÆÀ
123    $arrRet = sfGetPaymentDB(MDL_PAYGENT_ID, "AND del_flg = '0'");
124    $objFormParam->setParam($arrRet[0]);
125   
126   
127    // ²èÌÌɽ¼¨ÍѤ˥ǡ¼¥¿¤òÊÑ´¹
128    $arrDisp = array();
129   
130    foreach($arrRet as $key => $val){
131        // ÍøÍÑ·èºÑ¤òɽ¼¨ÍѤËÊÑ´¹
132        $arrDisp["payment"][$key] = $val["payment"];
133       
134        switch($val['payment']) {
135        // ¥¯¥ì¥¸¥Ã¥È
136        case '1':
137            break;
138        // ¥³¥ó¥Ó¥Ë
139        case '2':
140            $arrParam = unserialize($val['other_param']);
141            $arrDisp['conveni_limit_date'] = $arrParam['payment_limit_date'];
142            break;
143        // ATM·èºÑ
144        case '3':
145            $arrParam = unserialize($val['other_param']);
146            $arrDisp['payment_detail'] = $arrParam['payment_detail'];
147            $arrDisp['atm_limit_date'] = $arrParam['payment_limit_date'];
148            break;
149        // ¥Í¥Ã¥È¥Ð¥ó¥¯
150        case '4':
151            $arrParam = unserialize($val['other_param']);
152            $arrDisp['claim_kana'] = $arrParam['claim_kana'];
153            $arrDisp['claim_kanji'] = $arrParam['claim_kanji'];
154            break;                 
155        }
156    }   
157   
158    $objFormParam->setParam($arrDisp);
159}
160
161// ¥Ç¡¼¥¿¤Î¹¹¿·½èÍý
162function lfUpdPaymentDB($module_id){
163    global $objQuery;
164    global $objSess;
165       
166    // ´ØÏ¢¤¹¤ë»Ùʧ¤¤ÊýË¡¤Îdel_flg¤òºï½ü¤Ë¤·¤Æ¤ª¤¯
167    $del_sql = "UPDATE dtb_payment SET del_flg = 1 WHERE module_id = ? ";
168    $arrDel = array($module_id);
169    $objQuery->query($del_sql, $arrDel);
170   
171    // ¥Ç¡¼¥¿ÅÐÏ¿
172    foreach($_POST["payment"] as $key => $val){
173        // ¥é¥ó¥¯¤ÎºÇÂçÃͤò¼èÆÀ¤¹¤ë
174        $max_rank = $objQuery->getone("SELECT max(rank) FROM dtb_payment");
175
176        // »ÙʧÊýË¡¥Ç¡¼¥¿¤ò¼èÆÀ         
177        $arrPaymentData = sfGetPaymentDB(MDL_PAYGENT_ID, "AND memo03 = ?", array($val));
178       
179        // ¥¯¥ì¥¸¥Ã¥È¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤ì¤Ð¥¯¥ì¥¸¥Ã¥È¤òÅÐÏ¿¤¹¤ë
180        if($val == 1){
181            $arrData = array(           
182                "payment_method" => "PAYGENT¥¯¥ì¥¸¥Ã¥È"
183                ,"fix" => 3
184                ,"creator_id" => $objSess->member_id
185                ,"create_date" => "now()"
186                ,"update_date" => "now()"
187                ,"upper_rule" => 500000
188                ,"module_id" => $module_id
189                ,"module_path" => MODULE_PATH . "mdl_paygent/paygent_credit.php"
190                ,"memo01" => $_POST["merchant_id"]
191                ,"memo02" => $_POST["connect_id"]
192                ,"memo03" => $val
193                ,"memo04" => $_POST["connect_password"]
194                ,"memo05" => ""
195                ,"del_flg" => "0"
196                ,"charge_flg" => "2"
197                ,"upper_rule_max" => CHARGE_MAX
198               
199            );
200        }
201       
202        // ¥³¥ó¥Ó¥Ë¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤ì¤Ð¥³¥ó¥Ó¥Ë¤òÅÐÏ¿¤¹¤ë
203        if($val == 2){
204            $arrParam = array();
205            $arrParam['payment_limit_date'] = $_POST['conveni_limit_date'];
206           
207            $arrData = array(
208                "payment_method" => "PAYGENT¥³¥ó¥Ó¥Ë"
209                ,"fix" => 3
210                ,"creator_id" => $objSess->member_id
211                ,"create_date" => "now()"
212                ,"update_date" => "now()"
213                ,"upper_rule" => $upper_rule
214                ,"module_id" => $module_id
215                ,"module_path" => MODULE_PATH . "mdl_paygent/paygent_conveni.php"
216                ,"memo01" => $_POST["merchant_id"]
217                ,"memo02" => $_POST["connect_id"]
218                ,"memo03" => $val
219                ,"memo04" => $_POST["connect_password"]
220                ,"memo05" => serialize($arrParam)
221                ,"del_flg" => "0"
222                ,"charge_flg" => "1"
223                ,"upper_rule_max" => $upper_rule_max
224            );
225        }
226       
227        // ATM·èºÑ¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤ì¤ÐATM·èºÑ¤òÅÐÏ¿¤¹¤ë
228        if($val == 3){
229            $arrParam = array();
230            $arrParam['payment_detail'] = $_POST['payment_detail'];
231            $arrParam['payment_limit_date'] = $_POST['atm_limit_date'];
232           
233            $arrData = array(
234                "payment_method" => "PAYGENTATM·èºÑ"
235                ,"fix" => 3
236                ,"creator_id" => $objSess->member_id
237                ,"create_date" => "now()"
238                ,"update_date" => "now()"
239                ,"upper_rule" => $upper_rule
240                ,"module_id" => $module_id
241                ,"module_path" => MODULE_PATH . "mdl_paygent/paygent_atm.php"
242                ,"memo01" => $_POST["merchant_id"]
243                ,"memo02" => $_POST["connect_id"]
244                ,"memo03" => $val
245                ,"memo04" => $_POST["connect_password"]
246                ,"memo05" => serialize($arrParam)
247                ,"del_flg" => "0"
248                ,"charge_flg" => "1"
249                ,"upper_rule_max" => $upper_rule_max
250            );
251        }
252       
253        // ¶ä¹ÔNET¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤ì¤ÐATM·èºÑ¤òÅÐÏ¿¤¹¤ë
254        if($val == 4){
255            $arrParam = array();
256            $arrParam['claim_kana'] = $_POST['claim_kana'];
257            $arrParam['claim_kanji'] = $_POST['claim_kanji'];
258            $arrData = array(
259                "payment_method" => "PAYGENT¶ä¹Ô¥Í¥Ã¥È"
260                ,"fix" => 3
261                ,"creator_id" => $objSess->member_id
262                ,"create_date" => "now()"
263                ,"update_date" => "now()"
264                ,"upper_rule" => $upper_rule
265                ,"module_id" => $module_id
266                ,"module_path" => MODULE_PATH . "mdl_paygent/paygent_bank.php"
267                ,"memo01" => $_POST["merchant_id"]
268                ,"memo02" => $_POST["connect_id"]
269                ,"memo03" => $val
270                ,"memo04" => $_POST["connect_password"]
271                ,"memo05" => serialize($arrParam)
272                ,"del_flg" => "0"
273                ,"charge_flg" => "1"
274                ,"upper_rule_max" => $upper_rule_max
275            );
276        }
277       
278       
279        // ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤ì¤ÐUPDATE¡¢Ìµ¤±¤ì¤ÐINSERT
280        if(count($arrPaymentData) > 0){
281            $objQuery->update("dtb_payment", $arrData, " module_id = '" . $module_id . "' AND memo03 = '" . $val ."'");
282        }else{
283            $arrData["rank"] = $max_rank + 1;
284            $objQuery->insert("dtb_payment", $arrData);
285        }
286    }
287}
288
289// ¥³¥ó¥Ó¥ËÆþ¶â³Îǧ½èÍý
290function lfEpsilonCheck(){
291    global $objQuery;
292   
293    // trans_code ¤ò»ØÄꤵ¤ì¤Æ¤¤¤Æ³î¤Ä¡¢Æþ¶âºÑ¤ß¤Î¾ì¹ç
294    if($_POST["trans_code"] != "" and $_POST["paid"] == 1 and $_POST["order_number"] != ""){
295        // ¥¹¥Æ¡¼¥¿¥¹¤òÆþ¶âºÑ¤ß¤ËÊѹ¹¤¹¤ë
296        $sql = "UPDATE dtb_order SET status = 6, update_date = now() WHERE order_id = ? AND memo04 = ? ";
297        $objQuery->query($sql, array($_POST["order_number"], $_POST["trans_code"]));
298       
299        // POST¤ÎÆâÍƤòÁ´¤Æ¥í¥°Êݸ
300        $log_path = DATA_PATH . "logs/epsilon.log";
301        gfPrintLog("epsilon conveni start---------------------------------------------------------", $log_path);
302        foreach($_POST as $key => $val){
303            gfPrintLog( "\t" . $key . " => " . $val, $log_path);
304        }
305        gfPrintLog("epsilon conveni end-----------------------------------------------------------", $log_path);
306       
307        //±þÅú·ë²Ì¤òɽ¼¨
308        echo "1";
309    }
310}
311
312?>
Note: See TracBrowser for help on using the repository browser.