Index: /branches/version-1/data/downloads/module/mdl_cybs/class/mdl_cybs_config.php
===================================================================
--- /branches/version-1/data/downloads/module/mdl_cybs/class/mdl_cybs_config.php	(revision 17188)
+++ /branches/version-1/data/downloads/module/mdl_cybs/class/mdl_cybs_config.php	(revision 17224)
@@ -129,4 +129,90 @@
         return $arrData;
     }
+
+    /**
+     * 3D¥»¥­¥å¥¢¤òÍøÍÑ¤¹¤ë¤«¤É¤¦¤«
+     *
+     * @return boolean
+     */
+    function use3D() {
+        $use3D = $this->getConfig('cybs_3d_use');
+
+        return $use3D
+            ? true
+            : false;
+    }
+
+    /**
+     * ¥ª¥ó¥Ç¥Þ¥ó¥É²Ý¶â¤¬Í­¸ú¤«¤É¤¦¤«
+     *
+     * @return boolean
+     */
+    function enableOndemand() {
+        // Èó²ñ°÷¤ÏÌµ¸ú
+        $objCustomer = new SC_Customer;
+        if (!$objCustomer->isLoginSuccess()) return false;
+
+        $useOndemand = $this->getConfig('cybs_ondemand_use');
+
+        return $useOndemand ? true : false;
+    }
+
+    /**
+     * ²ñ°÷¤Î¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥óID¤òÊÖ¤¹.
+     *
+     * @return array
+     */
+    function getSubsIds() {
+        $objCustomer = new SC_Customer;
+        $objCustomer->updateSession();
+        $subsIdsString = $objCustomer->getValue('cybs_subs_id');
+
+        if (is_null($subsIdsString)) {
+            return array();
+        }
+
+        $arrSubsIds = unserialize($subsIdsString);
+
+        return is_array($arrSubsIds) ? $arrSubsIds : array();
+    }
+
+    /**
+     * ¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥óID¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÅÐÏ¿¤¹¤ë.
+     *
+     * @param string $subsId
+     * @param array $arrSubsResults
+     */
+    function addSubsId($subsId) {
+        if (!$this->canAddSubsId()) {
+            return;
+        }
+        $objCustomer = new SC_Customer;
+        $customerId = $objCustomer->getValue('customer_id');
+
+        $arrSubsId = $this->getSubsIds();
+
+        print_r($arrSubsId);
+        // ¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥óID¤¬´û¤ËÂ¸ºß¤¹¤ë¾ì¹ç¤ÏÄÉ²Ã¤·¤Ê¤¤
+        if (in_array($subsId, $arrSubsId)) return;
+
+        $arrSubsId[] = $subsId;
+        $arrUpdate = array('cybs_subs_id' => serialize($arrSubsId));
+
+        $objQuery = new SC_Query;
+        $objQuery->update('dtb_customer', $arrUpdate, 'customer_id = ?', array($customerId));
+    }
+
+    /**
+     * ¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥ó¤ÎÅÐÏ¿¿ô¤¬Max¤«¤É¤¦¤«¤òÈ½Äê¤¹¤ë
+     *
+     * @return boolean
+     */
+    function canAddSubsId() {
+        $arrSubsIds = $this->getSubsIds();
+        if (is_array($arrSubsIds) && count($arrSubsIds) < MDL_CYBS_SUBS_ID_MAX) {
+            return true;
+        }
+        return false;
+    }
 }
 ?>
Index: /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_credit_3d.tpl
===================================================================
--- /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_credit_3d.tpl	(revision 17224)
+++ /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_credit_3d.tpl	(revision 17224)
@@ -0,0 +1,27 @@
+<h2>ËÜ¿ÍÇ§¾Ú¥µ¡¼¥Ó¥¹¤ò³«»Ï¤·¤Þ¤¹¡£¤³¤Î¤Þ¤Þ¤Ç¤·¤Ð¤é¤¯¤ªÂÔ¤Á¤¯¤À¤µ¤¤¡£</h2>
+<form name="ACSCall" action="<!--{$AcsUrl}-->" method="POST">
+
+<noscript>
+<br />
+<br />
+<center>
+<h2>
+²èÌÌ¤¬°ÜÆ°¤·¤Ê¤¤¾ì¹ç¤Ï¡ÖOK¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£
+</h2>
+<input type="submit" value="OK">
+</center>
+</noscript>
+
+<input type="hidden" name="PaReq" value="<!--{$PaReq}-->">
+<input type="hidden" name="TermUrl" value="<!--{$TermUrl}-->">
+<input type="hidden" name="MD" value="<!--{$MD}-->">
+
+</form>
+
+<script>
+<!--
+function OnLoadEvent() {
+    document.ACSCall.submit();
+}
+//-->
+</script>
Index: /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_credit.php
===================================================================
--- /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_credit.php	(revision 16991)
+++ /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_credit.php	(revision 17224)
@@ -8,11 +8,20 @@
 require_once MODULE_PATH . "mdl_cybs/class/mdl_cybs_config.php";
 require_once MODULE_PATH . "mdl_cybs/class/mdl_cybs_request.php";
