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

Revision 15168, 3.8 KB checked in by naka, 14 years ago (diff)

ペイジェント決済モジュール

Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7require_once(MODULE_PATH . "mdl_paygent/mdl_paygent.inc");
8
9class LC_Page {
10    function LC_Page() {
11        /** ɬ¤º»ØÄꤹ¤ë **/
12        $this->tpl_mainpage = MODULE_PATH . 'mdl_paygent/paygent_credit.tpl';       // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
13        /*
14         session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
15         ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£
16         private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
17        */
18        session_cache_limiter('private-no-expire');     
19    }
20}
21
22$objPage = new LC_Page();
23$objView = new SC_SiteView();
24$objCampaignSess = new SC_CampaignSession();
25$objSiteInfo = $objView->objSiteInfo;
26$arrInfo = $objSiteInfo->data;
27
28// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
29$objFormParam = new SC_FormParam();
30// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
31lfInitParam();
32// POSTÃͤμèÆÀ
33$objFormParam->setParam($_POST);
34
35// ¥«¡¼¥È½¸·×½èÍý
36$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
37
38// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆɹþ
39$arrData = sfGetOrderTemp($uniqid);
40
41// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
42$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
43
44switch($_POST['mode']) {
45// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
46case 'return':
47    // Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
48    $objSiteSess->setRegistFlag();
49    header("Location: " . URL_SHOP_CONFIRM);
50    exit;
51    break;
52// ¼¡¤Ø
53case 'next':
54    // ÆþÎÏÃͤÎÊÑ´¹
55    $objFormParam->convParam();
56    $objPage->arrErr = lfCheckError($arrRet);
57    // ÆþÎÏ¥¨¥é¡¼¤Ê¤·¤Î¾ì¹ç
58    if(count($objPage->arrErr) == 0) {
59         // ÆþÎϥǡ¼¥¿¤Î¼èÆÀ¤ò¹Ô¤¦
60        $arrInput = $objFormParam->getHashArray();
61        // ¥¯¥ì¥¸¥Ã¥ÈÅÅʸÁ÷¿®
62        $arrRet = sfSendPaygentCredit($arrData, $arrInput, $uniqid);       
63       
64        // À®¸ù
65        if($arrRet['payment_id'] != "") {
66            // Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
67            $objSiteSess->setRegistFlag();
68            header("Location: " . URL_SHOP_COMPLETE);
69        } else {
70            // ¼ºÇÔ
71            $objPage->tpl_error = "ǧ¾Ú¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
72        }
73    }
74    break;
75}
76
77$objDate = new SC_Date();
78$objDate->setStartYear(RELEASE_YEAR);
79$objDate->setEndYear(RELEASE_YEAR + CREDIT_ADD_YEAR);
80$objPage->arrYear = $objDate->getZeroYear();
81$objPage->arrMonth = $objDate->getZeroMonth();
82
83// ¶¦Ä̤Îɽ¼¨½àÈ÷
84$objPage = sfPaygentDisp($objPage, $payment_id);
85
86$objPage->arrForm = $objFormParam->getFormParamList();
87$objView->assignobj($objPage);
88// ¥Õ¥ì¡¼¥à¤òÁªÂò(¥­¥ã¥ó¥Ú¡¼¥ó¥Ú¡¼¥¸¤«¤éÁ«°Ü¤Ê¤éÊѹ¹)
89$objCampaignSess->pageView($objView);
90//-------------------------------------------------------------------------------------------------------
91/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
92function lfInitParam() {
93    global $objFormParam;
94    $objFormParam->addParam("¥«¡¼¥ÉÈÖ¹æ1", "card_no01", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
95    $objFormParam->addParam("¥«¡¼¥ÉÈÖ¹æ2", "card_no02", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
96    $objFormParam->addParam("¥«¡¼¥ÉÈÖ¹æ3", "card_no03", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
97    $objFormParam->addParam("¥«¡¼¥ÉÈÖ¹æ4", "card_no04", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
98    $objFormParam->addParam("¥«¡¼¥É´ü¸Âǯ", "card_year", 2, "n", array("EXIST_CHECK", "NUM_COUNT_CHECK", "NUM_CHECK"));
99    $objFormParam->addParam("¥«¡¼¥É´ü¸Â·î", "card_month", 2, "n", array("EXIST_CHECK", "NUM_COUNT_CHECK", "NUM_CHECK"));
100    $objFormParam->addParam("À«", "card_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "ALPHA_CHECK"));
101    $objFormParam->addParam("̾", "card_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "ALPHA_CHECK"));
102}
103
104/* ÆþÎÏÆâÍƤΥÁ¥§¥Ã¥¯ */
105function lfCheckError() {
106    global $objFormParam;
107    // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£
108    $arrRet =  $objFormParam->getHashArray();
109    $objErr = new SC_CheckError($arrRet);
110    $objErr->arrErr = $objFormParam->checkError();
111   
112    return $objErr->arrErr;
113}
114?>
Note: See TracBrowser for help on using the repository browser.