shish 2 years ago
parent
commit
24e933b3c6
1 changed files with 32 additions and 1 deletions
  1. 32 1
      app-ghs/controllers/TestController.php

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

@@ -36,7 +36,38 @@ use wkhtmltox\Image\Converter;
 class TestController extends BaseController
 {
 
-    public $guestAccess = ['on', 'in', 'clear-query', 'ip', 'html', 'debt', 'apply', 'clear', 'ls-trade-query', 'refund-query', 'inform', 'notice', 'order-query', 'add-order', 'index', 'get', 'trade-query', 'query', 'balance-query', 'refund'];
+    public $guestAccess = ['fx','on', 'in', 'clear-query', 'ip', 'html', 'debt', 'apply', 'clear', 'ls-trade-query', 'refund-query', 'inform', 'notice', 'order-query', 'add-order', 'index', 'get', 'trade-query', 'query', 'balance-query', 'refund'];
+
+    public function actionFx(){
+        $ghsShopId = 7855
+        $ghsShop = ShopClass::getById($ghsShopId, true);
+        if (empty($ghsShop)) {
+            util::fail('没有找到供货商的门店');
+        }
+        $refundFee = bcmul(64, 100);
+        $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' => $ghsShop->lklSjNo,
+            'term_no' => $ghsShop->lklScanTermNo,
+            'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
+            'lklCertificatePath' => $lklCertificatePath,
+        ];
+        $laResource = new Lakala($params);
+        $refundReason = '';
+        $aliParams = [
+            'refundSn' => 'RD_CS001',
+            'orderSn' => 'CG27325720',
+            'refundAmount' => $refundFee,
+            'refundReason' => $refundReason,
+            'thirdNo' => '20240723110113130266217435048128',
+        ];
+        $response = $laResource->refund($aliParams);
+        echo '<pre>';
+        print_r($response);
+    }
 
     public function actionOn()
     {