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 17244)
@@ -1,3 +1,3 @@
-<h2>ËÜ¿ÍÇ§¾Ú¥µ¡¼¥Ó¥¹¤ò³«»Ï¤·¤Þ¤¹¡£¤³¤Î¤Þ¤Þ¤Ç¤·¤Ð¤é¤¯¤ªÂÔ¤Á¤¯¤À¤µ¤¤¡£</h2>
+<p>ËÜ¿ÍÇ§¾Ú¥µ¡¼¥Ó¥¹¤ò³«»Ï¤·¤Þ¤¹¡£¤³¤Î¤Þ¤Þ¤Ç¤·¤Ð¤é¤¯¤ªÂÔ¤Á¤¯¤À¤µ¤¤¡£</p>
 <form name="ACSCall" action="<!--{$AcsUrl}-->" method="POST">
 
@@ -6,7 +6,7 @@
 <br />
 <center>
-<h2>
+<p>
 ²èÌÌ¤¬°ÜÆ°¤·¤Ê¤¤¾ì¹ç¤Ï¡ÖOK¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£
-</h2>
+</p>
 <input type="submit" value="OK">
 </center>
Index: /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_order_edit.tpl
===================================================================
--- /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_order_edit.tpl	(revision 17244)
+++ /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_order_edit.tpl	(revision 17244)
@@ -0,0 +1,59 @@
+<!--{if $cybs_disp}-->
+<script type="text/javascript">
+// ·èºÑ½èÍý(Í¿¿®¼è¾Ã/Çä¾å/ÊÖ¶â)¤ò¹Ô¤¦
+function doCybsApp(app, name) {
+    var msg = name + '½èÍý¤ò¼Â¹Ô¤·¤Þ¤¹¡£¤è¤í¤·¤¤¤Ç¤¹¤«¡©';
+    if (window.confirm(msg)) {
+        fnModeSubmit('cybs_do_ics_application','cybs_app', app);
+    }
+}
+</script>
+<table width="678" border="0" cellspacing="1" cellpadding="8" summary=" ">
+    <tr class="fs12n">
+        <td bgcolor="#f2f1ec" width="717" colspan="4">¢§¥µ¥¤¥Ð¡¼¥½¡¼¥¹</td>
+    </tr>
+    <!--{if $cybs_result != ''}-->
+    <tr class="fs12n">
+        <td bgcolor="#f2f1ec" width="110">·ë²Ì</td>
+        <td bgcolor="#ffffff"><span class="red"><!--{$cybs_result}--></span></td>
+    </tr>
+    <!--{/if}-->
+    <tr class="fs12n">
+        <td bgcolor="#f2f1ec" width="110">¥¹¥Æ¡¼¥¿¥¹</td>
+        <td bgcolor="#ffffff">
+            <!--{assign var=key value="cybs_auth_status"}-->
+            <span class="red12"><!--{$arrErr[$key]}--></span>
+            <select name="<!--{$key}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->">
+            <!--{html_options options=$arrCybsAuthStatus selected=$arrCybsMemo.memo06}-->
+            </select>
+            <input type="button" value="ÊÑ¹¹" onClick="fnModeSubmit('cybs_change_auth_status','','');return false;">
+        </td>
+    </tr>
+    <tr class="fs12n">
+        <td bgcolor="#f2f1ec" width="110">½èÍý</td>
+        <td bgcolor="#ffffff">
+        <input type="hidden" name="cybs_app" value="">
+        <!--{if $arrCybsMemo.memo06 == $smarty.const.MDL_CYBS_AUTH_STATUS_AUTH}-->
+        <input type="button" value="Í¿¿®¼è¾Ã" onClick="doCybsApp('<!--{$smarty.const.MDL_CYBS_APP_REVERSAL}-->', 'Í¿¿®¼è¾Ã');return false;">¡¡
+        <input type="button" value="Çä¾å" onClick="doCybsApp('<!--{$smarty.const.MDL_CYBS_APP_BILL}-->', 'Çä¾å');return false;">¡¡
+        <input type="button" value="ÊÖ¶â" disabled="disabled">
+        <!--{elseif $arrCybsMemo.memo06 == $smarty.const.MDL_CYBS_AUTH_STATUS_AUTHCANCEL}-->
+        <input type="button" value="Í¿¿®¼è¾Ã" disabled="disabled">¡¡
+        <input type="button" value="Çä¾å" disabled="disabled">¡¡
+        <input type="button" value="ÊÖ¶â" disabled="disabled">
+        <!--{elseif $arrCybsMemo.memo06 == $smarty.const.MDL_CYBS_AUTH_STATUS_CAPTURE}-->
+        <input type="button" value="Í¿¿®¼è¾Ã" disabled="disabled">¡¡
+        <input type="button" value="Çä¾å" disabled="disabled">¡¡
+        <input type="button" value="ÊÖ¶â" onClick="doCybsApp('<!--{$smarty.const.MDL_CYBS_APP_CREDIT}-->', 'ÊÖ¶â');return false;">¡¡
+        <!--{elseif $arrCybsMemo.memo06 == $smarty.const.MDL_CYBS_AUTH_STATUS_RETURN}-->
+        <input type="button" value="Í¿¿®¼è¾Ã" disabled="disabled">¡¡
+        <input type="button" value="Çä¾å" disabled="disabled">¡¡
+        <input type="button" value="ÊÖ¶â" disabled="disabled">
+        <!--{/if}-->
+        </td>
+    </tr>
+</table>
+<table width="678" border="0" cellspacing="0" cellpadding="0" summary=" ">
+    <tr><td colspan="3"><img src="<!--{$smarty.const.URL_DIR}-->img/contents/main_bar.jpg" width="678" height="10" alt=""></td></tr>
+</table>
+<!--{/if}-->
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 17230)
+++ /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_credit.php	(revision 17244)
@@ -6,9 +6,17 @@
  */
 require_once MODULE_PATH . "mdl_cybs/mdl_cybs.inc";
