fix: 修复商家转账参数缺失的问题 (#977)

---------

Co-authored-by: yansongda <me@yansongda.cn>
This commit is contained in:
Hatim 2024-05-08 23:13:04 +08:00 committed by GitHub
parent 722ffdcd5c
commit 747806ee09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 3 deletions

View File

@ -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 }}

View File

@ -1,3 +1,9 @@
## v3.7.3
### fixed
- fix: 修复商家转账参数缺失的问题(#977)
## v3.7.2
### added

View File

@ -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);
}

View File

@ -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']);
}
}