public function testGetOrder_存在する顧客IDを指定した場合_対応する結果が取得できる() { $order_id = '1002'; $customer_id = '1002'; $this->expected = array('order_id' => '1002', 'customer_id' => '1002', 'order_name01' => '受注情報02'); $result = SC_Helper_Purchase::getOrder($order_id, $customer_id); $this->actual = Test_Utils::mapArray($result, array('order_id', 'customer_id', 'order_name01')); $this->verify(); }
<?php require_once '../require.php'; require_once CLASS_REALDIR . '/aripay/alipay_service.php'; require_once CLASS_REALDIR . '/helper/SC_Helper_Purchase.php'; $link = "hogegoe"; $orderid = $_GET["id"]; if (!is_null($orderid)) { $objPurchase = new SC_Helper_Purchase(); $orderInfo = $objPurchase->getOrder($orderid); if (!is_null($orderInfo)) { // 7:決済処理中 ,1:新規受付,2:入金待ち if ($orderInfo["status"] == 7 || $orderInfo["status"] == 1 || $orderInfo["status"] == 2) { $parameter = array("service" => "create_forex_trade", "partner" => ARIPAY_PARTNER, "return_url" => "hogehoge", "notify_url" => ARIPAY_NOTIFY_URL_HTTP, "_input_charset" => ARIPAY_INPUT_CHARSET, "subject" => "会社", "body" => "おいしいケーキ", "out_trade_no" => $orderid, "total_fee" => $orderInfo["total"], "currency" => "JPY"); $alipay = new alipay_service($parameter, ARIPAY_SECURITY_CODE, ARIPAY_SIGN_TYPE); print_r($parameter); $link = $alipay->create_url(); log_result($orderid . "アリペイURL:" . $link); // echo $link; // print <<<EOT //<br/> //<a href= $link target= "_blank">submit</a> //EOT; } } } header("Location: " . $link); function log_result($word) { $fp = fopen("request_log.log", "a"); flock($fp, LOCK_EX);
/** * 注文受付メールを送信する. * * 端末種別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; // 成功 }
<?php require_once '../require.php'; require_once CLASS_REALDIR . '/aripay/alipay_notify.php'; require_once CLASS_REALDIR . '/helper/SC_Helper_Purchase.php'; $alipay = new alipay_notify(ARIPAY_PARTNER, ARIPAY_SECURITY_CODE, ARIPAY_SIGN_TYPE, ARIPAY_INPUT_CHARSET, ARIPAY_TRANSPORT); $verify_result = $alipay->notify_verify(); $objMail = new SC_Helper_Mail_Ex(); if ($verify_result) { $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) {