Browse Source

feat(lakala): 新增电子钱包结算相关接口

- 新增账户余额查询接口 `ewalletBalanceQuery` 返回类型声明
- 新增提款模式查询接口 `ewalletSettleQuery`
- 新增提款模式设置接口 `ewalletSettleProfile`
- 补充对应接口文档链接注释
- 添加两个新接口的单元测试方法
runphp 3 tháng trước cách đây
mục cha
commit
3eac9a1dee

+ 48 - 1
src/Service/LaepIndustryService.php

@@ -16,7 +16,11 @@ class LaepIndustryService
         $this->v2LakalaApi = new V2LakalaApi($config->getV2Config());
     }
 
-    public function ewalletBalanceQuery(array $reqData)
+    /**
+     * 账户余额查询
+     * @link https://o.lakala.com/#/home/document/detail?id=364
+     */
+    public function ewalletBalanceQuery(array $reqData): object
     {
         $request = new V2ModelRequest();
         $reqData['orgNo'] = $this->config->org_code;
@@ -32,4 +36,47 @@ class LaepIndustryService
             );
         }
     }
+
+    /**
+     * 提款模式查询
+     * @link https://o.lakala.com/#/home/document/detail?id=373
+     */
+    public function ewalletSettleQuery(string $mercId): object
+    {
+        $request = new V2ModelRequest();
+        $reqData = [
+            'bmcpNo' => $this->config->org_code,
+            'mercId' => $mercId,
+        ];
+        $request->setReqData($reqData);
+        $response = $this->v2LakalaApi->tradeApi('/api/v2/laep/industry/ewallet/settleQuery', $request);
+        if ($response->getRetCode() == '000000') {
+            return $response->getRespData();
+        } else {
+            throw_logic_exception(
+                msg:$response->getRetMsg(),
+                code: (int)$response->getRetCode(),
+                data: $response->getRespData(),
+            );
+        }
+    }
+
+    /**
+     * 提款模式设置
+     *
+     * @link https://o.lakala.com/#/home/document/detail?id=372
+     */
+    public function ewalletSettleProfile(string $mercId, string $settleType): bool
+    {
+        $request = new V2ModelRequest();
+        $reqData = [
+            'bmcpNo' => $this->config->org_code,
+            'mercId' => $mercId,
+            'settleType' => $settleType,
+        ];
+        $request->setReqData($reqData);
+        $response = $this->v2LakalaApi->tradeApi('/api/v2/laep/industry/ewallet/settleProfile', $request);
+        return $response->getRetCode() == '000000';
+    }
+
 }

+ 13 - 0
tests/Service/LaepIndustryServiceTest.php

@@ -24,4 +24,17 @@ class LaepIndustryServiceTest extends TestCase
         ]);
         dump($response);
     }
+    #[Test]
+    public function ewalletSettleQuery()
+    {
+        $response = $this->laepIndustryService->ewalletSettleQuery('SR2024000184315');
+        dump($response);
+    }
+
+    #[Test]
+    public function ewalletSettleProfile()
+    {
+        $response = $this->laepIndustryService->ewalletSettleProfile('SR2024000184315', '01');
+        dump($response);
+    }
 }