Exemplo n.º 1
0
    $out_trade_no = $_POST["out_trade_no"];
    $status = $_POST["trade_status"];
    $trade_no = $_POST["trade_no"];
    $total_fee = $_POST["total_fee"];
    $currency = $_POST["currency"];
    $objPurchase = new SC_Helper_Purchase();
    $orderInfo = $objPurchase->getOrder($out_trade_no);
    if (is_null($orderInfo)) {
        log_result("受注番号存在しない。アリペイパラメータ出力 out_trade_no:" . $out_trade_no . "status:" . $status . "trade_no:" . $trade_no . "total_fee:" . $total_fee . "currency" . $currency);
        exit;
    }
    $parameter = array("memo01" => "アリペイパラメータ出力 status:" . $status . "trade_no:" . $trade_no . "total_fee:" . $total_fee . "currency" . $currency);
    if ($status == "TRADE_FINISHED" && $orderInfo['status'] != ORDER_DELIV && $orderInfo['status'] != ORDER_PRE_END) {
        $objQuery =& SC_Query_Ex::getSingletonInstance();
        $objQuery->begin();
        $objPurchase->sfUpdateOrderStatus($out_trade_no, ORDER_PRE_END);
        $objQuery->commit();
        log_result("支払い完了。アリペイパラメータ出力 out_trade_no:" . $out_trade_no . "status:" . $status . "trade_no:" . $trade_no . "total_fee:" . $total_fee . "currency" . $currency);
        //支払い完了メール送信
        $objMail->sfSendOrderMail($out_trade_no, 7);
    } else {
        if ($status == "TRADE_CLOSED" && $orderInfo['status'] != ORDER_CANCEL) {
            $objQuery =& SC_Query_Ex::getSingletonInstance();
            $objQuery->begin();
            $objPurchase->sfUpdateOrderStatus($out_trade_no, ORDER_CANCEL);
            $objQuery->commit();
            log_result("支払期限過ぎです。受注キャンセルし、在庫を引き戻す!out_trade_no:" . $out_trade_no . "status:" . $status . "trade_no:" . $trade_no . "total_fee:" . $total_fee . "currency" . $currency);
        }
    }
} else {
    log_result("不正アクセス.");
 protected function doRegister($order_id, SC_Helper_Purchase &$objPurchase, SC_FormParam &$objFormParam, &$message, &$arrValuesBefore)
 {
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $arrValues = $objFormParam->getDbArray();
     $objQuery->begin();
     // 支払い方法(固定)
     $arrValues['payment_method'] = 'ポイント購入';
     // 購入時情報を付与
     $arrValues["add_point"] = 0;
     $arrValues["carrier"] = $_SESSION["customer"]["carrier"];
     $arrValues["useragent"] = $_SERVER["HTTP_USER_AGENT"];
     // 受注テーブルの更新
     $order_id = $objPurchase->registerOrder($order_id, $arrValues);
     $arrDetail = $objFormParam->getHashArray();
     $arrDetail = $objQuery->extractOnlyColsOf("dtb_order_detail", $arrDetail);
     array_walk($arrDetail, function ($v, $k) use(&$arrDetail) {
         if (is_array($v)) {
             $arrDetail[$k] = array_shift($v);
         } else {
             $arrDetail[$k] = $v;
         }
     });
     $arrDetail = array(0 => $arrDetail);
     // 受注詳細データの更新
     $objPurchase->registerOrderDetail($order_id, $arrDetail);
     $objQuery->commit();
     if ($order_id > 0) {
         $objPurchase->sfUpdateOrderStatus($order_id, ORDER_PRE_END, 0, $objFormParam->getValue("use_point"));
     } else {
         $this->order_id = $order_id;
         GC_Utils_Ex::gfPrintLog(print_r($objFormParam->getHashArray(), true), ERROR_LOG_REALFILE);
         SC_Utils_Ex::sfDispSiteError(CANCEL_PURCHASE);
     }
     return $order_id;
 }