/** * 受注IDをキーにして, 決済モジュールのパスを取得する. * * 決済モジュールが取得できた場合は, require 可能な決済モジュールのパスを返す. * 受注IDが無効な場合, 取得したパスにファイルが存在しない場合は false * * @param integer $order_id 受注ID * @return string|boolean 成功した場合は決済モジュールのパス; * 失敗した場合 false */ public function getModulePath($order_id) { $objPurchase = new SC_Helper_Purchase_Ex(); $objPayment = new SC_Helper_Payment_Ex(); $order = $objPurchase->getOrder($order_id); $payment = $objPayment->get($order['payment_id']); $module_path = $payment['module_path']; /* * 2.12.x までは dtb_payment.module_path がフルパスとなっていた. * 2.13.x より, MODULE_REALDIR からのパスでも対応できるよう修正 * http://svn.ec-cube.net/open_trac/ticket/2292 */ if (realpath($module_path) !== false) { $module_path = str_replace('\\', '/', realpath($module_path)); } else { $module_path = str_replace('\\', '/', $module_path); } $module_realdir = str_replace('\\', '/', realpath(MODULE_REALDIR) . '/'); if (strpos($module_path, $module_realdir) !== false) { $module_path = str_replace($module_realdir, '', $module_path); } $module_path = $module_realdir . $module_path; if (file_exists($module_path)) { return $module_path; } return false; }
function lfCheckError($post, $objFormParam, SC_Helper_Payment_Ex $objPayment) { // DBのデータを取得 $arrPaymentData = $objPayment->get($post['payment_id']); // 手数料を設定できない場合には、手数料を0にする if ($arrPaymentData['charge_flg'] == 2) { $objFormParam->setValue('charge', '0'); } // 入力データを渡す。 $arrRet = $objFormParam->getHashArray(); $objErr = new SC_CheckError_Ex($arrRet); $objErr->arrErr = $objFormParam->checkError(); // 利用条件(下限)チェック if ($arrRet['rule_max'] < $arrPaymentData['rule_min'] and $arrPaymentData['rule_min'] != '') { $objErr->arrErr['rule'] = '利用条件(下限)は' . $arrPaymentData['rule_min'] . '円以上にしてください。<br>'; } // 利用条件(上限)チェック if ($arrRet['upper_rule'] > $arrPaymentData['upper_rule_max'] and $arrPaymentData['upper_rule_max'] != '') { $objErr->arrErr['upper_rule'] = '利用条件(上限)は' . $arrPaymentData['upper_rule_max'] . '円以下にしてください。<br>'; } // 利用条件チェック $objErr->doFunc(array('利用条件(~円以上)', '利用条件(~円以下)', 'rule_max', 'upper_rule'), array('GREATER_CHECK')); return $objErr->arrErr; }
/** * 入力内容のチェックを行なう. * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @param integer $subtotal 購入金額の小計 * @param integer $max_point 会員の保持ポイント * @return array 入力チェック結果の配列 */ public function lfCheckError(&$objFormParam, $subtotal, $max_point) { // 入力データを渡す。 $arrForm = $objFormParam->getHashArray(); $objErr = new SC_CheckError_Ex($arrForm); $objErr->arrErr = $objFormParam->checkError(); if (USE_POINT === false) { return $objErr->arrErr; } $objErr->doFunc(array('ポイントを使用する', 'point_check'), array('EXIST_CHECK')); if ($arrForm['point_check'] == '1' && SC_Utils_Ex::isBlank($objErr->arrErr['use_point'])) { $objErr->doFunc(array('ポイント', 'use_point'), array('EXIST_CHECK')); if ($max_point == '') { $max_point = 0; } // FIXME mobile 互換のため br は閉じない... if ($arrForm['use_point'] > $max_point) { $objErr->arrErr['use_point'] = '※ ご利用ポイントが所持ポイントを超えています。<br>'; } if ($arrForm['use_point'] * POINT_VALUE > $subtotal) { $objErr->arrErr['use_point'] = '※ ご利用ポイントがご購入金額を超えています。<br>'; } // ポイント差し引き後のお支払い方法チェック $objPayment = new SC_Helper_Payment_Ex(); $arrPayments = $objPayment->get($arrForm['payment_id']); if ($arrPayments['rule_max'] > $subtotal - $arrForm['use_point'] * POINT_VALUE) { $objErr->arrErr['use_point'] = '※ 選択したお支払い方法では、ポイントは' . ($subtotal - $arrPayments['rule_max']) . 'ポイントまでご利用いただけます。<br>'; } } return $objErr->arrErr; }
private function validateOrderConsistency($arrOrder) { switch ($arrOrder['status']) { case ORDER_PENDING: // 対象ケース。以降で処理する break; // 会計済み。許容しうる // 会計済み。許容しうる case ORDER_NEW: case ORDER_PAY_WAIT: case ORDER_PRE_END: SC_Response_Ex::sendRedirect(SHOPPING_COMPLETE_URLPATH); SC_Response_Ex::actionExit(); break; // WebPay の決済では発生しない // WebPay の決済では発生しない default: SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', true, '注文情報の状態が不正です。<br />この手続きは無効となりました。'); } $objPayment = new SC_Helper_Payment_Ex(); $arrPayment = $objPayment->get($arrOrder['payment_id']); if ($arrPayment === null || $arrPayment['module_id'] !== MDL_WEBPAY_ID) { SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', true, '支払方法が不正です。<br />この手続きは無効となりました。'); } }
function lfCheckError($post, $objFormParam, SC_Helper_Payment_Ex $objPayment) { // DBのデータを取得 $arrPaymentData = $objPayment->get($post['payment_id']); // 手数料を設定できない場合には、手数料を0にする if ($arrPaymentData['charge_flg'] == 2) { $objFormParam->setValue('charge', '0'); } // 入力データを渡す。 $arrRet = $objFormParam->getHashArray(); $objErr = new SC_CheckError_Ex($arrRet); $objErr->arrErr = $objFormParam->checkError(); // 利用条件(下限)チェック if ($arrRet['rule_max'] < $arrPaymentData['rule_min'] and $arrPaymentData['rule_min'] != '') { $objErr->arrErr['rule'] = t('c_Make the usage conditions (lower limit) $ T_ARG1 or more.<br>_01', array('T_ARG1', $arrPaymentData['rule_min'])); } // 利用条件(上限)チェック if ($arrRet['upper_rule'] > $arrPaymentData['upper_rule_max'] and $arrPaymentData['upper_rule_max'] != '') { $objErr->arrErr['rule'] = t('c_Make the usage conditions (max) $ T_ARG1 or less.<br>_01', array('T_ARG1', $arrPaymentData['upper_rule_max'])); } // 利用条件チェック $objErr->doFunc(array(t('c_Usage conditions(-$ Above)_01'), t('c_Usage conditions(-$ Less than)_01'), 'rule_max', 'upper_rule'), array('GREATER_CHECK')); return $objErr->arrErr; }