shish 2 anni fa
parent
commit
33a0474ac0
1 ha cambiato i file con 36 aggiunte e 1 eliminazioni
  1. 36 1
      app-ghs/controllers/TestController.php

+ 36 - 1
app-ghs/controllers/TestController.php

@@ -23,7 +23,42 @@ use common\components\util;
 class TestController extends BaseController
 {
 
-    public $guestAccess = ['inform', 'notice', 'order-query', 'add-order', 'index', 'get', 'trade-query', 'query', 'balance-query'];
+    public $guestAccess = ['inform', 'notice', 'order-query', 'add-order', 'index', 'get', 'trade-query', 'query', 'balance-query', 'refund'];
+
+    //退款操作 ssh 20231029
+    public function actionRefund()
+    {
+        $shopId = 36524;
+        $shop = ShopClass::getById($shopId, true);
+        if (empty($shop)) {
+            util::fail('没有找到门店');
+        }
+        $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,
+            'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
+            'lklCertificatePath' => $lklCertificatePath,
+        ];
+        $laResource = new Lakala($params);
+        $refundReason = '';
+        $refundOrderSn = orderSn::getCgRefundSn();
+        $refundPrice = 0.01;
+        $refundFee = bcmul($refundPrice, 100);
+        $orderSn = 'KD_CS61235199';
+        $aliParams = [
+            'refundSn' => $refundOrderSn,
+            'orderSn' => $orderSn,
+            'refundAmount' => $refundFee,
+            'refundReason' => $refundReason,
+        ];
+        $response = $laResource->refund($aliParams);
+        echo '<pre>';
+        print_r($response);
+    }
 
     public function actionApply()
     {