/**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $this->selectTemplate();
     $order_id = $this->getOrderId();
     if ($order_id === NULL) {
         SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', true, '注文情報の取得が出来ませんでした。<br />この手続きは無効となりました。');
     }
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objCharge = new SC_Mdl_WebPay_Models_Charge($order_id);
     $this->tpl_title = $objCharge->arrOrder['payment_method'];
     $this->validateOrderConsistency($objCharge->arrOrder);
     $arrModuleSetting = SC_Mdl_WebPay_Models_Module::loadCurrentSetting();
     $objWebPay = new SC_Mdl_WebPay_Wrapper($arrModuleSetting['secret_key']);
     $objCustomer = new SC_Mdl_WebPay_Models_Customer($objWebPay, $objCharge->arrOrder['customer_id']);
     $objFormParam = new SC_FormParam_Ex();
     $this->initFormParam($objFormParam);
     switch ($this->getMode()) {
         case 'delete_card':
             $objCustomer->deleteActiveCard();
             break;
         case 'other_card':
             break;
         case 'pay':
             $objFormParam->setParam($_REQUEST);
             $objFormParam->convParam();
             $this->arrErr = $this->checkFormParamError($objFormParam);
             if (empty($this->arrErr)) {
                 $arrData = $objFormParam->getHashArray();
                 $arrPayer = array();
                 $message = $this->selectPayer($objCustomer, $arrData, $arrPayer);
                 if ($message !== null) {
                     $this->tpl_webpay_charge_error = $message;
                     break;
                 }
                 $authorize = $arrModuleSetting['payment'] == 'authorize';
                 $message = $objCharge->createCharge($objWebPay, $authorize, $arrPayer);
                 if ($message !== null) {
                     $this->tpl_webpay_charge_error = $message;
                     break;
                 }
                 SC_Response_Ex::sendRedirect(SHOPPING_COMPLETE_URLPATH);
                 SC_Response_Ex::actionExit();
                 break;
             }
             break;
         default:
             $this->objSavedCard = $objCustomer->fetchSavedCardForCustomer();
             break;
     }
     $this->tpl_is_registered_customer = $objCustomer->getCustomerId() !== 0;
     $this->tpl_webpay_publishable_key = $arrModuleSetting['publishable_key'];
     $this->tpl_url = $_SERVER['REQUEST_URI'];
 }
示例#2
0
 /**
  * hook function called before LC_Page_Admin_Order_Edit
  * Send requests to WebPay if mode is of plg_webpayext
  */
 public function beforeAdminOrderEdit(LC_Page_Ex $objPage)
 {
     if ($objPage->getMode() === 'plg_webpayext_capture') {
         $_GET['mode'] = 'recalculate';
         $order_id = $_POST['order_id'];
         if (empty($order_id)) {
             return;
         }
         $objCharge = new SC_Mdl_WebPay_Models_Charge($order_id);
         $arrModuleSetting = SC_Mdl_WebPay_Models_Module::loadCurrentSetting();
         $objWebPay = new SC_Mdl_WebPay_Wrapper($arrModuleSetting['secret_key']);
         $message = $objCharge->capture($objWebPay);
         if ($message !== null) {
             $objPage->plg_webpayext_capture_error = $message;
         }
     }
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $this->initPaymentMethod($_SESSION['member_id']);
     $arrSetting = SC_Mdl_WebPay_Models_Module::loadCurrentSetting(true);
     $objFormParam = new SC_FormParam_Ex();
     $this->initFormParam($objFormParam, $arrSetting);
     switch ($this->getMode()) {
         case 'register':
             $objFormParam->setParam($_REQUEST);
             $objFormParam->convParam();
             $this->arrErr = $objFormParam->checkError();
             if (empty($this->arrErr)) {
                 $arrSetting = $objFormParam->getHashArray();
                 $this->updateModuleSetting($arrSetting);
             }
             break;
         default:
             $objFormParam->setParam($arrSetting);
             $objFormParam->convParam();
             $this->arrErr = $objFormParam->checkError();
             break;
     }
     $this->arrForm = $objFormParam->getFormParamList();
 }
示例#4
0
<?php

/**
 * This file is part of EC-CUBE WebPay module
 *
 * @copyright 2014 WebPay All Rights Reserved.
 */
require_once '../../../../html/require.php';
require_once MODULE_REALDIR . 'mdl_webpay/inc/include.php';
require_once MDL_WEBPAY_CLASS_REALDIR . 'models/SC_Mdl_WebPay_Models_Module.php';
SC_Mdl_WebPay_Models_Module::insert();
$setting_path = '/admin/load_module_config.php?module_id=' . MDL_WEBPAY_ID;
echo 'インストールが終了しました。ログインして ' . $setting_path . ' から設定をおこなってください。' . "\n";
$origdir = getcwd();
$tar_path = MDL_WEBPAY_REALDIR . 'WebPayExt.tar.gz';
$tar = new Archive_Tar($tar_path, true);
chdir(MDL_WEBPAY_REALDIR . '/plugin/');
$tar->setErrorHandling(PEAR_ERROR_PRINT);
$tar->create('.');
echo $tar_path . ' に拡張用プラグインを作成しました。管理画面のプラグイン管理からインストールしてください。' . "\n";
chdir($origdir);