-require_once MODULE_PATH . "mdl_cybs/class/mdl_cybs_config.php";
-require_once MODULE_PATH . "mdl_cybs/class/mdl_cybs_request.php";
+
+// ¥â¥Ð¥¤¥ë¤Ï¥¨¥é¡¼²èÌÌÉ½¼¨
+if (GC_MobileUserAgent::isMobile()) {
+    sfDispSiteError(
+        FREE_ERROR_MSG,
+        '',
+        false,
+        '¤³¤Î·èºÑ¤Ï»ÈÍÑ¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤»¤ó¡£<br>¤ª¼ê¿ô¤Ç¤¹¤¬¤ª»ÙÊ§¤¤ÊýË¡¤òÁªÂò¤·Ä¾¤·¤Æ²¼¤µ¤¤¡£',
+        true);
+}
 
 // extension¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¥¨¥é¡¼²èÌÌÉ½¼¨
-if (!lfLoadModCybs()) {
+if (!sfCybsLoadModCybs()) {
     sfDispSiteError(FREE_ERROR_MSG, '', false,
         '¤³¤Î·èºÑ¤Ï»ÈÍÑ¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤»¤ó¡£<br>¤ª¼ê¿ô¤Ç¤¹¤¬¤ª»ÙÊ§¤¤ÊýË¡¤òÁªÂò¤·Ä¾¤·¤Æ²¼¤µ¤¤¡£');
@@ -19,9 +27,9 @@
         $this->tpl_mainpage = MODULE_PATH . 'mdl_cybs/mdl_cybs_credit.tpl';
         // »ÙÊ§¤¤ÊýË¡
-        global $arrPayMethod;
-        $this->arrPayMethod = $arrPayMethod;
+        global $arrCybsPayMethod;
+        $this->arrPayMethod = $arrCybsPayMethod;
         // ¥«¡¼¥É²ñ¼Ò¼ïÎà
-        global $arrCardCompany;
-        $this->arrCardCompany = $arrCardCompany;
+        global $arrCybsCardCompany;
+        $this->arrCardCompany = $arrCybsCardCompany;
         /**
          * session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
@@ -84,6 +92,6 @@
         }
         // ¥ª¥ó¥Ç¥Þ¥ó¥É²Ý¶â¤Î¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®¤¹¤ë
-        $arrResults = lfSendRequest(lfCreateOndemandParam($objForm->getHashArray(), $arrData));
-        if (PEAR::isError($e = lfIsError($arrResults))) {
+        $arrResults = sfCybsSendRequest(lfCreateOndemandParam($objForm->getHashArray(), $arrData));
+        if (PEAR::isError($e = sfCybsIsError($arrResults))) {
             $objPage->tpl_error = $e->getMessage();
             gfPrintLog(' -> ondemand error: ' . $e->getMessage(), MDL_CYBS_LOG);
@@ -101,7 +109,7 @@
     if ($objCybs->use3D() && !$objCybs->enableOndemand()) {
         // 3D¥»¥­¥å¥¢¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®¤¹¤ë
-        $arrResults = lfSendRequest(lfCreateEnrollParam($objForm->getHashArray(), $arrData));
+        $arrResults = sfCybsSendRequest(lfCreateEnrollParam($objForm->getHashArray(), $arrData));
         // ¥¨¥é¡¼½èÍý
-        if (PEAR::isError($e = lfIsError($arrResults))) {
+        if (PEAR::isError($e = sfCybsIsError($arrResults))) {
             $objPage->tpl_error = $e->getMessage();
             gfPrintLog(' -> 3d(enroll) error: ' . $e->getMessage(), MDL_CYBS_LOG);
@@ -146,6 +154,6 @@
 
     // Í¿¿®¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®¤¹¤ë
-    $arrResults = lfSendRequest($arrSendParam);
-    if (PEAR::isError($e = lfIsError($arrResults))) {
+    $arrResults = sfCybsSendRequest($arrSendParam);
+    if (PEAR::isError($e = sfCybsIsError($arrResults))) {
         $objPage->tpl_error = $e->getMessage();
         gfPrintLog(' -> auth error: ' . $e->getMessage(), MDL_CYBS_LOG);
@@ -155,5 +163,5 @@
 
     $objSiteSess->setRegistFlag();
-    lfRegisterOrderTemp($uniqid, $objForm->getHashArray(), $arrResults);
+    lfRegisterOrderTemp($uniqid, $arrResults, $objForm->getHashArray());
     header("Location: " . URL_SHOP_COMPLETE);
     exit;
@@ -164,4 +172,5 @@
     // ÆþÎÏ¹àÌÜ¤Î¸¡¾Ú
     $subsId = $objForm->getValue('subs_id');
+    $paymethod = $objForm->getValue('ondemand_paymethod');
     $arrErr = $objForm->checkError();
     if (empty($subsId) || !empty($arrErr['subs_id'])) {
@@ -169,9 +178,15 @@
         break;
     }
-
-    $arrSendParam = lfCreateAuthParam($objForm->getHashArray(), $arrData);
+    if (empty($paymethod) || !empty($arrErr['ondemand_paymethod'])) {
+        $objPage->arrErr['ondemand_paymethod'] = '¢¨¡¡¤ª»ÙÊ§¤¤ÊýË¡¤òÁªÂò¤·¤Æ²¼¤µ¤¤¡£';
+        break;
+    }
+    $arrForm = $objForm->getHashArray();
+    $arrForm['paymethod'] = $paymethod;
+
+    $arrSendParam = lfCreateAuthParam($arrForm, $arrData);
     $arrSendParam = lfCreateOndemandAuthParam($subsId, $arrSendParam);
-    $arrResults = lfSendRequest($arrSendParam);
-    if (PEAR::isError($e = lfIsError($arrResults))) {
+    $arrResults = sfCybsSendRequest($arrSendParam);
+    if (PEAR::isError($e = sfCybsIsError($arrResults))) {
         $objPage->tpl_error = $e->getMessage();
         gfPrintLog(' -> auth error: ' . $e->getMessage(), MDL_CYBS_LOG);
@@ -181,5 +196,5 @@
 
     $objSiteSess->setRegistFlag();
-    lfRegisterOrderTemp($uniqid, $objForm->getHashArray(), $arrResults);
+    lfRegisterOrderTemp($uniqid, $arrResults, $arrForm);
     header("Location: " . URL_SHOP_COMPLETE);
     exit;
@@ -190,6 +205,6 @@
     // ¸¡¾Ú+Í¿¿®¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®¤¹¤ë
     $obj3DForm = lfInit3DParam($_POST);
-    $arrResults = lfSendRequest(lfCreateValidateParam($obj3DForm->getHashArray(), $arrData));
-    if (PEAR::isError($e = lfIsError($arrResults))) {
+    $arrResults = sfCybsSendRequest(lfCreateValidateParam($obj3DForm->getHashArray(), $arrData));
+    if (PEAR::isError($e = sfCybsIsError($arrResults))) {
         $objPage->tpl_error = $e->getMessage();
         gfPrintLog(' -> error: ' . $e->getMessage(), MDL_CYBS_LOG);
@@ -199,5 +214,6 @@
 
     $objSiteSess->setRegistFlag();
-    lfRegisterOrderTemp($uniqid, $objForm->getHashArray(), $arrResults);
+    $arrForm = unserialize(base64_decode($arrResults['MD']));
+    lfRegisterOrderTemp($uniqid,  $arrResults, $arrForm);
     header("Location: " . URL_SHOP_COMPLETE);
     exit;
@@ -233,7 +249,7 @@
     $objPage->cardCount = 0; // ¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥ó¤ÎÅÐÏ¿·ï¿ô
     foreach ($arrSubsIds as $subs) {
-        $arrResults = lfSendRequest(lfCreateOndemandRetParam($subs['subs_id'], $subs['merchant_ref_number']));
-
-        if (PEAR::isError($e = lfIsError($arrResults))) {
+        $arrResults = sfCybsSendRequest(lfCreateOndemandRetParam($subs['subs_id'], $subs['merchant_ref_number']));
+
+        if (PEAR::isError($e = sfCybsIsError($arrResults))) {
             $objPage->tpl_error = $e->getMessage();
             gfPrintLog(' -> get subs info error: ' . $e->getMessage(), MDL_CYBS_LOG);
@@ -297,33 +313,8 @@
     $objForm->addParam("¥«¡¼¥É¾ðÊó¤ÎÅÐÏ¿", "register_ondemand", 1, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
     $objForm->addParam("»ÈÍÑ¤¹¤ë¥«¡¼¥É", "subs_id", MTEXT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+    $objForm->addParam("»ÙÊ§ÊýË¡", "ondemand_paymethod", STEXT_LEN, "n", array("MAX_LENGTH_CHECK"));
     $objForm->setParam($arrParam);
     $objForm->convParam();
     return $objForm;
-}
-
-/**
- * ¥µ¥¤¥Ð¡¼¥½¡¼¥¹¤Ë¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®¤¹¤ë.
- * °ú¿ô¤ÎÁ÷¿®¥Ñ¥é¥á¡¼¥¿¤ÏlfCreateParam***()¤ÇÀ¸À®¤¹¤ë.
- *
- * @param array $arrSendParam
- * @return array
- */
-function lfSendRequest($arrSendParam) {
-    $objRequest = new CYBS_REQ;
-
-    foreach ($arrSendParam as $key => $value) {
-        $objRequest->add_request($key, $value);
-    }
-
-    $arrSendParam['customer_cc_number'] = ''; // ¥«¡¼¥ÉÈÖ¹æ¤Ï¥í¥°ÊÝÂ¸¤·¤Ê¤¤¡£
-    gfPrintLog('### send request param ###', MDL_CYBS_LOG);
-    gfPrintLog(print_r($arrSendParam, true), MDL_CYBS_LOG);
-
-    if ( ($result = cybs_send($objRequest->requests)) == false ) {
-        sfDispSiteError('');
-        gfPrintLog(' -> error: cybs_send() function.' , MDL_CYBS_LOG);
-    }
-
-    return $result;
 }
 
@@ -398,5 +389,5 @@
  */
 function lfCreateOndemandAuthParam($subsId, $arrAuthParam) {
-    return array(
+    $arrSendParam = array(
         'subscription_id'     => $subsId,
         "ics_applications"    => "ics_auth",
@@ -406,6 +397,13 @@
         'merchant_ref_number' => $arrAuthParam['merchant_ref_number'],
         'currency'            => $arrAuthParam['currency'],
-        'offer0'              => $arrAuthParam['offer0']
-    );
+        'offer0'              => $arrAuthParam['offer0'],
+        'jpo_payment_method'  => $arrAuthParam['jpo_payment_method'],
+    );
+
+    // Ê¬³ä²ó¿ô
+    if (isset($arrAuthParam["jpo_installments"])) {
+        $arrSendParam['jpo_installments'] = $arrAuthParam['jpo_installments'];
+    }
+    return $arrSendParam;
 }
 
@@ -510,5 +508,4 @@
  * @return array
  */
-
 function lfCreateOndemandParam($arrForm, $arrData) {
     global $arrCybsRequestURL;
@@ -559,42 +556,4 @@
 }
 
-
-/**
- * ¥ì¥¹¥Ý¥ó¥¹¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯
- *
- * @param array $arrResults
- * @return boolean|PEAR::Error
- */
-function lfIsError($arrResults) {
-    global $arrIcsErr;
-    $ret = null;
-
-    switch ($arrResults['ics_rcode']) {
-    // À®¸ù
-    case '1':
-        $ret = true;
-        break;
-    case '0':
-        // 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¥¨¥é¡¼¥³¡¼¥É¡§${arrResults['ics_rflag']}\n";
-        $ret = PEAR::raiseError($msg);
-        break;
-    default:
-        $ret = PEAR::raiseError("ÉÔÌÀ¤Ê¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£\n");
-    }
-
-    return $ret;
-}
-
 /**
  * SJIS¤ØÊÑ´¹¤¹¤ë
@@ -613,14 +572,13 @@
  * @param array $arrForm
  */
-function lfRegisterOrderTemp($uniqid, $arrForm, $arrResults) {
+function lfRegisterOrderTemp($uniqid, $arrResults, $arrForm) {
     $sqlval = array(
-        'memo06' => 1,
+        'memo06' => MDL_CYBS_AUTH_STATUS_AUTH,
         'memo07' => $arrResults['request_token'],
         'memo08' => $arrResults['request_id'],
-        //'memo08' => $arrResults[''],
-        //'memo09' => $arrResults[''],
+        'memo09' => $arrForm['paymethod']
         //'memo10' => $arrResults[''],
     );
-
+    gfPrintLog(print_r($arrResults, true), MDL_CYBS_LOG);
     $objQuery = new SC_Query;
     $objQuery->update("dtb_order_temp", $sqlval, "order_temp_id = ?", array($uniqid));
Index: /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs.php
===================================================================
--- /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs.php	(revision 17230)
+++ /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs.php	(revision 17244)
@@ -13,5 +13,5 @@
         $this->tpl_mainpage = MODULE_PATH . 'mdl_cybs/mdl_cybs.tpl';
         $this->tpl_subtitle = '¥µ¥¤¥Ð¡¼¥½¡¼¥¹·èºÑ¥â¥¸¥å¡¼¥ë';
-        $this->extension_installed = lfLoadModCybs();
+        $this->extension_installed = sfCybsLoadModCybs();
     }
 }
Index: /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs.inc
===================================================================
--- /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs.inc	(revision 17230)
+++ /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs.inc	(revision 17244)
@@ -3,4 +3,15 @@
  * ¥µ¥¤¥Ð¡¼¥½¡¼¥¹¥â¥¸¥å¡¼¥ë¤Ç¶¦ÄÌ»ÈÍÑ¤¹¤ëÄê¿ô¡¦ÇÛÎó¡¦´Ø¿ô·²
  *
+ */
+require_once MODULE_PATH . "mdl_cybs/class/mdl_cybs_config.php";
+require_once MODULE_PATH . "mdl_cybs/class/mdl_cybs_request.php";
+
+/**
+ * dtb_order memo»ÅÍÍ
+ * memo06 Í¿¿®¥¹¥Æ¡¼¥¿¥¹ $arrCybsAuthStatus»²¾È
+ * memo07 request_token
+ * memo08 request_id
+ * memo09 »ÙÊ§¤¤ÊýË¡¤Î¥­¡¼Ì¾ $arrCybsPayMethod»²¾È
+ * memo10 ÊÖ¶â¼Â¹ÔºÑ¤ß¥Õ¥é¥° 1:¼Â¹ÔºÑ¤ß¡¢1°Ê³°:Ì¤¼Â¹Ô
  */
 
@@ -22,5 +33,5 @@
  * @return boolean
  */
-function lfLoadModCybs() {
+function sfCybsLoadModCybs() {
     if (!extension_loaded(MDL_CYBS_MOD_CYBS)) {
         if (@!dl(MDL_CYBS_MOD_CYBS . ".so")) {
@@ -37,5 +48,5 @@
 
 // ICS¥¨¥é¡¼
-$arrIcsErr = array(
+$arrCybsIcsErr = array(
     'DCALL' => '¥«¡¼¥É²ñ¼Ò¤¬Í¿¿®È½Äê¤ò¼è¤ê¾Ã¤·¤Þ¤·¤¿¡£',
     'DCARDEXPIRED' => '¥«¡¼¥É¤ÎÍ­¸ú´ü¸ÂÀÚ¤ì¤Ç¤¹¡£',
@@ -46,5 +57,4 @@
     'ESYSTEM' => '¥·¥¹¥Æ¥à¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£',
     'ETIMEOUT' => '¥ê¥¯¥¨¥¹¥È¤¬¥¿¥¤¥à¥¢¥¦¥È¤·¤Þ¤·¤¿¡£',
-    'DAUTHENTICATE' => '¥æ¡¼¥¶¤ÏËÜ¿ÍÇ§¾ÚÅÐÏ¿¤ò¤·¤Æ¤¤¤Þ¤¹¡£',
 );
 
@@ -63,5 +73,5 @@
  *  );
  */
-$arrPayMethod = array(
+$arrCybsPayMethod = array(
     '1-0' => "°ì³çÊ§¤¤",
     '4-3' => "Ê¬³ä3²óÊ§¤¤",
@@ -74,5 +84,5 @@
 
 // ¥«¡¼¥É²ñ¼Ò¤Î¼ïÎà
-$arrCardCompany = array(
+$arrCybsCardCompany = array(
     '001' => 'Visa',
     '002' => 'MasterCard',
@@ -90,14 +100,296 @@
 );
 
-define('MDL_CYBS_CREDIT_STATUS_AUTH', '1'); // Í¿¿®
-define('MDL_CYBS_CREDIT_STATUS_AUTHCANCEL', '2');// Í¿¿®¼è¤ê¾Ã¤·
-define('MDL_CYBS_CREDIT_STATUS_CAPTURE', '3'); // Çä¾å
-define('MDL_CYBS_CREDIT_STATUS_RETURN', '4'); // ÊÖ¶â
-
-$arrCybsCreditStatus = array(
-    MDL_CYBS_CREDIT_STATUS_AUTH => 'Í¿¿®',
-    MDL_CYBS_CREDIT_STATUS_AUTHCANCEL => 'Í¿¿®¼è¾Ã',
-    MDL_CYBS_CREDIT_STATUS_CAPTURE => 'Çä¾å',
-    MDL_CYBS_CREDIT_STATUS_RETURN => 'ÊÖ¶â'
-);
-?>
+// Í¿¿®¥¹¥Æ¡¼¥¿¥¹
+define('MDL_CYBS_AUTH_STATUS_AUTH',       '1'); // Í¿¿®
+define('MDL_CYBS_AUTH_STATUS_AUTHCANCEL', '2'); // Í¿¿®¼è¤ê¾Ã¤·
+define('MDL_CYBS_AUTH_STATUS_CAPTURE',    '3'); // Çä¾å
+define('MDL_CYBS_AUTH_STATUS_RETURN',     '4'); // ÊÖ¶â
+$arrCybsAuthStatus = array(
+    MDL_CYBS_AUTH_STATUS_AUTH       => 'Í¿¿®',
+    MDL_CYBS_AUTH_STATUS_AUTHCANCEL => 'Í¿¿®¼è¾Ã',
+    MDL_CYBS_AUTH_STATUS_CAPTURE    => 'Çä¾å',
+    MDL_CYBS_AUTH_STATUS_RETURN     => 'ÊÖ¶â'
+);
+
+// ´ÉÍý²èÌÌ¤Ç¼Â¹Ô¤¹¤ëICS¥¢¥×¥ê¥±¡¼¥·¥ç¥ó
+define('MDL_CYBS_APP_REVERSAL', '1');
+define('MDL_CYBS_APP_BILL',     '2');
+define('MDL_CYBS_APP_CREDIT',   '3');
+$arrCybsApp = array(
+    MDL_CYBS_APP_REVERSAL => 'ics_auth_reversal',
+    MDL_CYBS_APP_BILL     => 'ics_bill',
+    MDL_CYBS_APP_CREDIT   => 'ics_credit'
+);
+
+/**
+ * ¥µ¥¤¥Ð¡¼¥½¡¼¥¹¤Ë¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®¤¹¤ë.
+ * °ú¿ô¤ÎÁ÷¿®¥Ñ¥é¥á¡¼¥¿¤Ïlf(sf)CreateParam***()¤ÇÀ¸À®¤¹¤ë.
+ *
+ * @param array $arrSendParam
+ * @return array
+ */
+function sfCybsSendRequest($arrSendParam) {
+    $objRequest = new CYBS_REQ;
+
+    foreach ($arrSendParam as $key => $value) {
+        $objRequest->add_request($key, $value);
+    }
+
+    // ¥«¡¼¥ÉÈÖ¹æ¤Ï¥í¥°ÊÝÂ¸¤·¤Ê¤¤
+    if (isset($arrSendParam['customer_cc_number'])) {
+        $arrSendParam['customer_cc_number'] = '****';
+    }
+
+    gfPrintLog('### send request param ###', MDL_CYBS_LOG);
+    gfPrintLog(print_r($arrSendParam, true), MDL_CYBS_LOG);
+
+    if ( ($result = cybs_send($objRequest->requests)) == false ) {
+        sfDispSiteError('');
+        gfPrintLog(' -> error: cybs_send() function.' , MDL_CYBS_LOG);
+    }
+
+    return $result;
+}
+
+/**
+ * ¥ì¥¹¥Ý¥ó¥¹¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯
+ *
+ * @param array $arrResults
+ * @return boolean|PEAR::Error
+ */
+function sfCybsIsError($arrResults) {
+    global $arrCybsIcsErr;
+    $ret = null;
+
+    switch ($arrResults['ics_rcode']) {
+    // À®¸ù
+    case '1':
+        $ret = true;
+        break;
+    case '0':
+        // 3D¥»¥­¥å¥¢¤Î¾ì¹ç¡¢ics_rflag¤¬DAUTHENTICATE¤Ç¤¢¤ì¤ÐÅÐÏ¿¤¢¤ê
+        if (isset($arrResults['pa_enroll_rflag'])
+            && $arrResults['pa_enroll_rflag'] == 'DAUTHENTICATE') {
+
+            $ret = true;
+            break;
+        }
+        $msg = "½èÍý¤¬µñÈÝ¤µ¤ì¤Þ¤·¤¿¡£ÆþÎÏÆâÍÆ¤Ë´Ö°ã¤¤¤¬¤Ê¤¤¤«¤´³ÎÇ§¤¯¤À¤µ¤¤¡£\n";
+        $rflag = $arrResults['ics_rflag'];
+        $err = isset($arrCybsIcsErr[$rflag]) ? $arrCybsIcsErr[$rflag] : "¥¨¥é¡¼¥³¡¼¥É¡§$rflag";
+        $ret = PEAR::raiseError($msg . $err);
+        break;
+    case '-1':
+        $msg = "¥·¥¹¥Æ¥à¤Þ¤¿¤Ï¥Í¥Ã¥È¥ï¡¼¥¯¥¨¥é¡¼¤Ë¤è¤ê½èÍý¤¬¥¨¥é¡¼¤È¤Ê¤ê¤Þ¤·¤¿¡£\n";
+        $rflag = $arrResults['ics_rflag'];
+        $err = isset($arrCybsIcsErr[$rflag]) ? $arrCybsIcsErr[$rflag] : "¥¨¥é¡¼¥³¡¼¥É¡§$rflag";
+        $ret = PEAR::raiseError($msg . $err);
+        break;
+    default:
+        $ret = PEAR::raiseError("ÉÔÌÀ¤Ê¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£\n");
+    }
+
+    return $ret;
+}
+
+/**
+ * ¼õÃíÊÔ½¸¥Ú¡¼¥¸¤Î¥Æ¥ó¥×¥ì¡¼¥ÈÀ©¸æ
+ *
+ * @param LC_Page $objPage
+ * @return LC_Page
+ */
+function sfCybsOrderPage($objPage) {
+    $objQuery = new SC_Query;
+    $moduleId = $objQuery->get('dtb_payment', 'module_id', 'payment_id = ?', array($objPage->arrDisp['payment_id']));
+    $objPage->cybs_disp = true;
+    if ($moduleId != MDL_CYBS_ID) {
+        $objPage->cybs_disp = false;
+        return $objPage;
+    }
+
+    if ($objPage->disp_mode) {
+        $objPage->cybs_disp = false;
+        return $objPage;
+    }
+
+    global $arrCybsAuthStatus;
+    $objPage->arrCybsAuthStatus = $arrCybsAuthStatus;
+
+
+    $arrMemo = $objQuery->select(
+        'memo06, memo07, memo08, memo09, memo10',
+        'dtb_order',
+        'order_id = ?',
+        array($objPage->tpl_order_id));
+
+    $objPage->arrCybsMemo = isset($arrMemo[0]) ? $arrMemo[0] : array();
+    return $objPage;
+}
+
+/**
+ * EC-CUBEÂ¦¤ÎÍ¿¿®¥¹¥Æ¡¼¥¿¥¹¤òÊÑ¹¹¤¹¤ë
+ * ¥µ¥¤¥Ð¡¼¥½¡¼¥¹Â¦¤ÈÄÌ¿®¤Ï¹Ô¤ï¤Ê¤¤¡£ÊÑ¹¹¤ÏEC-CUBEÂ¦¤Î¤ß¡£
+ */
+function sfCybsChangeAuthStatus($objPage, $status) {
+    global $arrCybsAuthStatus;
+    if (empty($arrCybsAuthStatus[$status])) {
+        gfPrintLog('error: call sfCybsChangeAuthStatus()', MDL_CYBS_LOG);
+        sfDispError('');
+    }
+
+    $arrUpdate = array(
+        'memo06' => $status,
+        'update_date' => 'NOW()'
+    );
+    $objQuery = new SC_Query;
+    $objQuery->update('dtb_order', $arrUpdate, 'order_id = ?', array($objPage->tpl_order_id));
+
+    $objPage->cybs_result = "¥¹¥Æ¡¼¥¿¥¹¤ò" . $arrCybsAuthStatus[$status] . "¤ØÊÑ¹¹¤·¤Þ¤·¤¿¡£";
+    return $objPage;
+}
+
+/**
+ * ICS¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¼Â¹Ô
+ *
+ */
+function sfCybsDoIcsApplication($objPage, $ics_app) {
+    global $arrCybsApp;
+    if (empty($arrCybsApp[$ics_app])) {
+        gfPrintLog('error: call sfCybsDoIcsApplication() error', MDL_CYBS_LOG);
+        sfDispError('');
+    }
+
+    global $arrCybsRequestURL;
+
+    $objConfig =& Mdl_Cybs_Config::getInstanse();
+    $arrConfig = $objConfig->getConfig();
+
+    $objQuery = new SC_Query;
+    $arrOrder = $objQuery->select('*', 'dtb_order', 'order_id = ?', array($objPage->tpl_order_id));
+    $arrOrder = $arrOrder[0];
+
+    // ¶¦ÄÌ¥Ñ¥é¥á¡¼¥¿
+    $arrSendParam = array(
+        "server_host"         => $arrCybsRequestURL[$arrConfig['cybs_request_url']],
+        "server_port"         => "80",
+        'currency'            => 'JPY',
+        'merchant_id'         => $arrConfig['cybs_merchant_id'],
+        'merchant_ref_number' => $objPage->tpl_order_id,
+    );
+
+    $resultMessage = '';
+    $resultStatus  = '';
+
+    switch($arrCybsApp[$ics_app]) {
+    // Í¿¿®¼è¾Ã
+    case 'ics_auth_reversal':
+        $resultMessage = 'Í¿¿®¼è¾Ã½èÍý¤ÏÀ®¸ù¤·¤Þ¤·¤¿¡£';
+        $resultStatus = MDL_CYBS_AUTH_STATUS_AUTHCANCEL;
+        $arrSendParam['auth_request_token'] = $arrOrder['memo07'];
+        $arrSendParam['auth_request_id']    = $arrOrder['memo08'];
+        $arrSendParam['ics_applications']   = "ics_auth_reversal";
+        $arrSendParam["offer0"] = "amount:" . $arrOrder['payment_total'];
+        $arrResults = sfCybsSendRequest($arrSendParam);
+        break;
+
+    // Çä¾å
+    case 'ics_bill':
+        $resultMessage = 'Çä¾å½èÍý¤ÏÀ®¸ù¤·¤Þ¤·¤¿¡£';
+        $resultStatus = MDL_CYBS_AUTH_STATUS_CAPTURE;
+        $arrSendParam['auth_request_token'] = $arrOrder['memo07']; // request_token
+        $arrSendParam['auth_request_id']    = $arrOrder['memo08']; // request_id
+        $arrSendParam['ics_applications']   = "ics_bill";
+        $arrSendParam["offer0"] = "amount:" . $arrOrder['payment_total'];
+        list($method, $paytimes) = split("-", $arrOrder['memo09']); // paymethod 4-15 ¤Ê¤É
+        $arrSendParam['jpo_payment_method'] = $method;
+        if ($paytimes > 0) $arrSendParam['jpo_installments'] = $paytimes;
+        $arrResults = sfCybsSendRequest($arrSendParam);
+        break;
+
+    // Çä¾å¼è¾Ã
+    case 'ics_credit':
+        // ÊÖ¶â½èÍý¤¬¼Â¹ÔºÑ¤ß¤Ê¤é¥ê¥¯¥¨¥¹¥È¤òÁ÷¿®¤·¤Ê¤¤¡£
+        if ($arrOrder['memo10'] == '1') {
+            $objPage->cybs_result = '´û¤ËÊÖ¶â¤µ¤ì¤Æ¤¤¤Þ¤¹¡£';
+            return $objPage;
+        }
+        $resultMessage = 'ÊÖ¶â½èÍý¤ÏÀ®¸ù¤·¤Þ¤·¤¿¡£';
+        $resultStatus = MDL_CYBS_AUTH_STATUS_RETURN;
+        $arrSendParam['ics_applications']   = "ics_credit";
+        $arrSendParam['bill_request_token'] = $arrOrder['memo07']; // request_token
+        $arrSendParam['bill_request_id']    = $arrOrder['memo08']; // request_id
+        $arrSendParam["offer0"] = "amount:" . $arrOrder['payment_total'];
+        $arrResults = sfCybsSendRequest($arrSendParam);
+        break;
+    }
+
+    if (PEAR::isError($e = sfCybsIsError($arrResults))) {
+        $objPage->cybs_result = $e->getMessage();
+        gfPrintLog(" -> " . $arrCybsApp[$ics_app] . " error: " . $e->getMessage(), MDL_CYBS_LOG);
+        gfPrintLog(print_r($arrResults, true), MDL_CYBS_LOG);
+        $objPage->cybs_result = $e->getMessage();
+        return $objPage;
+    }
+
+    // request_token, request_id¤Î¹¹¿·
+    $arrUpdate = array(
+        'update_date' => 'NOW()',
+        'memo07' => $arrResults['request_token'],
+        'memo08' => $arrResults['request_id'],
+    );
+    // ÊÖ¶â½èÍýÀ®¸ù»þ¤ÏÊÖ¶âºÑ¤ß¥Õ¥é¥°¤òÎ©¤Æ¤ë
+    if ($arrCybsApp[$ics_app] == 'ics_credit') {
+        $arrUpdate['memo10'] = '1';
+    }
+    $objQuery->update('dtb_order', $arrUpdate, 'order_id = ?', array($objPage->tpl_order_id));
+
+    $objPage = sfCybsChangeAuthStatus($objPage, $resultStatus);
+    $objPage->cybs_result = $resultMessage;
+    return $objPage;
+}
+
+/**
+ * Çä¾å¥Ð¥Ã¥ÁÍÑCSV¤Î¥À¥¦¥ó¥í¡¼¥É
+ *
+ */
+function sfCybsCSVDownload($where, $arrval) {
+    $objQuery = new SC_Query;
+    $objQuery->setoption('ORDER BY update_date DESC');
+    $arrOrder = $objQuery->select(
+        'order_id, payment_total, memo08 as req_id, memo07 as req_token',
+        'dtb_order',
+        $where,
+        $arrval);
+
+    $line = '';
+    $arrayOrder = is_array($arrOrder) ? $arrOrder : array();
+    foreach ($arrOrder as $order) {
+        $line .= implode(',', array(
+            $order['order_id'],
+            'JPY',
+            $order['payment_total'],
+            $order['req_id'],
+            $order['req_token'])) . ",,,,,,,\r\n";
+    }
+
+    $batchId = uniqid('');
+    $recordCount = count($arrayOrder);
+
+    $head1 = "batchID=$batchId,transactionType=capture,recordCount=$recordCount,,,,,,,,,\r\n";
+    $head2 = implode(',', array(
+        'merchantReferenceCode*',
+        'purchaseTotals_currency*',
+        'purchaseTotals_grandTotalAmount*',
+        'ccCaptureService_authRequestID*',
+        'ccCaptureService_authRequestToken',
+        'ccCaptureService_authType',
+        'ccCaptureService_verbalAuthCode',
+        'billTo_customerID',
+        'merchantDefinedData_field1',
+        'merchantDefinedData_field2',
+        'merchantDefinedData_field3',
+        'merchantDefinedData_field4')) . "\r\n";
+
+    $csvString = $head1 . $head2 . $line;
+    sfCSVDownload($csvString, 'cybs_capture');
+}
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 17230)
+++ /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_credit.tpl	(revision 17244)
@@ -238,4 +238,14 @@
 						<td bgcolor="#cccccc">
 						<table width="666" border="0" cellspacing="1" cellpadding="10" summary=" ">
+							<!--{if $arrErr.subs_id}-->
+							<tr>
+								<td class="fs12" bgcolor="#ffffff" colspan="3"><span class="red"><!--{$arrErr.subs_id}--></span></td>
+							</tr>
+							<!--{/if}-->
+							<!--{if $arrErr.ondemand_paymethod}-->
+							<tr>
+								<td class="fs12" bgcolor="#ffffff" colspan="3"><span class="red"><!--{$arrErr.ondemand_paymethod}--></span></td>
+							</tr>
+							<!--{/if}-->
 							<tr>
 								<td class="fs12" bgcolor="#f3f3f3">ÁªÂò</td>
@@ -243,9 +253,4 @@
 								<td class="fs12" bgcolor="#f3f3f3">Í­¸ú´ü¸Â</td>
 							</tr>
-							<!--{if $arrErr.subs_id}-->
-                            <tr>
-                                <td class="fs12" bgcolor="#ffffff" colspan="3"><span class="red"><!--{$arrErr.subs_id}--></span></td>
-                            </tr>
-                            <!--{/if}-->
 							<!--{foreach from=$arrCard item=card}-->
 							<tr>
@@ -257,4 +262,25 @@
 							</tr>
 							<!--{/foreach}-->
+						</table>
+						</td>
+					</tr>
+					<tr><td height="5" class="fs12"></td></tr>
+					<tr>
+						<td bgcolor="#cccccc">
+						<table width="666" border="0" cellspacing="1" cellpadding="10" summary=" ">
+							<tr>
+								<td class="fs12" bgcolor="#f3f3f3">¤ª»ÙÊ§¤¤ÊýË¡</td>
+								<td bgcolor="#ffffff">
+								<table cellspacing="0" cellpadding="0" summary=" ">
+									<tr>
+										<!--{assign var=key value="ondemand_paymethod"}-->
+										<td class="fs12n">
+										<select name="<!--{$key}-->" value="<!--{$arrForm[$key].value|escape}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" >
+										<!--{html_options options=$arrPayMethod selected=$arrForm[$key].value}-->
+										</select></td>
+									</tr>
+								</table>
+								</td>
+							</tr>
 						</table>
 						</td>
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 17230)
+++ /branches/version-1/data/downloads/module/mdl_cybs/class/mdl_cybs_config.php	(revision 17244)
@@ -203,11 +203,4 @@
         $arrSubsId = $this->getSubsIds();
 
-        // ¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥óID¤¬´û¤ËÂ¸ºß¤¹¤ë¾ì¹ç¤ÏÄÉ²Ã¤·¤Ê¤¤
-        foreach($arrSubsId as $subs) {
-            if ($subs['subs_id'] == $subsId) {
-                return;
-            }
-        }
-
         $arrSubsId[] = array(
             'subs_id' => $subsId,
Index: anches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_order_edit.php
===================================================================
--- /branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs_order_edit.php	(revision 17230)
+++ 	(revision )
@@ -1,3 +1,0 @@
-<?php
-
-?>
