From 747806ee09caa53702b87d6a805c84f072898e1a Mon Sep 17 00:00:00 2001 From: Hatim Date: Wed, 8 May 2024 23:13:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=95=86=E5=AE=B6?= =?UTF-8?q?=E8=BD=AC=E8=B4=A6=E5=8F=82=E6=95=B0=E7=BC=BA=E5=A4=B1=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#977)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --------- Co-authored-by: yansongda --- .github/workflows/coverage.yml | 2 +- CHANGELOG.md | 6 ++++++ src/Plugin/Wechat/V3/Marketing/Transfer/CreatePlugin.php | 3 ++- .../Wechat/V3/Marketing/Transfer/CreatePluginTest.php | 4 +++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 8c43885..348e6c9 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -23,6 +23,6 @@ jobs: - name: Run Coverage run: vendor/bin/phpunit --coverage-clover coverage.xml - name: Upload Coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d72088..460ff17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v3.7.3 + +### fixed + +- fix: 修复商家转账参数缺失的问题(#977) + ## v3.7.2 ### added diff --git a/src/Plugin/Wechat/V3/Marketing/Transfer/CreatePlugin.php b/src/Plugin/Wechat/V3/Marketing/Transfer/CreatePlugin.php index af21365..655df14 100644 --- a/src/Plugin/Wechat/V3/Marketing/Transfer/CreatePlugin.php +++ b/src/Plugin/Wechat/V3/Marketing/Transfer/CreatePlugin.php @@ -90,10 +90,11 @@ class CreatePlugin implements PluginInterface */ protected function encryptSensitiveData(array $params, array $config, Collection $payload): array { + $data['transfer_detail_list'] = $payload->get('transfer_detail_list', []); $data['_serial_no'] = get_wechat_serial_no($params); $publicKey = get_wechat_public_key($config, $data['_serial_no']); - foreach ($payload->get('transfer_detail_list', []) as $key => $list) { + foreach ($data['transfer_detail_list'] as $key => $list) { if (!empty($list['user_name'])) { $data['transfer_detail_list'][$key]['user_name'] = encrypt_wechat_contents($list['user_name'], $publicKey); } diff --git a/tests/Plugin/Wechat/V3/Marketing/Transfer/CreatePluginTest.php b/tests/Plugin/Wechat/V3/Marketing/Transfer/CreatePluginTest.php index 4eaf469..69a9da0 100644 --- a/tests/Plugin/Wechat/V3/Marketing/Transfer/CreatePluginTest.php +++ b/tests/Plugin/Wechat/V3/Marketing/Transfer/CreatePluginTest.php @@ -85,7 +85,8 @@ class CreatePluginTest extends TestCase "test" => "111", 'transfer_detail_list' => [ [ - 'user_name' => 'yansongda' + 'user_name' => 'yansongda', + 'foo' => 'bar', ] ] ])); @@ -102,5 +103,6 @@ class CreatePluginTest extends TestCase self::assertArrayHasKey('_serial_no', $payload); self::assertArrayHasKey('user_name', $payload['transfer_detail_list'][0]); self::assertNotEquals('yansongda', $payload['transfer_detail_list'][0]['user_name']); + self::assertEquals('bar', $payload['transfer_detail_list'][0]['foo']); } }