public function testGetPayments_存在する配送業者IDを指定した場合_結果が正しい順序で取得できる()
 {
     $deliv_id = '1001';
     $this->expected = array('1002', '1001');
     $helper = new SC_Helper_Purchase();
     $this->actual = $helper->getPayments($deliv_id);
     $this->verify('支払方法');
 }
 public function testGetDelivTime_存在する配送業者IDを指定した場合_結果が正しい順序で取得できる()
 {
     $deliv_id = '1001';
     $this->expected = array('1' => '午前', '2' => '午後');
     $helper = new SC_Helper_Purchase();
     $this->actual = $helper->getDelivTime($deliv_id);
     $this->verify('お届け時間');
 }
 public function testExtractShipping__予め指定されたキーだけが抽出される()
 {
     $helper = new SC_Helper_Purchase();
     $helper->arrShippingKey = array('id', 'name', 'code');
     $arrSrc = array('shipping_id' => '1001', 'shipping_code' => 'cd1001', 'shipping_detail' => 'dt1001', 'shipping_name' => '名称1001');
     $this->expected = array('shipping_id' => '1001', 'shipping_name' => '名称1001', 'shipping_code' => 'cd1001');
     $this->actual = $helper->extractShipping($arrSrc);
     $this->verify();
 }
 public function testGetPaymentsByPaymentsId_削除されている支払IDを指定した場合_結果が空になる()
 {
     $payment_id = '1002';
     // 削除済みのID
     $this->expected = null;
     $helper = new SC_Helper_Purchase();
     $this->actual = $helper->getPaymentsByPaymentsId($payment_id);
     $this->verify('支払方法');
 }
 public function testCopyFromOrder_接頭辞・キーを設定した場合_指定の値でコピーされる()
 {
     $dest = array();
     $src = array('input_name01' => '姓', 'input_name02' => '名', 'input_zip01' => '012');
     $this->expected = array('output_name01' => '姓', 'output_name02' => '名');
     $helper = new SC_Helper_Purchase();
     $helper->copyFromOrder($dest, $src, 'output', 'input', array('name01', 'name02'));
     $this->actual = $dest;
     $this->verify();
 }
 public function testGetPaymentsByPrice_購入金額がすべての下限を下回る場合_下限の設定がないものだけ取得できる()
 {
     $deliv_id = '1003';
     $total = 9999;
     $helper = new SC_Helper_Purchase();
     $this->expected = array('3002', '3004');
     $result = $helper->getPaymentsByPrice($total, $deliv_id);
     $this->actual = Test_Utils::mapCols($result, 'payment_id');
     $this->verify();
 }
 public function testGetShippings_商品取得フラグをOFFにした場合_結果に商品情報が含まれない()
 {
     $order_id = '1001';
     $this->expected['count'] = 1;
     $this->expected['first'] = array('order_id' => '1001', 'shipping_id' => '1', 'shipping_name01' => '配送情報01', 'shipping_date' => '2012-01-12 00:00:00');
     $this->expected['shipment_item_count'] = 0;
     $helper = new SC_Helper_Purchase();
     $result = $helper->getShippings($order_id, false);
     $this->actual['count'] = count($result);
     // shipping_idごとの配列になっているのでshipping_idで抽出
     $this->actual['first'] = Test_Utils::mapArray($result['1'], array('order_id', 'shipping_id', 'shipping_name01', 'shipping_date'));
     $this->actual['shipment_item_count'] = count($result['1']['shipment_item']);
     $this->verify('配送情報');
 }
 public function testClearShipmentItem_商品情報が配列でない場合_何も変更されない()
 {
     $this->setUpShipping($this->getMultipleShipping());
     // 内容を配列でないように変更
     $_SESSION['shipping']['00001'] = 'temp';
     $helper = new SC_Helper_Purchase();
     $helper->clearShipmentItemTemp('00001');
     // '00001'は配列でないので全体を取得
     $this->expected = array('00001' => 'temp', '00002' => array('商品2'), '00003' => array());
     $this->actual['00001'] = $_SESSION['shipping']['00001'];
     $this->actual['00002'] = $_SESSION['shipping']['00002']['shipment_item'];
     $this->actual['00003'] = $_SESSION['shipping']['00003']['shipment_item'];
     $this->verify('配送商品');
 }
 public function testGetDeliv_存在する商品種別IDを指定した場合_結果が正しい順序で取得できる()
 {
     $product_type_id = '1001';
     $this->expected['count'] = 2;
     $this->expected['first'] = array('deliv_id' => '1002', 'product_type_id' => '1001', 'name' => '配送業者02', 'rank' => '3');
     $this->expected['second'] = array('deliv_id' => '1001', 'product_type_id' => '1001', 'name' => '配送業者01', 'rank' => '2');
     $helper = new SC_Helper_Purchase();
     $result = $helper->getDeliv($product_type_id);
     $this->actual['count'] = count($result);
     $cols = array('deliv_id', 'product_type_id', 'name', 'rank');
     $this->actual['first'] = Test_Utils::mapArray($result[0], $cols);
     $this->actual['second'] = Test_Utils::mapArray($result[1], $cols);
     $this->verify('配送業者');
 }
