Ver Fonte

支付退款查询

shish há 2 anos atrás
pai
commit
04ea3082d1

+ 29 - 0
app-ghs/controllers/TestController.php

@@ -204,6 +204,35 @@ class TestController extends BaseController
         die;
     }
 
+    public function actionRefundQuery()
+    {
+//        $shopId = 1212;
+//        $shop = ShopClass::getById($shopId, true);
+//        if (empty($shop)) {
+//            util::stop('没有找到门店');
+//        }
+        $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
+        $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
+        $params = [
+            'appid' => 'OP00002119',
+            'serial_no' => '018b08cfddbd',
+            //'merchant_no' => $shop->lklSjNo,
+            //'term_no' => $shop->lklScanTermNo,
+            'merchant_no' => '82260205992007P',
+            'term_no' => 'D7652397',
+            'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
+            'lklCertificatePath' => $lklCertificatePath,
+        ];
+        $laResource = new Lakala($params);
+        $orderSn = 'TK26350406';
+        $data = [
+            'orderSn' => $orderSn,
+        ];
+        $response = $laResource->refundQuery($data);
+        echo "<pre>";
+        print_r($response);
+    }
+
     public function actionBalanceQuery()
     {
         $shopId = 1212;

+ 22 - 0
common/components/lakala/Lakala.php

@@ -80,6 +80,28 @@ class Lakala
         }
     }
 
+    public function refundQuery($params)
+    {
+        $orderSn = $params['orderSn'];
+        $ip = $this->getClientIp();
+        $location_info = ['request_ip' => $ip];
+        $arr = [
+            'merchant_no' => $this->merchant_no,
+            'term_no' => $this->term_no,
+            'out_refund_order_no' => $orderSn,
+            'location_info' => $location_info,
+        ];
+        $baseRequestVO = [
+            'req_data' => $arr,
+            'req_time' => date("YmdHis"),
+            'version' => $this->version,
+        ];
+        $body = json_encode($baseRequestVO, JSON_UNESCAPED_UNICODE);
+        $authorization = $this->getAuthorization($body);
+        $url = 'https://s2.lakala.com/api/v3/labs/query/idmrefundquery';
+        return $this->post($url, $body, $authorization);
+    }
+
     public function openStateQuery($params)
     {
         $subMerchantId = $params['subMerchantId'];