mirror of
https://gitee.com/yansongda/pay.git
synced 2024-11-30 03:07:38 +08:00
fix: 微信投诉相关插件响应解析错误 (#746)
* fix: 微信投诉相关插件响应解析错误 * changelog * style: fix coding style
This commit is contained in:
parent
765085bdd1
commit
81df62a863
@ -1,3 +1,9 @@
|
||||
## v3.2.14
|
||||
|
||||
### fixed
|
||||
|
||||
- fix: 微信投诉相关插件响应解析错误(#746)
|
||||
|
||||
## v3.2.13
|
||||
|
||||
### optimized
|
||||
|
@ -9,6 +9,7 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
|
||||
use function Yansongda\Pay\get_wechat_config;
|
||||
|
||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Supports\Collection;
|
||||
@ -24,6 +25,8 @@ class CompleteComplaintPlugin extends GeneralPlugin
|
||||
*/
|
||||
protected function doSomething(Rocket $rocket): void
|
||||
{
|
||||
$rocket->setDirection(OriginResponseParser::class);
|
||||
|
||||
$payload = $rocket->getPayload();
|
||||
$config = get_wechat_config($rocket->getParams());
|
||||
|
||||
|
@ -9,6 +9,7 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
|
||||
use function Yansongda\Pay\get_wechat_config;
|
||||
|
||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
@ -23,6 +24,8 @@ class ResponseComplaintPlugin extends GeneralPlugin
|
||||
*/
|
||||
protected function doSomething(Rocket $rocket): void
|
||||
{
|
||||
$rocket->setDirection(OriginResponseParser::class);
|
||||
|
||||
$config = get_wechat_config($rocket->getParams());
|
||||
$payload = $rocket->getPayload();
|
||||
|
||||
|
@ -5,6 +5,7 @@ namespace Yansongda\Pay\Tests\Plugin\Wechat\Risk\Complaints;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use Yansongda\Pay\Exception\Exception;
|
||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
||||
use Yansongda\Pay\Pay;
|
||||
use Yansongda\Pay\Plugin\Wechat\Risk\Complaints\CompleteComplaintPlugin;
|
||||
use Yansongda\Pay\Provider\Wechat;
|
||||
@ -38,6 +39,7 @@ class CompleteComplaintPluginTest extends TestCase
|
||||
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaints-v2/123/complete'), $radar->getUri());
|
||||
self::assertEquals(['complainted_mchid' => '1600314069'], $rocket->getPayload()->toArray());
|
||||
self::assertEquals('POST', $radar->getMethod());
|
||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
||||
}
|
||||
|
||||
public function testDirectMchId()
|
||||
@ -51,6 +53,7 @@ class CompleteComplaintPluginTest extends TestCase
|
||||
|
||||
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaints-v2/456/complete'), $radar->getUri());
|
||||
self::assertEquals(['complainted_mchid' => 'bar'], $rocket->getPayload()->toArray());
|
||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
||||
}
|
||||
|
||||
public function testMissingId()
|
||||
|
@ -5,6 +5,7 @@ namespace Yansongda\Pay\Tests\Plugin\Wechat\Risk\Complaints;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use Yansongda\Pay\Exception\Exception;
|
||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
||||
use Yansongda\Pay\Pay;
|
||||
use Yansongda\Pay\Plugin\Wechat\Risk\Complaints\ResponseComplaintPlugin;
|
||||
use Yansongda\Pay\Provider\Wechat;
|
||||
@ -35,6 +36,7 @@ class ResponseComplaintPluginTest extends TestCase
|
||||
|
||||
$radar = $result->getRadar();
|
||||
|
||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
||||
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaints-v2/123/response'), $radar->getUri());
|
||||
self::assertEquals('POST', $radar->getMethod());
|
||||
self::assertEquals(['foo' => 'bar', 'complainted_mchid' => '1600314069'], $rocket->getPayload()->toArray());
|
||||
@ -49,6 +51,7 @@ class ResponseComplaintPluginTest extends TestCase
|
||||
|
||||
$radar = $result->getRadar();
|
||||
|
||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
||||
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaints-v2/456/response'), $radar->getUri());
|
||||
self::assertEquals(['complainted_mchid' => 'bar', 'u' => 'a'], $rocket->getPayload()->toArray());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user