コード例 #1
0
ファイル: BeeClound.php プロジェクト: buuug7/game4039
 public function bill()
 {
     $data = ['app_id' => $this->app_id, 'timestamp' => $this->timestamp, 'app_sign' => $this->app_sign, 'channel' => $this->channel, 'total_fee' => $this->total_fee, 'bill_no' => $this->bill_no, 'title' => $this->title, 'return_url' => $this->return_url];
     try {
         $result = api::bill($data);
         if ($result->result_code != 0) {
             echo $result->err_detail;
             exit;
         }
         $htmlContent = $result->html;
         $url = $result->url;
         echo $htmlContent;
     } catch (\Exception $e) {
         echo $e->getMessage();
     }
 }
コード例 #2
0
$data = array();
$appSecret = "39a7a518-9ac8-4a9e-87bc-7885f33cf18c";
$data["app_id"] = "c5d1cba1-5e3f-4ba0-941d-9b0a371fe719";
$data["timestamp"] = time() * 1000;
$data["app_sign"] = md5($data["app_id"] . $data["timestamp"] . $appSecret);
$data["channel"] = "WX_NATIVE";
$data["total_fee"] = 1;
$data["bill_no"] = "bcdemo" . $data["timestamp"];
//$data["bill_no"] = "bcdemo" . "static";
$data["title"] = "白开水";
//选填 optional
$data["optional"] = json_decode(json_encode(array("tag" => "msgtoreturn")));
//选填 return_url
//$data["return_url"] = "http://payservice.beecloud.cn";
try {
    $result = \beecloud\rest\api::bill($data);
    if ($result->result_code != 0) {
        echo json_encode($result);
        exit;
    }
    $code_url = $result->code_url;
    ?>
    <div align="center" id="qrcode" >
    </div>
    <div align="center">
        <p>订单号:<?php 
    echo $data["bill_no"];
    ?>
</p>
        <button id="query">查询订单状态</button>
        <p id="query-result"></p>
コード例 #3
0
require_once "../../loader.php";
$data = array();
$appSecret = "c37d661d-7e61-49ea-96a5-68c34e83db3b";
$data["app_id"] = "c37d661d-7e61-49ea-96a5-68c34e83db3b";
$data["timestamp"] = time() * 1000;
$data["app_sign"] = md5($data["app_id"] . $data["timestamp"] . $appSecret);
$data["channel"] = "ALI";
$data["batch_no"] = "bcdemo" . $data["timestamp"];
$data["account_name"] = "苏州比可网络科技有限公司";
$data["transfer_data"] = array();
$data["transfer_data"][] = json_decode(json_encode(array("transfer_id" => "bf693b3121864f3f969a3e1ebc5c376a", "receiver_account" => "*****@*****.**", "receiver_name" => "钱志浩", "transfer_fee" => 100, "transfer_note" => "test")));
$data["transfer_data"][] = json_decode(json_encode(array("transfer_id" => "bf693b3121864f3f969a3e1ebc5c3768", "receiver_account" => "*****@*****.**", "receiver_name" => "钱志浩", "transfer_fee" => 100, "transfer_note" => "test")));
//选填 optional
$data["optional"] = json_decode(json_encode(array("tag" => "msgtoreturn")));
try {
    $result = \beecloud\rest\api::transfers($data);
    if ($result->result_code != 0) {
        echo json_encode($result);
        exit;
    }
    $url = $result->url;
    ?>
    <a href="<?php 
    echo $url;
    ?>
">点击开始批量打款</a>
    <?php 
} catch (Exception $e) {
    echo $e->getMessage();
}
?>
コード例 #4
0
<?php 
require_once "../../loader.php";
$data = array();
$appSecret = "c37d661d-7e61-49ea-96a5-68c34e83db3b";
$data["app_id"] = "c37d661d-7e61-49ea-96a5-68c34e83db3b";
$data["timestamp"] = time() * 1000;
$data["app_sign"] = md5($data["app_id"] . $data["timestamp"] . $appSecret);
$data["bill_no"] = $_GET["bill_no"];
$data["refund_no"] = $_GET["refund_no"];
$data["refund_fee"] = (int) $_GET["refund_fee"];
//选择渠道类型(WX、WX_APP、WX_NATIVE、WX_JSAPI、ALI、ALI_APP、ALI_WEB、ALI_QRCODE、UN、UN_APP、UN_WEB)
$data["channel"] = "JD";
//选填 optional
$data["optional"] = json_decode(json_encode(array("tag" => "msgtoreturn")));
try {
    $result = \beecloud\rest\api::refund($data);
    if ($result->result_code != 0 || $result->result_msg != "OK") {
        echo json_encode($result);
        exit;
    }
    $url = $result->url;
    ?>
    <script>
        window.location.href="<?php 
    echo $url;
    ?>
";
    </script>
    <?php 
} catch (Exception $e) {
    echo $e->getMessage();
コード例 #5
0
 public function cancelSingleOrderItem()
 {
     $orderItemLogic = D("OrderItem", "Logic");
     $res = array("status" => "0", "needOpenNewWindow" => 'false');
     $id = I("post.cancelId", "");
     if ($id == "") {
         echo json_encode($res);
         return;
     }
     //找到支付成功的bill记录
     $orderItem = D('OrderItem', 'Logic')->getOrderItemById($id);
     $order = D('Order', 'Logic')->findByOrderId($orderItem['orderId']);
     $orderNumber = $order['orderNumber'];
     $orderBill = D('OrderBill', 'Logic')->findOrderSuccessPayBill($orderNumber);
     //向第三方支付发起退款请求
     $data = array();
     $appSecret = C('PAYMENT_APP_SECRET');
     $data["app_id"] = C('PAYMENT_APP_ID');
     $data["timestamp"] = time() * 1000;
     $data["app_sign"] = md5($data["app_id"] . $data["timestamp"] . $appSecret);
     //bill_no为支付成功的支付单号
     $data["bill_no"] = $orderBill['billNumber'];
     //商户退款单号,格式为:退款日期(8位) + 流水号(3~24 位)。请自行确保在商户系统中唯一,且退款日期必须是发起退款的当天日期,同一退款单号不可重复提交,否则会造成退款单重复。流水号可以接受数字或英文字符,建议使用数字,但不可接受“000”
     $data["refund_no"] = date("Ymd") . $data["timestamp"];
     $data["refund_fee"] = intval($orderItem['price'] * 100);
     //选择渠道类型(WX、WX_APP、WX_NATIVE、WX_JSAPI、ALI、ALI_APP、ALI_WEB、ALI_QRCODE、UN、UN_APP、UN_WEB)
     $data["channel"] = $orderBill['channel'];
     //选填 optional
     $data["optional"] = json_decode(json_encode(array("tag" => "msgtoreturn")));
     //创建退款的数据库记录,t_orderbill
     $billData['orderNumber'] = $orderNumber;
     $billData['billNumber'] = $data["bill_no"];
     $billData['refundNumber'] = $data["refund_no"];
     //只有退单个商品时才有值
     $billData['orderItemId'] = $orderItem['id'];
     $billData['totalAmount'] = $data["refund_fee"] / 100;
     $billData['channel'] = $data["channel"];
     $billData['type'] = 'REFUND';
     $billData['status'] = 'N';
     D('OrderBill', 'Logic')->createBill($billData);
     //$this->createOrderBill($data, $orderNumber, $data["channel"], 'REFUND');
     if (C('IS_DEV') == 'false') {
         //本地测试不用向第三方发送请求
         Vendor("beecloud.autoload");
         $result = \beecloud\rest\api::refund($data);
         if ($result->result_code != 0 || $result->result_msg != "OK") {
             echo json_encode($result->err_detail);
             logInfo('errorDetail:' . $result->err_detail);
             exit;
         }
     }
     if (D('OrderItem', 'Logic')->cancelSingleOrderItem($id)) {
         $res["status"] = "1";
     }
     if ($result->url != '') {
         $res["url"] = $result->url;
         $res["needOpenNewWindow"] = 'true';
     }
     echo json_encode($res);
 }
コード例 #6
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>BeeCloud微信更新退款状态示例</title>
</head>
<body>
<?php 
require_once "../../loader.php";
$data = array();
$appSecret = "39a7a518-9ac8-4a9e-87bc-7885f33cf18c";
$data["app_id"] = "c5d1cba1-5e3f-4ba0-941d-9b0a371fe719";
$data["timestamp"] = time() * 1000;
$data["app_sign"] = md5($data["app_id"] . $data["timestamp"] . $appSecret);
$data["channel"] = "WX";
$data["refund_no"] = $_GET["refund_no"];
try {
    $result = \beecloud\rest\api::refundStatus($data);
    if ($result->result_code != 0 || $result->result_msg != "OK") {
        echo json_encode($result->err_detail);
        echo "<br/><a href='wx.refunds.php'>返回</a>";
        exit;
    }
    echo "更新成功,<a href='wx.refunds.php'>返回</a>";
} catch (Exception $e) {
    echo $e->getMessage();
}
?>
</body>
</html>
コード例 #7
0
 private function payCommonProcess($channel, $subChannel)
 {
     $orderNumber = I('orderNumber');
     $orderLogic = D('Order', 'Logic');
     $map['orderNumber'] = $orderNumber;
     $map['status'] = 'N';
     $result = $orderLogic->queryOrder($map);
     if (count($result) == 0) {
         header("Content-type:text/html;charset=utf-8");
         echo L('orderNotExist');
         exit;
     }
     $order = $result[0];
     $inadequateInventoryItems = $this->checkOrderItemsInventory($order['orderId']);
     if (count($inadequateInventoryItems) > 0) {
         $this->redirect('Cart/index', array('itemId' => $inadequateInventoryItems['itemId'], 'itemSize' => $inadequateInventoryItems['itemSize']));
     }
     Vendor("beecloud.autoload");
     $data = array();
     $appSecret = C('PAYMENT_APP_SECRET');
     $data["app_id"] = C('PAYMENT_APP_ID');
     $data["timestamp"] = time() * 1000;
     $data["app_sign"] = md5($data["app_id"] . $data["timestamp"] . $appSecret);
     $data["channel"] = $subChannel;
     if ($data["channel"] == 'WX_JSAPI') {
         $data["openid"] = session('openid');
     }
     //当channel参数为 ALI_WEB 或 ALI_QRCODE 或 UN_WEB时 return_url为必填
     if ($data["channel"] == 'ALI_WEB') {
         $data["return_url"] = C('PAYMENT_RETURN_URL');
     }
     $data["total_fee"] = intval($order['totalFee'] * 100);
     //商户订单号, 8到32位数字和/或字母组合,请自行确保在商户系统中唯一,同一订单号不可重复提交,否则会造成订单重复.
     //这里直接在订单号后面加上时间戳作为付款的订单号
     $data["bill_no"] = $orderNumber . $data["timestamp"];
     if (C('IS_DEV') == 'true') {
         $data["title"] = "Testing开发测试订单" . $orderNumber;
     } else {
         $data["title"] = "StarBall.Kids订单" . $orderNumber;
     }
     //微信支付页面显示所需要的内容
     $this->assign('totalFee', $data["total_fee"] / 100);
     $this->assign('orderNumber', $orderNumber);
     $this->assign('bill_no', $data["bill_no"]);
     $this->assign('is_dev', C('IS_DEV'));
     $this->createOrderBill($data, $orderNumber, 'PAY', $channel, $subChannel);
     $result = \beecloud\rest\api::bill($data);
     if ($result->result_code != 0) {
         logInfo('PaymentError:' . json_encode($result));
         exit;
     }
     return $result;
 }