Skip to content

Commit 765085b

Browse files
authored
optimize: 微信退款可取消 notify_url (#741)
1 parent 4c1893d commit 765085b

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v3.2.13
2+
3+
### optimized
4+
5+
- optimize: 微信退款可取消 notify_url(#741)
6+
17
## v3.2.12
28

39
### added

src/Plugin/Wechat/Pay/Common/RefundPlugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ protected function doSomething(Rocket $rocket): void
2626
$config = get_wechat_config($rocket->getParams());
2727
$payload = $rocket->getPayload();
2828

29-
if (empty($payload->get('notify_url'))) {
30-
$merge['notify_url'] = $config['notify_url'] ?? '';
29+
if (empty($payload->get('notify_url')) && !empty($config['notify_url'])) {
30+
$merge['notify_url'] = $config['notify_url'];
3131
}
3232

3333
if (Pay::MODE_SERVICE === ($config['mode'] ?? null)) {

tests/Plugin/Wechat/Pay/Common/RefundPluginTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,13 @@ public function testNormalNotifyUrl()
7979
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
8080
self::assertEquals('yansongda.cn', $result->getPayload()->get('notify_url'));
8181
}
82+
83+
public function testEmptyNotifyUrl()
84+
{
85+
$rocket = (new Rocket())
86+
->setParams(['_config' => 'empty_wechat_public_cert'])->setPayload(new Collection());
87+
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
88+
89+
self::assertArrayNotHasKey('notify_url', $result->getPayload()->all());
90+
}
8291
}

0 commit comments

Comments
 (0)