public function testGetDetailAndProductsClass_商品規格IDの商品情報と規格情報を返す()
 {
     //更新日を取得
     $arrRet = $this->objQuery->getCol('update_date', 'dtb_products', 'product_id = 1001');
     $this->expected = array('product_id' => '1001', 'product_code_min' => 'code1001', 'product_code_max' => 'code1001', 'name' => '製品名1001', 'comment1' => 'コメント10011', 'comment2' => 'コメント10012', 'comment3' => 'コメント10013', 'main_list_comment' => 'リストコメント1001', 'main_image' => '1001.jpg', 'main_list_image' => '1001-main.jpg', 'price01_min' => '1500', 'price01_max' => '1500', 'price02_min' => '1500', 'price02_max' => '1500', 'stock_min' => '99', 'stock_max' => '99', 'stock_unlimited_min' => '0', 'stock_unlimited_max' => '0', 'deliv_date_id' => '1', 'status' => '1', 'del_flg' => '0', 'update_date' => $arrRet[0], 'price01_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price01_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'maker_id' => null, 'comment4' => null, 'comment5' => null, 'comment6' => null, 'note' => null, 'main_comment' => 'メインコメント1001', 'main_large_image' => null, 'sub_title1' => null, 'sub_comment1' => null, 'sub_image1' => null, 'sub_large_image1' => null, 'sub_title2' => null, 'sub_comment2' => null, 'sub_image2' => null, 'sub_large_image2' => null, 'sub_title3' => null, 'sub_comment3' => null, 'sub_image3' => null, 'sub_large_image3' => null, 'sub_title4' => null, 'sub_comment4' => null, 'sub_image4' => null, 'sub_large_image4' => null, 'sub_title5' => null, 'sub_comment5' => null, 'sub_image5' => null, 'sub_large_image5' => null, 'sub_title6' => null, 'sub_comment6' => null, 'sub_image6' => null, 'sub_large_image6' => null, 'creator_id' => '1', 'create_date' => $arrRet[0], 'point_rate' => '0', 'deliv_fee' => null, 'class_count' => '1', 'maker_name' => null, 'stock' => '99', 'stock_unlimited' => '0', 'sale_limit' => null, 'price01' => '1500', 'price02' => '1500', 'product_code' => 'code1001', 'product_class_id' => '1001', 'product_type_id' => '1', 'down_filename' => null, 'down_realfilename' => null, 'classcategory_name1' => 'cat1001', 'rank1' => '1', 'class_name1' => '味', 'class_id1' => '1', 'classcategory_id1' => '1001', 'classcategory_id2' => '1002', 'classcategory_name2' => 'cat1002', 'rank2' => '2', 'class_name2' => '味', 'class_id2' => '1', 'price01_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500));
     $this->actual = $this->objProducts->getDetailAndProductsClass('1001');
     $this->verify('商品詳細+規格');
 }
 /**
  * @test
  * @depends getCartList_商品を1つ追加した場合1つの配列を返す
  */
 public function getCartList_商品を1つ追加した場合商品データを返す($cartList)
 {
     $this->expected = array('product_id' => '1001', 'product_code_min' => 'code1001', 'product_code_max' => 'code1001', 'name' => '製品名1001', 'comment1' => 'コメント10011', 'comment2' => 'コメント10012', 'comment3' => 'コメント10013', 'main_list_comment' => 'リストコメント1001', 'main_image' => '1001.jpg', 'main_list_image' => '1001-main.jpg', 'price01_min' => '1500', 'price01_max' => '1500', 'price02_min' => '1500', 'price02_max' => '1500', 'stock_min' => '99', 'stock_max' => '99', 'stock_unlimited_min' => '0', 'stock_unlimited_max' => '0', 'deliv_date_id' => '1', 'status' => '1', 'del_flg' => '0', 'price01_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price01_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'maker_id' => null, 'comment4' => null, 'comment5' => null, 'comment6' => null, 'note' => null, 'main_comment' => 'メインコメント1001', 'main_large_image' => null, 'sub_title1' => null, 'sub_comment1' => null, 'sub_image1' => null, 'sub_large_image1' => null, 'sub_title2' => null, 'sub_comment2' => null, 'sub_image2' => null, 'sub_large_image2' => null, 'sub_title3' => null, 'sub_comment3' => null, 'sub_image3' => null, 'sub_large_image3' => null, 'sub_title4' => null, 'sub_comment4' => null, 'sub_image4' => null, 'sub_large_image4' => null, 'sub_title5' => null, 'sub_comment5' => null, 'sub_image5' => null, 'sub_large_image5' => null, 'sub_title6' => null, 'sub_comment6' => null, 'sub_image6' => null, 'sub_large_image6' => null, 'creator_id' => '1', 'point_rate' => '0', 'deliv_fee' => null, 'maker_name' => null, 'stock' => '99', 'stock_unlimited' => '0', 'sale_limit' => null, 'price01' => '1500', 'price02' => '1500', 'product_code' => 'code1001', 'product_class_id' => '1001', 'product_type_id' => '1', 'down_filename' => null, 'down_realfilename' => null, 'classcategory_name1' => 'cat1001', 'rank1' => null, 'class_name1' => '味', 'class_id1' => '1', 'classcategory_id1' => '1001', 'classcategory_id2' => '1002', 'classcategory_name2' => 'cat1002', 'rank2' => null, 'class_name2' => '味', 'class_id2' => '1', 'price01_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500));
     // 時間はずれるので配列から削除
     unset($cartList[0]['productsClass']['update_date']);
     unset($cartList[0]['productsClass']['create_date']);
     $this->actual = $cartList[0]['productsClass'];
     $this->verify('商品詳細');
 }
 public function testGetListByProductIds_指定の商品IDで情報を取得する()
 {
     $arrProductId = array('1001');
     //更新日を取得
     $arrRet = $this->objQuery->getCol('update_date', 'dtb_products', 'product_id = 1001');
     $this->expected = array('1001' => array('product_id' => '1001', 'product_code_min' => 'code1001', 'product_code_max' => 'code1001', 'name' => '製品名1001', 'comment1' => 'コメント10011', 'comment2' => 'コメント10012', 'comment3' => 'コメント10013', 'main_list_comment' => 'リストコメント1001', 'main_image' => '1001.jpg', 'main_list_image' => '1001-main.jpg', 'price01_min' => '1500', 'price01_max' => '1500', 'price02_min' => '1500', 'price02_max' => '1500', 'stock_min' => '99', 'stock_max' => '99', 'stock_unlimited_min' => '0', 'stock_unlimited_max' => '0', 'deliv_date_id' => '1', 'status' => '1', 'del_flg' => '0', 'update_date' => $arrRet[0], 'price01_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price01_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500)));
     $this->actual = $this->objProducts->getListByProductIds($this->objQuery, $arrProductId);
     $this->verify('商品ID指定');
 }
 public function testGetProductsClass_商品規格IDから規格情報を返す()
 {
     $this->setUpProductClass();
     $this->setUpProducts();
     $this->setUpClassCategory();
     $this->expected = array('product_id' => '1001', 'del_flg' => '0', 'point_rate' => '0', 'stock' => '99', 'stock_unlimited' => '0', 'sale_limit' => null, 'price01' => '1500', 'price02' => '1500', 'product_code' => 'code1001', 'product_class_id' => '1001', 'product_type_id' => '1', 'down_filename' => null, 'down_realfilename' => null, 'classcategory_name1' => 'cat1001', 'rank1' => null, 'class_name1' => '味', 'class_id1' => '1', 'classcategory_id1' => '1001', 'classcategory_id2' => '1002', 'classcategory_name2' => 'cat1002', 'rank2' => null, 'class_name2' => '味', 'class_id2' => '1', 'price01_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax('1500'), 'price02_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax('1500'));
     $this->actual = $this->objProducts->getProductsClass('1001');
     $this->verify('商品規格');
 }
 public function testSetShipmentItemTemp_製品情報が存在しない場合_DBから取得した値が反映される()
 {
     $this->helper->setShipmentItemTemp('1001', '1002', 10);
     $this->expected = array('shipping_id' => '1001', 'product_class_id' => '1002', 'quantity' => 10, 'price' => '2500', 'total_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(25000));
     $result = $_SESSION['shipping']['1001']['shipment_item']['1002'];
     unset($result['productsClass']);
     $this->actual = $result;
     $this->verify();
 }
 public function testGetDetail_商品IDの詳細情報を返す()
 {
     $this->setUpProductClass();
     $this->setUpProducts();
     $this->setUpClassCategory();
     //更新日を取得
     $arrRet = $this->objQuery->getCol('update_date', 'dtb_products', 'product_id = 1001');
     $this->expected = array('product_id' => '1001', 'product_code_min' => 'code1001', 'product_code_max' => 'code1001', 'name' => '製品名1001', 'comment1' => 'コメント10011', 'comment2' => 'コメント10012', 'comment3' => 'コメント10013', 'main_list_comment' => 'リストコメント1001', 'main_image' => '1001.jpg', 'main_list_image' => '1001-main.jpg', 'price01_min' => '1500', 'price01_max' => '1500', 'price02_min' => '1500', 'price02_max' => '1500', 'stock_min' => '99', 'stock_max' => '99', 'stock_unlimited_min' => '0', 'stock_unlimited_max' => '0', 'deliv_date_id' => '1', 'status' => '1', 'del_flg' => '0', 'update_date' => $arrRet[0], 'price01_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax('1500'), 'price01_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax('1500'), 'price02_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax('1500'), 'price02_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax('1500'), 'maker_id' => null, 'comment4' => null, 'comment5' => null, 'comment6' => null, 'note' => null, 'main_comment' => 'メインコメント1001', 'main_large_image' => null, 'sub_title1' => null, 'sub_comment1' => null, 'sub_image1' => null, 'sub_large_image1' => null, 'sub_title2' => null, 'sub_comment2' => null, 'sub_image2' => null, 'sub_large_image2' => null, 'sub_title3' => null, 'sub_comment3' => null, 'sub_image3' => null, 'sub_large_image3' => null, 'sub_title4' => null, 'sub_comment4' => null, 'sub_image4' => null, 'sub_large_image4' => null, 'sub_title5' => null, 'sub_comment5' => null, 'sub_image5' => null, 'sub_large_image5' => null, 'sub_title6' => null, 'sub_comment6' => null, 'sub_image6' => null, 'sub_large_image6' => null, 'creator_id' => '1', 'create_date' => $arrRet[0], 'point_rate' => '0', 'deliv_fee' => null, 'class_count' => '1', 'maker_name' => null);
     $this->actual = $this->objProducts->getDetail('1001');
     $this->verify('商品詳細');
 }
 /**
  * 配送商品を設定する.
  *
  * @param  integer $shipping_id      配送先ID
  * @param  integer $product_class_id 商品規格ID
  * @param  integer $quantity         数量
  * @return void
  */
 public function setShipmentItemTemp($shipping_id, $product_class_id, $quantity)
 {
     // 配列が長くなるので, リファレンスを使用する
     $arrItems =& $_SESSION['shipping'][$shipping_id]['shipment_item'][$product_class_id];
     $arrItems['shipping_id'] = $shipping_id;
     $arrItems['product_class_id'] = $product_class_id;
     $arrItems['quantity'] = $quantity;
     $objProduct = new SC_Product_Ex();
     // カート情報から読みこめば済むと思うが、一旦保留。むしろ、カート情報も含め、セッション情報を縮小すべきかもしれない。
     /*
     $objCartSession = new SC_CartSession_Ex();
     $cartKey = $objCartSession->getKey();
     // 詳細情報を取得
     $cartItems = $objCartSession->getCartList($cartKey);
     */
     if (empty($arrItems['productsClass'])) {
         $product =& $objProduct->getDetailAndProductsClass($product_class_id);
         $arrItems['productsClass'] = $product;
     }
     $arrItems['price'] = $arrItems['productsClass']['price02'];
     $inctax = SC_Helper_TaxRule_Ex::sfCalcIncTax($arrItems['price'], $arrItems['productsClass']['product_id'], $arrItems['productsClass']['product_class_id']);
     $arrItems['total_inctax'] = $inctax * $arrItems['quantity'];
 }
 /**
  * カート内の商品の妥当性をチェックする.
  *
  * エラーが発生した場合は, 商品をカート内から削除又は数量を調整し,
  * エラーメッセージを返す.
  *
  * 1. 商品種別に関連づけられた配送業者の存在チェック
  * 2. 削除/非表示商品のチェック
  * 3. 販売制限数のチェック
  * 4. 在庫数チェック
  *
  * @param  string $productTypeId 商品種別ID
  * @return string エラーが発生した場合はエラーメッセージ
  */
 public function checkProducts($productTypeId)
 {
     $objProduct = new SC_Product_Ex();
     $objDelivery = new SC_Helper_Delivery_Ex();
     $arrDeliv = $objDelivery->getList($productTypeId);
     $tpl_message = '';
     // カート内の情報を取得
     $arrItems = $this->getCartList($productTypeId);
     foreach ($arrItems as &$arrItem) {
         $product =& $arrItem['productsClass'];
         /*
          * 表示/非表示商品のチェック
          */
         if (SC_Utils_Ex::isBlank($product) || $product['status'] != 1) {
             $this->delProduct($arrItem['cart_no'], $productTypeId);
             $tpl_message .= "※ 現時点で販売していない商品が含まれておりました。該当商品をカートから削除しました。\n";
         } else {
             /*
              * 配送業者のチェック
              */
             if (SC_Utils_Ex::isBlank($arrDeliv)) {
                 $tpl_message .= '※「' . $product['name'] . '」はまだ配送の準備ができておりません。';
                 $tpl_message .= '恐れ入りますがお問い合わせページよりお問い合わせください。' . "\n";
                 $this->delProduct($arrItem['cart_no'], $productTypeId);
             }
             /*
              * 販売制限数, 在庫数のチェック
              */
             $limit = $objProduct->getBuyLimit($product);
             if (!is_null($limit) && $arrItem['quantity'] > $limit) {
                 if ($limit > 0) {
                     $this->setProductValue($arrItem['id'], 'quantity', $limit, $productTypeId);
                     $total_inctax = $limit * SC_Helper_TaxRule_Ex::sfCalcIncTax($arrItem['price'], $product['product_id'], $arrItem['id'][0]);
                     $this->setProductValue($arrItem['id'], 'total_inctax', $total_inctax, $productTypeId);
                     $tpl_message .= '※「' . $product['name'] . '」は販売制限(または在庫が不足)しております。';
                     $tpl_message .= "一度に数量{$limit}を超える購入はできません。\n";
                 } else {
                     $this->delProduct($arrItem['cart_no'], $productTypeId);
                     $tpl_message .= '※「' . $product['name'] . "」は売り切れました。\n";
                     continue;
                 }
             }
         }
     }
     return $tpl_message;
 }
 /**
  * 商品情報の配列に税込金額を設定する
  *
  * @param  array $arrProducts 商品情報の配列
  * @return void
  */
 public static function setIncTaxToProduct(&$arrProduct)
 {
     $arrProduct['price01_min_inctax'] = isset($arrProduct['price01_min']) ? SC_Helper_TaxRule_Ex::sfCalcIncTax($arrProduct['price01_min'], $arrProduct['product_id']) : null;
     $arrProduct['price01_max_inctax'] = isset($arrProduct['price01_max']) ? SC_Helper_TaxRule_Ex::sfCalcIncTax($arrProduct['price01_max'], $arrProduct['product_id']) : null;
     $arrProduct['price02_min_inctax'] = isset($arrProduct['price02_min']) ? SC_Helper_TaxRule_Ex::sfCalcIncTax($arrProduct['price02_min'], $arrProduct['product_id']) : null;
     $arrProduct['price02_max_inctax'] = isset($arrProduct['price02_max']) ? SC_Helper_TaxRule_Ex::sfCalcIncTax($arrProduct['price02_max'], $arrProduct['product_id']) : null;
 }
 /**
  * 都度課金.
  *
  * @param unknown $config
  * @param SC_Customer $objCustomer
  * @param number $ammount
  */
 function doPayCertForAuthorySold($config, SC_Customer $objCustomer, $ammount = 500)
 {
     // TODO 次期リリースで マスタ化
     switch ($ammount) {
         case 1000:
             $ammount = 1000;
             break;
         default:
             $ammount = 500;
     }
     $objQuery = SC_Query_Ex::getSingletonInstance();
     if (!$objCustomer->isLoginSuccess()) {
         $this->doLogin($this->getMode(), $objCustomer, $objQuery);
     }
     // FIXME 1円 1ポイント購入計算
     $point = $ammount;
     if ($this->tpl_point + $point > AU_MAXPOINT) {
         $msg = "合計ポイントが%sポイントを越えるためポイントの購入が出来ません";
         $msg = sprintf($msg, number_format(AU_MAXPOINT));
         SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", true, $msg);
     }
     $objProduct = new SC_Product_Ex();
     $ammount_in_tax = SC_Helper_TaxRule_Ex::sfCalcIncTax($ammount);
     $_SESSION["return_to_key"] = "pay_cert_for_authory_sold_return_to";
     if ($objProduct->isValidProductId($_REQUEST["product_id"])) {
         $_SESSION[$_SESSION["return_to_key"]] = P_DETAIL_URLPATH . $_REQUEST["product_id"];
     } else {
         $_SESSION[$_SESSION["return_to_key"]] = ROOT_URLPATH . "au/point_add_complete.php?ammount={$ammount}";
     }
     $_SESSION["before_mode"] = "pay_cert_for_authory_sold";
     $okUrl = new Net_URL($_SERVER["SCRIPT_NAME"]);
     $ngUrl = new Net_URL($_SERVER["SCRIPT_NAME"]);
     $okUrl->addQueryString("mode", "pay_cert_for_authory_sold_ok");
     $okUrl->addQueryString("ammount", $ammount);
     $okUrl->addQueryString("ammount_in_tax", $ammount_in_tax);
     $ngUrl->addQueryString("mode", "pay_cert_for_authory_sold_ng");
     $shop_name = mb_convert_kana($this->arrSiteInfo["shop_name"], "AKc");
     $shop_tel = $this->getShopTel();
     // FIXME 決済認可
     $curl = $this->curl_init();
     $post_history = array();
     $post = $this->getPost("PayCertForAuthorySold", $config, array("certType" => "01", "openId" => $objCustomer->getValue("au_open_id"), "amount" => $ammount_in_tax, "commodity" => mb_convert_kana("ポイント購入", "A"), "memberAuthOkUrl" => $okUrl->getURL(), "memberAuthNgUrl" => $ngUrl->getURL(), "serviceName" => $shop_name, "serviceTel" => $shop_tel));
     $post_history[] = $post;
     curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
     $result = $this->curl_result($curl);
     $result["post_history"] = $post_history;
     $this->check_result($result);
     $transactionId = rawurldecode($result["body"]["transactionId"]);
     // FIXME ユーザー認証
     $result = $this->doUserPermitBridge($config, $objCustomer, $transactionId, $post_history);
     header("Location: " . $result["head"]["Location"]);
     SC_Response_Ex::actionExit();
 }
Example #11
0
 /**
  * Page のAction.
  *
  * @return void
  */
 public function action()
 {
     //決済処理中ステータスのロールバック
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG);
     $objCustomer = new SC_Customer_Ex();
     $objProduct = new SC_Product();
     if (!SC_Utils_Ex::sfIsInt($_GET['order_id'])) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     $order_id = $_GET['order_id'];
     $this->is_price_change = false;
     //受注データの取得
     $this->tpl_arrOrderData = $objPurchase->getOrder($order_id, $objCustomer->getValue('customer_id'));
     if (empty($this->tpl_arrOrderData)) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     $this->arrShipping = $this->lfGetShippingDate($objPurchase, $order_id, $this->arrWDAY);
     $this->isMultiple = count($this->arrShipping) > 1;
     // 支払い方法の取得
     $this->arrPayment = SC_Helper_Payment_Ex::getIDValueList();
     // 受注商品明細の取得
     $this->tpl_arrOrderDetail = $objPurchase->getOrderDetail($order_id);
     foreach ($this->tpl_arrOrderDetail as $product_index => $arrOrderProductDetail) {
         //必要なのは商品の販売金額のみなので、遅い場合は、別途SQL作成した方が良い
         $arrTempProductDetail = $objProduct->getProductsClass($arrOrderProductDetail['product_class_id']);
         // 税計算
         $this->tpl_arrOrderDetail[$product_index]['price_inctax'] = $this->tpl_arrOrderDetail[$product_index]['price'] + SC_Helper_TaxRule_Ex::calcTax($this->tpl_arrOrderDetail[$product_index]['price'], $this->tpl_arrOrderDetail[$product_index]['tax_rate'], $this->tpl_arrOrderDetail[$product_index]['tax_rule']);
         $arrTempProductDetail['price02_inctax'] = SC_Helper_TaxRule_Ex::sfCalcIncTax($arrTempProductDetail['price02'], $arrTempProductDetail['product_id'], $arrTempProductDetail['product_class_id']);
         if ($this->tpl_arrOrderDetail[$product_index]['price_inctax'] != $arrTempProductDetail['price02_inctax']) {
             $this->is_price_change = true;
         }
         $this->tpl_arrOrderDetail[$product_index]['product_price_inctax'] = $arrTempProductDetail['price02_inctax'] ? $arrTempProductDetail['price02_inctax'] : 0;
     }
     $this->tpl_arrOrderDetail = $this->setMainListImage($this->tpl_arrOrderDetail);
     $objPurchase->setDownloadableFlgTo($this->tpl_arrOrderDetail);
     // モバイルダウンロード対応処理
     $this->lfSetAU($this->tpl_arrOrderDetail);
     // 受注メール送信履歴の取得
     $this->tpl_arrMailHistory = $this->lfGetMailHistory($order_id);
 }