fly 5 years ago
parent
commit
bd34de07f8

+ 1 - 1
app/Http/Controllers/QuickApp/Order/OrdersController.php

@@ -590,7 +590,7 @@ class OrdersController extends BaseController
         if ($order_info && $order_info->status == 'PAID') {
             return response()->success();
         }
-        return response()->error('QAPP_SYS_ERROR');
+        return response()->success($order);
     }
 
     /**

+ 71 - 0
app/Libs/Pay/Merchants/JoinPay.php

@@ -0,0 +1,71 @@
+<?php
+
+namespace App\Libs\Pay\Merchants;
+
+use Exception;
+use GuzzleHttp\Client;
+
+/**
+ * 汇聚支付
+ */
+class JoinPay implements PayMerchantInterface
+{
+    private $make_order_url = 'https://www.joinpay.com/trade/uniPayApi.action';
+    private $query_order_url = 'https://qr.chinaums.com/netpay-route-server/api/';
+    private $appId;
+    private $merchantNo;
+    private $version;
+
+    public function __construct(array $config)
+    {
+        $this->version = "1.0";
+        $this->merchantNo = "888108800000947";
+        
+    }
+
+    public function send(array $data)
+    { }
+
+    public function query(string $trade_no)
+    { }
+
+    public function notify(array $data)
+    { }
+
+    public function refund(array $data)
+    { }
+
+
+    public function makeSign(array $data)
+    {
+        //签名步骤一:按字典序排序参数
+        ksort($data);
+        $buff = "";
+        foreach ($data as $k => $v) {
+            if ($k != "sign" && $v != "" && !is_array($v)) {
+                $buff .= $k . "=" . $v . "&";
+            }
+        }
+        $buff = trim($buff, "&");
+        //签名步骤二:在string后加入KEY
+        $string = $buff . $this->key;
+        //签名步骤三:MD5加密
+        $string = md5($string);
+        //签名步骤四:所有字符转为大写
+        $result = strtoupper($string);
+        return $result;
+    }
+
+    private function request(array $data)
+    {
+        try {
+            $data['sign'] = $this->makeSign($data);
+            $client = new Client(['timeout' => 3]);
+            $result = $client->request('post',  $this->query_order_url, ['json' => $data])->getBody()->getContents();
+            if ($result) {
+                $result = json_decode($result);
+            }
+            return $result;
+        } catch (Exception $e) { }
+    }
+}