source: branches/dev/data/downloads/module/mdl_epsilon/card.php @ 8

Revision 8, 4.4 KB checked in by root, 16 years ago (diff)

new import

Line 
1<?php
2/*
3 * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7
8require_once("../require.php");
9require_once(DATA_PATH . "module/Request.php");
10require_once(MODULE_PATH . "mdl_epsilon/mdl_epsilon.inc");
11
12class LC_Page {
13    function LC_Page() {
14        /** ɬ¤º»ØÄꤹ¤ë **/
15        $this->tpl_mainpage = 'mdl_epsilon/card.tpl';           // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
16        /*
17         session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
18         ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£
19         private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
20        */
21        session_cache_limiter('private-no-expire');     
22    }
23}
24
25$objPage = new LC_Page();
26$objView = new SC_SiteView();
27$objCampaignSess = new SC_CampaignSession();
28$objSiteInfo = $objView->objSiteInfo;
29$arrInfo = $objSiteInfo->data;
30
31// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
32$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
33
34// ¥«¡¼¥È½¸·×½èÍý
35$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
36
37// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆɹþ
38$arrData = sfGetOrderTemp($uniqid);
39
40// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
41$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
42
43// Âåɽ¾¦ÉʾðÊó
44$arrMainProduct = $objPage->arrProductsClass[0];
45
46// »Ùʧ¤¤¾ðÊó¤ò¼èÆÀ
47$arrPayment = $objQuery->getall("SELECT module_id, memo01, memo02, memo03, memo04, memo05, memo06, memo07, memo08, memo09, memo10 FROM dtb_payment WHERE payment_id = ? ", array($arrData["payment_id"]));
48
49// trans_code¤ËÃͤ¬¤¢¤ê³î¤Ä¡¢Àµ¾ï½ªÎ»¤Î¤È¤­¤Ï¥ª¡¼¥À¡¼³Îǧ¤ò¹Ô¤¦¡£
50if($_GET["result"] == "1"){
51   
52    // Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
53    $objSiteSess->setRegistFlag();
54   
55    // GET¥Ç¡¼¥¿¤òÊݸ
56    $arrVal["credit_result"] = $_GET["result"];
57    $arrVal["memo01"] = PAYMENT_CREDIT_ID;
58    $arrVal["memo03"] = $arrPayment[0]["module_id"];
59    $sqlval["memo04"] = sfGetXMLValue($arrXML,'RESULT','TRANS_CODE');
60
61    // ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥³¡¼¥É
62    $arrMemo["trans_code"] = array("name"=>"Epsilon¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥³¡¼¥É", "value" => $_GET["trans_code"]);
63    $arrVal["memo02"] = serialize($arrMemo);
64
65    // ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë¹¹¿·
66    sfRegistTempOrder($uniqid, $arrVal);
67
68    // ´°Î»²èÌ̤Ø
69    header("Location: " .  URL_SHOP_COMPLETE);
70}
71
72// ¥Ç¡¼¥¿Á÷¿®
73lfSendCredit($arrData, $arrPayment, $arrMainProduct);
74
75//---------------------------------------------------------------------------------------------------------------------------------------------------------
76
77// ¥Ç¡¼¥¿Á÷¿®½èÍý
78function lfSendCredit($arrData, $arrPayment, $arrMainProduct, $again = true){
79    global $objSiteSess;
80    global $objCampaignSess;
81   
82    // ¥Ç¡¼¥¿Á÷¿®ÀèCGI
83    $order_url = $arrPayment[0]["memo02"];
84
85    // Èó²ñ°÷¤Î¤È¤­¤Ï user_id ¤Ë not_member¤ÈÁ÷¤ë
86    ($arrData["customer_id"] == 0) ? $user_id = "not_member" : $user_id = $arrData["customer_id"]; 
87   
88    // Á÷¿®¥Ç¡¼¥¿À¸À®
89    $item_name = $arrMainProduct["name"] . "¡ß" . $arrMainProduct["quantity"] . "¸Ä (Âåɽ)";
90    $arrSendData = array(
91        'contract_code' => $arrPayment[0]["memo01"],                        // ·ÀÌ󥳡¼¥É
92        'user_id' => $user_id ,                                             // ¥æ¡¼¥¶ID
93        'user_name' => $arrData["order_name01"].$arrData["order_name02"],   // ¥æ¡¼¥¶Ì¾
94        'user_mail_add' => $arrData["order_email"],                         // ¥á¡¼¥ë¥¢¥É¥ì¥¹
95        'order_number' => $arrData["order_id"],                             // ¥ª¡¼¥À¡¼ÈÖ¹æ
96        'item_code' => $arrMainProduct["product_code"],                     // ¾¦ÉÊ¥³¡¼¥É(Âåɽ)
97        'item_name' => $item_name,                                          // ¾¦ÉÊ̾(Âåɽ)
98        'item_price' => $arrData["payment_total"],                          // ¾¦ÉʲÁ³Ê(Àǹþ¤ßÁí³Û)
99        'st_code' => $arrPayment[0]["memo04"],                              // ·èºÑ¶èʬ
100        'mission_code' => '1',                                              // ²Ý¶â¶èʬ(¸ÇÄê)
101        'process_code' => '1',                                              // ½èÍý¶èʬ(¸ÇÄê)
102        'xml' => '1',                                                       // ±þÅú·Á¼°(¸ÇÄê)
103        'memo1' => "",                                                      // ͽÈ÷01
104        'memo2' => ECCUBE_PAYMENT . "_" . date("YmdHis"),                   // ͽÈ÷02
105    );
106
107    // ¥Ç¡¼¥¿Á÷¿®
108    $arrXML = sfPostPaymentData($order_url, $arrSendData);
109   
110    // ¥¨¥é¡¼¤¬¤¢¤ë¤«¥Á¥§¥Ã¥¯¤¹¤ë
111    $err_code = sfGetXMLValue($arrXML,'RESULT','ERR_CODE');
112   
113    if($err_code != "") {
114        $err_detail = sfGetXMLValue($arrXML,'RESULT','ERR_DETAIL');
115       
116        // ·èºÑ¶èʬ¥¨¥é¡¼¤Î¾ì¹ç¤Ë¤Ï VISA,MASTER ¤Î¤ß¤ÇºÆÁ÷¿®¤ò»î¤ß¤ë
117        if($err_code == "909" and $again){
118            $arrPayment[0]["memo04"] = "10000-0000-00000";
119            lfSendCredit($arrData, $arrPayment, $arrMainProduct, false);
120        }
121        sfDispSiteError(FREE_ERROR_MSG, "", true, "¹ØÆþ½èÍýÃæ¤Ë°Ê²¼¤Î¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£<br /><br /><br />¡¦" . $err_detail . "<br /><br /><br />¤³¤Î¼ê³¤­¤Ï̵¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£");
122    } else {
123        // Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
124        $objSiteSess->setRegistFlag();
125       
126        $url = sfGetXMLValue($arrXML,'RESULT','REDIRECT');
127        header("Location: " . $url);
128    }
129}
130
131?>
Note: See TracBrowser for help on using the repository browser.