diff --git a/CHANGELOG.md b/CHANGELOG.md index 55b6a25..6ec2cf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v3.0.19 + +### fixed + +- fix: 支付宝 system.oauth.token 请求参数错误 (#528) + ## v3.0.18 ### added diff --git a/src/Plugin/Alipay/Tools/SystemOauthTokenPlugin.php b/src/Plugin/Alipay/Tools/SystemOauthTokenPlugin.php index ce47a33..336d9e9 100644 --- a/src/Plugin/Alipay/Tools/SystemOauthTokenPlugin.php +++ b/src/Plugin/Alipay/Tools/SystemOauthTokenPlugin.php @@ -5,9 +5,15 @@ declare(strict_types=1); namespace Yansongda\Pay\Plugin\Alipay\Tools; use Yansongda\Pay\Plugin\Alipay\GeneralPlugin; +use Yansongda\Pay\Rocket; class SystemOauthTokenPlugin extends GeneralPlugin { + protected function doSomethingBefore(Rocket $rocket): void + { + $rocket->mergePayload($rocket->getParams()); + } + protected function getMethod(): string { return 'alipay.system.oauth.token'; diff --git a/tests/Plugin/Alipay/Tools/SystemOauthTokenPluginTest.php b/tests/Plugin/Alipay/Tools/SystemOauthTokenPluginTest.php new file mode 100644 index 0000000..5533c4d --- /dev/null +++ b/tests/Plugin/Alipay/Tools/SystemOauthTokenPluginTest.php @@ -0,0 +1,24 @@ +setParams(['name' => 'yansongda', 'age' => 28]); + + $plugin = new SystemOauthTokenPlugin(); + + $result = $plugin->assembly($rocket, function ($rocket) { return $rocket; }); + + self::assertEquals('yansongda', $result->getPayload()->get('name')); + self::assertEquals(28, $result->getPayload()->get('age')); + } +}