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

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