Skip to content

Commit

Permalink
fix: 修复商家转账参数缺失的问题 (#977)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: yansongda <me@yansongda.cn>
  • Loading branch information
AExiaoliou and yansongda authored May 8, 2024
1 parent 722ffdc commit 747806e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v3.7.3

### fixed

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

## v3.7.2

### added
Expand Down
3 changes: 2 additions & 1 deletion src/Plugin/Wechat/V3/Marketing/Transfer/CreatePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ protected function normal(array $params, array $config, Collection $payload): ar
*/
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public function testNormalWithName()
"test" => "111",
'transfer_detail_list' => [
[
'user_name' => 'yansongda'
'user_name' => 'yansongda',
'foo' => 'bar',
]
]
]));
Expand All @@ -102,5 +103,6 @@ public function testNormalWithName()
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']);
}
}

0 comments on commit 747806e

Please sign in to comment.