-dl(MDL_CYBS_EXT);
+
+// extension¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¥¨¥é¡¼²èÌÌÉ½¼¨
+if (!lfLoadModCybs()) {
+    sfDispSiteError(FREE_ERROR_MSG, '', false,
+        '¤³¤Î·èºÑ¤Ï»ÈÍÑ¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤»¤ó¡£<br>¤ª¼ê¿ô¤Ç¤¹¤¬¤ª»ÙÊ§¤¤ÊýË¡¤òÁªÂò¤·Ä¾¤·¤Æ²¼¤µ¤¤¡£');
+}
 
 class LC_Page {
     function LC_Page() {
         $this->tpl_mainpage = MODULE_PATH . 'mdl_cybs/mdl_cybs_credit.tpl';
+        // »ÙÊ§¤¤ÊýË¡
         global $arrPayMethod;
         $this->arrPayMethod = $arrPayMethod;
+        // ¥«¡¼¥É²ñ¼Ò¼ïÎà
+        global $arrCardCompany;
+        $this->arrCardCompany = $arrCardCompany;
         /**
          * session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
@@ -31,4 +40,8 @@
 $arrInfo = sf_getBasisData();
 
+$objCybs =& Mdl_Cybs_Config::getInstanse();
+$objPage->enable_ondemand = $objCybs->enableOndemand(); //¥ª¥ó¥Ç¥Þ¥ó¥É²Ý¶â¤Î»ÈÍÑ²ÄÈÝ
+$objPage->tpl_payment_method = '¥µ¥¤¥Ð¡¼¥½¡¼¥¹·èºÑ';
+
 $objDate = new SC_Date();
 $objDate->setStartYear(RELEASE_YEAR);
@@ -40,16 +53,16 @@
 $uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
 
-$objForm = lfInitParam();
+$objForm = lfInitParam($_POST);
 $objPage->arrForm = $objForm->getFormParamList();
 
-$mode = isset($_POST['mode']) ? $_POST['mode'] : '';
-switch($mode) {
+switch(lfGetMode()) {
 
 case 'register':
     // ÆþÎÏ¹àÌÜ¤Î¸¡¾Ú
-    if ($arrErr = lfCheckError($objForm)) {
+    if ($arrErr = $objForm->checkError()) {
         $objPage->arrErr = $arrErr;
         break;
     }
+
     // ¥«¡¼¥È½¸·×½èÍý
     $objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
@@ -59,27 +72,113 @@
     $arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
 
-    // ¥ê¥¯¥¨¥¹¥È¤ÎÁ÷¿®
-    gfPrintLog('#### cybs request start ###' , MDL_CYBS_LOG);
-    $arrResults = lfSendRequest($objForm->getHashArray(), $arrData);
-    // ·ë²Ì¤ÎÈ½Äê
-    $e = lfIsError($arrResults);
-    if (PEAR::isError($e)) {
-        gfPrintLog('#### cybs request error ###' , MDL_CYBS_LOG);
-        gfPrintLog('-> cybs request results' , MDL_CYBS_LOG);
+    /**
+     * ¥ª¥ó¥Ç¥Þ¥ó¥É²Ý¶â¤¬Í­¸ú¤Ç¡¢¤«¤Ä¥«¡¼¥É¤òÅÐÏ¿¤¹¤ë¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤¿¾ì¹ç¤Ï¡¢
+     * ¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥ó¤òºîÀ®¤¹¤ë
+     */
+    if ($objCybs->enableOndemand() && $objForm->getValue('register_ondemand')) {
+        // ÅÐÏ¿·ï¿ô¤Î¥Á¥§¥Ã¥¯
+        if (!$objCybs->canAddSubsId()) {
+            $objPage->tpl_error = 'ÅÐÏ¿½ÐÍè¤ë¥«¡¼¥É¤Î·ï¿ô¤Ï' . MDL_CYBS_SUBS_ID_MAX . "·ï¤Þ¤Ç¤Ç¤¹¡£\n";
+            gfPrintLog(' -> ondemand error: over card max', MDL_CYBS_LOG);
+            break;
+        }
+        // ¥ª¥ó¥Ç¥Þ¥ó¥É²Ý¶â¤Î¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®¤¹¤ë
+        $arrResults = lfSendRequest(lfCreateOndemandParam($objForm->getHashArray(), $arrData));
+        if (PEAR::isError($e = lfIsError($arrResults))) {
+            $objPage->tpl_error = $e->getMessage();
+            gfPrintLog(' -> ondemand error: ' . $e->getMessage(), MDL_CYBS_LOG);
+            gfPrintLog(print_r($arrResults, true), MDL_CYBS_LOG);
+            break;
+        }
+        // ¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥óID¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ØÄÉ²Ã¤¹¤ë
+        $subsId = $arrResults['pay_subscription_create_subscription_id'];
+        $objCybs->addSubsId($subsId);
+    }
+
+    $authAddParam = null; // ¥Á¥ã¡¼¥¸¥Ð¥Ã¥¯ÍÑÄÉ²Ã¥Ñ¥é¥á¡¼¥¿
+
+    // 3D¥»¥­¥å¥¢»ÈÍÑÀßÄêÈ½Äê
+    if ($objCybs->use3D() && !$objCybs->enableOndemand()) {
+        // 3D¥»¥­¥å¥¢¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®¤¹¤ë
+        $arrResults = lfSendRequest(lfCreateEnrollParam($objForm->getHashArray(), $arrData));
+        // ¥¨¥é¡¼½èÍý
+        if (PEAR::isError($e = lfIsError($arrResults))) {
+            $objPage->tpl_error = $e->getMessage();
+            gfPrintLog(' -> 3d(enroll) error: ' . $e->getMessage(), MDL_CYBS_LOG);
+            gfPrintLog(print_r($arrResults, true), MDL_CYBS_LOG);
+            break;
+        }
+
+        /**
+         * ÅÐÏ¿Í­¤ê¤Î¾ì¹ç¤Ï¥ê¥À¥¤¥ì¥¯¥ÈHTML¤ò½ÐÎÏ¤¹¤ë.
+         * ÅÐÏ¿Ìµ¤·¤Ç¤«¤ÄÍ¿¿®¤Ø¿Ê¤á¤ë¾ì¹ç(¾åµ­¥¨¥é¡¼È½Äê¤ÇSOK¤Î¾ì¹ç)¤Ï,
+         * ¥Á¥ã¡¼¥¸¥Ð¥Ã¥¯ÍÑ¤Î¥Ñ¥é¥á¡¼¥¿¤òÄÉ²Ã¤·¼¡¤ÎÍ¿¿®¥ê¥¯¥¨¥¹¥È¤Ø¿Ê¤à.
+         */
+        if (isset($arrResults['pa_enroll_rflag']) && $arrResults['pa_enroll_rflag'] == 'DAUTHENTICATE') {
+            $objPage->AcsUrl  = $arrResults['pa_enroll_acs_url'];
+            $objPage->TermUrl = SSL_URL . 'shopping/load_payment_module.php';
+            $objPage->PaReq   = $arrResults['pa_enroll_pareq'];
+            $objPage->MD      = base64_encode(serialize($objForm->getHashArray())); // POST¥Ç¡¼¥¿¤òMD¤ËÊÝ»ý
+            $objPage->tpl_onload   = 'OnLoadEvent()';
+            $objPage->tpl_mainpage = MODULE_PATH . 'mdl_cybs/mdl_cybs_credit_3d.tpl'; // ¥ê¥À¥¤¥ì¥¯¥ÈHTML
+            $objSiteSess->setRegistFlag();
+            break;
+        }
+        // ¥Á¥ã¡¼¥¸¥Ð¥Ã¥¯ÍÑÄÉ²Ã¥Ñ¥é¥á¡¼¥¿
+        $authAddParam = array(
+            'e_commerce_indicator' => $arrResults['pa_enroll_e_commerce_indicator'],
+            'eci_raw'              => '06',
+        );
+        // ¥Þ¥¹¥¿¡¼¥«¡¼¥É¤Î¤ß¤Î¥Ñ¥é¥á¡¼¥¿
+        if ($objForm->getValue('card_company') === '002') $authAddParam['ucaf_collection_indicator'] = '1';
+    }
+
+    $arrSendParam = array();
+    // ¥ª¥ó¥Ç¥Þ¥ó¥É·èºÑ»þ¤Î¥Ñ¥é¥á¡¼¥¿¹½ÃÛ
+    if ($objCybs->enableOndemand() && $objForm->getValue('register_ondemand')) {
+        $arrSendParam = lfCreateAuthParam($objForm->getHashArray(), $arrData);
+        $arrSendParam = lfCreateOndemandAuthParam($subsId, $arrSendParam);
+
+    // ÄÌ¾ï·èºÑ¤Î¥Ñ¥é¥á¡¼¥¿¹½ÃÛ
+    } else {
+        $arrSendParam = lfCreateAuthParam($objForm->getHashArray(), $arrData, $authAddParam);
+    }
+
+    // Í¿¿®¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®¤¹¤ë
+    $arrResults = lfSendRequest($arrSendParam);
+    if (PEAR::isError($e = lfIsError($arrResults))) {
+        $objPage->tpl_error = $e->getMessage();
+        gfPrintLog(' -> auth error: ' . $e->getMessage(), MDL_CYBS_LOG);
         gfPrintLog(print_r($arrResults, true), MDL_CYBS_LOG);
-        $objPage->tpl_error = $e->getMessage();
         break;
     }
 
-    gfPrintLog('#### cybs request successfull ###', MDL_CYBS_LOG);
-    gfPrintLog('-> cybs request results', MDL_CYBS_LOG);
-    gfPrintLog(print_r($arrResults, true), MDL_CYBS_LOG);
-    gfPrintLog('#### cybs request end ###' , MDL_CYBS_LOG);
-
-    // À®¸ù»þ¤Ï´°Î»²èÌÌ¤ØÁ«°Ü
     $objSiteSess->setRegistFlag();
-    lfRegisterOrderTemp($uniqid, $objForm->getHashArray(), $arrResults);
+    //lfRegisterOrderTemp($uniqid, $objForm->getHashArray(), $arrResults);
     header("Location: " . URL_SHOP_COMPLETE);
     exit;
+
+// ¥Ñ¥¹¥ï¡¼¥ÉÆþÎÏ¤«¤é¤ÎÌá¤ê
+case 'verify3d':
+    // ¥«¡¼¥È½¸·×½èÍý
+    $objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+    // °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+    $arrData = sfGetOrderTemp($uniqid);
+    // ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
+    $arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
+
+    // ¸¡¾Ú+Í¿¿®¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®¤¹¤ë
+    $obj3DForm = lfInit3DParam($_POST);
+    $arrResults = lfSendRequest(lfCreateValidateParam($obj3DForm->getHashArray(), $arrData));
+    if (PEAR::isError($e = lfIsError($arrResults))) {
+        $objPage->tpl_error = $e->getMessage();
+        gfPrintLog(' -> error: ' . $e->getMessage(), MDL_CYBS_LOG);
+        gfPrintLog(print_r($arrResults, true), MDL_CYBS_LOG);
+        break;
+    }
+
+    $objSiteSess->setRegistFlag();
+    header("Location: " . URL_SHOP_COMPLETE);
+    break;
 
 // Ìá¤ë¥Ü¥¿¥ó²¡²¼»þ
@@ -91,9 +190,43 @@
 // ÄÌ¾ïÉ½¼¨
 default:
+    // TODO ¥ª¥ó¥Ç¥Þ¥ó¥É¼èÆÀ
+
 }
 
 $objView->assignobj($objPage);
 $objView->display(SITE_FRAME);
-
+sfPrintR($_POST, 'blue');
+sfPrintR($objPage, 'red');
+/**
+ * ¥â¡¼¥É¤ò¼èÆÀ¤¹¤ë
+ *
+ * @return string
+ */
+
+function lfGetMode() {
+    $mode = isset($_POST['mode']) ? $_POST['mode'] : '';
+
+    // 3D¥»¥­¥å¥¢¤ÎÌá¤êÍÑ¡£¥«¡¼¥É²ñ¼Ò¤Î¥Ñ¥¹¥ï¡¼¥ÉÆþÎÏ²èÌÌ¤«¤éÁ«°Ü¤¹¤ë
+    $obj3dForm = lfInit3DParam($_POST);
+    if (!$obj3dForm->checkError()) {
+        $mode = 'verify3d';
+    }
+
+    return $mode;
+}
+
+/**
+ * 3D¥»¥­¥å¥¢Ìá¤êÍÑ¥Ñ¥é¥á¡¼¥¿¤Î½é´ü²½
+ *
+ * @param array $arrParam
+ * @return SC_FormParam
+ */
+function lfInit3DParam($arrParam) {
+    $objForm = new SC_FormParam;
+    $objForm->addParam("PaRes", "PaRes", '', "", array("EXIST_CHECK"));
+    $objForm->addParam("MD", "MD", '', "", array("EXIST_CHECK"));
+    $objForm->setParam($arrParam);
+    return $objForm;
+}
 
 /**
@@ -102,5 +235,5 @@
  * @return SC_FormParam
  */
-function lfInitParam() {
+function lfInitParam($arrParam) {
     $objForm = new SC_FormParam;
     $objForm->addParam("¥«¡¼¥ÉÈÖ¹æ1", "card_no01", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
@@ -108,4 +241,5 @@
     $objForm->addParam("¥«¡¼¥ÉÈÖ¹æ3", "card_no03", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
     $objForm->addParam("¥«¡¼¥ÉÈÖ¹æ4", "card_no04", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+    $objForm->addParam("¥«¡¼¥É²ñ¼Ò", "card_company", 3, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
     $objForm->addParam("¥«¡¼¥É´ü¸ÂÇ¯", "card_year", 2, "n", array("EXIST_CHECK", "NUM_COUNT_CHECK", "NUM_CHECK"));
     $objForm->addParam("¥«¡¼¥É´ü¸Â·î", "card_month", 2, "n", array("EXIST_CHECK", "NUM_COUNT_CHECK", "NUM_CHECK"));
@@ -113,81 +247,254 @@
     $objForm->addParam("Ì¾", "card_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "ALPHA_CHECK"));
     $objForm->addParam("»ÙÊ§ÊýË¡", "paymethod", STEXT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-    $objForm->setParam($_POST);;
+    $objForm->addParam("¥«¡¼¥É¾ðÊó¤ÎÅÐÏ¿", "register_ondemand", 1, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+    $objForm->setParam($arrParam);
+    $objForm->convParam();
     return $objForm;
 }
 
 /**
- * ÆþÎÏ¹àÌÜ¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯
- *
- * @param SC_FormParam $objForm
- * @return array|null
- */
-function lfCheckError($objForm) {
-    if ($arrErr = $objForm->checkError()) {
-        return $arrErr;
-    }
-    return null;
-}
-
-/**
- * ¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®¤¹¤ë
+ * ¥µ¥¤¥Ð¡¼¥½¡¼¥¹¤Ë¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®¤¹¤ë.
+ * °ú¿ô¤ÎÁ÷¿®¥Ñ¥é¥á¡¼¥¿¤ÏlfCreateParam***()¤ÇÀ¸À®¤¹¤ë.
+ *
+ * @param array $arrSendParam
+ * @return array
+ */
+function lfSendRequest($arrSendParam) {
+    $objRequest = new CYBS_REQ;
+
+    gfPrintLog('### send request param ###', MDL_CYBS_LOG);
+    gfPrintLog(print_r($arrSendParam, true), MDL_CYBS_LOG);
+
+    foreach ($arrSendParam as $key => $value) {
+        $objRequest->add_request($key, $value);
+    }
+
+    if ( ($result = cybs_send($objRequest->requests)) == false ) {
+        sfDispSiteError('');
+        gfPrintLog(' -> error: cybs_send() function.' , MDL_CYBS_LOG);
+    }
+
+    return $result;
+}
+
+/**
+ * ics_auth¥Ñ¥é¥á¡¼¥¿¤ò¹½ÃÛ¤¹¤ë.
  *
  * @param array $arrForm
  * @param array $arrData
- * @return array
- */
-function lfSendRequest($arrForm, $arrData) {
-    global $objCartSess;
+ */
+function lfCreateAuthParam($arrForm, $arrData, $addData = null) {
     global $arrCybsRequestURL;
     global $arrPref;
 
     $objConfig =& Mdl_Cybs_Config::getInstanse();
-    $objRequest = new CYBS_REQ;
-
     $arrConfig = $objConfig->getConfig();
 
     $cardNo = $arrForm['card_no01'] . $arrForm['card_no02'] . $arrForm['card_no03'] . $arrForm['card_no04'];
     $expMo = $arrForm['card_month'];
-    $expyr = '20' . $arrForm['card_year'];
+    $expYr = '20' . $arrForm['card_year'];
     $phoneNo = $arrData['order_tel01'] . $arrData['order_tel02'] . $arrData['order_tel03'];
 
-    $objRequest->add_request("server_host", $arrCybsRequestURL[$arrConfig['cybs_request_url']]);
-    $objRequest->add_request("server_port", "80");
-    $objRequest->add_request("customer_cc_number", $cardNo);
-    $objRequest->add_request("customer_cc_expmo", $expMo);
-    $objRequest->add_request("customer_cc_expyr", $expyr);
-    $objRequest->add_request("customer_firstname", lfToSjis($arrData['order_name02']));
-    $objRequest->add_request("customer_lastname", lfToSjis($arrData['order_name01']));
-    $objRequest->add_request("customer_email", $arrData['order_email']);
-    $objRequest->add_request("customer_phone", $phoneNo);
-    $objRequest->add_request("bill_address1", lfToSjis($arrData['order_addr02']));
-    $objRequest->add_request("bill_city", lfToSjis($arrData['order_addr01']));
-    $objRequest->add_request("bill_state", lfToSjis($arrPref[$arrData['order_pref']]));
-    $objRequest->add_request("bill_zip", $arrData['order_zip01'] . $arrData['order_zip02']);
-    $objRequest->add_request("bill_country", "JP");
-    $objRequest->add_request("merchant_id", $arrConfig['cybs_merchant_id']);
-    $objRequest->add_request("merchant_ref_number", $arrData['order_id']);
-    $objRequest->add_request("currency", "JPY");
-
-    if ($arrConfig['cybs_subs_use']) {
-        lfAddSubsParam($objRequest, $arrConfig, $arrData);
-    } else {
-        lfAddAuthParam($objRequest, $arrForm, $arrData);
-    }
-
-    $request_array = $objRequest->requests;
-    gfPrintLog(print_r($request_array, true), MDL_CYBS_LOG);
-    gfPrintLog(print_r($arrConfig, true), MDL_CYBS_LOG);
-    if( ($result = cybs_send($request_array)) == false ) {
-      print("error");
-      gfPrintLog('#### cybs_send() error ###' , MDL_CYBS_LOG);
-      exit;
-    }
-
-    return $result;
-}
-
-/**
- * ¥ê¥¯¥¨¥¹¥È¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯
+    $arrSendParam = array(
+        "ics_applications"    => "ics_auth",
+        "server_host"         => $arrCybsRequestURL[$arrConfig['cybs_request_url']],
+        "server_port"         => "80",
+        "card_type"           => $arrForm['card_company'],
+        "customer_cc_number"  => $cardNo,
+        "customer_cc_expmo"   => $expMo,
+        "customer_cc_expyr"   => $expYr,
+        "customer_firstname"  => lfToSjis($arrData['order_name02']),
+        "customer_lastname"   => lfToSjis($arrData['order_name01']),
+        "customer_email"      => $arrData['order_email'],
+        "customer_phone"      => $phoneNo,
+        "bill_address1"       => lfToSjis($arrData['order_addr02']),
+        "bill_city"           => lfToSjis($arrData['order_addr01']),
+        "bill_state"          => lfToSjis($arrPref[$arrData['order_pref']]),
+        "bill_zip"            => $arrData['order_zip01'] . $arrData['order_zip02'],
+        "bill_country"        => "JP",
+        "merchant_id"         => $arrConfig['cybs_merchant_id'],
+        "merchant_ref_number" => $arrData['order_id'],
+        "currency"            => "JPY",
+        /**
+        "ship_to_address1"    => lfToSjis($arrData['deliv_addr02']),
+        "ship_to_city"        => lfToSjis($arrData['deliv_addr01']),
+        "ship_to_country"     => lfToSjis($arrPref[$arrData['deliv_pref']]),
+        "ship_to_state"       => $arrData['deliv_zip01'] . $arrData['deliv_zip02'],
+        "ship_to_zip"         => "JP",
+        */
+    );
+
+    // »ÙÊ§¤¤ÊýË¡
+    list($method, $paytimes) = split("-", $arrForm['paymethod']);
+    $arrSendParam["jpo_payment_method"] = $method;
+
+    // Ê¬³ä²ó¿ô
+    if ($paytimes > 0) $arrSendParam["jpo_installments"] = $paytimes;
+
+    $arrSendParam["offer0"] = "amount:" . $arrData['payment_total'];
+
+    if (is_array($addData)) {
+        $arrSendParam = array_merge($arrSendParam, $addData);
+    }
+    return $arrSendParam;
+}
+
+/**
+ * ¥ª¥ó¥Ç¥Þ¥ó¥É²Ý¶â+Í¿¿®¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿¤ò¹½ÃÛ¤¹¤ë.
+ *
+ * @param string $subsId
+ * @param array $arrAuthParam
+ * @return array
+ */
+function lfCreateOndemandAuthParam($subsId, $arrAuthParam) {
+    return array(
+        'subscription_id'     => $subsId,
+        "ics_applications"    => "ics_auth",
+        "server_host"         => $arrAuthParam['server_host'],
+        "server_port"         => $arrAuthParam["server_port"],
+        'merchant_id'         => $arrAuthParam['merchant_id'],
+        'merchant_ref_number' => $arrAuthParam['merchant_ref_number'],
+        'currency'            => $arrAuthParam['currency'],
+        'offer0'              => $arrAuthParam['offer0']
+    );
+}
+
+/**
+ * ics_pa_enroll¥Ñ¥é¥á¡¼¥¿¤ò¹½ÃÛ¤¹¤ë.
+ *
+ * @param array $arrForm
+ * @param array $arrData
+ */
+function lfCreateEnrollParam($arrForm, $arrData) {
+    global $arrInfo;
+    global $arrCybsRequestURL;
+
+    $objCustomer = new SC_Customer;
+
+    $cardNo  = $arrForm['card_no01'] . $arrForm['card_no02'] . $arrForm['card_no03'] . $arrForm['card_no04'];
+    $expMo   = $arrForm['card_month'];
+    $expYr   = '20' . $arrForm['card_year'];
+    $phoneNo = $arrData['order_tel01'] . $arrData['order_tel02'] . $arrData['order_tel03'];
+
+    $objConfig =& Mdl_Cybs_Config::getInstanse();
+    $arrConfig = $objConfig->getConfig();
+
+    $arrSendParam = array(
+        "ics_applications"    => "ics_pa_enroll",
+        "server_host"         => $arrCybsRequestURL[$arrConfig['cybs_request_url']],
+        "server_port"         => "80",
+        'card_type'           => $arrForm['card_company'],
+        'customer_account_id' => $objCustomer->getValue('customer_id'),
+        "currency"            => "JPY",
+        "customer_cc_expmo"   => $expMo,
+        "customer_cc_expyr"   => $expYr,
+        'customer_cc_number'  => $cardNo,
+        "merchant_id"         => $arrConfig['cybs_merchant_id'],
+        "merchant_ref_number" => $arrData['order_id'],
+        'pa_http_accept'      => $_SERVER['HTTP_ACCEPT'],
+        'pa_http_user_agent'  => $_SERVER['HTTP_USER_AGENT'],
+        'pa_merchant_country_code' => 'JP',
+        //'pa_merchant_id'      => $arrConfig['cybs_merchant_id'], // ¥µ¥¤¥Ð¡¼¥½¡¼¥¹¤Î¥Þ¡¼¥Á¥ã¥ó¥ÈID¤È¤ÏÊÌ
+        'pa_merchant_name'    => lfToSjis($arrInfo['shop_name']),
+        'pa_merchant_url'     => SSL_URL,
+        'offer0'              => "amount:" . $arrData['payment_total']
+    );
+    return $arrSendParam;
+}
+
+/**
+ * ics_pa_validate¥Ñ¥é¥á¡¼¥¿¤ò¹½ÃÛ¤¹¤ë
+ * ics_auth¥Ñ¥é¥á¡¼¥¿¤È¥Þ¡¼¥¸¤¹¤ë
+ *
+ * @param array $arrForm MDµÚ¤ÓPaReq¤¬´Þ¤Þ¤ì¤ëÇÛÎó
+ * @param array $arrData °ì»þ¼õÃí¥Ç¡¼¥¿
+ * @return array
+ */
+function lfCreateValidateParam($arrForm, $arrData) {
+    global $arrCybsRequestURL;
+    $objCustomer = new SC_Customer;
+
+    $objConfig =& Mdl_Cybs_Config::getInstanse();
+    $arrConfig = $objConfig->getConfig();
+
+    $arrCardData = unserialize(base64_decode($arrForm['MD']));
+
+    $arrSendParam = array(
+        "server_host"         => $arrCybsRequestURL[$arrConfig['cybs_request_url']],
+        "server_port"         => "80",
+        'card_type'           => $arrCardData['card_company'],
+        'customer_account_id' => $objCustomer->getValue('customer_id'),
+        "currency"            => "JPY",
+        "merchant_id"         => $arrConfig['cybs_merchant_id'],
+        "merchant_ref_number" => $arrData['order_id'],
+        'pa_signedpares'      => trim($arrForm['PaRes']),
+        'offer0'              => "amount:" . $arrData['payment_total']
+    );
+
+    $arrSendParam = lfCreateAuthParam($arrCardData, $arrData, $arrSendParam);
+    $arrSendParam["ics_applications"] = "ics_pa_validate,ics_auth";
+
+    return $arrSendParam;
+}
+
+/**
+ * ¥ª¥ó¥Ç¥Þ¥ó¥É²Ý¶â¤Î¥Ñ¥é¥á¡¼¥¿¤ò¹½ÃÛ¤¹¤ë
+ *
+ * @param array $arrForm ¥Õ¥©¡¼¥à¥Ñ¥é¥á¡¼¥¿(¥«¡¼¥É¾ðÊó¤Ê¤É)
+ * @param array $arrData °ì»þ¼õÃí¥Ç¡¼¥¿
+ * @return array
+ */
+
+function lfCreateOndemandParam($arrForm, $arrData) {
+    global $arrCybsRequestURL;
+    global $arrPref;
+    $objCustomer = new SC_Customer;
+
+    $objConfig =& Mdl_Cybs_Config::getInstanse();
+    $arrConfig = $objConfig->getConfig();
+
+    $cardNo = $arrForm['card_no01'] . $arrForm['card_no02'] . $arrForm['card_no03'] . $arrForm['card_no04'];
+    $expMo = $arrForm['card_month'];
+    $expYr = '20' . $arrForm['card_year'];
+    $phoneNo = $arrData['order_tel01'] . $arrData['order_tel02'] . $arrData['order_tel03'];
+
+    $arrSendParam = array(
+        "ics_applications"    => "ics_pay_subscription_create",
+        "server_host"         => $arrCybsRequestURL[$arrConfig['cybs_request_url']],
+        "server_port"         => "80",
+        "customer_account_id" => $objCustomer->getValue('customer_id'),
+        "customer_cc_number"  => $cardNo,
+        "customer_cc_expmo"   => $expMo,
+        "customer_cc_expyr"   => $expYr,
+        "customer_firstname"  => lfToSjis($arrData['order_name02']),
+        "customer_lastname"   => lfToSjis($arrData['order_name01']),
+        "customer_email"      => $arrData['order_email'],
+        "customer_phone"      => $phoneNo,
+        "bill_address1"       => lfToSjis($arrData['order_addr02']),
+        "bill_city"           => lfToSjis($arrData['order_addr01']),
+        "bill_state"          => lfToSjis($arrPref[$arrData['order_pref']]),
+        "bill_zip"            => $arrData['order_zip01'] . $arrData['order_zip02'],
+        "bill_country"        => "JP",
+        "merchant_id"         => $arrConfig['cybs_merchant_id'],
+        "merchant_ref_number" => $arrData['order_id'],
+        "currency"            => "JPY",
+        /**
+        "ship_to_address1"    => lfToSjis($arrData['deliv_addr02']),
+        "ship_to_city"        => lfToSjis($arrData['deliv_addr01']),
+        "ship_to_country"     => lfToSjis($arrPref[$arrData['deliv_pref']]),
+        "ship_to_state"       => $arrData['deliv_zip01'] . $arrData['deliv_zip02'],
+        "ship_to_zip"         => "JP",
+        */
+        "recurring_disable_auto_auth" => 'Y',
+        "recurring_frequency" => 'on-demand',
+        "card_type"           => $arrForm['card_company'],
+    );
+
+    return $arrSendParam;
+}
+
+
+/**
+ * ¥ì¥¹¥Ý¥ó¥¹¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯
  *
  * @param array $arrResults
@@ -195,5 +502,5 @@
  */
 function lfIsError($arrResults) {
-    global $arrIcsAuthErr;
+    global $arrIcsErr;
     $ret = null;
 
@@ -204,9 +511,16 @@
         break;
     case '0':
-        $msg = "½èÍý¤¬µñÈÝ¤µ¤ì¤Þ¤·¤¿¡£\n" . $arrIcsAuthErr[$arrResults['ics_rflag']];
+        // 3D¥»¥­¥å¥¢¤Î¾ì¹ç¡¢ics_rflag¤¬DAUTHENTICATE¤Ç¤¢¤ì¤ÐÅÐÏ¿¤¢¤ê
+        if (isset($arrResults['pa_enroll_rflag'])
+            && $arrResults['pa_enroll_rflag'] == 'DAUTHENTICATE') {
+
+            $ret = true;
+            break;
+        }
+        $msg = "½èÍý¤¬µñÈÝ¤µ¤ì¤Þ¤·¤¿¡£\n¥¨¥é¡¼¥³¡¼¥É¡§${arrResults['ics_rflag']}\n";
         $ret = PEAR::raiseError($msg);
         break;
     case '-1':
-        $msg = "¥·¥¹¥Æ¥à¤Þ¤¿¤Ï¥Í¥Ã¥È¥ï¡¼¥¯¥¨¥é¡¼¤Ë¤è¤ê½èÍý¤¬¥¨¥é¡¼¤È¤Ê¤ê¤Þ¤·¤¿¡£\n" . $arrIcsAuthErr[$arrResults['ics_rflag']];
+        $msg = "¥·¥¹¥Æ¥à¤Þ¤¿¤Ï¥Í¥Ã¥È¥ï¡¼¥¯¥¨¥é¡¼¤Ë¤è¤ê½èÍý¤¬¥¨¥é¡¼¤È¤Ê¤ê¤Þ¤·¤¿¡£\n¥¨¥é¡¼¥³¡¼¥É¡§${arrResults['ics_rflag']}\n";
         $ret = PEAR::raiseError($msg);
         break;
@@ -242,33 +556,3 @@
     $objQuery->update("dtb_order_temp", $sqlval, "order_temp_id = ?", array($uniqid));
 }
-
-function lfAddSubsParam(&$objRequest, $arrConfig, $arrData) {
-    global $arrSubsFrequency;
-    $objCustomer = new SC_Customer;
-
-    if ($objCustomer->isLoginSuccess()) {
-        $customer_id = $objCustomer->getValue('customer_id');
-        $objRequest->add_request("customer_account_id", $customer_id);
-        gfPrintLog('-> cybs subs user=' . $customer_id);
-    } else {
-        gfPrintLog('-> cybs subs not customer');
-    }
-
-    $objRequest->add_request("ics_applications", "ics_pay_subscription_create");
-    $objRequest->add_request('card_type', MDL_CYBS_SUBS_CARD); // XXX
-    $objRequest->add_request('recurring_disable_auto_auth', 'N');
-    $objRequest->add_request('recurring_frequency', $arrSubsFrequency[MDL_CYBS_SUBS_FREQ]); // XXX
-    $objRequest->add_request('recurring_payment_amount', (string)$arrData['payment_total']);
-}
-
-function lfAddAuthParam(&$objRequest, $arrForm, $arrData) {
-    $objRequest->add_request("ics_applications", "ics_auth");
-
-    // »ÙÊ§¤¤ÊýË¡
-    list($method, $paytimes) = split("-", $arrForm['paymethod']);
-    $objRequest->add_request("jpo_payment_method", $method);
-    if ($paytimes > 0) $objRequest->add_request("jpo_installments", $paytimes);
-
-    $objRequest->add_request("offer0", "offerid:0^amount:" . $arrData['payment_total']);
-}
 ?>
Index: /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs.php
===================================================================
--- /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs.php	(revision 17187)
+++ /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs.php	(revision 17224)
@@ -13,5 +13,5 @@
         $this->tpl_mainpage = MODULE_PATH . 'mdl_cybs/mdl_cybs.tpl';
         $this->tpl_subtitle = '¥µ¥¤¥Ð¡¼¥½¡¼¥¹·èºÑ¥â¥¸¥å¡¼¥ë';
-        $this->extension_installed = lfIsInstalledCybsExt();
+        $this->extension_installed = lfLoadModCybs();
     }
 }
@@ -42,5 +42,5 @@
     $objConfig =& Mdl_Cybs_Config::getInstanse();
     $arrConfig = $objConfig->getConfig();
-sfPrintR($arrConfig);
+
     // DB¤ËÃÍ¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ì¤Ð¤½¤ÎÃÍ¤òÉ½¼¨¤µ¤»¤ë
     if (!empty($arrConfig)) {
@@ -83,16 +83,3 @@
 }
 
-/**
- * mod_cybs¤¬¥¤¥ó¥¹¥È¡¼¥ëºÑ¤ß¤«¥Á¥§¥Ã¥¯¤¹¤ë.
- *
- * @return boolean
- */
-function lfIsInstalledCybsExt() {
-    if (!extension_loaded(MDL_CYBS_EXT)) {
-        if (@!dl(MDL_CYBS_EXT)) {
-            return false;
-        }
-    }
-    return true;
-}
 ?>
Index: /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs.inc
===================================================================
--- /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs.inc	(revision 16993)
+++ /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs.inc	(revision 17224)
@@ -12,5 +12,22 @@
 
 // ³ÈÄ¥¥â¥¸¥å¡¼¥ëÌ¾
-define('MDL_CYBS_EXT', 'mod_cybs.so');
+define('MDL_CYBS_MOD_CYBS', 'mod_cybs');
+
+// ¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥óIDÅÐÏ¿¿ô¾å¸Â
+define('MDL_CYBS_SUBS_ID_MAX', 5);
+
+/**
+ * mod_cybs¤ò¥í¡¼¥É¤¹¤ë
+ *
+ * @return boolean
+ */
+function lfLoadModCybs() {
+    if (!extension_loaded(MDL_CYBS_MOD_CYBS)) {
+        if (@!dl(MDL_CYBS_MOD_CYBS . ".so")) {
+            return false;
+        }
+    }
+    return true;
+}
 
 // ËÜÈÖURL
@@ -19,4 +36,17 @@
 define('MDL_CYBS_REQUEST_URL_TEST', 'ics2test.ic3.com');
 
+// ICS¥¨¥é¡¼
+$arrIcsErr = array(
+    'DCALL' => '¥«¡¼¥É²ñ¼Ò¤¬Í¿¿®È½Äê¤ò¼è¤ê¾Ã¤·¤Þ¤·¤¿¡£',
+    'DCARDEXPIRED' => '¥«¡¼¥É¤ÎÍ­¸ú´ü¸ÂÀÚ¤ì¤Ç¤¹¡£',
+    'DCARDREFUSED' => '¥«¡¼¥É²ñ¼Ò¤¬Í¿¿®¤ò¾µÇ§¤·¤Þ¤»¤ó¤Ç¤·¤¿¡£',
+    'DINVALIDCARD' => '¥¯¥ì¥¸¥Ã¥È¥«¡¼¥ÉÈÖ¹æ¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£',
+    'DINVALIDDATA' => '¥ê¥¯¥¨¥¹¥È¤Ë´Þ¤Þ¤ì¤ë¥Ç¡¼¥¿¤¬ÉÔÀµ¤Ç¤¹¡£',
+    'DMISSINGFIELD' => '¥ê¥¯¥¨¥¹¥È¤ËÉ¬¿Ü¥Õ¥£¡¼¥ë¥É¤¬·ç¤±¤Æ¤¤¤Þ¤¹¡£',
+    'ESYSTEM' => '¥·¥¹¥Æ¥à¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£',
+    'ETIMEOUT' => '¥ê¥¯¥¨¥¹¥È¤¬¥¿¥¤¥à¥¢¥¦¥È¤·¤Þ¤·¤¿¡£',
+    'DAUTHENTICATE' => '¥æ¡¼¥¶¤ÏËÜ¿ÍÇ§¾ÚÅÐÏ¿¤ò¤·¤Æ¤¤¤Þ¤¹¡£',
+);
+
 // ¥ê¥¯¥¨¥¹¥ÈÀèURLÇÛÎó
 $arrCybsRequestURL = array(
@@ -24,7 +54,4 @@
     '2' => MDL_CYBS_REQUEST_URL
 );
-
-// ¸°¡¦¾ÚÌÀ½ñ¤Î¥Ñ¥¹
-define('MDL_CYBS_KEY_PATH', '/opt/CyberSource/SDK/keys/');
 
 /**
@@ -46,46 +73,20 @@
 );
 
-// ics_auth¤Î¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸
-$arrIcsAuthErr = array(
-    'DCALL' => '¥«¡¼¥É²ñ¼Ò¤¬Í¿¿®È½Äê¤ò¼è¤ê¾Ã¤·¤Þ¤·¤¿¡£',
-    'DCARDEXPIRED' => '¥«¡¼¥É¤ÎÍ­¸ú´ü¸ÂÀÚ¤ì¤Ç¤¹¡£',
-    'DCARDREFUSED' => '¥«¡¼¥É²ñ¼Ò¤¬Í¿¿®¤ò¾µÇ§¤·¤Þ¤»¤ó¤Ç¤·¤¿¡£',
-    'DINVALIDCARD' => '¥¯¥ì¥¸¥Ã¥È¥«¡¼¥ÉÈÖ¹æ¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£',
-    'DINVALIDDATA' => '¥ê¥¯¥¨¥¹¥È¤Ë´Þ¤Þ¤ì¤ë¥Ç¡¼¥¿¤¬ÉÔÀµ¤Ç¤¹¡£',
-    'DMISSINGFIELD' => '¥ê¥¯¥¨¥¹¥È¤ËÉ¬¿Ü¥Õ¥£¡¼¥ë¥É¤¬·ç¤±¤Æ¤¤¤Þ¤¹¡£',
-    'ESYSTEM' => '¥·¥¹¥Æ¥à¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£',
-    'ETIMEOUT' => '¥ê¥¯¥¨¥¹¥È¤¬¥¿¥¤¥à¥¢¥¦¥È¤·¤Þ¤·¤¿¡£',
+// ¥«¡¼¥É²ñ¼Ò¤Î¼ïÎà
+$arrCardCompany = array(
+    '001' => 'Visa',
+    '002' => 'MasterCard',
+    '003' => 'American Express',
+    '004' => 'Discover',
+    '005' => 'Diners Club',
+    '006' => 'Carte Blanche',
+    '007' => 'JCB',
+    '008' => 'Optima',
+    '010' => 'Benificial Private Label',
+    '014' => 'EnRoute',
+    '017' => 'MBNA',
+    '021' => 'JAL',
+    '027' => 'Nicos',
 );
 
-// »ÈÍÑ¤¹¤ë²Ý¶âÉÑÅÙ
-define('MDL_CYBS_SUBS_FREQ', '1');
-
-// ²Ý¶âÉÑÅÙ
-$arrSubsFrequency = array(
-    '1' => 'weekly',
-    '2' => 'bi-weekly',
-    '3' => 'semi-monthly',
-    '4' => 'monthly',
-    '5' => 'quarterly',
-    '6' => 'quad-weekly',
-    '7' => 'semi-annually',
-    '8' => 'annually',
-);
-
-// ²Ý¶âÉÑÅÙ¤ÎÉ½¼¨Ì¾
-$arrSubsFrequencyDisp = array(
-    '1' => '½µ1 ²ó',
-    '2' => '2 ½µ1 ²ó',
-    '3' => 'È¾·î1²ó',
-    '4' => '1 ¥ö·î1 ²ó',
-    '5' => '3 ¥ö·î1 ²ó',
-    '6' => '4 ½µ1 ²ó',
-    '7' => 'È¾Ç¯1²ó',
-    '8' => '1 Ç¯1 ²ó',
-);
-
-// ¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥ó¤ò»ÈÍÑ¤¹¤ë¥«¡¼¥É¤Î¼ïÎà
-define('MDL_CYBS_SUBS_CARD', '001');
-
-//
 ?>
Index: /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_credit.tpl
===================================================================
--- /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_credit.tpl	(revision 16908)
+++ /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_credit.tpl	(revision 17224)
@@ -116,4 +116,15 @@
 							</tr>
 							<tr>
+								<td class="fs12" bgcolor="#f3f3f3">¥«¡¼¥É²ñ¼Ò</td>
+								<!--{assign var=key value="card_company"}-->
+								<td  bgcolor="#ffffff" class="fs12">
+								<span class="red"><!--{$arrErr[$key]}--></span>
+								<select name="<!--{$key}-->" value="<!--{$arrForm[$key].value|escape}-->" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" >
+								<option value="">--</option>
+								<!--{html_options options=$arrCardCompany selected=$arrForm[$key].value}-->
+								</select>
+								</td>
+							</tr>
+							<tr>
 								<td class="fs12" bgcolor="#f3f3f3">Í­¸ú´ü¸Â</td>
 								<!--{assign var=key1 value="card_month"}-->
@@ -165,4 +176,25 @@
 								</td>
 							</tr>
+							<!--{if $enable_ondemand}-->
+                            <tr>
+                                <td class="fs12" bgcolor="#f3f3f3">¤³¤Î¥«¡¼¥É¾ðÊó¤òÅÐÏ¿¤¹¤ë</td>
+                                <td bgcolor="#ffffff">
+                                <table cellspacing="0" cellpadding="0" summary=" ">
+                                    <tr>
+                                        <!--{assign var=key value="register_ondemand"}-->
+                                        <td class="fs12n">
+                                        <span class="red"><!--{$arrErr[$key]}--></span>
+                                        <input type="checkbox"
+                                               name="<!--{$key}-->"
+                                               value="1"
+                                               maxlength="<!--{$arrForm[$key].length}-->"
+                                               style="<!--{$arrErr[$key]|sfGetErrorColor}-->" <!--{if $arrForm[$key].value}-->checked=checked<!--{/if}-->>¥«¡¼¥É¾ðÊó¤òÅÐÏ¿¤¹¤ë<br>
+                                               ¢¨¥«¡¼¥É¤òÅÐÏ¿¤¹¤ë¤È¡¢¼¡²ó°Ê¹ßÅÐÏ¿¤·¤¿¥«¡¼¥É¤ò»ÈÍÑ¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
+                                        </select></td>
+                                    </tr>
+                                </table>
+                                </td>
+                            </tr>
+							<!--{/if}-->
 						</table>
 						</td>