Example #10
0
 /**
  * 受注を完了する.
  *
  * 下記のフローで受注を完了する.
  *
  * 1. トランザクションを開始する
  * 2. カートの内容を検証する.
  * 3. 受注一時テーブルから受注データを読み込む
  * 4. ユーザーがログインしている場合はその他の発送先へ登録する
  * 5. 受注データを受注テーブルへ登録する
  * 6. トランザクションをコミットする
  *
  * 実行中に, 何らかのエラーが発生した場合, 処理を中止しエラーページへ遷移する
  *
  * 決済モジュールを使用する場合は対応状況を「決済処理中」に設定し,
  * 決済完了後「新規受付」に変更すること
  *
  * @param integer $orderStatus 受注処理を完了する際に設定する対応状況
  * @return void
  */
 function completeOrder($orderStatus = ORDER_NEW)
 {
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $objSiteSession = new SC_SiteSession_Ex();
     $objCartSession = new SC_CartSession_Ex();
     $objCustomer = new SC_Customer_Ex();
     $customerId = $objCustomer->getValue('customer_id');
     $objQuery->begin();
     if (!$objSiteSession->isPrePage()) {
         SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, $objSiteSession);
     }
     $uniqId = $objSiteSession->getUniqId();
     $this->verifyChangeCart($uniqId, $objCartSession);
     $orderTemp = $this->getOrderTemp($uniqId);
     $orderTemp['status'] = $orderStatus;
     $cartkey = $objCartSession->getKey();
     $order_id = $this->registerOrderComplete($orderTemp, $objCartSession, $cartkey);
     $isMultiple = SC_Helper_Purchase::isMultiple();
     $shippingTemp =& $this->getShippingTemp($isMultiple);
     foreach ($shippingTemp as $shippingId => $val) {
         $this->registerShipmentItem($order_id, $shippingId, $val['shipment_item']);
     }
     $this->registerShipping($order_id, $shippingTemp);
     $objQuery->commit();
     //会員情報の最終購入日、購入合計を更新
     if ($customerId > 0) {
         SC_Customer_Ex::updateOrderSummary($customerId);
     }
     $this->cleanupSession($order_id, $objCartSession, $objCustomer, $cartkey);
     GC_Utils_Ex::gfPrintLog('order complete. order_id=' . $order_id);
 }
 public function testGetShippingPref_保有フラグがONの場合_商品のある配送情報のみ取得する()
 {
     $this->setUpShipping($this->getMultipleShipping());
     $this->expected = array('東京都', '沖縄県');
     $this->actual = SC_Helper_Purchase::getShippingPref(TRUE);
     $this->verify('配送先の都道府県');
 }
 public function testGetOrderDetail_ステータス取得フラグがOFFのの場合_ステータス以外の情報が取得できる()
 {
     $order_id = '1001';
     $this->expected = array(array('product_id' => '1002', 'product_class_id' => '1002', 'product_type_id' => '2', 'product_code' => 'pc1002', 'product_name' => '製品名1002', 'classcategory_name1' => 'cat10021', 'classcategory_name2' => 'cat10022', 'price' => '3000', 'quantity' => '10', 'point_rate' => '5', 'enable' => '0', 'effective' => '1', 'tax_rate' => '5', 'tax_rule' => '0'), array('product_id' => '1001', 'product_class_id' => '1001', 'product_type_id' => '1', 'product_code' => 'pc1001', 'product_name' => '製品名1001', 'classcategory_name1' => 'cat10011', 'classcategory_name2' => 'cat10012', 'price' => '4000', 'quantity' => '15', 'point_rate' => '6', 'enable' => '1', 'effective' => '1', 'tax_rate' => '3', 'tax_rule' => '1'));
     $this->actual = SC_Helper_Purchase::getOrderDetail($order_id, false);
     $this->verify();
 }
 public function testGetShippingTemp_保有フラグがONの場合_商品のある情報のみ取得する()
 {
     $this->setUpShipping($this->getMultipleShipping());
     $this->expected = array('00001' => array('shipment_id' => '00001', 'shipment_item' => array('商品1'), 'shipping_pref' => '東京都'), '00002' => array('shipment_id' => '00002', 'shipment_item' => array('商品2'), 'shipping_pref' => '沖縄県'));
     $this->actual = SC_Helper_Purchase::getShippingTemp(TRUE);
     $this->verify('配送情報');
 }
 public function testGetOrderTemp_存在する受注IDを指定した場合_対応する結果が取得できる()
 {
     $order_temp_id = '1002';
     $this->expected = array('order_temp_id' => '1002', 'customer_id' => '1002', 'order_name01' => '受注情報02');
     $result = SC_Helper_Purchase::getOrderTemp($order_temp_id);
     $this->actual = Test_Utils::mapArray($result, array('order_temp_id', 'customer_id', 'order_name01'));
     $this->verify();
 }
 public function testUnsetShippingTemp__配送情報が全て破棄される()
 {
     SC_Helper_Purchase::unsetShippingTemp(TRUE);
     $this->expected = array('shipping' => TRUE, 'multiple_temp' => TRUE);
     $this->actual['shipping'] = empty($_SESSION['shipping']);
     $this->actual['multiple_temp'] = empty($_SESSION['multiple_temp']);
     $this->verify('セッション情報が空かどうか');
 }
 public function testSetDownloadableFlgTo_ダウンロード期限外かつ入金日なしの場合_フラグがOFFになる()
 {
     $input = array('1001' => array('price' => 1000, 'effective' => '0', 'payment_date' => null));
     $this->expected = false;
     SC_Helper_Purchase::setDownloadableFlgTo($input);
     $this->actual = $input['1001']['is_downloadable'];
     $this->verify('ダウンロード可能フラグ設定結果');
 }
 public function testUnsetOneShippingTemp__指定したIDの配送情報のみが破棄される()
 {
     $this->setUpShipping($this->getMultipleShipping());
     SC_Helper_Purchase::unsetOneShippingTemp('00002');
     $this->expected = array('00001' => array('shipment_id' => '00001', 'shipment_item' => array('商品1'), 'shipping_pref' => '東京都'), '00003' => array('shipment_id' => '00003', 'shipment_item' => array(), 'shipping_pref' => '埼玉県'));
     $this->actual = $_SESSION['shipping'];
     $this->verify('配送情報');
 }
 public function testRegisterOrderDetail_該当の受注が存在しない場合_新しい情報が追加登録される()
 {
     $params = array(array('order_id' => '1003', 'hoge' => '999', 'product_id' => '9003', 'product_class_id' => '9003', 'product_name' => '製品名9003'));
     SC_Helper_Purchase::registerOrderDetail('1003', $params);
     $this->expected['count'] = '4';
     $this->expected['content'] = array('order_id' => '1003', 'product_id' => '9003', 'product_class_id' => '9003', 'product_name' => '製品名9003', 'product_code' => null);
     $this->actual['count'] = $this->objQuery->count('dtb_order_detail');
     $result = $this->objQuery->select('order_id, product_id, product_class_id, product_name, product_code', 'dtb_order_detail', 'order_id = ?', array('1003'));
     $this->actual['content'] = $result[0];
     $this->verify();
 }
 public function testSaveShippingTemp_元々存在する配送先IDの場合_情報がマージされる()
 {
     $this->setUpShipping($this->getMultipleShipping());
     SC_Helper_Purchase::saveShippingTemp(array('shipment_item' => '商品4', 'shipping_pref' => '大阪府'), '00001');
     $this->expected = array('count' => 3, 'shipping_id' => '00001', 'shipment_item' => array('商品1'), 'shipping_pref' => '大阪府');
     $this->actual['count'] = count($_SESSION['shipping']);
     $this->actual['shipping_id'] = $_SESSION['shipping']['00001']['shipping_id'];
     $this->actual['shipment_item'] = $_SESSION['shipping']['00001']['shipment_item'];
     $this->actual['shipping_pref'] = $_SESSION['shipping']['00001']['shipping_pref'];
     $this->verify('更新した配送情報');
 }
 public function testCleanupSession__カートとセッションの配送情報が削除される()
 {
     // 引数の準備
     $helper = new SC_Helper_Purchase();
     $cartSession = new SC_CartSession();
     $customer = new SC_Customer();
     // 削除前のデータを設定
     $cartSession->addProduct('1001', 5);
     // product_type_id=1
     $cartSession->addProduct('1002', 10);
     // product_type_id=2
     $_SESSION['site']['uniqid'] = '100001';
     $helper->cleanupSession('1001', $cartSession, $customer, '1');
     $this->expected = array('cart_max_deleted' => 0, 'cart_max_notdeleted' => 1, 'uniqid' => '', 'shipping' => null, 'multiple_temp' => null);
     $this->actual['cart_max_deleted'] = $cartSession->getMax('1');
     $this->actual['cart_max_notdeleted'] = $cartSession->getMax('2');
     $this->actual['uniqid'] = $_SESSION['site']['uniqid'];
     $this->actual['shipping'] = $_SESSION['shipping'];
     $this->actual['multiple_temp'] = $_SESSION['multiple_temp'];
     $this->verify();
 }
 public function testGetShipmentItems_詳細フラグをOFFにした場合_結果に詳細情報が含まれない()
 {
     $order_id = '1';
     $shipping_id = '1';
     $this->expected['count'] = 2;
     $this->expected['first'] = array('order_id' => '1', 'shipping_id' => '1', 'product_class_id' => '1001', 'product_name' => '商品名01', 'price' => '1500', 'productsClass' => null);
     $this->expected['second'] = array('order_id' => '1', 'shipping_id' => '1', 'product_class_id' => '1002', 'product_name' => '商品名02', 'price' => '2400', 'productsClass' => null);
     $result = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id, false);
     $this->actual['count'] = count($result);
     $this->actual['first'] = Test_Utils::mapArray($result[0], array('order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass'));
     $this->actual['second'] = Test_Utils::mapArray($result[1], array('order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass'));
     $this->verify('配送情報');
 }
 public function testCopyFromCustomer_モバイルでない場合_通常のメールアドレスをそのまま設定する()
 {
     $dest = array();
     $prefix = 'prefix';
     // キーを絞る
     $keys = array('name01', 'email');
     User_Utils::setLoginState(TRUE, $this->customer_array, $this->objQuery);
     User_Utils::setDeviceType(DEVICE_TYPE_PC);
     $this->customer->setValue('email_mobile', '*****@*****.**');
     $this->expected = array('prefix_name01' => '姓01', 'prefix_email' => '*****@*****.**', 'customer_id' => '1001', 'update_date' => 'CURRENT_TIMESTAMP');
     $helper = new SC_Helper_Purchase();
     $helper->copyFromCustomer($dest, $this->customer, $prefix, $keys);
     $this->actual = $dest;
     $this->verify();
 }
 /**
  * 注文受付メールを送信する.
  *
  * 端末種別IDにより, 携帯電話の場合は携帯用の文面,
  * それ以外の場合は PC 用の文面でメールを送信する.
  *
  * @param integer $order_id 受注ID
  * @param  object  $objPage LC_Page インスタンス
  * @return boolean 送信に成功したか。現状では、正確には取得できない。
  */
 public static function sendOrderMail($order_id, &$objPage = NULL)
 {
     $objMail = new SC_Helper_Mail_Ex();
     // setPageは、プラグインの処理に必要(see #1798)
     if (is_object($objPage)) {
         $objMail->setPage($objPage);
     }
     $arrOrder = SC_Helper_Purchase::getOrder($order_id);
     if (empty($arrOrder)) {
         return false;
         // 失敗
     }
     $template_id = $arrOrder['device_type_id'] == DEVICE_TYPE_MOBILE ? 2 : 1;
     $objMail->sfSendOrderMail($order_id, $template_id);
     return true;
     // 成功
 }
 public function testRegisterShipmentItem_DBに存在しないカラムを指定した場合_エラーなく登録できる()
 {
     // 引数の設定
     $order_id = '1';
     $shipping_id = '1';
     $arrParams = array(array('product_class_id' => '1', 'product_name' => '追加製品名01', 'product_code' => 'newcode01', 'classcategory_name1' => 'newcat01', 'classcategory_name2' => 'newcat02', 'price' => '2500', 'xxxx' => 'yyyyyy'));
     // 期待値の設定
     $this->expected['count'] = 1;
     $this->expected['first'] = array('product_class_id' => '1', 'product_name' => '追加製品名01', 'product_code' => 'newcode01', 'classcategory_name1' => 'newcat01', 'classcategory_name2' => 'newcat02', 'price' => '2500');
     // 対象functionの呼び出し
     SC_Helper_Purchase::registerShipmentItem($order_id, $shipping_id, $arrParams);
     $result = $this->objQuery->select('product_class_id,product_name,product_code,classcategory_name1,classcategory_name2,price', 'dtb_shipment_item', 'order_id = ? and shipping_id = ?', array($order_id, $shipping_id));
     $this->actual['count'] = count($result);
     $this->actual['first'] = $result[0];
     $this->verify('登録された配送商品情報');
 }
 /**
  * DB更新処理
  *
  * @param integer $order_id 受注ID
  * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
  * @param SC_FormParam $objFormParam SC_FormParam インスタンス
  * @param string $message 通知メッセージ
  * @param array $arrValuesBefore 更新前の受注情報
  * @return integer $order_id 受注ID
  *
  * エラー発生時は負数を返す。
  */
 function doRegister($order_id, &$objPurchase, &$objFormParam, &$message, &$arrValuesBefore)
 {
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $arrValues = $objFormParam->getDbArray();
     $where = 'order_id = ?';
     $objQuery->begin();
     // 支払い方法が変更されたら、支払い方法名称も更新
     if ($arrValues['payment_id'] != $arrValuesBefore['payment_id']) {
         $arrValues['payment_method'] = $this->arrPayment[$arrValues['payment_id']];
         $arrValuesBefore['payment_id'] = NULL;
     }
     // 受注テーブルの更新
     $order_id = $objPurchase->registerOrder($order_id, $arrValues);
     $arrDetail = $objFormParam->getSwapArray(array('product_id', 'product_class_id', 'product_code', 'product_name', 'price', 'quantity', 'point_rate', 'classcategory_name1', 'classcategory_name2'));
     // 変更しようとしている商品情報とDBに登録してある商品情報を比較することで、更新すべき数量を計算
     $max = count($arrDetail);
     $k = 0;
     $arrStockData = array();
     for ($i = 0; $i < $max; $i++) {
         if (!empty($arrDetail[$i]['product_id'])) {
             $arrPreDetail = $objQuery->select('*', 'dtb_order_detail', 'order_id = ? AND product_class_id = ?', array($order_id, $arrDetail[$i]['product_class_id']));
             if (!empty($arrPreDetail) && $arrPreDetail[0]['quantity'] != $arrDetail[$i]['quantity']) {
                 // 数量が変更された商品
                 $arrStockData[$k]['product_class_id'] = $arrDetail[$i]['product_class_id'];
                 $arrStockData[$k]['quantity'] = $arrPreDetail[0]['quantity'] - $arrDetail[$i]['quantity'];
                 ++$k;
             } elseif (empty($arrPreDetail)) {
                 // 新しく追加された商品 もしくは 違う商品に変更された商品
                 $arrStockData[$k]['product_class_id'] = $arrDetail[$i]['product_class_id'];
                 $arrStockData[$k]['quantity'] = -$arrDetail[$i]['quantity'];
                 ++$k;
             }
             $objQuery->delete('dtb_order_detail', 'order_id = ? AND product_class_id = ?', array($order_id, $arrDetail[$i]['product_class_id']));
         }
     }
     // 上記の新しい商品のループでDELETEされなかった商品は、注文より削除された商品
     $arrPreDetail = $objQuery->select('*', 'dtb_order_detail', 'order_id = ?', array($order_id));
     foreach ($arrPreDetail as $key => $val) {
         $arrStockData[$k]['product_class_id'] = $val['product_class_id'];
         $arrStockData[$k]['quantity'] = $val['quantity'];
         ++$k;
     }
     // 受注詳細データの更新
     $objPurchase->registerOrderDetail($order_id, $arrDetail);
     // 在庫数調整
     if (ORDER_DELIV != $arrValues['status'] && ORDER_CANCEL != $arrValues['status']) {
         foreach ($arrStockData as $stock) {
             $objQuery->update('dtb_products_class', array(), 'product_class_id = ?', array($stock['product_class_id']), array('stock' => 'stock + ?'), array($stock['quantity']));
         }
     }
     $arrAllShipping = $objFormParam->getSwapArray($this->arrShippingKeys);
     $arrAllShipmentItem = $objFormParam->getSwapArray($this->arrShipmentItemKeys);
     $arrDelivTime = $objPurchase->getDelivTime($objFormParam->getValue('deliv_id'));
     $arrShippingValues = array();
     foreach ($arrAllShipping as $shipping_index => $arrShipping) {
         $shipping_id = $arrShipping['shipping_id'];
         $arrShippingValues[$shipping_index] = $arrShipping;
         $arrShippingValues[$shipping_index]['shipping_date'] = SC_Utils_Ex::sfGetTimestamp($arrShipping['shipping_date_year'], $arrShipping['shipping_date_month'], $arrShipping['shipping_date_day']);
         // 配送業者IDを取得
         $arrShippingValues[$shipping_index]['deliv_id'] = $objFormParam->getValue('deliv_id');
         // お届け時間名称を取得
         $arrShippingValues[$shipping_index]['shipping_time'] = $arrDelivTime[$arrShipping['time_id']];
         // 複数配送の場合は配送商品を登録
         if (!SC_Utils_Ex::isBlank($arrAllShipmentItem)) {
             $arrShipmentValues = array();
             foreach ($arrAllShipmentItem[$shipping_index] as $key => $arrItem) {
                 $i = 0;
                 foreach ($arrItem as $item) {
                     $arrShipmentValues[$shipping_index][$i][str_replace('shipment_', '', $key)] = $item;
                     $i++;
                 }
             }
             $objPurchase->registerShipmentItem($order_id, $shipping_id, $arrShipmentValues[$shipping_index]);
         }
     }
     $objPurchase->registerShipping($order_id, $arrShippingValues, false);
     $objQuery->commit();
     return $order_id;
 }
 /**
  * 複数配送情報を一時保存する.
  *
  * 会員ログインしている場合は, その他のお届け先から住所情報を取得する.
  *
  * @param  integer            $uniqid       一時受注テーブルのユニークID
  * @param  SC_FormParam       $objFormParam SC_FormParam インスタンス
  * @param  SC_Customer        $objCustomer  SC_Customer インスタンス
  * @param  SC_Helper_Purchase $objPurchase  SC_Helper_Purchase インスタンス
  * @return void
  */
 public function saveMultipleShippings($uniqid, &$objFormParam, &$objCustomer, &$objPurchase, &$objAddress)
 {
     $arrParams = $objFormParam->getSwapArray();
     foreach ($arrParams as $arrParam) {
         $other_deliv_id = $arrParam['shipping'];
         if ($objCustomer->isLoginSuccess(true)) {
             if ($other_deliv_id != 0) {
                 $otherDeliv = $objAddress->getAddress($other_deliv_id, $objCustomer->getValue('customer_id'));
                 if (!$otherDeliv) {
                     SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', false, "入力値が不正です。<br />正しい値を入力してください。");
                     SC_Response_Ex::actionExit();
                 }
                 foreach ($otherDeliv as $key => $val) {
                     $arrValues[$other_deliv_id]['shipping_' . $key] = $val;
                 }
             } else {
                 $objPurchase->copyFromCustomer($arrValues[0], $objCustomer, 'shipping');
             }
         } else {
             $arrValues = $objPurchase->getShippingTemp();
         }
         $arrItemTemp[$other_deliv_id][$arrParam['product_class_id']] += $arrParam['quantity'];
     }
     $objPurchase->clearShipmentItemTemp();
     foreach ($arrValues as $shipping_id => $arrVal) {
         $objPurchase->saveShippingTemp($arrVal, $shipping_id);
     }
     foreach ($arrItemTemp as $other_deliv_id => $arrProductClassIds) {
         foreach ($arrProductClassIds as $product_class_id => $quantity) {
             if ($quantity == 0) {
                 continue;
             }
             $objPurchase->setShipmentItemTemp($other_deliv_id, $product_class_id, $quantity);
         }
     }
     //不必要な配送先を削除
     foreach ($_SESSION['shipping'] as $id => $arrShipping) {
         if (!isset($arrShipping['shipment_item'])) {
             $objPurchase->unsetOneShippingTemp($id);
         }
     }
     // $arrValues[0] には, 購入者の情報が格納されている
     $objPurchase->saveOrderTemp($uniqid, $arrValues[0], $objCustomer);
 }
 /**
  * 複数配送情報を一時保存する.
  *
  * 会員ログインしている場合は, その他のお届け先から住所情報を取得する.
  *
  * @param integer $uniqid 一時受注テーブルのユニークID
  * @param SC_FormParam $objFormParam SC_FormParam インスタンス
  * @param SC_Customer $objCustomer SC_Customer インスタンス
  * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
  * @param SC_CartSession $objCartSess SC_CartSession インスタンス
  * @return void
  */
 function saveMultipleShippings($uniqid, &$objFormParam, &$objCustomer, &$objPurchase, &$objCartSess, &$objAddress)
 {
     $arrParams = $objFormParam->getSwapArray();
     foreach ($arrParams as $arrParam) {
         $other_deliv_id = $arrParam['shipping'];
         if ($objCustomer->isLoginSuccess(true)) {
             if ($other_deliv_id != 0) {
                 $otherDeliv = $objAddress->getAddress($other_deliv_id);
                 foreach ($otherDeliv as $key => $val) {
                     $arrValues[$other_deliv_id]['shipping_' . $key] = $val;
                 }
             } else {
                 $objPurchase->copyFromCustomer($arrValues[0], $objCustomer, 'shipping');
             }
         } else {
             $arrValues = $objPurchase->getShippingTemp();
         }
         $arrItemTemp[$other_deliv_id][$arrParam['product_class_id']] += $arrParam['quantity'];
     }
     $objPurchase->clearShipmentItemTemp();
     foreach ($arrValues as $shipping_id => $arrVal) {
         $objPurchase->saveShippingTemp($arrVal, $shipping_id);
     }
     foreach ($arrItemTemp as $other_deliv_id => $arrProductClassIds) {
         foreach ($arrProductClassIds as $product_class_id => $quantity) {
             if ($quantity == 0) {
                 continue;
             }
             $objPurchase->setShipmentItemTemp($other_deliv_id, $product_class_id, $quantity);
         }
     }
     //不必要な配送先を削除
     foreach ($_SESSION['shipping'] as $id => $arrShipping) {
         if (!isset($arrShipping['shipment_item'])) {
             $objPurchase->unsetOneShippingTemp($id);
         }
     }
     // $arrValues[0] には, 購入者の情報が格納されている
     $objPurchase->saveOrderTemp($uniqid, $arrValues[0], $objCustomer);
 }
 /**
  * 配送業者IDから, 支払い方法, お届け時間の配列を取得する.
  *
  * 結果の連想配列の添字の値は以下の通り
  * - 'arrDelivTime' - お届け時間の配列
  * - 'arrPayment' - 支払い方法の配列
  * - 'img_show' - 支払い方法の画像の有無
  *
  * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
  * @param SC_CartSession $objCartSess SC_CartSession インスタンス
  * @param integer $deliv_id 配送業者ID
  * @return array 支払い方法, お届け時間を格納した配列
  */
 function getSelectedDeliv(&$objPurchase, &$objCartSess, $deliv_id)
 {
     $arrResults = array();
     $arrResults['arrDelivTime'] = $objPurchase->getDelivTime($deliv_id);
     $total = $objCartSess->getAllProductsTotal($objCartSess->getKey(), $deliv_id);
     $arrResults['arrPayment'] = $objPurchase->getPaymentsByPrice($total, $deliv_id);
     $arrResults['img_show'] = $this->hasPaymentImage($arrResults['arrPayment']);
     return $arrResults;
 }
 public function testIsAddPoint_その他の場合_FALSEが返る()
 {
     $this->expected = FALSE;
     $this->actual = SC_Helper_Purchase::isAddPoint(ORDER_PENDING);
     $this->verify('ポイント加算するかどうか');
 }
 public function testIsUsePoint_ステータスがキャンセル以外の場合_TRUEが返る()
 {
     $this->expected = TRUE;
     $this->actual = SC_Helper_Purchase::isUsePoint(ORDER_NEW);
     $this->verify('ポイント加算するかどうか');
 }