mirror of
https://gitee.com/yansongda/pay.git
synced 2024-11-30 03:07:38 +08:00
parent
1560fc989a
commit
f48ec8850a
@ -1,3 +1,9 @@
|
||||
## v3.0.19
|
||||
|
||||
### fixed
|
||||
|
||||
- fix: 支付宝 system.oauth.token 请求参数错误 (#528)
|
||||
|
||||
## v3.0.18
|
||||
|
||||
### added
|
||||
|
@ -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';
|
||||
|
24
tests/Plugin/Alipay/Tools/SystemOauthTokenPluginTest.php
Normal file
24
tests/Plugin/Alipay/Tools/SystemOauthTokenPluginTest.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Tests\Plugin\Alipay\Tools;
|
||||
|
||||
use Yansongda\Pay\Parser\ResponseParser;
|
||||
use Yansongda\Pay\Plugin\Alipay\Tools\SystemOauthTokenPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Pay\Tests\TestCase;
|
||||
|
||||
class SystemOauthTokenPluginTest extends TestCase
|
||||
{
|
||||
public function testNormal()
|
||||
{
|
||||
$rocket = new Rocket();
|
||||
$rocket->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'));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user